Apollo 10.0
自动驾驶开放平台
wiper_cmd_134.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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 Wipercmd134::ID = 0x134;
28
29// public
31
32uint32_t Wipercmd134::GetPeriod() const {
33 // TODO(QiL) modify every protocol's period manually
34 static const uint32_t PERIOD = 20 * 1000;
35 return PERIOD;
36}
37
38void Wipercmd134::UpdateData(uint8_t* data) {
39 set_p_ignore_overrides(data, ignore_overrides_);
40 set_p_enable(data, enable_);
41 set_p_clear_override(data, clear_override_);
42 set_p_wiper_cmd(data, wiper_cmd_);
43 set_p_clear_faults(data, clear_faults_);
44}
45
47 // TODO(QiL) you should check this manually
48 ignore_overrides_ = false;
49 enable_ = false;
50 clear_override_ = false;
52 clear_faults_ = false;
53}
54
56 ignore_overrides_ = ignore_overrides;
57 return this;
58}
59
60// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
61// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
62// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
63void Wipercmd134::set_p_ignore_overrides(uint8_t* data, bool ignore_overrides) {
64 uint8_t x = ignore_overrides;
65
66 Byte to_set(data + 0);
67 to_set.set_value(x, 1, 1);
68}
69
71 enable_ = enable;
72 return this;
73}
74
75// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
76// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
77// 'order': 'motorola', 'physical_unit': ''}
78void Wipercmd134::set_p_enable(uint8_t* data, bool enable) {
79 uint8_t x = enable;
80
81 Byte to_set(data + 0);
82 to_set.set_value(x, 0, 1);
83}
84
86 clear_override_ = clear_override;
87 return this;
88}
89
90// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
91// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
92// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
93void Wipercmd134::set_p_clear_override(uint8_t* data, bool clear_override) {
94 uint8_t x = clear_override;
95
96 Byte to_set(data + 0);
97 to_set.set_value(x, 2, 1);
98}
99
102 wiper_cmd_ = wiper_cmd;
103 return this;
104}
105
106// config detail: {'name': 'WIPER_CMD', 'enum': {0: 'WIPER_CMD_WIPERS_OFF', 1:
107// 'WIPER_CMD_INTERMITTENT_1', 2: 'WIPER_CMD_INTERMITTENT_2', 3:
108// 'WIPER_CMD_INTERMITTENT_3', 4: 'WIPER_CMD_INTERMITTENT_4', 5:
109// 'WIPER_CMD_INTERMITTENT_5', 6: 'WIPER_CMD_LOW', 7: 'WIPER_CMD_HIGH'},
110// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
111// 'physical_range': '[0|7]', 'bit': 15, 'type': 'enum', 'order': 'motorola',
112// 'physical_unit': ''}
113void Wipercmd134::set_p_wiper_cmd(uint8_t* data,
115 uint8_t x = wiper_cmd;
116
117 Byte to_set(data + 1);
118 to_set.set_value(x, 0, 8);
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 Wipercmd134::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.
Wipercmd134 * set_clear_faults(bool clear_faults)
Wipercmd134 * set_ignore_overrides(bool ignore_overrides)
uint32_t GetPeriod() const override
Wipercmd134 * set_wiper_cmd(Wiper_cmd_134::Wiper_cmdType wiper_cmd)
Wipercmd134 * set_enable(bool enable)
void UpdateData(uint8_t *data) override
Wipercmd134 * set_clear_override(bool clear_override)
class register implement
Definition arena_queue.h:37