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 name :VehicleSens_Did_MainGpsInterruptSignal.cpp
19 * System name :PastModel002
20 * Subsystem name :GPS process
21 * Program name :MAIN GPS interrupt data master(VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL)
22 * Module configuration :VehicleSensInitMainGpsInterruptSignal() Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL initialization function
23 * :VehicleSensSetMainGpsInterruptSignal() Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL SET function
24 * :VehicleSensGetMainGpsInterruptSignal() Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL GET function
25 ******************************************************************************/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
30 #define VEHICLE_SENS_DID_MAIN_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY 0
32 /*************************************************/
34 /*************************************************/
35 static VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL gstMainGpsInterruptSignal; // NOLINT(readability/nolint)
37 /*******************************************************************************
38 * MODULE : VehicleSensInitMainGpsInterruptSignal
39 * ABSTRACT : Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL initialization function
40 * FUNCTION : MAIN_GPS_INTERRUPT_SIGNAL data master initialization processing
44 ******************************************************************************/
45 void VehicleSensInitMainGpsInterruptSignal(void) {
46 (void)memset(reinterpret_cast<void *>(&(gstMainGpsInterruptSignal)),
47 static_cast<int>(0x00), sizeof(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL));
48 gstMainGpsInterruptSignal.ul_did = VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL;
49 gstMainGpsInterruptSignal.us_size = VEHICLE_DSIZE_MAIN_GPS_INTERRUPT_SIGNAL;
50 gstMainGpsInterruptSignal.uc_data = VEHICLE_DINIT_MAIN_GPS_INTERRUPT_SIGNAL;
52 #if VEHICLE_SENS_DID_MAIN_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
53 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
54 "#[FACTORY] gstMainGpsInterruptSignal.uc_data.uc_data == 0x%x\r\n", gstMainGpsInterruptSignal.uc_data);
58 /*******************************************************************************
59 * MODULE : VehicleSensSetMainGpsInterruptSignal
60 * ABSTRACT : Vehicle sensor MAIN_GPS_INTERRUPT_SIGNALE SET function
61 * FUNCTION : Update the Main_GPS_INTERRUPT_SIGNAL data master
62 * ARGUMENT : *pst_data : Pointer to received message data
64 * RETURN : VEHICLESENS_EQ : No data change
65 * VEHICLESENS_NEQ : Data change
66 ******************************************************************************/
67 u_int8 VehicleSensSetMainGpsInterruptSignal(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code.
68 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
69 u_int8 uc_ret = VEHICLESENS_EQ;
70 VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
72 if (pst_data == NULL) {
73 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
75 pst_master = &gstMainGpsInterruptSignal;
77 /* Compare data master and received data */
78 uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
79 (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->us_size));
81 /* Received data is set in the data master. */
82 pst_master->ul_did = pst_data->ul_did;
83 pst_master->us_size = pst_data->us_size;
84 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
85 (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
86 (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
88 #if VEHICLE_SENS_DID_MAIN_GPS_INTERRUPT_SIGNAL_DEBUG_FACTORY
89 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
90 "#[FACTORY] pst_data->ul_did == 0x%x", pst_data->ul_did);
91 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
92 "#[FACTORY] gstMainGpsInterruptSignal.ul_did == 0x%x\r\n", gstMainGpsInterruptSignal.ul_did);
93 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
94 "#[FACTORY] (u_int8)pst_data->us_size == 0x%x", (u_int8)pst_data->us_size);
95 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
96 "#[FACTORY] gstMainGpsInterruptSignal.us_size == 0x%x\r\n", gstMainGpsInterruptSignal.us_size);
97 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
98 "#[FACTORY] pst_data->uc_data == 0x%x", pst_data->uc_data[0]);
99 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
100 "#[FACTORY] gstMainGpsInterruptSignal.uc_data == 0x%x\r\n", gstMainGpsInterruptSignal.uc_data);
107 /*******************************************************************************
108 * MODULE : VehicleSensGetMainGpsInterruptSignal
109 * ABSTRACT : Vehicle sensor MAIN_GPS_INTERRUPT_SIGNAL GET function
110 * FUNCTION : Provide the MAIN_GPS_INTERRUPT_SIGNAL data master
111 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
114 ******************************************************************************/
115 void VehicleSensGetMainGpsInterruptSignal(VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_data) {
116 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
117 const VEHICLESENS_DATA_MASTER_GPS_INTERRUPT_SIGNAL *pst_master;
119 if (pst_data == NULL) {
120 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
122 pst_master = &gstMainGpsInterruptSignal;
124 /* Store the data master in the specified destination. */
125 pst_data->ul_did = pst_master->ul_did;
126 pst_data->us_size = pst_master->us_size;
127 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
128 (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
129 (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));