Remove unused directories and files in video_in_hal
[staging/basesystem.git] / vehicleservice / positioning / server / src / Sensor / DeadReckoning_Did_Longitude_dr.cpp
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
17 /************************************************************************
18 @file      DeadReckoning_Did_Longitude.cpp
19 @detail      DeadReckoning data Master(VEHICLE_DID_DR_LONGITUDE)
20 *****************************************************************************/
21
22 #include <vehicle_service/positioning_base_library.h>
23 #include "DeadReckoning_DataMaster.h"
24
25 /*************************************************/
26 /*           Global variable                      */
27 /*************************************************/
28 static  DEADRECKONING_DATA_MASTER  gst_longitude;    // NOLINT(readability/nolint)
29
30 /***********************************************************************
31 @brief      Longitude Dead Reckoning initialization function
32 @outline    Longitude initialization process data master
33 @type      Completion return type
34 @param[in]    none
35 @threshold    none
36 @return      void
37 @retval      none
38 @trace
39 **************************************************************************** */
40 void DeadReckoningInitLongitudeDr(void) {  // LCOV_EXCL_START 8: dead code.
41     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
42     memset(&(gst_longitude), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
43     gst_longitude.ul_did    = VEHICLE_DID_DR_LONGITUDE;
44     gst_longitude.us_size    = VEHICLE_DSIZE_LONGITUDE;
45     gst_longitude.uc_rcv_flag  = DEADRECKONING_RCVFLAG_OFF;
46     gst_longitude.dr_status  = SENSORLOCATION_DRSTATUS_INVALID;
47     gst_longitude.uc_data[0]  = VEHICLE_DINIT_LONGITUDE;
48 }
49
50 /************************************************************************
51 @brief      Longitude Dead Reckoning SET function
52 @outline    To update the master data Longitude.
53 @type      Completion return type
54 @param[in]    DEADRECKONING_DATA_MASTER *p_st_data  :  The pointer to GPS incoming message data
55 @threshold    none
56 @return      u_int8
57 @retval      DEADRECKONING_EQ  :   No data changes
58 @retval      DEADRECKONING_NEQ  :   With data changes
59 @trace
60 *****************************************************************************/
61 u_int8 DeadReckoningSetLongitudeDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
62     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
63     u_int8 uc_ret;
64     DEADRECKONING_DATA_MASTER *p_st_master;
65
66     p_st_master = &gst_longitude;
67
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);
70
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;
76
77     memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
78
79     return (uc_ret);
80 }
81
82 /************************************************************************
83 @brief      Longitude Dead Reckoning GET function
84 @outline    Master Data provides the Longitude
85 @type      Completion return type
86 @param[in]    DEADRECKONING_DATA_MASTER *p_st_data  :  Where to get a pointer to the data master
87 @threshold    none
88 @return      void
89 @retval      none
90 @trace
91 *****************************************************************************/
92 void DeadReckoningGetLongitudeDr(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;
95
96     p_st_master = &gst_longitude;
97
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);
104 }
105 // LCOV_EXCL_STOP