Apollo 10.0
自动驾驶开放平台
global_rpt_6a.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 gem {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Globalrpt6a::ID = 0x6A;
32
33void Globalrpt6a::Parse(const std::uint8_t* bytes, int32_t length,
34 Gem* chassis) const {
35 chassis->mutable_global_rpt_6a()->set_pacmod_status(
36 pacmod_status(bytes, length));
37 chassis->mutable_global_rpt_6a()->set_override_status(
38 override_status(bytes, length));
39 chassis->mutable_global_rpt_6a()->set_veh_can_timeout(
40 veh_can_timeout(bytes, length));
41 chassis->mutable_global_rpt_6a()->set_str_can_timeout(
42 str_can_timeout(bytes, length));
43 chassis->mutable_global_rpt_6a()->set_brk_can_timeout(
44 brk_can_timeout(bytes, length));
45 chassis->mutable_global_rpt_6a()->set_usr_can_timeout(
46 usr_can_timeout(bytes, length));
47 chassis->mutable_global_rpt_6a()->set_usr_can_read_errors(
48 usr_can_read_errors(bytes, length));
49}
50
51// config detail: {'name': 'pacmod_status', 'enum': {0:
52// 'PACMOD_STATUS_CONTROL_DISABLED', 1: 'PACMOD_STATUS_CONTROL_ENABLED'},
53// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'offset': 0.0,
54// 'physical_range': '[0|1]', 'bit': 0, 'type': 'enum', 'order': 'motorola',
55// 'physical_unit': ''}
56Global_rpt_6a::Pacmod_statusType Globalrpt6a::pacmod_status(
57 const std::uint8_t* bytes, int32_t length) const {
58 Byte t0(bytes + 0);
59 int32_t x = t0.get_byte(0, 1);
60
63 return ret;
64}
65
66// config detail: {'name': 'override_status', 'enum': {0:
67// 'OVERRIDE_STATUS_NOT_OVERRIDDEN', 1: 'OVERRIDE_STATUS_OVERRIDDEN'},
68// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'offset': 0.0,
69// 'physical_range': '[0|1]', 'bit': 1, 'type': 'enum', 'order': 'motorola',
70// 'physical_unit': ''}
71Global_rpt_6a::Override_statusType Globalrpt6a::override_status(
72 const std::uint8_t* bytes, int32_t length) const {
73 Byte t0(bytes + 0);
74 int32_t x = t0.get_byte(1, 1);
75
78 return ret;
79}
80
81// config detail: {'name': 'veh_can_timeout', 'offset': 0.0, 'precision': 1.0,
82// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
83// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
84bool Globalrpt6a::veh_can_timeout(const std::uint8_t* bytes,
85 int32_t length) const {
86 Byte t0(bytes + 0);
87 int32_t x = t0.get_byte(2, 1);
88
89 bool ret = x;
90 return ret;
91}
92
93// config detail: {'name': 'str_can_timeout', 'offset': 0.0, 'precision': 1.0,
94// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
95// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
96bool Globalrpt6a::str_can_timeout(const std::uint8_t* bytes,
97 int32_t length) const {
98 Byte t0(bytes + 0);
99 int32_t x = t0.get_byte(3, 1);
100
101 bool ret = x;
102 return ret;
103}
104
105// config detail: {'name': 'brk_can_timeout', 'enum': {0:
106// 'BRK_CAN_TIMEOUT_NO_ACTIVE_CAN_TIMEOUT', 1:
107// 'BRK_CAN_TIMEOUT_ACTIVE_CAN_TIMEOUT'}, 'precision': 1.0, 'len': 1,
108// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 4,
109// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
110Global_rpt_6a::Brk_can_timeoutType Globalrpt6a::brk_can_timeout(
111 const std::uint8_t* bytes, int32_t length) const {
112 Byte t0(bytes + 0);
113 int32_t x = t0.get_byte(4, 1);
114
117 return ret;
118}
119
120// config detail: {'name': 'usr_can_timeout', 'offset': 0.0, 'precision': 1.0,
121// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
122// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
123bool Globalrpt6a::usr_can_timeout(const std::uint8_t* bytes,
124 int32_t length) const {
125 Byte t0(bytes + 0);
126 int32_t x = t0.get_byte(5, 1);
127
128 bool ret = x;
129 return ret;
130}
131
132// config detail: {'name': 'usr_can_read_errors', 'offset': 0.0,
133// 'precision': 1.0, 'len': 16, 'is_signed_var': False, 'physical_range':
134// '[0|65535]', 'bit': 55, 'type': 'int', 'order': 'motorola', 'physical_unit':
135// ''}
136int Globalrpt6a::usr_can_read_errors(const std::uint8_t* bytes,
137 int32_t length) const {
138 Byte t0(bytes + 6);
139 int32_t x = t0.get_byte(0, 8);
140
141 Byte t1(bytes + 7);
142 int32_t t = t1.get_byte(0, 8);
143 x <<= 8;
144 x |= t;
145
146 int ret = x;
147 return ret;
148}
149} // namespace gem
150} // namespace canbus
151} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Gem *chassis) const override
class register implement
Definition arena_queue.h:37