Apollo
10.0
自动驾驶开放平台
ads_req_vin_390.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/wey/protocol/ads_req_vin_390.h
"
18
19
#include "
modules/drivers/canbus/common/byte.h
"
20
21
namespace
apollo
{
22
namespace
canbus {
23
namespace
wey {
24
25
using ::apollo::drivers::canbus::Byte;
26
27
const
int32_t
Adsreqvin390::ID
= 0x390;
28
29
// public
30
Adsreqvin390::Adsreqvin390
() {
Reset
(); }
31
32
uint32_t
Adsreqvin390::GetPeriod
()
const
{
33
// TODO(ChaoMa) :modify every protocol's period manually
34
static
const
uint32_t PERIOD = 20 * 1000;
35
return
PERIOD;
36
}
37
38
void
Adsreqvin390::UpdateData
(uint8_t* data) {
39
set_p_req_vin_signal(data, req_vin_signal_);
40
}
41
42
void
Adsreqvin390::Reset
() {
43
// TODO(ChaoMa) :you should check this manually
44
req_vin_signal_ =
Ads_req_vin_390::REQ_VIN_SIGNAL_NO_REQUEST
;
45
}
46
47
Adsreqvin390
*
Adsreqvin390::set_req_vin_signal
(
48
Ads_req_vin_390::Req_vin_signalType
req_vin_signal) {
49
req_vin_signal_ = req_vin_signal;
50
return
this
;
51
}
52
53
// config detail: {'name': 'Req_VIN_Signal', 'enum': {
54
// 0: 'REQ_VIN_SIGNAL_NO_REQUEST', 1: 'REQ_VIN_SIGNAL_REQUEST'},
55
// 'precision': 1.0, 'len': 8, 'is_signed_var': False,
56
// 'offset': 0.0, 'physical_range': '[0|255]', 'bit': 7,
57
// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
58
void
Adsreqvin390::set_p_req_vin_signal(
59
uint8_t* data,
Ads_req_vin_390::Req_vin_signalType
req_vin_signal) {
60
int
x = req_vin_signal;
61
62
Byte to_set(data + 0);
63
to_set.set_value(
static_cast<
uint8_t
>
(x), 0, 8);
64
}
65
66
}
// namespace wey
67
}
// namespace canbus
68
}
// namespace apollo
ads_req_vin_390.h
byte.h
Defines the Byte class.
apollo::canbus::wey::Adsreqvin390
Definition
ads_req_vin_390.h:27
apollo::canbus::wey::Adsreqvin390::ID
static const int32_t ID
Definition
ads_req_vin_390.h:29
apollo::canbus::wey::Adsreqvin390::GetPeriod
uint32_t GetPeriod() const override
Definition
ads_req_vin_390.cc:32
apollo::canbus::wey::Adsreqvin390::Adsreqvin390
Adsreqvin390()
Definition
ads_req_vin_390.cc:30
apollo::canbus::wey::Adsreqvin390::set_req_vin_signal
Adsreqvin390 * set_req_vin_signal(Ads_req_vin_390::Req_vin_signalType req_vin_signal)
Definition
ads_req_vin_390.cc:47
apollo::canbus::wey::Adsreqvin390::Reset
void Reset() override
Definition
ads_req_vin_390.cc:42
apollo::canbus::wey::Adsreqvin390::UpdateData
void UpdateData(uint8_t *data) override
Definition
ads_req_vin_390.cc:38
apollo
class register implement
Definition
arena_queue.h:37
apollo::canbus::Ads_req_vin_390::Req_vin_signalType
Req_vin_signalType
Definition
wey.proto:305
apollo::canbus::Ads_req_vin_390::REQ_VIN_SIGNAL_NO_REQUEST
@ REQ_VIN_SIGNAL_NO_REQUEST
Definition
wey.proto:306
modules
canbus_vehicle
wey
protocol
ads_req_vin_390.cc