e0124c352a4e16033827e22999a922ea034a4741
[src/low-level-can-generator.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                                                                                     id_;\r
15                 std::string                                                                                     generic_name_;\r
16                 std::uint32_t                                                                           bit_position_;\r
17                 std::uint32_t                                                                           bit_size_;\r
18                 float                                                                                           factor_;\r
19                 float                                                                                           offset_;\r
20                 std::string                                                                                     decoder_;\r
21                 bool                                                                                            ignore_;\r
22                 bool                                                                                            enabled_;\r
23                 std::map<std::string, std::vector<std::uint32_t>>       states_;\r
24                 float                                                                           max_frequency_;\r
25                 bool                                                                                            send_same_;\r
26                 bool                                                                                            force_send_changed_;\r
27                 bool                                                                                            writable_;\r
28                 std::string                                                                                     encoder_;\r
29         public:\r
30                 std::string id() const;\r
31                 void id(const std::string& id);\r
32                 std::string generic_name() const;\r
33                 std::uint32_t bit_position() const;\r
34                 std::uint32_t bit_size() const;\r
35                 float factor() const;\r
36                 float offset() const;\r
37                 std::string decoder() const;\r
38                 bool ignore() const;\r
39                 bool enabled() const;\r
40                 const std::map<std::string, std::vector<std::uint32_t>>& states() const;\r
41                 float max_frequency() const;\r
42                 bool send_same() const;\r
43                 bool force_send_changed() const;\r
44                 bool writable() const;\r
45                 std::string encoder() const;\r
46                 \r
47                 void from_json(const nlohmann::json& j);\r
48                 nlohmann::json to_json() const;\r
49         };\r
50 \r
51         void to_json(nlohmann::json& j, const signal& p);\r
52         void from_json(const nlohmann::json& j, signal& p);\r
53 }\r