Apollo 10.0
自动驾驶开放平台
scu_bcm_304.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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#include "glog/logging.h"
21
22namespace apollo {
23namespace canbus {
24namespace ge3 {
25
26using ::apollo::drivers::canbus::Byte;
27
29const int32_t Scubcm304::ID = 0x304;
30
31void Scubcm304::Parse(const std::uint8_t* bytes, int32_t length,
32 Ge3* chassis) const {
33 chassis->mutable_scu_bcm_304()->set_bcm_vehreversest(
34 bcm_vehreversest(bytes, length));
35 chassis->mutable_scu_bcm_304()->set_bcm_rightturnlampst(
36 bcm_rightturnlampst(bytes, length));
37 chassis->mutable_scu_bcm_304()->set_bcm_rearfoglampst(
38 bcm_rearfoglampst(bytes, length));
39 chassis->mutable_scu_bcm_304()->set_bcm_parkinglampst(
40 bcm_parkinglampst(bytes, length));
41 chassis->mutable_scu_bcm_304()->set_bcm_lowbeamst(
42 bcm_lowbeamst(bytes, length));
43 chassis->mutable_scu_bcm_304()->set_bcm_leftturnlampst(
44 bcm_leftturnlampst(bytes, length));
45 chassis->mutable_scu_bcm_304()->set_bcm_keyst(
46 bcm_keyst(bytes, length));
47 chassis->mutable_scu_bcm_304()->set_bcm_hornst(
48 bcm_hornst(bytes, length));
49 chassis->mutable_scu_bcm_304()->set_bcm_highbeamst(
50 bcm_highbeamst(bytes, length));
51 chassis->mutable_scu_bcm_304()->set_bcm_hazardlampst(
52 bcm_hazardlampst(bytes, length));
53 chassis->mutable_scu_bcm_304()->set_bcm_frontfoglampst(
54 bcm_frontfoglampst(bytes, length));
55 chassis->mutable_scu_bcm_304()->set_bcm_brakelightswitchst(
56 bcm_brakelightswitchst(bytes, length));
57}
58
59// config detail: {'description': 'Vehicle reverse status', 'enum': {0:
60// 'BCM_VEHREVERSEST_NORMAL', 1: 'BCM_VEHREVERSEST_REVERSE'}, 'precision': 1.0,
61// 'len': 1, 'name': 'bcm_vehreversest', 'is_signed_var': False, 'offset': 0.0,
62// 'physical_range': '[0|1]', 'bit': 11, 'type': 'enum', 'order': 'motorola',
63// 'physical_unit': '-'}
64Scu_bcm_304::Bcm_vehreversestType Scubcm304::bcm_vehreversest(
65 const std::uint8_t* bytes, int32_t length) const {
66 Byte t0(bytes + 1);
67 int32_t x = t0.get_byte(3, 1);
68
71 return ret;
72}
73
74// config detail: {'description': 'Right turn lamp status', 'enum': {0:
75// 'BCM_RIGHTTURNLAMPST_INACTIVE', 1: 'BCM_RIGHTTURNLAMPST_ACTIVE'},
76// 'precision': 1.0, 'len': 1, 'name': 'bcm_rightturnlampst', 'is_signed_var':
77// False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 4, 'type': 'enum',
78// 'order': 'motorola', 'physical_unit': '-'}
79Scu_bcm_304::Bcm_rightturnlampstType Scubcm304::bcm_rightturnlampst(
80 const std::uint8_t* bytes, int32_t length) const {
81 Byte t0(bytes + 0);
82 int32_t x = t0.get_byte(4, 1);
83
86 return ret;
87}
88
89// config detail: {'description': 'Rear fog lamp status', 'enum': {0:
90// 'BCM_REARFOGLAMPST_INACTIVE', 1: 'BCM_REARFOGLAMPST_ACTIVE'},
91// 'precision': 1.0, 'len': 1, 'name': 'bcm_rearfoglampst', 'is_signed_var':
92// False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 0, 'type': 'enum',
93// 'order': 'motorola', 'physical_unit': '-'}
94Scu_bcm_304::Bcm_rearfoglampstType Scubcm304::bcm_rearfoglampst(
95 const std::uint8_t* bytes, int32_t length) const {
96 Byte t0(bytes + 0);
97 int32_t x = t0.get_byte(0, 1);
98
101 return ret;
102}
103
104// config detail: {'description': 'Parking lamp status', 'enum': {0:
105// 'BCM_PARKINGLAMPST_INACTIVE', 1: 'BCM_PARKINGLAMPST_ACTIVE'},
106// 'precision': 1.0, 'len': 1, 'name': 'bcm_parkinglampst', 'is_signed_var':
107// False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 12, 'type': 'enum',
108// 'order': 'motorola', 'physical_unit': ''}
109Scu_bcm_304::Bcm_parkinglampstType Scubcm304::bcm_parkinglampst(
110 const std::uint8_t* bytes, int32_t length) const {
111 Byte t0(bytes + 1);
112 int32_t x = t0.get_byte(4, 1);
113
116 return ret;
117}
118
119// config detail: {'description': 'Low beam status', 'enum': {0:
120// 'BCM_LOWBEAMST_INACTIVE', 1: 'BCM_LOWBEAMST_ACTIVE'}, 'precision': 1.0,
121// 'len': 1, 'name': 'bcm_lowbeamst', 'is_signed_var': False, 'offset': 0.0,
122// 'physical_range': '[0|1]', 'bit': 2, 'type': 'enum', 'order': 'motorola',
123// 'physical_unit': '-'}
124Scu_bcm_304::Bcm_lowbeamstType Scubcm304::bcm_lowbeamst(
125 const std::uint8_t* bytes, int32_t length) const {
126 Byte t0(bytes + 0);
127 int32_t x = t0.get_byte(2, 1);
128
130 static_cast<Scu_bcm_304::Bcm_lowbeamstType>(x);
131 return ret;
132}
133
134// config detail: {'description': 'Left turn lamp status', 'enum': {0:
135// 'BCM_LEFTTURNLAMPST_INACTIVE', 1: 'BCM_LEFTTURNLAMPST_ACTIVE'},
136// 'precision': 1.0, 'len': 1, 'name': 'bcm_leftturnlampst', 'is_signed_var':
137// False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 5, 'type': 'enum',
138// 'order': 'motorola', 'physical_unit': '-'}
139Scu_bcm_304::Bcm_leftturnlampstType Scubcm304::bcm_leftturnlampst(
140 const std::uint8_t* bytes, int32_t length) const {
141 Byte t0(bytes + 0);
142 int32_t x = t0.get_byte(5, 1);
143
146 return ret;
147}
148
149// config detail: {'description': 'Key status', 'enum': {0: 'BCM_KEYST_OFF', 1:
150// 'BCM_KEYST_ACC', 2: 'BCM_KEYST_ON', 3: 'BCM_KEYST_CRANK'}, 'precision': 1.0,
151// 'len': 2, 'name': 'bcm_keyst', 'is_signed_var': False, 'offset': 0.0,
152// 'physical_range': '[0|3]', 'bit': 7, 'type': 'enum', 'order': 'motorola',
153// 'physical_unit': '-'}
154Scu_bcm_304::Bcm_keystType Scubcm304::bcm_keyst(const std::uint8_t* bytes,
155 int32_t length) const {
156 Byte t0(bytes + 0);
157 int32_t x = t0.get_byte(6, 2);
158
160 return ret;
161}
162
163// config detail: {'description': 'Horn status', 'enum': {0:
164// 'BCM_HORNST_INACTIVE', 1: 'BCM_HORNST_ACTIVE'}, 'precision': 1.0, 'len': 1,
165// 'name': 'bcm_hornst', 'is_signed_var': False, 'offset': 0.0,
166// 'physical_range': '[0|1]', 'bit': 15, 'type': 'enum', 'order': 'motorola',
167// 'physical_unit': '-'}
168Scu_bcm_304::Bcm_hornstType Scubcm304::bcm_hornst(const std::uint8_t* bytes,
169 int32_t length) const {
170 Byte t0(bytes + 1);
171 int32_t x = t0.get_byte(7, 1);
172
174 return ret;
175}
176
177// config detail: {'description': 'High beam status', 'enum': {0:
178// 'BCM_HIGHBEAMST_INACTIVE', 1: 'BCM_HIGHBEAMST_ACTIVE'}, 'precision': 1.0,
179// 'len': 1, 'name': 'bcm_highbeamst', 'is_signed_var': False, 'offset': 0.0,
180// 'physical_range': '[0|1]', 'bit': 3, 'type': 'enum', 'order': 'motorola',
181// 'physical_unit': '-'}
182Scu_bcm_304::Bcm_highbeamstType Scubcm304::bcm_highbeamst(
183 const std::uint8_t* bytes, int32_t length) const {
184 Byte t0(bytes + 0);
185 int32_t x = t0.get_byte(3, 1);
186
188 static_cast<Scu_bcm_304::Bcm_highbeamstType>(x);
189 return ret;
190}
191
192// config detail: {'description': 'Hazard lamp status', 'enum': {0:
193// 'BCM_HAZARDLAMPST_INACTIVE', 1: 'BCM_HAZARDLAMPST_ACTIVE'}, 'precision': 1.0,
194// 'len': 1, 'name': 'bcm_hazardlampst', 'is_signed_var': False, 'offset': 0.0,
195// 'physical_range': '[0|1]', 'bit': 13, 'type': 'enum', 'order': 'motorola',
196// 'physical_unit': ''}
197Scu_bcm_304::Bcm_hazardlampstType Scubcm304::bcm_hazardlampst(
198 const std::uint8_t* bytes, int32_t length) const {
199 Byte t0(bytes + 1);
200 int32_t x = t0.get_byte(5, 1);
201
203 static_cast<Scu_bcm_304::Bcm_hazardlampstType>(x);
204 return ret;
205}
206
207// config detail: {'description': 'Front fog lamp status', 'enum': {0:
208// 'BCM_FRONTFOGLAMPST_INACTIVE', 1: 'BCM_FRONTFOGLAMPST_ACTIVE'},
209// 'precision': 1.0, 'len': 1, 'name': 'bcm_frontfoglampst', 'is_signed_var':
210// False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 1, 'type': 'enum',
211// 'order': 'motorola', 'physical_unit': '-'}
212Scu_bcm_304::Bcm_frontfoglampstType Scubcm304::bcm_frontfoglampst(
213 const std::uint8_t* bytes, int32_t length) const {
214 Byte t0(bytes + 0);
215 int32_t x = t0.get_byte(1, 1);
216
219 return ret;
220}
221
222// config detail: {'description': 'Brake light switch status', 'enum': {0:
223// 'BCM_BRAKELIGHTSWITCHST_INACTIVE', 1: 'BCM_BRAKELIGHTSWITCHST_ACTIVE'},
224// 'precision': 1.0, 'len': 1, 'name': 'bcm_brakelightswitchst',
225// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 14,
226// 'type': 'enum', 'order': 'motorola', 'physical_unit': '-'}
227Scu_bcm_304::Bcm_brakelightswitchstType Scubcm304::bcm_brakelightswitchst(
228 const std::uint8_t* bytes, int32_t length) const {
229 Byte t0(bytes + 1);
230 int32_t x = t0.get_byte(6, 1);
231
234 return ret;
235}
236} // namespace ge3
237} // namespace canbus
238} // namespace apollo
Defines the Byte class.
static const int32_t ID
Definition scu_bcm_304.h:29
void Parse(const std::uint8_t *bytes, int32_t length, Ge3 *chassis) const override
class register implement
Definition arena_queue.h:37