common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / vehicleservice / positioning / server / src / Sensor / DeadReckoning_Did_SnsCounter.cpp
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
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  ******************************************************************************/
26
27 #include <vehicle_service/positioning_base_library.h>
28 #include "DeadReckoning_DataMaster.h"
29
30 /*************************************************/
31 /*           Global variable                      */
32 /*************************************************/
33 static  DEADRECKONING_DATA_MASTER  gst_snscounter_dr;    // NOLINT(readability/nolint)
34
35 /*******************************************************************************
36 * MODULE    : DeadReckoningInitSnsCounterDr
37 * ABSTRACT  : Vehicle sensor SNS_COUNTER initialization function
38 * FUNCTION  : SNS_COUNTER data master initialization processing
39 * ARGUMENT  : void
40 * NOTE      :
41 * RETURN    : void
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;
51 }
52
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
58 * NOTE      :
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
64     u_int8 uc_ret;
65     DEADRECKONING_DATA_MASTER *p_st_master;
66
67     p_st_master = &gst_snscounter_dr;
68
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);
71
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);
78
79     return (uc_ret);
80 }
81
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
87 * NOTE      :
88 * RETURN    : void
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;
93
94     p_st_master = &gst_snscounter_dr;
95
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);
102 }
103 // LCOV_EXCL_STOP