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_GyroTrouble.cpp
19 * System name :PastModel002
20 * Subsystem name :Vehicle sensor process
21 * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_TROUBLE)
22 * Module configuration :VehicleSensInitGyroTrouble() Vehicle Sensor GYRO TROUBLE Initialization Functions
23 * :VehicleSensSetGyroTrouble() Vehicle Sensor GYRO TROUBLE SET Functions
24 * :VehicleSensGetGyroTrouble() Vehicle Sensor GYRO TROUBLE GET Functions
25 ******************************************************************************/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
30 #define VEHICLE_SENS_DID_GYRO_TROUBLE_DEBUG_FACTORY 0
32 /*************************************************/
34 /*************************************************/
35 static VEHICLESENS_DATA_MASTER_GYRO_TROUBLE gstGyroTrouble; // NOLINT(readability/nolint)
37 /*******************************************************************************
38 * MODULE : VehicleSensInitGyroTrouble
39 * ABSTRACT : Vehicle sensor GYRO_TROUBLE initialization function
40 * FUNCTION : GYRO_TROUBLE data master initialization processing
44 ******************************************************************************/
45 void VehicleSensInitGyroTrouble(void) {
46 (void)memset(reinterpret_cast<void *>(&(gstGyroTrouble)),
47 static_cast<int>(0x00), sizeof(VEHICLESENS_DATA_MASTER_GYRO_TROUBLE));
48 gstGyroTrouble.ul_did = VEHICLE_DID_GYRO_TROUBLE;
49 gstGyroTrouble.us_size = VEHICLE_DSIZE_GYRO_TROUBLE;
50 gstGyroTrouble.uc_data = VEHICLE_DINIT_GYRO_TROUBLE;
53 /*******************************************************************************
54 * MODULE : VehicleSensSetGyroTrouble
55 * ABSTRACT : Vehicle Sensor GYRO_TROUBLE SET Function
56 * FUNCTION : Update the GYRO_TROUBLE data master
57 * ARGUMENT : *pst_data : Pointer to received message data
59 * RETURN : VEHICLESENS_EQ : No data change
60 * VEHICLESENS_NEQ : Data change
61 ******************************************************************************/
62 u_int8 VehicleSensSetGyroTrouble(const LSDRV_MSG_LSDATA_DAT_GYRO_TROUBLE *pst_data) { // LCOV_EXCL_START 8: dead code.
63 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
64 u_int8 uc_ret = VEHICLESENS_EQ;
65 VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_master;
67 if (pst_data == NULL) {
68 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
70 pst_master = &gstGyroTrouble;
72 /* Compare data master and received data */
73 uc_ret = VehicleSensmemcmp(&(pst_master->uc_data), &(pst_data->uc_data), pst_data->uc_size);
75 /* Received data is set in the data master. */
76 pst_master->ul_did = pst_data->ul_did;
77 pst_master->us_size = (u_int16)pst_data->uc_size;
78 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
79 pst_master->uc_data = pst_data->uc_data;
80 (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
81 (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
84 #if VEHICLE_SENS_DID_GYRO_TROUBLE_DEBUG_FACTORY
85 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] pst_data->ul_did == 0x%x", pst_data->ul_did);
86 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] gstGyroTrouble.ul_did == 0x%x\r\n", gstGyroTrouble.ul_did);
87 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] (u_int8)pst_data->ucSize == 0x%x", (u_int8)pst_data->uc_size);
88 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] gstGyroTrouble.us_size == 0x%x\r\n", gstGyroTrouble.us_size);
89 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] pst_data->uc_data == 0x%x", pst_data->uc_data);
90 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] gstGyroTrouble.uc_data == 0x%x\r\n", gstGyroTrouble.uc_data);
96 /*******************************************************************************
97 * MODULE : VehicleSensGetGyroTrouble
98 * ABSTRACT : Vehicle Sensor GYRO TROUBLE GET Functions
99 * FUNCTION : Provide a GYRO TROUBLE data master
100 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
103 ******************************************************************************/
104 void VehicleSensGetGyroTrouble(VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_data) {
105 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
106 const VEHICLESENS_DATA_MASTER_GYRO_TROUBLE *pst_master;
108 if (pst_data == NULL) {
109 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
111 pst_master = &gstGyroTrouble;
113 /* Store the data master in the specified destination. */
114 pst_data->ul_did = pst_master->ul_did;
115 pst_data->us_size = pst_master->us_size;
116 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
117 (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
118 (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));