Apollo 10.0
自动驾驶开放平台
component_rpt_20.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 Componentrpt20::ID = 0x20;
32
33void Componentrpt20::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_component_rpt_20()->set_component_type(
36 component_type(bytes, length));
37 chassis->mutable_component_rpt_20()->set_component_func(
38 component_func(bytes, length));
39 chassis->mutable_component_rpt_20()->set_counter(
40 counter(bytes, length));
41 chassis->mutable_component_rpt_20()->set_complement(
42 complement(bytes, length));
43 chassis->mutable_component_rpt_20()->set_config_fault(
44 config_fault(bytes, length));
45}
46
47// config detail: {'name': 'component_type', 'enum': {0:
48// 'COMPONENT_TYPE_PACMOD', 1: 'COMPONENT_TYPE_PACMINI', 2:
49// 'COMPONENT_TYPE_PACMICRO'}, 'precision': 1.0, 'len': 8, 'is_signed_var':
50// False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit': 7, 'type': 'enum',
51// 'order': 'motorola', 'physical_unit': ''}
52Component_rpt_20::Component_typeType Componentrpt20::component_type(
53 const std::uint8_t* bytes, int32_t length) const {
54 Byte t0(bytes + 0);
55 int32_t x = t0.get_byte(0, 8);
56
59 return ret;
60}
61
62// config detail: {'name': 'component_func', 'enum': {0:
63// 'COMPONENT_FUNC_PACMOD', 1: 'COMPONENT_FUNC_STEERING_AND_STEERING_COLUMN', 2:
64// 'COMPONENT_FUNC_ACCELERATOR_AND_BRAKING', 3: 'COMPONENT_FUNC_BRAKING', 4:
65// 'COMPONENT_FUNC_SHIFTING', 5: 'COMPONENT_FUNC_STEERING', 6:
66// 'COMPONENT_FUNC_E_SHIFTER', 7: 'COMPONENT_FUNC_WATCHDOG'}, 'precision': 1.0,
67// 'len': 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]',
68// 'bit': 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
69Component_rpt_20::Component_funcType Componentrpt20::component_func(
70 const std::uint8_t* bytes, int32_t length) const {
71 Byte t0(bytes + 1);
72 int32_t x = t0.get_byte(0, 8);
73
76 return ret;
77}
78
79// config detail: {'name': 'counter', 'offset': 0.0, 'precision': 1.0, 'len': 4,
80// 'is_signed_var': False, 'physical_range': '[0|15]', 'bit': 19, 'type': 'int',
81// 'order': 'motorola', 'physical_unit': ''}
82int Componentrpt20::counter(const std::uint8_t* bytes, int32_t length) const {
83 Byte t0(bytes + 2);
84 int32_t x = t0.get_byte(0, 4);
85
86 int ret = x;
87 return ret;
88}
89
90// config detail: {'name': 'complement', 'offset': 0.0, 'precision': 1.0, 'len':
91// 4, 'is_signed_var': False, 'physical_range': '[0|15]', 'bit': 23, 'type':
92// 'int', 'order': 'motorola', 'physical_unit': ''}
93int Componentrpt20::complement(const std::uint8_t* bytes,
94 int32_t length) const {
95 Byte t0(bytes + 2);
96 int32_t x = t0.get_byte(4, 4);
97
98 int ret = x;
99 return ret;
100}
101
102// config detail: {'name': 'config_fault', 'offset': 0.0, 'precision': 1.0,
103// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 24,
104// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
105bool Componentrpt20::config_fault(const std::uint8_t* bytes,
106 int32_t length) const {
107 Byte t0(bytes + 3);
108 int32_t x = t0.get_byte(0, 1);
109
110 bool ret = x;
111 return ret;
112}
113} // namespace lexus
114} // namespace canbus
115} // 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