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_SettingTime_clock.cpp
22 /*---------------------------------------------------------------------------------*
24 *---------------------------------------------------------------------------------*/
25 #include <vehicle_service/positioning_base_library.h>
26 #include "VehicleSens_DataMaster.h"
28 /*---------------------------------------------------------------------------------*
30 *---------------------------------------------------------------------------------*/
31 static VEHICLESENS_DATA_MASTER gstSettingTime_clock; // NOLINT(readability/nolint)
35 * GPS setting time information data master initialization process(NAVI information)
37 * Initialize the GPS setting time information data master
44 void VehicleSensInitSettingTimeclock(void) {
47 memset(&gstSettingTime_clock, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
49 /** Data ID setting */
50 gstSettingTime_clock.ul_did = VEHICLE_DID_SETTINGTIME;
52 /** Data size setting */
53 gstSettingTime_clock.us_size = sizeof(POS_DATETIME);
55 /** Data content setting */
56 memset(&st_time, 0x00, sizeof(st_time));
57 memcpy(&gstSettingTime_clock.uc_data[0], &st_time, sizeof(st_time));
64 * GPS setting time information data master SET process(NAVI information)
66 * Update the GPS setting time information data master
68 * @param[in] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
71 * @retval VEHICLESENS_EQ : No data change
72 * @retval VEHICLESENS_NEQ : Data change
74 u_int8 VehicleSensSetSettingTimeclock(const POS_DATETIME *pst_rcv_time) {
76 VEHICLESENS_DATA_MASTER *pst_master;
78 pst_master = &gstSettingTime_clock;
80 /** Compare the data master and generated data */
81 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_rcv_time, sizeof(POS_DATETIME));
83 /** Received data is set in the data master. */
84 pst_master->ul_did = VEHICLE_DID_SETTINGTIME;
85 pst_master->us_size = sizeof(POS_DATETIME);
86 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
87 memcpy(pst_master->uc_data, pst_rcv_time, sizeof(POS_DATETIME));
94 * GPS setting time information data master GET process(NAVI information)
96 * Provide the GPS setting time information data master
99 * @param[out] VEHICLESENS_DATA_MASTER *pst_data : Pointer to the data master acquisition destination
103 void VehicleSensGetSettingTimeclock(VEHICLESENS_DATA_MASTER *pst_data) {
104 const VEHICLESENS_DATA_MASTER *pst_master;
106 pst_master = &gstSettingTime_clock;
108 /** Store the data master in the specified destination. */
109 pst_data->ul_did = pst_master->ul_did;
110 pst_data->us_size = pst_master->us_size;
111 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
112 memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */