common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / vehicleservice / positioning / server / src / Sensor / VehicleSens_Did_Rev_l.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    :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  ******************************************************************************/
27
28 #include <vehicle_service/positioning_base_library.h>
29 #include "VehicleSens_DataMaster.h"
30
31 /*************************************************/
32 /*           Global variable                      */
33 /*************************************************/
34 static  VEHICLESENS_DATA_MASTER  gstRev_l;    // NOLINT(readability/nolint)
35
36 /*******************************************************************************
37 * MODULE    : VehicleSensInitRevl
38 * ABSTRACT  : Vehicle Sensor REV Initialization Functions
39 * FUNCTION  : REV data master initialization processing
40 * ARGUMENT  : void
41 * NOTE      :
42 * RETURN    : void
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;
49 }
50
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
56 * NOTE      :
57 * RETURN    : VEHICLESENS_EQ  : No data change
58 *             VEHICLESENS_NEQ  : Data change
59 ******************************************************************************/
60 u_int8 VehicleSensSetRevl(const LSDRV_LSDATA *pst_data) {
61     u_int8 uc_ret;
62     VEHICLESENS_DATA_MASTER *pst_master;
63
64     pst_master = &gstRev_l;
65
66     /* Compare data master and received data */
67     uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
68
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));
76
77     return(uc_ret);
78 }
79
80 /**
81  * @brief
82  *   Vehicle Sensor REV SET Functions
83  *
84  *   Update the REV data master
85  *
86  * @param[in]  *pst_data : Pointer to the message data received by the direct line
87  *
88  * @return VEHICLESENS_EQ  : No data change
89 *          VEHICLESENS_NEQ  : Data change
90  */
91 u_int8 VehicleSensSetRevlG(const LSDRV_LSDATA_G *pst_data) {
92     u_int8 uc_ret;
93     VEHICLESENS_DATA_MASTER *pst_master;
94
95     pst_master = &gstRev_l;
96
97     /* Compare data master and received data */
98     uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
99
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));
107
108     return(uc_ret);
109 }
110
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
116 * NOTE      :
117 * RETURN    : void
118 ******************************************************************************/
119 void VehicleSensGetRevl(VEHICLESENS_DATA_MASTER *pst_data) {
120     const VEHICLESENS_DATA_MASTER *pst_master;
121
122     pst_master = &gstRev_l;
123
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));
131 }
132
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
138 * NOTE      :
139 * RETURN    : void
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;
144
145     pst_master = &gstRev_l;
146
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));
154 }
155 // LCOV_EXCL_STOP
156
157