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_GpsAntenna_l.cpp
19 * System name :_CWORD107_
20 * Subsystem name :Vehicle sensor process
21 * Program name :Vehicle sensor data master(VEHICLE_DID_GPS_ANTENNA)
22 * Module configuration :VehicleSensInitGpsAntennal() Vehicle sensor GPS_ANTENNA initialization function
23 * :VehicleSensSetGpsAntennal() Vehicle Sensor GPS_ANTENNA SET Function
24 * :VehicleSensGetGpsAntennal() Vehicle Sensor GPS_ANTENNA GET Function
25 ******************************************************************************/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
30 /*************************************************/
32 /*************************************************/
33 static VEHICLESENS_DATA_MASTER gstGpsAntenna_l; // NOLINT(readability/nolint)
35 /*******************************************************************************
36 * MODULE : VehicleSensInitGpsAntennal
37 * ABSTRACT : Vehicle sensor GPS_ANTENNA initialization function
38 * FUNCTION : GPS_ANTENNA data master initialization processing
42 ******************************************************************************/
43 void VehicleSensInitGpsAntennal(void) {
44 memset(&gstGpsAntenna_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
45 gstGpsAntenna_l.ul_did = POSHAL_DID_GPS_ANTENNA;
46 gstGpsAntenna_l.us_size = VEHICLE_DSIZE_GPS_ANTENNA;
47 gstGpsAntenna_l.uc_data[0] = VEHICLE_DINIT_GPS_ANTENNA;
50 /*******************************************************************************
51 * MODULE : VehicleSensSetGpsAntennal
52 * ABSTRACT : Vehicle Sensor GPS_ANTENNA SET Function
53 * FUNCTION : Update the GPS_ANTENNA data master
54 * ARGUMENT : *pst_data : Pointer to the message data received by the direct line
56 * RETURN : VEHICLESENS_EQ : No data change
57 * VEHICLESENS_NEQ : Data change
58 ******************************************************************************/
59 u_int8 VehicleSensSetGpsAntennal(const LSDRV_LSDATA *pst_data) {
61 VEHICLESENS_DATA_MASTER *pst_master;
63 pst_master = &gstGpsAntenna_l;
65 /* Compare data master and received data */
66 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
67 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
69 /* Received data is set in the data master. */
70 pst_master->ul_did = pst_data->ul_did;
71 pst_master->us_size = pst_data->uc_size; /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
72 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
73 memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
74 memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
79 /*******************************************************************************
80 * MODULE : VehicleSensGetGpsAntennal
81 * ABSTRACT : Vehicle Sensor GPS_ANTENNA GET Function
82 * FUNCTION : Provide the GPS_ANTENNA data master
83 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
86 ******************************************************************************/
87 void VehicleSensGetGpsAntennal(VEHICLESENS_DATA_MASTER *pst_data) {
88 const VEHICLESENS_DATA_MASTER *pst_master;
90 pst_master = &gstGpsAntenna_l;
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_rcvflag = pst_master->uc_rcvflag;
96 memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */