Remove unused directories and files in video_in_hal
[staging/basesystem.git] / service / vehicle / positioning / server / src / Sensor / VehicleSens_Did_NaviinfoDiagGPS_g.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       VehicleSens_Did_NaviinfoDiagGPS_g.cpp
19 @detail     Management of GPS Information Master for Diag
20 ******************************************************************************/
21 #include <vehicle_service/positioning_base_library.h>
22 #include "VehicleSens_DataMaster.h"
23
24 /*************************************************
25  *           Global variable                      *
26  *************************************************/
27 static  VEHICLESENS_DATA_MASTER_GPS_FORMAT  gstNaviinfoDiagGPS_g;    // NOLINT(readability/nolint)
28
29 /****************************************************************************
30 @brief      VehicleSensInitNaviinfoDiagGPSg<BR>
31             Initialization of GPS Data Master for Diag
32 @outline    Initializing GPS Data Master for Diag
33 @param[in]  none
34 @param[out] none
35 @return     none
36 @retval     none
37 *******************************************************************************/
38 void VehicleSensInitNaviinfoDiagGPSg(void) {
39     memset(&gstNaviinfoDiagGPS_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
40
41     /** Data ID setting */
42     gstNaviinfoDiagGPS_g.ul_did    = VEHICLE_DID_NAVIINFO_DIAG_GPS;
43     /** Data size setting */
44     gstNaviinfoDiagGPS_g.us_size    = sizeof(NAVIINFO_DIAG_GPS);
45 }
46
47 /****************************************************************************
48 @brief      VehicleSensSetNaviinfoDiagGPSg<BR>
49             GPS Information Master SET Processing for Diag
50 @outline    Update the GPS Data Master for Diag
51 @param[in]  NAVIINFO_DIAG_GPS*  pst_diag_data     : GPS information for Diag
52 @param[out] none
53 @return     u_int8
54 @retval     VEHICLESENS_EQ  : No data change
55 @retval     VEHICLESENS_NEQ : Data change
56 *******************************************************************************/
57 u_int8 VehicleSensSetNaviinfoDiagGPSg(const NAVIINFO_DIAG_GPS *pst_diag_data) {
58     u_int8  uc_ret;
59     VEHICLESENS_DATA_MASTER_GPS_FORMAT  *pst_master;
60
61     pst_master = &gstNaviinfoDiagGPS_g;
62
63     /** With the contents of the current data master,Compare received data */
64     uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_diag_data, sizeof(NAVIINFO_DIAG_GPS));
65
66     /** Received data is set in the data master. */
67     pst_master->ul_did    = VEHICLE_DID_NAVIINFO_DIAG_GPS;
68     pst_master->us_size    = sizeof(NAVIINFO_DIAG_GPS);
69     pst_master->uc_rcvflag  = VEHICLE_RCVFLAG_ON;
70     memcpy(pst_master->uc_data, pst_diag_data, sizeof(NAVIINFO_DIAG_GPS));
71
72     return(uc_ret);
73 }
74
75 /****************************************************************************
76 @brief      VehicleSensGetNaviinfoDiagGPSg<BR>
77             GPS Information Master GET Processing for Diag
78 @outline    Provide a master GPS information for Diag
79 @param[in]  none
80 @param[out] SENSOR_MSG_GPSDATA_DAT *pst_data : Pointer to the data master acquisition destination
81 @return     none
82 @retval     none
83 *******************************************************************************/
84 void VehicleSensGetNaviinfoDiagGPSg(SENSOR_MSG_GPSDATA_DAT *pst_data) {
85     const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
86
87     pst_master = reinterpret_cast<VEHICLESENS_DATA_MASTER_GPS_FORMAT*>(&gstNaviinfoDiagGPS_g);
88
89     /* Store the data master in the specified destination. */
90     pst_data->ul_did    = pst_master->ul_did;
91     pst_data->us_size    = pst_master->us_size;
92     pst_data->uc_rcv_flag  = pst_master->uc_rcvflag;
93     memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);  /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
94 }