Apollo 10.0
自动驾驶开放平台
software_version_700.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2021 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 nano_radar {
27
29
31const uint32_t SoftwareVersion700::ID = 0x700;
32
33void SoftwareVersion700::Parse(const std::uint8_t* bytes, int32_t length,
34 NanoRadar* nano_radar) const {
35 auto version = nano_radar->mutable_software_version();
36 version->set_soft_major_release(soft_major_release(bytes, length));
37 version->set_soft_minor_release(soft_minor_release(bytes, length));
38 version->set_soft_patch_level(soft_patch_level(bytes, length));
39}
40
41int SoftwareVersion700::soft_major_release(const std::uint8_t* bytes,
42 int32_t length) const {
43 Byte t0(bytes);
44 uint32_t x = t0.get_byte(0, 8);
45
46 int ret = x;
47 return ret;
48}
49
50int SoftwareVersion700::soft_minor_release(const std::uint8_t* bytes,
51 int32_t length) const {
52 Byte t0(bytes + 1);
53 uint32_t x = t0.get_byte(0, 8);
54
55 int ret = x;
56 return ret;
57}
58
59int SoftwareVersion700::soft_patch_level(const std::uint8_t* bytes,
60 int32_t length) const {
61 Byte t0(bytes + 2);
62 uint32_t x = t0.get_byte(0, 8);
63
64 int ret = x;
65 return ret;
66}
67
68} // namespace nano_radar
69} // namespace drivers
70} // 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, NanoRadar *nano_radar) const override
class register implement
Definition arena_queue.h:37