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_Latitude.cpp
19 @detail DeadReckoning data Master(VEHICLE_DID_DR_LATITUDE)
20 *****************************************************************************/
22 #include <vehicle_service/positioning_base_library.h>
23 #include "DeadReckoning_DataMaster.h"
25 /*************************************************/
27 /*************************************************/
28 static DEADRECKONING_DATA_MASTER gst_latitude; // NOLINT(readability/nolint)
30 /***********************************************************************
31 @brief Latitude Dead Reckoning initialization function
32 @outline Latitude initialization process data master
33 @type Completion return type
39 **************************************************************************** */
40 void DeadReckoningInitLatitudeDr(void) { // LCOV_EXCL_START 8: dead code.
41 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
42 memset(&(gst_latitude), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
43 gst_latitude.ul_did = VEHICLE_DID_DR_LATITUDE;
44 gst_latitude.us_size = VEHICLE_DSIZE_LATITUDE;
45 gst_latitude.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
46 gst_latitude.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
47 gst_latitude.uc_data[0] = VEHICLE_DINIT_LATITUDE;
50 /************************************************************************
51 @brief Latitude Dead Reckoning SET function
52 @outline To update the master data Latitude.
53 @type Completion return type
54 @param[in] DEADRECKONING_DATA_MASTER *p_st_data : The pointer to GPS incoming message data
57 @retval DEADRECKONING_EQ : No data changes
58 @retval DEADRECKONING_NEQ : With data changes
60 *****************************************************************************/
61 u_int8 DeadReckoningSetLatitudeDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
62 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
64 DEADRECKONING_DATA_MASTER *p_st_master;
66 p_st_master = &gst_latitude;
68 /** Compare data master and received data */
69 uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
71 /** Received data is set in the data master. */
72 p_st_master->ul_did = p_st_data->ul_did;
73 p_st_master->us_size = p_st_data->us_size;
74 p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
75 p_st_master->dr_status = p_st_data->dr_status;
77 memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
82 /************************************************************************
83 @brief Latitude Dead Reckoning GET function
84 @outline Master Data provides the Latitude
85 @type Completion return type
86 @param[in] DEADRECKONING_DATA_MASTER *p_st_data : Where to get a pointer to the data master
91 *****************************************************************************/
92 void DeadReckoningGetLatitudeDr(DEADRECKONING_DATA_MASTER *p_st_data) {
93 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
94 const DEADRECKONING_DATA_MASTER *p_st_master;
96 p_st_master = &gst_latitude;
98 /** Store the data master in the specified destination. */
99 p_st_data->ul_did = p_st_master->ul_did;
100 p_st_data->us_size = p_st_master->us_size;
101 p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
102 p_st_data->dr_status = p_st_master->dr_status;
103 memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);