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_GPSInterruptFlag.cpp
19 @detail Master vehicle sensor data(VEHICLE_DID_GPS_INTERRUPT_FLAG)
20 *****************************************************************************/
22 #include <vehicle_service/positioning_base_library.h>
23 #include "VehicleSens_DataMaster.h"
25 /*************************************************/
27 /*************************************************/
28 static VEHICLESENS_DATA_MASTER gstGpsInterruptFlag; // NOLINT(readability/nolint)
30 /***************************************************************************
31 @brief VehicleSensInitGpsInterruptFlag<BR>
32 Vehicle sensor SPEED_PULSE initialization function
33 @outline SPEED_PULSE_FLAG initialization process data master
34 @type Completion return type
40 *****************************************************************************/
41 void VehicleSensInitGpsInterruptFlag(void) {
42 memset(&gstGpsInterruptFlag, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
43 gstGpsInterruptFlag.ul_did = POSHAL_DID_GPS_INTERRUPT_FLAG;
44 gstGpsInterruptFlag.us_size = VEHICLE_DSIZE_GPS_INTERRUPT_FLAG;
46 gstGpsInterruptFlag.uc_data[0] = VEHICLE_DINIT_GPS_INTERRUPT_FLAG;
49 /***************************************************************************
50 @brief NAV-CLOCK SET vehicle sensor function
51 @outline To update the master data NAV-CLOCK.
52 @type Completion return type
53 @param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : The pointer to GPS incoming message data
56 @retval VEHICLESENS_EQ : No data changes
57 @retval VEHICLESENS_NEQ : With data changes
59 *****************************************************************************/
60 u_int8 VehicleSensSetGpsInterruptFlag(const LSDRV_LSDATA_G *pst_data) { // LCOV_EXCL_START 8: dead code.
61 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
63 VEHICLESENS_DATA_MASTER *pst_master;
65 pst_master = &gstGpsInterruptFlag;
67 /** Compare data master and received data */
68 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
70 /** Received data is set in the data master. */
71 pst_master->ul_did = pst_data->ul_did;
72 pst_master->us_size = pst_data->uc_size;
73 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
74 pst_master->uc_snscnt = pst_data->uc_sns_cnt;
75 (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
76 (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
81 /***************************************************************************
82 @brief Vehicle sensor function NAV-CLOCK GET
83 @outline Master Data provides the NAV-CLOCK
84 @type Completion return type
85 @param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
90 *****************************************************************************/
91 void VehicleSensGetGpsInterruptFlag(VEHICLESENS_DATA_MASTER *pst_data) {
92 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
93 const VEHICLESENS_DATA_MASTER *pst_masterdata;
95 pst_masterdata = &gstGpsInterruptFlag;
97 /** Store the data master in the specified destination. */
98 pst_data->ul_did = pst_masterdata->ul_did;
99 pst_data->us_size = pst_masterdata->us_size;
100 pst_data->uc_rcvflag = pst_masterdata->uc_rcvflag;
101 pst_data->uc_snscnt = pst_masterdata->uc_snscnt;
102 (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
103 (const void *)(pst_masterdata->uc_data), (size_t)(pst_masterdata->us_size));