Apollo 10.0
自动驾驶开放平台
global_cmd_69.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
20
21namespace apollo {
22namespace canbus {
23namespace gem {
24
25using ::apollo::drivers::canbus::Byte;
26
27const int32_t Globalcmd69::ID = 0x69;
28
29// public
31
32uint32_t Globalcmd69::GetPeriod() const {
33 // TODO(QiL) :modify every protocol's period manually
34 static const uint32_t PERIOD = 20 * 1000;
35 return PERIOD;
36}
37
38void Globalcmd69::UpdateData(uint8_t* data) {
39 set_p_pacmod_enable(data, pacmod_enable_);
40 set_p_clear_override(data, clear_override_);
41 set_p_ignore_override(data, ignore_override_);
42}
43
45 // TODO(QiL) :you should check this manually
49}
50
53 pacmod_enable_ = pacmod_enable;
54 return this;
55}
56
57// config detail: {'name': 'PACMOD_ENABLE', 'enum': {0:
58// 'PACMOD_ENABLE_CONTROL_DISABLED', 1: 'PACMOD_ENABLE_CONTROL_ENABLED'},
59// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'offset': 0.0,
60// 'physical_range': '[0|1]', 'bit': 0, 'type': 'enum', 'order': 'motorola',
61// 'physical_unit': ''}
62void Globalcmd69::set_p_pacmod_enable(
63 uint8_t* data, Global_cmd_69::Pacmod_enableType pacmod_enable) {
64 uint8_t x = pacmod_enable;
65
66 Byte to_set(data + 0);
67 to_set.set_value(static_cast<uint8_t>(x), 0, 1);
68}
69
71 Global_cmd_69::Clear_overrideType clear_override) {
72 clear_override_ = clear_override;
73 return this;
74}
75
76// config detail: {'name': 'CLEAR_OVERRIDE', 'enum': {0:
77// 'CLEAR_OVERRIDE_DON_T_CLEAR_ACTIVE_OVERRIDES', 1:
78// 'CLEAR_OVERRIDE_CLEAR_ACTIVE_OVERRIDES'}, 'precision': 1.0, 'len': 1,
79// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 1,
80// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
81void Globalcmd69::set_p_clear_override(
82 uint8_t* data, Global_cmd_69::Clear_overrideType clear_override) {
83 uint8_t x = clear_override;
84
85 Byte to_set(data + 0);
86 to_set.set_value(static_cast<uint8_t>(x), 1, 1);
87}
88
90 Global_cmd_69::Ignore_overrideType ignore_override) {
91 ignore_override_ = ignore_override;
92 return this;
93}
94
95// config detail: {'name': 'IGNORE_OVERRIDE', 'enum': {0:
96// 'IGNORE_OVERRIDE_DON_T_IGNORE_USER_OVERRIDES', 1:
97// 'IGNORE_OVERRIDE_IGNORE_USER_OVERRIDES'}, 'precision': 1.0, 'len': 1,
98// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 2,
99// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
100void Globalcmd69::set_p_ignore_override(
101 uint8_t* data, Global_cmd_69::Ignore_overrideType ignore_override) {
102 uint8_t x = ignore_override;
103
104 Byte to_set(data + 0);
105 to_set.set_value(static_cast<uint8_t>(x), 2, 1);
106}
107
108} // namespace gem
109} // namespace canbus
110} // namespace apollo
Defines the Byte class.
uint32_t GetPeriod() const override
Globalcmd69 * set_pacmod_enable(Global_cmd_69::Pacmod_enableType pacmod_enable)
void UpdateData(uint8_t *data) override
Globalcmd69 * set_ignore_override(Global_cmd_69::Ignore_overrideType ignore_override)
Globalcmd69 * set_clear_override(Global_cmd_69::Clear_overrideType clear_override)
class register implement
Definition arena_queue.h:37