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_GpsCounter_g.cpp
19 * System name :_CWORD107_
20 * Subsystem name :Vehicle sensor process
21 * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_COUNTER)
22 * Module configuration :VehicleSensInitGpsCounterg() Vehicle sensor GPS_COUNTER initialization function
23 * :VehicleSensSetGpsCounterg() Vehicle Sensor GPS_COUNTER SET Function
24 * :VehicleSensGetGpsCounterg() Vehicle Sensor GPS_COUNTER GET Function
25 ******************************************************************************/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
30 /*************************************************/
32 /*************************************************/
33 static VEHICLESENS_DATA_MASTER gstGpsCounter_g; // NOLINT(readability/nolint)
35 /*******************************************************************************
36 * MODULE : VehicleSensInitGpsCounterg
37 * ABSTRACT : Vehicle sensor GPS_COUNTER initialization function
38 * FUNCTION : GPS_COUNTER data master initialization process
42 ******************************************************************************/
43 void VehicleSensInitGpsCounterg(void) {
44 memset(&gstGpsCounter_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
45 gstGpsCounter_g.ul_did = VEHICLE_DID_GPS_COUNTER;
46 gstGpsCounter_g.us_size = VEHICLE_DSIZE_GPS_COUNTER;
47 gstGpsCounter_g.uc_data[0] = VEHICLE_DINIT_GPS_COUNTER;
50 /*******************************************************************************
51 * MODULE : VehicleSensSetGpsCounterg
52 * ABSTRACT : Vehicle Sensor GPS_COUNTER SET Function
53 * FUNCTION : Update the GPS_COUNTER data master
54 * ARGUMENT : *pst_data : Pointer to CAN received message data
56 * RETURN : VEHICLESENS_EQ : No data change
57 * VEHICLESENS_NEQ : Data change
58 ******************************************************************************/
59 u_int8 VehicleSensSetGpsCounterg(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
60 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
62 VEHICLESENS_DATA_MASTER *pst_master;
64 pst_master = &gstGpsCounter_g;
66 /* Compare data master and received data */
67 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
69 /* Received data is set in the data master. */
70 pst_master->ul_did = pst_data->ul_did;
71 pst_master->us_size = (u_int8)pst_data->us_size;
72 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
73 memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
78 /*******************************************************************************
79 * MODULE : VehicleSensGetGpsCounterg
80 * ABSTRACT : Vehicle Sensor GPS_COUNTER GET Function
81 * FUNCTION : Provide the GPS_COUNTER data master
82 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
85 ******************************************************************************/
86 void VehicleSensGetGpsCounterg(SENSOR_MSG_GPSDATA_DAT *pst_data) {
87 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
88 const VEHICLESENS_DATA_MASTER *pst_master;
90 pst_master = &gstGpsCounter_g;
92 /* Store the data master in the specified destination. */
93 pst_data->ul_did = pst_master->ul_did;
94 pst_data->us_size = pst_master->us_size;
95 pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
96 memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);