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_GpsTime_g.cpp
23 /*---------------------------------------------------------------------------------*
25 *---------------------------------------------------------------------------------*/
26 #include <vehicle_service/positioning_base_library.h>
27 #include "VehicleSens_DataMaster.h"
29 /*---------------------------------------------------------------------------------*
31 *---------------------------------------------------------------------------------*/
32 static VEHICLESENS_DATA_MASTER gstGpsTime_g; // NOLINT(readability/nolint)
34 /*---------------------------------------------------------------------------------*
36 *---------------------------------------------------------------------------------*/
39 * GPS time information data master initialization processing
41 void VehicleSensInitGpsTimeG(void) {
42 SENSOR_MSG_GPSTIME st_gps_time;
44 memset(&gstGpsTime_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
46 /** Data ID setting */
47 gstGpsTime_g.ul_did = POSHAL_DID_GPS_TIME;
48 /** Data size setting */
49 gstGpsTime_g.us_size = sizeof(SENSOR_MSG_GPSTIME);
50 /** Data content setting */
51 memset(&st_gps_time, 0x00, sizeof(st_gps_time));
52 memcpy(&gstGpsTime_g.uc_data[0], &st_gps_time, sizeof(st_gps_time));
59 * GPS time information data master SET process
61 * @param[in] SENSOR_MSG_GPS*
65 u_int8 VehicleSensSetGpsTimeG(const SENSOR_MSG_GPSTIME *pst_gps_time) {
67 VEHICLESENS_DATA_MASTER *pst_master;
69 pst_master = &gstGpsTime_g;
71 /** With the contents of the current data master,Compare received data */
72 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_gps_time, sizeof(SENSOR_MSG_GPSTIME));
74 /** Received data is set in the data master. */
75 pst_master->ul_did = POSHAL_DID_GPS_TIME;
76 pst_master->us_size = sizeof(SENSOR_MSG_GPSTIME);
77 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
78 memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
79 memcpy(pst_master->uc_data, pst_gps_time, sizeof(SENSOR_MSG_GPSTIME));
86 * GPS time information data master GET processing
88 * @param[out] SENSOR_MSG_GPS*
90 void VehicleSensGetGpsTimeG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
91 const VEHICLESENS_DATA_MASTER *pst_master;
93 pst_master = &gstGpsTime_g;
95 /* Store the data master in the specified destination. */
96 pst_data->ul_did = pst_master->ul_did;
97 pst_data->us_size = pst_master->us_size;
98 pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
99 memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);