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_FullBinary_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"
29 #include "VehicleSens_Common.h"
32 /*************************************************/
34 /*************************************************/
35 static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGps_CWORD82_FullBinary_g; // NOLINT(readability/nolint)
37 /*******************************************************************************
38 * MODULE : VehicleSensInitGps_CWORD82_FullBinaryG
39 * ABSTRACT : Vehicle sensor GPS_VERSION initialization function
40 * FUNCTION : GPS__CWORD82__FULLBINARY data master initialization processing
44 ******************************************************************************/
45 void VehicleSensInitGps_CWORD82_FullBinaryG(void) {
46 memset(&gstGps_CWORD82_FullBinary_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
47 gstGps_CWORD82_FullBinary_g.ul_did = POSHAL_DID_GPS__CWORD82__FULLBINARY;
48 /* _CWORD82_-only format with a fixed magic number */
49 /* GPS antenna connection information(1byte) + Sensor Counter(1byte) + 191 */
50 gstGps_CWORD82_FullBinary_g.us_size = (VEHICLE_DSIZE_GPS_ANTENNA + VEHICLE_DSIZE_SNS_COUNTER + GPS_CMD_FULLBIN_SZ);
53 /*******************************************************************************
54 * MODULE : VehicleSensSetGps_CWORD82_FullBinaryG
55 * ABSTRACT : Vehicle sensor GPS_VERSION SET function
56 * FUNCTION : Update the GPS__CWORD82__FULLBINARY 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_FullBinaryG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
64 VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
65 VehicleSensSetGpsVersion(pst_data); /* Pass the _CWORD82_ binary */
67 pst_master = &gstGps_CWORD82_FullBinary_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 = 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_FullBinaryG
83 * ABSTRACT : Vehicle sensor GPS_VERSION GET function
84 * FUNCTION : Provide the GPS__CWORD82__FULLBINARY data master
85 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
88 ******************************************************************************/
89 void VehicleSensGetGps_CWORD82_FullBinaryG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
90 const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
92 pst_master = &gstGps_CWORD82_FullBinary_g;
94 /* Store the data master in the specified destination. */
95 pst_data->ul_did = pst_master->ul_did;
96 pst_data->us_size = pst_master->us_size;
97 pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
98 memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */