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_Gps_CWORD82_Nmea_g.cpp
19 * System name :_CWORD72_
20 * Subsystem name :Vehicle sensor process
21 * Program name :Vehicle sensor data master(VEHICLE_DID_GPS__CWORD82__FULLBINARY)
22 * Module configuration :VehicleSensInitGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY initialization function
23 * :VehicleSensSetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY SET function
24 * :VehicleSensGetGps_CWORD82_FullBinaryG() Vehicle sensor GPS__CWORD82__FULLBINARY GET function
25 ******************************************************************************/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
31 /*************************************************/
33 /*************************************************/
34 static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGps_CWORD82__CWORD44_Gp4_g; // NOLINT(readability/nolint)
36 /*******************************************************************************
37 * MODULE : VehicleSensInitGps_CWORD82__CWORD44_Gp4G
38 * ABSTRACT : Vehicle sensor GPS__CWORD44__GP4 initialization function
39 * FUNCTION : GPS__CWORD82___CWORD44__GP4 data master initialization processing
43 ******************************************************************************/
44 void VehicleSensInitGps_CWORD82__CWORD44_Gp4G(void) {
45 memset(&gstGps_CWORD82__CWORD44_Gp4_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
46 gstGps_CWORD82__CWORD44_Gp4_g.ul_did = POSHAL_DID_GPS__CWORD82___CWORD44_GP4;
47 /* Initialize with _CWORD82_ only and size fixed VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4 */
48 /* GPS antenna connection information(1byte) + Sensor Counter(1byte) + VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4 */
49 gstGps_CWORD82__CWORD44_Gp4_g.us_size = (VEHICLE_DSIZE_GPS_ANTENNA + VEHICLE_DSIZE_SNS_COUNTER) \
50 + (VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_4);
53 /*******************************************************************************
54 * MODULE : VehicleSensSetGps_CWORD82__CWORD44_Gp4G
55 * ABSTRACT : Vehicle sensor GPS_NMEA SET function
56 * FUNCTION : Update the GPS__CWORD82___CWORD44__GP4 data master
57 * ARGUMENT : *pst_data : Pointer to CAN received message data
59 * RETURN : VEHICLESENS_EQ : No data change
60 * VEHICLESENS_NEQ : Data change
61 *******************************************************************************/
62 u_int8 VehicleSensSetGps_CWORD82__CWORD44_Gp4G(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
63 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
65 VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
67 pst_master = &gstGps_CWORD82__CWORD44_Gp4_g;
69 /* Compare data master and received data */
70 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
72 /* Received data is set in the data master. */
73 pst_master->ul_did = pst_data->ul_did;
74 pst_master->us_size = (u_int8)pst_data->us_size;
75 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
76 memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
81 /*******************************************************************************
82 * MODULE : VehicleSensGetGps_CWORD82__CWORD44_Gp4G
83 * ABSTRACT : Vehicle sensor GPS__CWORD44__GP4 GET function
84 * FUNCTION : Provide the GPS__CWORD82___CWORD44__GP4 data master
85 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
88 ******************************************************************************/
89 void VehicleSensGetGps_CWORD82__CWORD44_Gp4G(SENSOR_MSG_GPSDATA_DAT *pst_data) {
90 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
91 const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
93 pst_master = &gstGps_CWORD82__CWORD44_Gp4_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); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */