Apollo 10.0
自动驾驶开放平台
occupancy_rpt_415.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 Occupancyrpt415::ID = 0x415;
32
33void Occupancyrpt415::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_occupancy_rpt_415()->set_rear_seatbelt_buckled_is_valid(
36 rear_seatbelt_buckled_is_valid(bytes, length));
37 chassis->mutable_occupancy_rpt_415()->set_pass_seatbelt_buckled_is_valid(
38 pass_seatbelt_buckled_is_valid(bytes, length));
39 chassis->mutable_occupancy_rpt_415()->set_driver_seatbelt_buckled_is_valid(
40 driver_seatbelt_buckled_is_valid(bytes, length));
41 chassis->mutable_occupancy_rpt_415()->set_rear_seat_occupied_is_valid(
42 rear_seat_occupied_is_valid(bytes, length));
43 chassis->mutable_occupancy_rpt_415()->set_pass_seat_occupied_is_valid(
44 pass_seat_occupied_is_valid(bytes, length));
45 chassis->mutable_occupancy_rpt_415()->set_driver_seat_occupied_is_valid(
46 driver_seat_occupied_is_valid(bytes, length));
47 chassis->mutable_occupancy_rpt_415()->set_rear_seatbelt_buckled(
48 rear_seatbelt_buckled(bytes, length));
49 chassis->mutable_occupancy_rpt_415()->set_pass_seatbelt_buckled(
50 pass_seatbelt_buckled(bytes, length));
51 chassis->mutable_occupancy_rpt_415()->set_driver_seatbelt_buckled(
52 driver_seatbelt_buckled(bytes, length));
53 chassis->mutable_occupancy_rpt_415()->set_rear_seat_occupied(
54 rear_seat_occupied(bytes, length));
55 chassis->mutable_occupancy_rpt_415()->set_pass_seat_occupied(
56 pass_seat_occupied(bytes, length));
57 chassis->mutable_occupancy_rpt_415()->set_driver_seat_occupied(
58 driver_seat_occupied(bytes, length));
59}
60
61// config detail: {'name': 'rear_seatbelt_buckled_is_valid', 'offset': 0.0,
62// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
63// '[0|1]', 'bit': 13, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
64bool Occupancyrpt415::rear_seatbelt_buckled_is_valid(const std::uint8_t* bytes,
65 int32_t length) const {
66 Byte t0(bytes + 1);
67 int32_t x = t0.get_byte(5, 1);
68
69 bool ret = x;
70 return ret;
71}
72
73// config detail: {'name': 'pass_seatbelt_buckled_is_valid', 'offset': 0.0,
74// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
75// '[0|1]', 'bit': 12, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
76bool Occupancyrpt415::pass_seatbelt_buckled_is_valid(const std::uint8_t* bytes,
77 int32_t length) const {
78 Byte t0(bytes + 1);
79 int32_t x = t0.get_byte(4, 1);
80
81 bool ret = x;
82 return ret;
83}
84
85// config detail: {'name': 'driver_seatbelt_buckled_is_valid', 'offset': 0.0,
86// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
87// '[0|1]', 'bit': 11, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
88bool Occupancyrpt415::driver_seatbelt_buckled_is_valid(
89 const std::uint8_t* bytes, int32_t length) const {
90 Byte t0(bytes + 1);
91 int32_t x = t0.get_byte(3, 1);
92
93 bool ret = x;
94 return ret;
95}
96
97// config detail: {'name': 'rear_seat_occupied_is_valid', 'offset': 0.0,
98// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
99// '[0|1]', 'bit': 10, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
100bool Occupancyrpt415::rear_seat_occupied_is_valid(const std::uint8_t* bytes,
101 int32_t length) const {
102 Byte t0(bytes + 1);
103 int32_t x = t0.get_byte(2, 1);
104
105 bool ret = x;
106 return ret;
107}
108
109// config detail: {'name': 'pass_seat_occupied_is_valid', 'offset': 0.0,
110// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
111// '[0|1]', 'bit': 9, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
112bool Occupancyrpt415::pass_seat_occupied_is_valid(const std::uint8_t* bytes,
113 int32_t length) const {
114 Byte t0(bytes + 1);
115 int32_t x = t0.get_byte(1, 1);
116
117 bool ret = x;
118 return ret;
119}
120
121// config detail: {'name': 'driver_seat_occupied_is_valid', 'offset': 0.0,
122// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
123// '[0|1]', 'bit': 8, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
124bool Occupancyrpt415::driver_seat_occupied_is_valid(const std::uint8_t* bytes,
125 int32_t length) const {
126 Byte t0(bytes + 1);
127 int32_t x = t0.get_byte(0, 1);
128
129 bool ret = x;
130 return ret;
131}
132
133// config detail: {'name': 'rear_seatbelt_buckled', 'offset': 0.0,
134// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
135// '[0|1]', 'bit': 5, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
136bool Occupancyrpt415::rear_seatbelt_buckled(const std::uint8_t* bytes,
137 int32_t length) const {
138 Byte t0(bytes + 0);
139 int32_t x = t0.get_byte(5, 1);
140
141 bool ret = x;
142 return ret;
143}
144
145// config detail: {'name': 'pass_seatbelt_buckled', 'offset': 0.0,
146// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
147// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
148bool Occupancyrpt415::pass_seatbelt_buckled(const std::uint8_t* bytes,
149 int32_t length) const {
150 Byte t0(bytes + 0);
151 int32_t x = t0.get_byte(4, 1);
152
153 bool ret = x;
154 return ret;
155}
156
157// config detail: {'name': 'driver_seatbelt_buckled', 'offset': 0.0,
158// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
159// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
160bool Occupancyrpt415::driver_seatbelt_buckled(const std::uint8_t* bytes,
161 int32_t length) const {
162 Byte t0(bytes + 0);
163 int32_t x = t0.get_byte(3, 1);
164
165 bool ret = x;
166 return ret;
167}
168
169// config detail: {'name': 'rear_seat_occupied', 'offset': 0.0,
170// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
171// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
172bool Occupancyrpt415::rear_seat_occupied(const std::uint8_t* bytes,
173 int32_t length) const {
174 Byte t0(bytes + 0);
175 int32_t x = t0.get_byte(2, 1);
176
177 bool ret = x;
178 return ret;
179}
180
181// config detail: {'name': 'pass_seat_occupied', 'offset': 0.0,
182// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
183// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
184bool Occupancyrpt415::pass_seat_occupied(const std::uint8_t* bytes,
185 int32_t length) const {
186 Byte t0(bytes + 0);
187 int32_t x = t0.get_byte(1, 1);
188
189 bool ret = x;
190 return ret;
191}
192
193// config detail: {'name': 'driver_seat_occupied', 'offset': 0.0,
194// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
195// '[0|1]', 'bit': 0, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
196bool Occupancyrpt415::driver_seat_occupied(const std::uint8_t* bytes,
197 int32_t length) const {
198 Byte t0(bytes + 0);
199 int32_t x = t0.get_byte(0, 1);
200
201 bool ret = x;
202 return ret;
203}
204} // namespace lexus
205} // namespace canbus
206} // 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