Apollo 10.0
自动驾驶开放平台
hazard_lights_cmd_114.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
20
21namespace apollo {
22namespace canbus {
23namespace lexus {
24
25using ::apollo::drivers::canbus::Byte;
26
27const int32_t Hazardlightscmd114::ID = 0x114;
28
29// public
31
33 // TODO(QiL) modify every protocol's period manually
34 static const uint32_t PERIOD = 20 * 1000;
35 return PERIOD;
36}
37
38void Hazardlightscmd114::UpdateData(uint8_t* data) {
39 set_p_hazard_lights_cmd(data, hazard_lights_cmd_);
40 set_p_ignore_overrides(data, ignore_overrides_);
41 set_p_clear_override(data, clear_override_);
42 set_p_enable(data, enable_);
43 set_p_clear_faults(data, clear_faults_);
44}
45
47 // TODO(QiL) you should check this manually
48 hazard_lights_cmd_ = false;
49 ignore_overrides_ = false;
50 clear_override_ = false;
51 enable_ = false;
52 clear_faults_ = false;
53}
54
56 bool hazard_lights_cmd) {
57 hazard_lights_cmd_ = hazard_lights_cmd;
58 return this;
59}
60
61// config detail: {'name': 'HAZARD_LIGHTS_CMD', 'offset': 0.0, 'precision': 1.0,
62// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 8,
63// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
64void Hazardlightscmd114::set_p_hazard_lights_cmd(uint8_t* data,
65 bool hazard_lights_cmd) {
66 uint8_t x = hazard_lights_cmd;
67
68 Byte to_set(data + 1);
69 to_set.set_value(x, 0, 1);
70}
71
73 bool ignore_overrides) {
74 ignore_overrides_ = ignore_overrides;
75 return this;
76}
77
78// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
79// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
80// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
81void Hazardlightscmd114::set_p_ignore_overrides(uint8_t* data,
82 bool ignore_overrides) {
83 uint8_t x = ignore_overrides;
84
85 Byte to_set(data + 0);
86 to_set.set_value(x, 1, 1);
87}
88
90 bool clear_override) {
91 clear_override_ = clear_override;
92 return this;
93}
94
95// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
96// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
97// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
98void Hazardlightscmd114::set_p_clear_override(uint8_t* data,
99 bool clear_override) {
100 uint8_t x = clear_override;
101
102 Byte to_set(data + 0);
103 to_set.set_value(x, 2, 1);
104}
105
107 enable_ = enable;
108 return this;
109}
110
111// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
112// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
113// 'order': 'motorola', 'physical_unit': ''}
114void Hazardlightscmd114::set_p_enable(uint8_t* data, bool enable) {
115 uint8_t x = enable;
116
117 Byte to_set(data + 0);
118 to_set.set_value(x, 0, 1);
119}
120
122 clear_faults_ = clear_faults;
123 return this;
124}
125
126// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
127// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
128// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
129void Hazardlightscmd114::set_p_clear_faults(uint8_t* data, bool clear_faults) {
130 uint8_t x = clear_faults;
131
132 Byte to_set(data + 0);
133 to_set.set_value(x, 3, 1);
134}
135
136} // namespace lexus
137} // namespace canbus
138} // namespace apollo
Defines the Byte class.
Hazardlightscmd114 * set_hazard_lights_cmd(bool hazard_lights_cmd)
Hazardlightscmd114 * set_enable(bool enable)
Hazardlightscmd114 * set_ignore_overrides(bool ignore_overrides)
Hazardlightscmd114 * set_clear_override(bool clear_override)
Hazardlightscmd114 * set_clear_faults(bool clear_faults)
class register implement
Definition arena_queue.h:37