Apollo 10.0
自动驾驶开放平台
media_controls_cmd_120.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 lexus {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Mediacontrolscmd120::ID = 0x120;
32
33void Mediacontrolscmd120::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_media_controls_cmd_120()->set_media_controls_cmd(
36 media_controls_cmd(bytes, length));
37 chassis->mutable_media_controls_cmd_120()->set_ignore_overrides(
38 ignore_overrides(bytes, length));
39 chassis->mutable_media_controls_cmd_120()->set_clear_override(
40 clear_override(bytes, length));
41 chassis->mutable_media_controls_cmd_120()->set_clear_faults(
42 clear_faults(bytes, length));
43 chassis->mutable_media_controls_cmd_120()->set_enable(
44 enable(bytes, length));
45}
46
47// config detail: {'name': 'media_controls_cmd', 'enum': {0:
48// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_NONE', 1:
49// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOICE_COMMAND', 2:
50// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_MUTE', 3:
51// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_PREV_TRACK_ANSWER', 4:
52// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_NEXT_TRACK_HANG_UP', 5:
53// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOL_UP', 6:
54// 'MEDIA_CONTROLS_CMD_MEDIA_CONTROL_VOL_DOWN'}, 'precision': 1.0, 'len': 8,
55// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
56// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
58Mediacontrolscmd120::media_controls_cmd(const std::uint8_t* bytes,
59 int32_t length) const {
60 Byte t0(bytes + 1);
61 int32_t x = t0.get_byte(0, 8);
62
65 return ret;
66}
67
68// config detail: {'name': 'ignore_overrides', 'offset': 0.0, 'precision': 1.0,
69// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
70// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
71bool Mediacontrolscmd120::ignore_overrides(const std::uint8_t* bytes,
72 int32_t length) const {
73 Byte t0(bytes + 0);
74 int32_t x = t0.get_byte(1, 1);
75
76 bool ret = x;
77 return ret;
78}
79
80// config detail: {'name': 'clear_override', 'offset': 0.0, 'precision': 1.0,
81// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
82// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
83bool Mediacontrolscmd120::clear_override(const std::uint8_t* bytes,
84 int32_t length) const {
85 Byte t0(bytes + 0);
86 int32_t x = t0.get_byte(2, 1);
87
88 bool ret = x;
89 return ret;
90}
91
92// config detail: {'name': 'clear_faults', 'offset': 0.0, 'precision': 1.0,
93// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
94// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
95bool Mediacontrolscmd120::clear_faults(const std::uint8_t* bytes,
96 int32_t length) const {
97 Byte t0(bytes + 0);
98 int32_t x = t0.get_byte(3, 1);
99
100 bool ret = x;
101 return ret;
102}
103
104// config detail: {'name': 'enable', 'offset': 0.0, 'precision': 1.0, 'len': 1,
105// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
106// 'order': 'motorola', 'physical_unit': ''}
107bool Mediacontrolscmd120::enable(const std::uint8_t* bytes,
108 int32_t length) const {
109 Byte t0(bytes + 0);
110 int32_t x = t0.get_byte(0, 1);
111
112 bool ret = x;
113 return ret;
114}
115} // namespace lexus
116} // namespace canbus
117} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Lexus *chassis) const override
class register implement
Definition arena_queue.h:37