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_Altitude.cpp
19 @detail DeadReckoning data Master(VEHICLE_DID_DR_ALTITUDE)<BR>
20 DeadReckoning data master(VEHICLE_DID_DR_ALTITUDE)
21 *****************************************************************************/
23 #include <vehicle_service/positioning_base_library.h>
24 #include "DeadReckoning_DataMaster.h"
26 /*************************************************/
28 /*************************************************/
29 static DEADRECKONING_DATA_MASTER gst_altitude; // NOLINT(readability/nolint)
31 /************************************************************************
32 @brief Altitude Dead Reckoning initialization function
33 @outline Altitude initialization process data master
34 @type Completion return type
40 **************************************************************************** */
41 void DeadReckoningInitAltitudeDr(void) { // LCOV_EXCL_START 8: dead code.
42 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
43 memset(&(gst_altitude), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
44 gst_altitude.ul_did = VEHICLE_DID_DR_ALTITUDE;
45 gst_altitude.us_size = VEHICLE_DSIZE_ALTITUDE;
46 gst_altitude.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
47 gst_altitude.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
48 gst_altitude.uc_data[0] = VEHICLE_DINIT_ALTITUDE;
51 /***********************************************************************
52 @brief Altitude Dead Reckoning SET function
53 @outline To update the master data Altitude.
54 @type Completion return type
55 @param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
58 @retval DEADRECKONING_EQ : No data changes
59 @retval DEADRECKONING_NEQ : With data changes
61 *****************************************************************************/
62 u_int8 DeadReckoningSetAltitudeDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
63 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
65 DEADRECKONING_DATA_MASTER *p_st_master;
67 p_st_master = &gst_altitude;
69 /** Compare data master and received data */
70 uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
72 /** Received data is set in the data master. */
73 p_st_master->ul_did = p_st_data->ul_did;
74 p_st_master->us_size = p_st_data->us_size;
75 p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
76 p_st_master->dr_status = p_st_data->dr_status;
78 memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
83 /************************************************************************
84 @brief Altitude Dead Reckoning GET function
85 @outline Master Data provides the Altitude
86 @type Completion return type
87 @param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
92 *****************************************************************************/
93 void DeadReckoningGetAltitudeDr(DEADRECKONING_DATA_MASTER *p_st_data) {
94 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
95 const DEADRECKONING_DATA_MASTER *p_st_master;
97 p_st_master = &gst_altitude;
99 /** Store the data master in the specified destination. */
100 p_st_data->ul_did = p_st_master->ul_did;
101 p_st_data->us_size = p_st_master->us_size;
102 p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
103 p_st_data->dr_status = p_st_master->dr_status;
104 memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);