initial commit.
[apps/agl-service-can-low-level.git] / src / openxc / signal.hpp
1 #pragma once\r
2 \r
3 #include <string>\r
4 #include <map>\r
5 #include <vector>\r
6 #include <cstdint>\r
7 #include <json.hpp>\r
8 \r
9 namespace openxc\r
10 {\r
11         class signal\r
12         {\r
13         private:\r
14                 std::string                                                                                     generic_name_;\r
15                 std::uint32_t                                                                           bit_position_;\r
16                 std::uint32_t                                                                           bit_size_;\r
17                 float                                                                                           factor_;\r
18                 std::uint32_t                                                                           offset_;\r
19                 std::string                                                                                     decoder_;\r
20                 bool                                                                                            ignore_;\r
21                 bool                                                                                            enabled_;\r
22                 std::map<std::string, std::vector<std::uint32_t>>       states_;\r
23                 std::uint32_t                                                                           max_frequency_;\r
24                 bool                                                                                            send_same_;\r
25                 bool                                                                                            force_send_changed_;\r
26                 bool                                                                                            writable_;\r
27                 std::string                                                                                     encoder_;\r
28         public:\r
29                 std::string generic_name() const;\r
30                 std::uint32_t bit_position() const;\r
31                 std::uint32_t bit_size() const;\r
32                 float factor() const;\r
33                 std::uint32_t offset() const;\r
34                 std::string decoder() const;\r
35                 bool ignore() const;\r
36                 bool enabled() const;\r
37                 const std::map<std::string, std::vector<std::uint32_t>>& states() const;\r
38                 std::uint32_t max_frequency() const;\r
39                 bool send_same() const;\r
40                 bool force_send_changed() const;\r
41                 bool writable() const;\r
42                 std::string encoder() const;\r
43                 \r
44                 void from_json(const nlohmann::json& j);\r
45                 nlohmann::json to_json() const;\r
46         };\r
47 \r
48         void to_json(nlohmann::json& j, const signal& p);\r
49         void from_json(const nlohmann::json& j, signal& p);\r
50 }\r