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_Rev_l.cpp
19 * System name :_CWORD107_
20 * Subsystem name :Vehicle sensor process
21 * Program name :Vehicle sensor data master(VEHICLE_DID_REV)
22 * Module configuration :VehicleSensInitRevl() Vehicle Sensor REV Initialization Functions
23 * :VehicleSensSetRevl() Vehicle Sensor REV SET Functions
24 * :VehicleSensGetRevl() Vehicle Sensor REV GET Functions
25 * :VehicleSensGetRevline() Vehicle Sensor REV GET Functions(_LINE)
26 ******************************************************************************/
28 #include <vehicle_service/positioning_base_library.h>
29 #include "VehicleSens_DataMaster.h"
31 /*************************************************/
33 /*************************************************/
34 static VEHICLESENS_DATA_MASTER gstRev_l; // NOLINT(readability/nolint)
36 /*******************************************************************************
37 * MODULE : VehicleSensInitRevl
38 * ABSTRACT : Vehicle Sensor REV Initialization Functions
39 * FUNCTION : REV data master initialization processing
43 ******************************************************************************/
44 void VehicleSensInitRevl(void) {
45 memset(&gstRev_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
46 gstRev_l.ul_did = VEHICLE_DID_REV;
47 gstRev_l.us_size = VEHICLE_DSIZE_REV;
48 gstRev_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
51 /*******************************************************************************
52 * MODULE : VehicleSensSetRevl
53 * ABSTRACT : Vehicle Sensor REV SET Functions
54 * FUNCTION : Update the REV data master
55 * ARGUMENT : *pst_data : Pointer to the message data received by the direct line
57 * RETURN : VEHICLESENS_EQ : No data change
58 * VEHICLESENS_NEQ : Data change
59 ******************************************************************************/
60 u_int8 VehicleSensSetRevl(const LSDRV_LSDATA *pst_data) {
62 VEHICLESENS_DATA_MASTER *pst_master;
64 pst_master = &gstRev_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 pst_master->uc_snscnt = pst_data->uc_sns_cnt;
74 (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
75 (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
82 * Vehicle Sensor REV SET Functions
84 * Update the REV data master
86 * @param[in] *pst_data : Pointer to the message data received by the direct line
88 * @return VEHICLESENS_EQ : No data change
89 * VEHICLESENS_NEQ : Data change
91 u_int8 VehicleSensSetRevlG(const LSDRV_LSDATA_G *pst_data) {
93 VEHICLESENS_DATA_MASTER *pst_master;
95 pst_master = &gstRev_l;
97 /* Compare data master and received data */
98 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
100 /* Received data is set in the data master. */
101 pst_master->ul_did = pst_data->ul_did;
102 pst_master->us_size = pst_data->uc_size;
103 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
104 pst_master->uc_snscnt = pst_data->uc_sns_cnt;
105 (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
106 (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
111 /*******************************************************************************
112 * MODULE : VehicleSensGetRevl
113 * ABSTRACT : Vehicle Sensor REV GET Functions
114 * FUNCTION : Provide a REV data master
115 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
118 ******************************************************************************/
119 void VehicleSensGetRevl(VEHICLESENS_DATA_MASTER *pst_data) {
120 const VEHICLESENS_DATA_MASTER *pst_master;
122 pst_master = &gstRev_l;
124 /* Store the data master in the specified destination. */
125 pst_data->ul_did = pst_master->ul_did;
126 pst_data->us_size = pst_master->us_size;
127 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
128 pst_data->uc_snscnt = pst_master->uc_snscnt;
129 (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
130 (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
133 /*******************************************************************************
134 * MODULE : VehicleSensGetRevline
135 * ABSTRACT : Vehicle Sensor REV GET Functions(For direct lines)
136 * FUNCTION : Provide a REV data master(For direct lines)
137 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
140 ******************************************************************************/
141 void VehicleSensGetRevline(VEHICLESENS_DATA_MASTER *pst_data) { // LCOV_EXCL_START 8 : dead code
142 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
143 const VEHICLESENS_DATA_MASTER *pst_master;
145 pst_master = &gstRev_l;
147 /* Store the data master in the specified destination. */
148 pst_data->ul_did = VEHICLE_DID_REV_LINE;
149 pst_data->us_size = pst_master->us_size;
150 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
151 pst_data->uc_snscnt = pst_master->uc_snscnt;
152 (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
153 (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));