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.
19 * VehicleSens_Did_LocationAltitude_n.cpp
22 /*---------------------------------------------------------------------------------*
24 *---------------------------------------------------------------------------------*/
25 #include <vehicle_service/positioning_base_library.h>
26 #include "VehicleSens_DataMaster.h"
27 #include "SensorLocation_API.h"
28 #include "CommonDefine.h"
30 /*---------------------------------------------------------------------------------*
32 *---------------------------------------------------------------------------------*/
33 static VEHICLESENS_DATA_MASTER gstLocationAltitude_n; // NOLINT(readability/nolint)
37 * Altitude information data master initialization processing(NAVI information)
39 * Initialize the altitude information data master
46 void VehicleSensInitLocationAltitudeN(void) {
47 SENSORLOCATION_ALTITUDEINFO_DAT st_altitude;
49 memset(&gstLocationAltitude_n, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
51 /** Data ID setting */
52 gstLocationAltitude_n.ul_did = VEHICLE_DID_LOCATION_ALTITUDE_NAVI;
54 /** Data size setting */
55 gstLocationAltitude_n.us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
57 /** Data content setting */
58 memset(&st_altitude, 0x00, sizeof(st_altitude));
59 st_altitude.getMethod = SENSOR_GET_METHOD_NAVI;
60 st_altitude.SyncCnt = 0x00;
61 st_altitude.isEnable = SENSORLOCATION_STATUS_DISABLE;
62 st_altitude.Altitude = 0x00;
63 memcpy(&gstLocationAltitude_n.uc_data[0], &st_altitude, sizeof(st_altitude));
70 * Altitude information data master SET processing(NAVI information)
72 * Update the altitude information data master
74 * @param[in] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
77 * @retval VEHICLESENS_EQ : No data change
78 * @retval VEHICLESENS_NEQ : Data change
80 u_int8 VehicleSensSetLocationAltitudeN(const SENSORLOCATION_ALTITUDEINFO_DAT *pst_altitude) {
82 VEHICLESENS_DATA_MASTER *pst_master;
84 pst_master = &gstLocationAltitude_n;
86 /** With the contents of the current data master,Compare received data */
87 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
89 /** Received data is set in the data master. */
90 pst_master->ul_did = VEHICLE_DID_LOCATION_ALTITUDE_NAVI;
91 pst_master->us_size = sizeof(SENSORLOCATION_ALTITUDEINFO_DAT);
92 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
93 memcpy(pst_master->uc_data, pst_altitude, sizeof(SENSORLOCATION_ALTITUDEINFO_DAT));
100 * Altitude Information Data Master GET Processing(NAVI information)
102 * Provide an altitude information data master
105 * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
109 void VehicleSensGetLocationAltitudeN(VEHICLESENS_DATA_MASTER *pst_data) {
110 const VEHICLESENS_DATA_MASTER *pst_master;
112 pst_master = &gstLocationAltitude_n;
114 /** Store the data master in the specified destination. */
115 pst_data->ul_did = pst_master->ul_did;
116 pst_data->us_size = pst_master->us_size;
117 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
118 memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);