Apollo 10.0
自动驾驶开放平台
vin_rpt_414.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 Vinrpt414::ID = 0x414;
32
33void Vinrpt414::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_vin_rpt_414()->set_veh_serial(
36 veh_serial(bytes, length));
37 chassis->mutable_vin_rpt_414()->set_veh_my_code(
38 veh_my_code(bytes, length));
39 chassis->mutable_vin_rpt_414()->set_veh_mfg_code(
40 veh_mfg_code(bytes, length));
41}
42
43// config detail: {'name': 'veh_serial', 'offset': 0.0, 'precision': 1.0, 'len':
44// 24, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 39, 'type':
45// 'int', 'order': 'motorola', 'physical_unit': ''}
46int Vinrpt414::veh_serial(const std::uint8_t* bytes, int32_t length) const {
47 Byte t0(bytes + 4);
48 int32_t x = t0.get_byte(0, 8);
49
50 Byte t1(bytes + 5);
51 int32_t t = t1.get_byte(0, 8);
52 x <<= 8;
53 x |= t;
54
55 Byte t2(bytes + 6);
56 t = t2.get_byte(0, 8);
57 x <<= 8;
58 x |= t;
59
60 int ret = x;
61 return ret;
62}
63
64// config detail: {'name': 'veh_my_code', 'offset': 0.0, 'precision': 1.0,
65// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 31,
66// 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
67int Vinrpt414::veh_my_code(const std::uint8_t* bytes, int32_t length) const {
68 Byte t0(bytes + 3);
69 int32_t x = t0.get_byte(0, 8);
70
71 int ret = x;
72 return ret;
73}
74
75// config detail: {'name': 'veh_mfg_code', 'offset': 0.0, 'precision': 1.0,
76// 'len': 24, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 7,
77// 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
78int Vinrpt414::veh_mfg_code(const std::uint8_t* bytes, int32_t length) const {
79 Byte t0(bytes + 0);
80 int32_t x = t0.get_byte(0, 8);
81
82 Byte t1(bytes + 1);
83 int32_t t = t1.get_byte(0, 8);
84 x <<= 8;
85 x |= t;
86
87 Byte t2(bytes + 2);
88 t = t2.get_byte(0, 8);
89 x <<= 8;
90 x |= t;
91
92 int ret = x;
93 return ret;
94}
95} // namespace lexus
96} // namespace canbus
97} // 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