Apollo 10.0
自动驾驶开放平台
horn_rpt_21c.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
19#include "glog/logging.h"
20
23
24namespace apollo {
25namespace canbus {
26namespace lexus {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Hornrpt21c::ID = 0x21C;
32
33void Hornrpt21c::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_horn_rpt_21c()->set_vehicle_fault(
36 vehicle_fault(bytes, length));
37 chassis->mutable_horn_rpt_21c()->set_pacmod_fault(
38 pacmod_fault(bytes, length));
39 chassis->mutable_horn_rpt_21c()->set_override_active(
40 override_active(bytes, length));
41 chassis->mutable_horn_rpt_21c()->set_output_reported_fault(
42 output_reported_fault(bytes, length));
43 chassis->mutable_horn_rpt_21c()->set_input_output_fault(
44 input_output_fault(bytes, length));
45 chassis->mutable_horn_rpt_21c()->set_enabled(
46 enabled(bytes, length));
47 chassis->mutable_horn_rpt_21c()->set_command_output_fault(
48 command_output_fault(bytes, length));
49 chassis->mutable_horn_rpt_21c()->set_output_value(
50 output_value(bytes, length));
51 chassis->mutable_horn_rpt_21c()->set_commanded_value(
52 commanded_value(bytes, length));
53 chassis->mutable_horn_rpt_21c()->set_manual_input(
54 manual_input(bytes, length));
55}
56
57// config detail: {'name': 'vehicle_fault', 'offset': 0.0, 'precision': 1.0,
58// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
59// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
60bool Hornrpt21c::vehicle_fault(const std::uint8_t* bytes,
61 int32_t length) const {
62 Byte t0(bytes + 0);
63 int32_t x = t0.get_byte(6, 1);
64
65 bool ret = x;
66 return ret;
67}
68
69// config detail: {'name': 'pacmod_fault', 'offset': 0.0, 'precision': 1.0,
70// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
71// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
72bool Hornrpt21c::pacmod_fault(const std::uint8_t* bytes, int32_t length) const {
73 Byte t0(bytes + 0);
74 int32_t x = t0.get_byte(5, 1);
75
76 bool ret = x;
77 return ret;
78}
79
80// config detail: {'name': 'override_active', 'offset': 0.0, 'precision': 1.0,
81// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
82// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
83bool Hornrpt21c::override_active(const std::uint8_t* bytes,
84 int32_t length) const {
85 Byte t0(bytes + 0);
86 int32_t x = t0.get_byte(1, 1);
87
88 bool ret = x;
89 return ret;
90}
91
92// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
93// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
94// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
95bool Hornrpt21c::output_reported_fault(const std::uint8_t* bytes,
96 int32_t length) const {
97 Byte t0(bytes + 0);
98 int32_t x = t0.get_byte(4, 1);
99
100 bool ret = x;
101 return ret;
102}
103
104// config detail: {'name': 'input_output_fault', 'offset': 0.0,
105// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
106// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
107bool Hornrpt21c::input_output_fault(const std::uint8_t* bytes,
108 int32_t length) const {
109 Byte t0(bytes + 0);
110 int32_t x = t0.get_byte(3, 1);
111
112 bool ret = x;
113 return ret;
114}
115
116// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
117// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
118// 'order': 'motorola', 'physical_unit': ''}
119bool Hornrpt21c::enabled(const std::uint8_t* bytes, int32_t length) const {
120 Byte t0(bytes + 0);
121 int32_t x = t0.get_byte(0, 1);
122
123 bool ret = x;
124 return ret;
125}
126
127// config detail: {'name': 'command_output_fault', 'offset': 0.0,
128// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
129// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
130bool Hornrpt21c::command_output_fault(const std::uint8_t* bytes,
131 int32_t length) const {
132 Byte t0(bytes + 0);
133 int32_t x = t0.get_byte(2, 1);
134
135 bool ret = x;
136 return ret;
137}
138
139// config detail: {'name': 'output_value', 'enum': {0: 'OUTPUT_VALUE_OFF', 1:
140// 'OUTPUT_VALUE_ON'}, 'precision': 1.0, 'len': 8, 'is_signed_var': False,
141// 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 31, 'type': 'enum', 'order':
142// 'motorola', 'physical_unit': ''}
143Horn_rpt_21c::Output_valueType Hornrpt21c::output_value(
144 const std::uint8_t* bytes, int32_t length) const {
145 Byte t0(bytes + 3);
146 int32_t x = t0.get_byte(0, 8);
147
149 static_cast<Horn_rpt_21c::Output_valueType>(x);
150 return ret;
151}
152
153// config detail: {'name': 'commanded_value', 'enum': {0: 'COMMANDED_VALUE_OFF',
154// 1: 'COMMANDED_VALUE_ON'}, 'precision': 1.0, 'len': 8, 'is_signed_var': False,
155// 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 23, 'type': 'enum', 'order':
156// 'motorola', 'physical_unit': ''}
157Horn_rpt_21c::Commanded_valueType Hornrpt21c::commanded_value(
158 const std::uint8_t* bytes, int32_t length) const {
159 Byte t0(bytes + 2);
160 int32_t x = t0.get_byte(0, 8);
161
163 static_cast<Horn_rpt_21c::Commanded_valueType>(x);
164 return ret;
165}
166
167// config detail: {'name': 'manual_input', 'enum': {0: 'MANUAL_INPUT_OFF', 1:
168// 'MANUAL_INPUT_ON'}, 'precision': 1.0, 'len': 8, 'is_signed_var': False,
169// 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 15, 'type': 'enum', 'order':
170// 'motorola', 'physical_unit': ''}
171Horn_rpt_21c::Manual_inputType Hornrpt21c::manual_input(
172 const std::uint8_t* bytes, int32_t length) const {
173 Byte t0(bytes + 1);
174 int32_t x = t0.get_byte(0, 8);
175
177 static_cast<Horn_rpt_21c::Manual_inputType>(x);
178 return ret;
179}
180} // namespace lexus
181} // namespace canbus
182} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Lexus *chassis) const override
class register implement
Definition arena_queue.h:37