2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 /************************************************************************
18 @file DeadReckoning_Did_SpeedPulseScaleFactorLevel_dr.cpp
19 @detail DeadReckoning data Master(VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL)
20 *****************************************************************************/
22 #include <vehicle_service/positioning_base_library.h>
23 #include "DeadReckoning_DataMaster.h"
25 /*************************************************/
27 /*************************************************/
28 static DEADRECKONING_DATA_MASTER gst_speedpulsescalefactor_level; // NOLINT(readability/nolint)
30 /************************************************************************
31 @brief SpeedPulseScaleFactorLevel initialization function
32 @outline SpeedPulseScaleFactorLevel initialization process data master
33 @type Completion return type
39 **************************************************************************** */
40 void DeadReckoningInitSpeedPulseScaleFactorLevelDr(void) { // LCOV_EXCL_START 8: dead code.
41 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
42 (void)memset(reinterpret_cast<void *>(&gst_speedpulsescalefactor_level), 0x00,
43 sizeof(gst_speedpulsescalefactor_level));
44 gst_speedpulsescalefactor_level.ul_did = VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL;
45 gst_speedpulsescalefactor_level.us_size = VEHICLE_DSIZE_SPEED_PULSE_SCALE_FACTOR_LEVEL;
46 gst_speedpulsescalefactor_level.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
47 gst_speedpulsescalefactor_level.dr_status = 0U; /* Not used */
50 /************************************************************************
51 @brief SpeedPulseScaleFactorLevel SET function
52 @outline To update the master data SpeedPulseScaleFactorLevel
53 @type Completion return type
54 @param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to incoming message data
57 @retval DEADRECKONING_EQ : No data changes
58 @retval DEADRECKONING_NEQ : With data changes
60 *****************************************************************************/
61 u_int8 DeadReckoningSetSpeedPulseScaleFactorLevelDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
62 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
63 u_int8 uc_ret = DEADRECKONING_EQ;
64 DEADRECKONING_DATA_MASTER *p_st_master;
66 if (p_st_data == NULL) {
67 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
69 p_st_master = &gst_speedpulsescalefactor_level;
71 /** Compare data master and received data */
72 uc_ret = DeadReckoningMemcmp(reinterpret_cast<void *>(&(p_st_master->uc_data)),
73 (const void *)(&(p_st_data->uc_data)), (size_t)(p_st_data->us_size));
75 /** Received data is set in the data master. */
76 p_st_master->ul_did = p_st_data->ul_did;
77 p_st_master->us_size = p_st_data->us_size;
78 p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
79 p_st_master->dr_status = 0U; /* Not used */
81 (void)memcpy(reinterpret_cast<void *>(&(p_st_master->uc_data)),
82 (const void *)(&(p_st_data->uc_data)), sizeof(p_st_master->uc_data));
88 /************************************************************************
89 @brief SpeedPulseScaleFactorLevel GET function
90 @outline Master Data provides the SpeedPulseScaleFactorLevel
91 @type Completion return type
92 @param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
97 *****************************************************************************/
98 void DeadReckoningGetSpeedPulseScaleFactorLevelDr(DEADRECKONING_DATA_MASTER *p_st_data) {
99 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
100 const DEADRECKONING_DATA_MASTER *p_st_master;
102 if (p_st_data == NULL) {
103 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "p_st_data == NULL\r\n");
105 p_st_master = &gst_speedpulsescalefactor_level;
107 /** Store the data master in the specified destination. */
108 p_st_data->ul_did = p_st_master->ul_did;
109 p_st_data->us_size = p_st_master->us_size;
110 p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
111 p_st_data->dr_status = p_st_master->dr_status; /* Not used(Set DataMaster defaults) */
112 (void)memcpy(reinterpret_cast<void *>(&(p_st_data->uc_data)),
113 (const void *)(&(p_st_master->uc_data)), (size_t)p_st_master->us_size);