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_GyroConnectStatus.cpp
19 * System name :PastModel002
20 * Subsystem name :Vehicle sensor process
21 * Program name :Vehicle sensor data master(VEHICLE_DID_GYRO_CONNECT_STATUS)
22 * Module configuration :VehicleSensInitGyroConnectStatus() Vehicle Sensor GYRO CONNECT STATUS Initialization Functions
23 * :VehicleSensSetGyroConnectStatus() Vehicle Sensor GYRO CONNECT STATUS SET Functions
24 * :VehicleSensGetGyroConnectStatus() Vehicle Sensor GYRO CONNECT STATUS GET Functions
25 ******************************************************************************/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
30 /*************************************************/
32 /*************************************************/
33 static VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS gstGyroConnectStatus; // NOLINT(readability/nolint)
35 /*******************************************************************************
36 * MODULE : VehicleSensInitGyroConnectStatus
37 * ABSTRACT : Vehicle sensor GYRO_CONNECT_STATUS initialization function
38 * FUNCTION : GYRO_CONNECT_STATUS data master initialization processing
42 ******************************************************************************/
43 void VehicleSensInitGyroConnectStatus(void) {
44 (void)memset(reinterpret_cast<void *>(&(gstGyroConnectStatus)), static_cast<int>(0x00),
45 sizeof(VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS));
46 gstGyroConnectStatus.ul_did = VEHICLE_DID_GYRO_CONNECT_STATUS;
47 gstGyroConnectStatus.us_size = VEHICLE_DSIZE_GYRO_CONNECT_STATUS;
48 gstGyroConnectStatus.uc_data = VEHICLE_DINIT_GYRO_CONNECT_STATUS;
51 /*******************************************************************************
52 * MODULE : VehicleSensSetGyroConnectStatus
53 * ABSTRACT : Vehicle sensor GYRO_CONNECT_STATUS SET function
54 * FUNCTION : Update the GYRO_CONNECT_STATUS data master
55 * ARGUMENT : *pst_data : Pointer to received message data
57 * RETURN : VEHICLESENS_EQ : No data change
58 * VEHICLESENS_NEQ : Data change
59 ******************************************************************************/
60 u_int8 VehicleSensSetGyroConnectStatus(const LSDRV_MSG_LSDATA_DAT_GYRO_CONNECT_STATUS *pst_data) { // LCOV_EXCL_START 8: dead code. // NOLINT(whitespace/line_length)
61 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
62 u_int8 uc_ret = VEHICLESENS_EQ;
63 VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_master;
65 if (pst_data == NULL) {
66 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
68 pst_master = &gstGyroConnectStatus;
70 /* Compare data master and received data */
71 uc_ret = VehicleSensmemcmp(reinterpret_cast<void *>(&(pst_master->uc_data)),
72 (const void *)(&(pst_data->uc_data)), (size_t)(pst_data->uc_size));
74 /* Received data is set in the data master. */
75 pst_master->ul_did = pst_data->ul_did;
76 pst_master->us_size = (u_int16)pst_data->uc_size;
77 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
78 (void)memcpy(reinterpret_cast<void *>(&(pst_master->uc_data)),
79 (const void *)(&(pst_data->uc_data)), sizeof(pst_master->uc_data));
85 /*******************************************************************************
86 * MODULE : VehicleSensGetGyroConnectStatus
87 * ABSTRACT : Vehicle Sensor GYRO TROUBLE GET Functions
88 * FUNCTION : Provide a GYRO TROUBLE data master
89 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
92 ******************************************************************************/
93 void VehicleSensGetGyroConnectStatus(VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_data) {
94 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
95 const VEHICLESENS_DATA_MASTER_GYRO_CONNECT_STATUS *pst_master;
97 if (pst_data == NULL) {
98 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "pst_data == NULL\r\n");
100 pst_master = &gstGyroConnectStatus;
102 /* Store the data master in the specified destination. */
103 pst_data->ul_did = pst_master->ul_did;
104 pst_data->us_size = pst_master->us_size;
105 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
106 (void)memcpy(reinterpret_cast<void *>(&(pst_data->uc_data)),
107 (const void *)(&(pst_master->uc_data)), sizeof(pst_data->uc_data));