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 :DeadReckoning_Did_SnsCounter.cpp
19 * System name :PastModel002
20 * Subsystem name :Vehicle sensor process
21 * Program name :Vehicle sensor data master(VEHICLE_DID_SNS_COUNTER)
22 * Module configuration :DeadReckoningInitSnsCounterDr() Vehicle sensor SNS_COUNTER initialization function
23 * :DeadReckoningSetSnsCounterDr() Vehicle sensor SNS_COUNTER SET function
24 * :DeadReckoningGetSnsCounterDr() Vehicle sensor SNS_COUNTER GET function
25 ******************************************************************************/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "DeadReckoning_DataMaster.h"
30 /*************************************************/
32 /*************************************************/
33 static DEADRECKONING_DATA_MASTER gst_snscounter_dr; // NOLINT(readability/nolint)
35 /*******************************************************************************
36 * MODULE : DeadReckoningInitSnsCounterDr
37 * ABSTRACT : Vehicle sensor SNS_COUNTER initialization function
38 * FUNCTION : SNS_COUNTER data master initialization processing
42 ******************************************************************************/
43 void DeadReckoningInitSnsCounterDr(void) { // LCOV_EXCL_START 8: dead code.
44 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
45 memset(&(gst_snscounter_dr), 0x00, sizeof(DEADRECKONING_DATA_MASTER));
46 gst_snscounter_dr.ul_did = VEHICLE_DID_DR_SNS_COUNTER;
47 gst_snscounter_dr.us_size = VEHICLE_DSIZE_DR_SNS_COUNTER;
48 gst_snscounter_dr.uc_rcv_flag = DEADRECKONING_RCVFLAG_OFF;
49 gst_snscounter_dr.dr_status = SENSORLOCATION_DRSTATUS_INVALID;
50 gst_snscounter_dr.uc_data[0] = VEHICLE_DINIT_DR_SNS_COUNTER;
53 /*******************************************************************************
54 * MODULE : DeadReckoningSetSnsCounterDr
55 * ABSTRACT : Vehicle sensor SNS_COUNTER SET function
56 * FUNCTION : Update the SNS_COUNTER data master
57 * ARGUMENT : *p_st_data : Pointer to the message data received by the direct line
59 * RETURN : VEHICLESENS_EQ : No data change
60 * VEHICLESENS_NEQ : Data change
61 ******************************************************************************/
62 u_int8 DeadReckoningSetSnsCounterDr(const DEADRECKONING_DATA_MASTER *p_st_data) {
63 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
65 DEADRECKONING_DATA_MASTER *p_st_master;
67 p_st_master = &gst_snscounter_dr;
69 /* Compare data master and received data */
70 uc_ret = DeadReckoningMemcmp(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
72 /* Received data is set in the data master. */
73 p_st_master->ul_did = p_st_data->ul_did;
74 p_st_master->us_size = p_st_data->us_size;
75 p_st_master->uc_rcv_flag = DEADRECKONING_RCVFLAG_ON;
76 p_st_master->dr_status = p_st_data->dr_status;
77 memcpy(p_st_master->uc_data, p_st_data->uc_data, p_st_data->us_size);
82 /*******************************************************************************
83 * MODULE : DeadReckoningGetSnsCounterDr
84 * ABSTRACT : Vehicle sensor SNS_COUNTER GET function
85 * FUNCTION : Provide the SNS_COUNTER data master
86 * ARGUMENT : *p_st_data : Pointer to the data master acquisition destination
89 ******************************************************************************/
90 void DeadReckoningGetSnsCounterDr(DEADRECKONING_DATA_MASTER *p_st_data) {
91 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
92 const DEADRECKONING_DATA_MASTER *p_st_master;
94 p_st_master = &gst_snscounter_dr;
96 /* Store the data master in the specified destination. */
97 p_st_data->ul_did = p_st_master->ul_did;
98 p_st_data->us_size = p_st_master->us_size;
99 p_st_data->uc_rcv_flag = p_st_master->uc_rcv_flag;
100 p_st_data->dr_status = p_st_master->dr_status;
101 memcpy(p_st_data->uc_data, p_st_master->uc_data, p_st_master->us_size);