2 * @copyright Copyright (c) 2019-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_GsnsZ_l.cpp
19 * Subsystem name :Vehicle sensor process
20 * Program name :Vehicle sensor data master(POSHAL_DID_GSNS_Z)
21 * Module configuration :VehicleSensInitGsnsZl() Vehicle sensor GSNS_Z initialization function
22 * :VehicleSensSetGsnsZlG() Vehicle sensor GSNS_Z SET function
23 * :VehicleSensGetGsnsZl() Vehicle sensor GSNS_Z GET function
24 ******************************************************************************/
26 #include "VehicleSens_DataMaster.h"
28 /*************************************************/
30 /*************************************************/
31 static VEHICLESENS_DATA_MASTER gstGsnsZ_l; // NOLINT(readability/nolint)
33 /*******************************************************************************
34 * MODULE : VehicleSensInitGsnsZl
35 * ABSTRACT : Vehicle sensor GSNS_Z initialization function
36 * FUNCTION : GSNS_Z data master initialization processing
40 ******************************************************************************/
41 void VehicleSensInitGsnsZl(void) {
42 memset(&gstGsnsZ_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
43 gstGsnsZ_l.ul_did = POSHAL_DID_GSNS_Z;
44 gstGsnsZ_l.us_size = VEHICLE_DSIZE_GSNS_Z;
45 gstGsnsZ_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
50 * Vehicle sensor GSNS_Z SET function
52 * Update the GSNS_Z data master
54 * @param[in] *pst_data : Pointer to the message data received by the direct line
56 * @return VEHICLESENS_EQ No data change<br>
57 * VEHICLESENS_NEQ Data change
60 u_int8 VehicleSensSetGsnsZlG(const LSDRV_LSDATA_G *pst_data) {
62 VEHICLESENS_DATA_MASTER *pst_master;
64 pst_master = &gstGsnsZ_l;
66 /* Compare data master and received data */
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;
72 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
73 (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
74 (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
79 /*******************************************************************************
80 * MODULE : VehicleSensGetGsnsZl
81 * ABSTRACT : Vehicle sensor GSNS_Z GET function
82 * FUNCTION : Provide the GSNS_Z data master
83 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
86 ******************************************************************************/
87 void VehicleSensGetGsnsZl(VEHICLESENS_DATA_MASTER *pst_data) {
88 const VEHICLESENS_DATA_MASTER *pst_master;
90 pst_master = &gstGsnsZ_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);