Apollo 10.0
自动驾驶开放平台
fail_241.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 "glog/logging.h"
20
23
24namespace apollo {
25namespace canbus {
26namespace wey {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Fail241::ID = 0x241;
32
33void Fail241::Parse(const std::uint8_t* bytes, int32_t length,
34 Wey* chassis) const {
35 chassis->mutable_fail_241()->set_engfail(
36 engfail(bytes, length));
37 chassis->mutable_fail_241()->set_espfail(
38 espfail(bytes, length));
39 chassis->mutable_fail_241()->set_epbfail(
40 epbfail(bytes, length));
41 chassis->mutable_fail_241()->set_shiftfail(
42 shiftfail(bytes, length));
43 chassis->mutable_fail_241()->set_epsfail(
44 epsfail(bytes, length));
45}
46
47// config detail: {'description': 'Engine Fail status', 'enum': {0:
48// 'ENGFAIL_NO_FAIL', 1: 'ENGFAIL_FAIL'}, 'precision': 1.0, 'len': 1, 'name':
49// 'engfail', 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]',
50// 'bit': 7, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
51Fail_241::EngfailType Fail241::engfail(const std::uint8_t* bytes,
52 int32_t length) const {
53 Byte t0(bytes + 0);
54 int32_t x = t0.get_byte(7, 1);
55
56 Fail_241::EngfailType ret = static_cast<Fail_241::EngfailType>(x);
57 return ret;
58}
59
60// config detail: {'description': 'ESP fault', 'enum': {0:'ESPFAIL_NO_FAILURE',
61// 1: 'ESPFAIL_FAILURE'}, 'precision': 1.0, 'len': 1, 'name': 'espfail',
62// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 14,
63// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
64Fail_241::EspfailType Fail241::espfail(const std::uint8_t* bytes,
65 int32_t length) const {
66 Byte t0(bytes + 1);
67 int32_t x = t0.get_byte(6, 1);
68
69 Fail_241::EspfailType ret = static_cast<Fail_241::EspfailType>(x);
70 return ret;
71}
72
73// config detail: {'description': 'error indication of EPB system', 'enum': {0:
74// 'EPBFAIL_UNDEFINED', 1: 'EPBFAIL_NO_ERROR', 2: 'EPBFAIL_ERROR', 3:
75// 'EPBFAIL_DIAGNOSIS'}, 'precision': 1.0, 'len': 2, 'name': 'epbfail',
76// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 35,
77// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
78Fail_241::EpbfailType Fail241::epbfail(const std::uint8_t* bytes,
79 int32_t length) const {
80 Byte t0(bytes + 4);
81 int32_t x = t0.get_byte(2, 2);
82
83 Fail_241::EpbfailType ret = static_cast<Fail_241::EpbfailType>(x);
84 return ret;
85}
86
87// config detail: {'description': 'Driver display failure messages', 'enum': {0:
88// 'SHIFTFAIL_NO_FAIL', 1: 'SHIFTFAIL_TRANSMISSION_MALFUNCTION', 2:
89// 'SHIFTFAIL_TRANSMISSION_P_ENGAGEMENT_FAULT', 3:
90// 'SHIFTFAIL_TRANSMISSION_P_DISENGAGEMENT_FAULT', 4: 'SHIFTFAIL_RESERVED',
91// 15: 'SHIFTFAIL_TRANSMISSION_LIMIT_FUNCTION'}, 'precision': 1.0, 'len': 4,
92// 'name': 'shiftfail', 'is_signed_var': False, 'offset': 0.0,
93// 'physical_range': '[0|15]', 'bit': 31, 'type': 'enum', 'order': 'motorola',
94// 'physical_unit': ''}
95Fail_241::ShiftfailType Fail241::shiftfail(const std::uint8_t* bytes,
96 int32_t length) const {
97 Byte t0(bytes + 3);
98 int32_t x = t0.get_byte(4, 4);
99
101 return ret;
102}
103
104// config detail: {'description': 'Electrical steering fail status', 'enum':
105// {0: 'EPSFAIL_NO_FAULT', 1: 'EPSFAIL_FAULT'}, 'precision': 1.0, 'len': 1,
106// 'name': 'epsfail', 'is_signed_var': False, 'offset': 0.0,
107// 'physical_range': '[0|1]', 'bit': 21, 'type': 'enum', 'order': 'motorola',
108// 'physical_unit': ''}
109Fail_241::EpsfailType Fail241::epsfail(const std::uint8_t* bytes,
110 int32_t length) const {
111 Byte t0(bytes + 2);
112 int32_t x = t0.get_byte(5, 1);
113
114 Fail_241::EpsfailType ret = static_cast<Fail_241::EpsfailType>(x);
115 return ret;
116}
117} // namespace wey
118} // namespace canbus
119} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Wey *chassis) const override
Definition fail_241.cc:33
static const int32_t ID
Definition fail_241.h:29
class register implement
Definition arena_queue.h:37