Apollo
10.0
自动驾驶开放平台
vehicle_mode_command_116.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
17
#include "
modules/canbus_vehicle/ch/protocol/vehicle_mode_command_116.h
"
18
19
#include "
modules/drivers/canbus/common/byte.h
"
20
21
namespace
apollo
{
22
namespace
canbus {
23
namespace
ch {
24
25
using ::apollo::drivers::canbus::Byte;
26
27
const
int32_t
Vehiclemodecommand116::ID
= 0x116;
28
29
// public
30
Vehiclemodecommand116::Vehiclemodecommand116
() {
Reset
(); }
31
32
uint32_t
Vehiclemodecommand116::GetPeriod
()
const
{
33
// TODO(All) : modify every protocol's period manually
34
static
const
uint32_t PERIOD = 500 * 1000;
35
return
PERIOD;
36
}
37
38
void
Vehiclemodecommand116::UpdateData
(uint8_t* data) {
39
set_p_vin_req_cmd(data, vin_req_cmd_);
40
}
41
42
void
Vehiclemodecommand116::Reset
() {
43
// TODO(All) : you should check this manually
44
vin_req_cmd_ =
Vehicle_mode_command_116::VIN_REQ_CMD_VIN_REQ_DISABLE
;
45
}
46
47
Vehiclemodecommand116
*
Vehiclemodecommand116::set_vin_req_cmd
(
48
Vehicle_mode_command_116::Vin_req_cmdType
vin_req_cmd) {
49
vin_req_cmd_ = vin_req_cmd;
50
return
this
;
51
}
52
53
// config detail: {'bit': 0, 'description': 'Request VIN(Command)', 'enum': {0:
54
// 'VIN_REQ_CMD_VIN_REQ_DISABLE', 1: 'VIN_REQ_CMD_VIN_REQ_ENABLE'},
55
// 'is_signed_var': False, 'len': 1, 'name': 'VIN_REQ_CMD', 'offset': 0.0,
56
// 'order': 'intel', 'physical_range': '[0|1]', 'physical_unit': '',
57
// 'precision': 1.0, 'type': 'enum'}
58
void
Vehiclemodecommand116::set_p_vin_req_cmd(
59
uint8_t* data,
Vehicle_mode_command_116::Vin_req_cmdType
vin_req_cmd) {
60
int
x = vin_req_cmd;
61
62
Byte to_set(data + 0);
63
to_set.set_value(
static_cast<
uint8_t
>
(x), 0, 1);
64
}
65
66
}
// namespace ch
67
}
// namespace canbus
68
}
// namespace apollo
byte.h
Defines the Byte class.
apollo::canbus::ch::Vehiclemodecommand116
Definition
vehicle_mode_command_116.h:27
apollo::canbus::ch::Vehiclemodecommand116::ID
static const int32_t ID
Definition
vehicle_mode_command_116.h:29
apollo::canbus::ch::Vehiclemodecommand116::Vehiclemodecommand116
Vehiclemodecommand116()
Definition
vehicle_mode_command_116.cc:30
apollo::canbus::ch::Vehiclemodecommand116::UpdateData
void UpdateData(uint8_t *data) override
Definition
vehicle_mode_command_116.cc:38
apollo::canbus::ch::Vehiclemodecommand116::set_vin_req_cmd
Vehiclemodecommand116 * set_vin_req_cmd(Vehicle_mode_command_116::Vin_req_cmdType vin_req_cmd)
Definition
vehicle_mode_command_116.cc:47
apollo::canbus::ch::Vehiclemodecommand116::GetPeriod
uint32_t GetPeriod() const override
Definition
vehicle_mode_command_116.cc:32
apollo::canbus::ch::Vehiclemodecommand116::Reset
void Reset() override
Definition
vehicle_mode_command_116.cc:42
apollo
class register implement
Definition
arena_queue.h:37
apollo::canbus::Vehicle_mode_command_116::Vin_req_cmdType
Vin_req_cmdType
Definition
ch.proto:84
apollo::canbus::Vehicle_mode_command_116::VIN_REQ_CMD_VIN_REQ_DISABLE
@ VIN_REQ_CMD_VIN_REQ_DISABLE
Definition
ch.proto:85
vehicle_mode_command_116.h
modules
canbus_vehicle
ch
protocol
vehicle_mode_command_116.cc