Apollo 10.0
自动驾驶开放平台
vin_resp1_51b.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
19#include <string>
20
21#include "glog/logging.h"
22
25
26namespace apollo {
27namespace canbus {
28namespace ch {
29
30using ::apollo::drivers::canbus::Byte;
31
33const int32_t Vinresp151b::ID = 0x51B;
34
35void Vinresp151b::Parse(const std::uint8_t* bytes, int32_t length,
36 Ch* chassis) const {
37 chassis->mutable_vin_resp1_51b()->set_vin08(
38 vin08(bytes, length));
39 chassis->mutable_vin_resp1_51b()->set_vin07(
40 vin07(bytes, length));
41 chassis->mutable_vin_resp1_51b()->set_vin06(
42 vin06(bytes, length));
43 chassis->mutable_vin_resp1_51b()->set_vin05(
44 vin05(bytes, length));
45 chassis->mutable_vin_resp1_51b()->set_vin04(
46 vin04(bytes, length));
47 chassis->mutable_vin_resp1_51b()->set_vin03(
48 vin03(bytes, length));
49 chassis->mutable_vin_resp1_51b()->set_vin02(
50 vin02(bytes, length));
51 chassis->mutable_vin_resp1_51b()->set_vin01(
52 vin01(bytes, length));
53}
54
55// config detail: {'bit': 56, 'description': 'VIN Response', 'is_signed_var':
56// False, 'len': 8, 'name': 'vin08', 'offset': 0.0, 'order': 'intel',
57// 'physical_range': '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type':
58// 'int'}
59std::string Vinresp151b::vin08(const std::uint8_t* bytes,
60 int32_t length) const {
61 Byte t0(bytes + 7);
62 int32_t x = t0.get_byte(0, 8);
63
64 std::string ret = "";
65 ret += x;
66 return ret;
67}
68
69// config detail: {'bit': 48, 'description': 'VIN Response', 'is_signed_var':
70// False, 'len': 8, 'name': 'vin07', 'offset': 0.0, 'order': 'intel',
71// 'physical_range': '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type':
72// 'int'}
73std::string Vinresp151b::vin07(const std::uint8_t* bytes,
74 int32_t length) const {
75 Byte t0(bytes + 6);
76 int32_t x = t0.get_byte(0, 8);
77
78 std::string ret = "";
79 ret += x;
80 return ret;
81}
82
83// config detail: {'bit': 40, 'description': 'VIN Response', 'is_signed_var':
84// False, 'len': 8, 'name': 'vin06', 'offset': 0.0, 'order': 'intel',
85// 'physical_range': '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type':
86// 'int'}
87std::string Vinresp151b::vin06(const std::uint8_t* bytes,
88 int32_t length) const {
89 Byte t0(bytes + 5);
90 int32_t x = t0.get_byte(0, 8);
91
92 std::string ret = "";
93 ret += x;
94 return ret;
95}
96
97// config detail: {'bit': 32, 'description': 'VIN Response', 'is_signed_var':
98// False, 'len': 8, 'name': 'vin05', 'offset': 0.0, 'order': 'intel',
99// 'physical_range': '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type':
100// 'int'}
101std::string Vinresp151b::vin05(const std::uint8_t* bytes,
102 int32_t length) const {
103 Byte t0(bytes + 4);
104 int32_t x = t0.get_byte(0, 8);
105
106 std::string ret = "";
107 ret += x;
108 return ret;
109}
110
111// config detail: {'bit': 24, 'description': 'VIN Response', 'is_signed_var':
112// False, 'len': 8, 'name': 'vin04', 'offset': 0.0, 'order': 'intel',
113// 'physical_range': '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type':
114// 'int'}
115std::string Vinresp151b::vin04(const std::uint8_t* bytes,
116 int32_t length) const {
117 Byte t0(bytes + 3);
118 int32_t x = t0.get_byte(0, 8);
119
120 std::string ret = "";
121 ret += x;
122 return ret;
123}
124
125// config detail: {'bit': 16, 'description': 'VIN Response', 'is_signed_var':
126// False, 'len': 8, 'name': 'vin03', 'offset': 0.0, 'order': 'intel',
127// 'physical_range': '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type':
128// 'int'}
129std::string Vinresp151b::vin03(const std::uint8_t* bytes,
130 int32_t length) const {
131 Byte t0(bytes + 2);
132 int32_t x = t0.get_byte(0, 8);
133
134 std::string ret = "";
135 ret += x;
136 return ret;
137}
138
139// config detail: {'bit': 8, 'description': 'VIN Response', 'is_signed_var':
140// False, 'len': 8, 'name': 'vin02', 'offset': 0.0, 'order': 'intel',
141// 'physical_range': '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type':
142// 'int'}
143std::string Vinresp151b::vin02(const std::uint8_t* bytes,
144 int32_t length) const {
145 Byte t0(bytes + 1);
146 int32_t x = t0.get_byte(0, 8);
147
148 std::string ret = "";
149 ret += x;
150 return ret;
151}
152
153// config detail: {'bit': 0, 'description': 'VIN Response', 'is_signed_var':
154// False, 'len': 8, 'name': 'vin01', 'offset': 0.0, 'order': 'intel',
155// 'physical_range': '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type':
156// 'int'}
157std::string Vinresp151b::vin01(const std::uint8_t* bytes,
158 int32_t length) const {
159 Byte t0(bytes + 0);
160 int32_t x = t0.get_byte(0, 8);
161
162 std::string ret = "";
163 ret += x;
164 return ret;
165}
166} // namespace ch
167} // namespace canbus
168} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Ch *chassis) const override
class register implement
Definition arena_queue.h:37