Apollo 10.0
自动驾驶开放平台
vcu_vehicle_info_response_502.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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 neolix_edu {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Vcuvehicleinforesponse502::ID = 0x502;
32
33void Vcuvehicleinforesponse502::Parse(const std::uint8_t* bytes, int32_t length,
34 Neolix_edu* chassis) const {
35 chassis->mutable_vcu_vehicle_info_response_502()
36 ->set_vehicle_softwareversion_indicati(
37 vehicle_softwareversion_indicati(bytes, length));
38 chassis->mutable_vcu_vehicle_info_response_502()
39 ->set_project(project(bytes, length));
40 chassis->mutable_vcu_vehicle_info_response_502()
41 ->set_manufacturer(manufacturer(bytes, length));
42 chassis ->mutable_vcu_vehicle_info_response_502()
43 ->set_year(year(bytes, length));
44 chassis->mutable_vcu_vehicle_info_response_502()
45 ->set_month(month(bytes, length));
46 chassis->mutable_vcu_vehicle_info_response_502()
47 ->set_day(day(bytes, length));
48 chassis->mutable_vcu_vehicle_info_response_502()
49 ->set_vehicle_serial_number(vehicle_serial_number(bytes, length));
50}
51
52// config detail: {'name': 'vehicle_softwareversion_indicati', 'offset': 0.0,
53// 'precision': 1.0, 'len': 24, 'is_signed_var': False, 'physical_range':
54// '[0|16777215]', 'bit': 7, 'type': 'int', 'order': 'motorola',
55// 'physical_unit': ''}
56int Vcuvehicleinforesponse502::vehicle_softwareversion_indicati(
57 const std::uint8_t* bytes, int32_t length) const {
58 Byte t0(bytes + 0);
59 int32_t x = t0.get_byte(0, 8);
60
61 Byte t1(bytes + 1);
62 int32_t t = t1.get_byte(0, 8);
63 x <<= 8;
64 x |= t;
65
66 Byte t2(bytes + 2);
67 t = t2.get_byte(0, 8);
68 x <<= 8;
69 x |= t;
70
71 int ret = x;
72 return ret;
73}
74
75// config detail: {'name': 'project', 'offset': 0.0, 'precision': 1.0, 'len': 4,
76// 'is_signed_var': False, 'physical_range': '[0|15]', 'bit': 27, 'type': 'int',
77// 'order': 'motorola', 'physical_unit': ''}
78int Vcuvehicleinforesponse502::project(const std::uint8_t* bytes,
79 int32_t length) const {
80 Byte t0(bytes + 3);
81 int32_t x = t0.get_byte(0, 4);
82
83 int ret = x;
84 return ret;
85}
86
87// config detail: {'name': 'manufacturer', 'offset': 0.0, 'precision': 1.0,
88// 'len': 4, 'is_signed_var': False, 'physical_range': '[0|15]', 'bit': 31,
89// 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
90int Vcuvehicleinforesponse502::manufacturer(const std::uint8_t* bytes,
91 int32_t length) const {
92 Byte t0(bytes + 3);
93 int32_t x = t0.get_byte(4, 4);
94
95 int ret = x;
96 return ret;
97}
98
99// config detail: {'name': 'year', 'offset': 0.0, 'precision': 1.0, 'len': 8,
100// 'is_signed_var': False, 'physical_range': '[0|255]', 'bit': 39, 'type':
101// 'int', 'order': 'motorola', 'physical_unit': ''}
102int Vcuvehicleinforesponse502::year(const std::uint8_t* bytes,
103 int32_t length) const {
104 Byte t0(bytes + 4);
105 int32_t x = t0.get_byte(0, 8);
106
107 int ret = x;
108 return ret;
109}
110
111// config detail: {'name': 'month', 'offset': 0.0, 'precision': 1.0, 'len': 4,
112// 'is_signed_var': False, 'physical_range': '[1|12]', 'bit': 47, 'type': 'int',
113// 'order': 'motorola', 'physical_unit': ''}
114int Vcuvehicleinforesponse502::month(const std::uint8_t* bytes,
115 int32_t length) const {
116 Byte t0(bytes + 5);
117 int32_t x = t0.get_byte(4, 4);
118
119 int ret = x;
120 return ret;
121}
122
123// config detail: {'name': 'day', 'offset': 0.0, 'precision': 1.0, 'len': 5,
124// 'is_signed_var': False, 'physical_range': '[1|31]', 'bit': 43, 'type': 'int',
125// 'order': 'motorola', 'physical_unit': ''}
126int Vcuvehicleinforesponse502::day(const std::uint8_t* bytes,
127 int32_t length) const {
128 Byte t0(bytes + 5);
129 int32_t x = t0.get_byte(0, 4);
130
131 Byte t1(bytes + 6);
132 int32_t t = t1.get_byte(7, 1);
133 x <<= 1;
134 x |= t;
135
136 int ret = x;
137 return ret;
138}
139
140// config detail: {'name': 'vehicle_serial_number', 'offset': 0.0,
141// 'precision': 1.0, 'len': 15, 'is_signed_var': False, 'physical_range':
142// '[0|32767]', 'bit': 54, 'type': 'int', 'order': 'motorola', 'physical_unit':
143// ''}
144int Vcuvehicleinforesponse502::vehicle_serial_number(const std::uint8_t* bytes,
145 int32_t length) const {
146 Byte t0(bytes + 6);
147 int32_t x = t0.get_byte(0, 7);
148
149 Byte t1(bytes + 7);
150 int32_t t = t1.get_byte(0, 8);
151 x <<= 8;
152 x |= t;
153
154 int ret = x;
155 return ret;
156}
157} // namespace neolix_edu
158} // namespace canbus
159} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Neolix_edu *chassis) const override
class register implement
Definition arena_queue.h:37