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_LocationAltitude_g.cpp
19 @detail Altitude information data master management(NMEA information)
20 ******************************************************************************/
21 #include <vehicle_service/positioning_base_library.h>
22 #include "VehicleSens_DataMaster.h"
23 #include "CommonDefine.h"
25 /*************************************************
27 *************************************************/
28 static VEHICLESENS_DATA_MASTER gstLocationAltitude_g; // NOLINT(readability/nolint)
30 /****************************************************************************
31 @brief VehicleSensInitLocationAltitudeG<BR>
32 Altitude information data master initialization processing(NMEA information)
33 @outline Initialize the altitude information data master
38 *******************************************************************************/
39 void VehicleSensInitLocationAltitudeG(void) {
40 SENSORLOCATION_ALTITUDEINFO_DAT st_altitude;
42 memset(&gstLocationAltitude_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
44 /** Data ID setting */
45 gstLocationAltitude_g.ul_did = VEHICLE_DID_LOCATION_ALTITUDE;
46 /** Data size setting */
47 gstLocationAltitude_g.us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
48 /** Data content setting */
49 memset(&st_altitude, 0x00, sizeof(st_altitude));
50 st_altitude.getMethod = SENSOR_GET_METHOD_GPS;
51 st_altitude.SyncCnt = 0x00;
52 st_altitude.isEnable = SENSORLOCATION_STATUS_DISABLE;
53 memcpy(&gstLocationAltitude_g.uc_data[0], &st_altitude, sizeof(st_altitude));
56 /****************************************************************************
57 @brief VehicleSensSetLocationAltitudeG<BR>
58 Altitude information data master SET processing(NMEA information)
59 @outline Update the altitude information data master
60 @param[in] u_int8 ucSensCnt : Sensor counter value
61 @param[in] u_int8* pucDGGA : Double precision GGAInformation(_CWORD82_ NMEA)
64 @retval VEHICLESENS_EQ : No data change
65 @retval VEHICLESENS_NEQ : Data change
66 *******************************************************************************/
67 u_int8 VehicleSensSetLocationAltitudeG(const SENSORLOCATION_ALTITUDEINFO_DAT *pst_altitude) {
69 VEHICLESENS_DATA_MASTER *pst_master;
71 pst_master = &gstLocationAltitude_g;
73 /** With the contents of the current data master,Compare received data */
74 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
76 /** Received data is set in the data master. */
77 pst_master->ul_did = VEHICLE_DID_LOCATION_ALTITUDE;
78 pst_master->us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
79 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
80 memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
81 memcpy(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
86 /****************************************************************************
87 @brief VehicleSensGetLocationAltitudeG<BR>
88 Altitude Information Data Master GET Processing(NMEA information)
89 @outline Provide an altitude information data master
91 @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
94 *******************************************************************************/
95 void VehicleSensGetLocationAltitudeG(VEHICLESENS_DATA_MASTER *pst_data) {
96 const VEHICLESENS_DATA_MASTER *pst_master;
98 pst_master = &gstLocationAltitude_g;
100 /* Store the data master in the specified destination. */
101 pst_data->ul_did = pst_master->ul_did;
102 pst_data->us_size = pst_master->us_size;
103 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
104 memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */