Move some functions to configuration class.
[apps/agl-service-can-low-level.git] / src / can / can-signals.cpp
1 /*
2  * Copyright (C) 2015, 2016 "IoT.bzh"
3  * Author "Romain Forlot" <romain.forlot@iot.bzh>
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *       http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #include "can/can-signals.hpp"
19
20 #include <fnmatch.h>
21
22 #include "utils/signals.hpp"
23 #include "can/can-decoder.hpp"
24 #include "obd2/obd2-signals.hpp"
25 #include "low-can-binding.hpp"
26
27 can_message_definition_t& can_signal_t::get_message()
28 {
29         return message_;
30 }
31
32 std::string& can_signal_t::get_generic_name()
33 {
34         return generic_name_;
35 }
36
37 uint8_t can_signal_t::get_bit_position() const
38 {
39         return bit_position_;
40 }
41
42 uint8_t can_signal_t::get_bit_size() const
43 {
44         return bit_size_;
45 }
46
47 float can_signal_t::get_factor() const
48 {
49         return factor_;
50 }
51
52 float can_signal_t::get_offset() const
53 {
54         return offset_;
55 }
56
57 float can_signal_t::get_min_value() const
58 {
59         return min_value_;
60 }       
61
62 float can_signal_t::get_max_value() const
63 {
64         return max_value_;
65 }
66
67 FrequencyClock& can_signal_t::get_frequency()
68 {
69         return frequency_;
70 }
71
72 bool can_signal_t::get_send_same() const
73 {
74         return send_same_;
75 }
76
77 bool can_signal_t::get_force_send_changed() const
78 {
79         return force_send_changed_;
80 }
81
82 std::map<int, std::string> can_signal_t::get_state() const
83 {
84         return states_;
85 }
86
87 size_t can_signal_t::get_state_count() const
88 {
89         return states_.size();
90 }
91
92 bool can_signal_t::get_writable() const
93 {
94         return writable_;
95 }
96
97 SignalDecoder& can_signal_t::get_decoder()
98 {
99         return decoder_;
100 }
101
102 SignalEncoder& can_signal_t::get_encoder()
103 {
104         return encoder_;
105 }
106
107 bool can_signal_t::get_received() const
108 {
109         return received_;
110 }
111 float can_signal_t::get_last_value() const
112 {
113         return last_value_;
114 }
115
116 void can_signal_t::set_received(bool r)
117 {
118         received_ = r;
119 }
120
121 void can_signal_t::set_last_value(float val)
122 {
123         last_value_ = val;
124 }