Apollo 10.0
自动驾驶开放平台
cluster_list_status_600.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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 drivers {
26namespace conti_radar {
27
30
32const uint32_t ClusterListStatus600::ID = 0x600;
33
34void ClusterListStatus600::Parse(const std::uint8_t* bytes, int32_t length,
35 ContiRadar* conti_radar) const {
36 auto status = conti_radar->mutable_cluster_list_status();
37 status->set_near(near(bytes, length));
38 status->set_far(far(bytes, length));
39 status->set_meas_counter(meas_counter(bytes, length));
40 status->set_interface_version(interface_version(bytes, length));
41 auto counter = status->near() + status->far();
42 conti_radar->mutable_contiobs()->Reserve(counter);
43}
44
45int ClusterListStatus600::near(const std::uint8_t* bytes,
46 int32_t length) const {
47 Byte t0(bytes);
48 int32_t x = t0.get_byte(0, 8);
49
50 int ret = x;
51 return ret;
52}
53
54int ClusterListStatus600::far(const std::uint8_t* bytes, int32_t length) const {
55 Byte t0(bytes + 1);
56 int32_t x = t0.get_byte(0, 8);
57
58 int ret = x;
59 return ret;
60}
61
62int ClusterListStatus600::meas_counter(const std::uint8_t* bytes,
63 int32_t length) const {
64 Byte t0(bytes + 2);
65 int32_t x = t0.get_byte(0, 8);
66
67 Byte t1(bytes + 3);
68 uint32_t t = t0.get_byte(0, 8);
69 x <<= 8;
70 x |= t;
71
72 int ret = x;
73 return ret;
74}
75
76int ClusterListStatus600::interface_version(const std::uint8_t* bytes,
77 int32_t length) const {
78 Byte t0(bytes + 4);
79 int32_t x = t0.get_byte(4, 4);
80
81 int ret = x;
82 return ret;
83}
84
85} // namespace conti_radar
86} // namespace drivers
87} // namespace apollo
Defines the Byte class.
The class of one byte, which is 8 bits.
Definition byte.h:39
void Parse(const std::uint8_t *bytes, int32_t length, ContiRadar *conti_radar) const override
class register implement
Definition arena_queue.h:37