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 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"
24 /*************************************************
26 *************************************************/
27 static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstNaviinfoDiagGPS_g; // NOLINT(readability/nolint)
29 /****************************************************************************
30 @brief VehicleSensInitNaviinfoDiagGPSg<BR>
31 Initialization of GPS Data Master for Diag
32 @outline Initializing GPS Data Master for Diag
37 *******************************************************************************/
38 void VehicleSensInitNaviinfoDiagGPSg(void) {
39 memset(&gstNaviinfoDiagGPS_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
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);
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
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) {
59 VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
61 pst_master = &gstNaviinfoDiagGPS_g;
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));
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));
75 /****************************************************************************
76 @brief VehicleSensGetNaviinfoDiagGPSg<BR>
77 GPS Information Master GET Processing for Diag
78 @outline Provide a master GPS information for Diag
80 @param[out] SENSOR_MSG_GPSDATA_DAT *pst_data : Pointer to the data master acquisition destination
83 *******************************************************************************/
84 void VehicleSensGetNaviinfoDiagGPSg(SENSOR_MSG_GPSDATA_DAT *pst_data) {
85 const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
87 pst_master = reinterpret_cast<VEHICLESENS_DATA_MASTER_GPS_FORMAT*>(&gstNaviinfoDiagGPS_g);
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 */