common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / vehicleservice / positioning / server / src / Sensor / VehicleSens_Did_GPSInterruptFlag.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      VehicleSens_Did_GPSInterruptFlag.cpp
19 @detail      Master vehicle sensor data(VEHICLE_DID_GPS_INTERRUPT_FLAG)
20 *****************************************************************************/
21
22 #include <vehicle_service/positioning_base_library.h>
23 #include "VehicleSens_DataMaster.h"
24
25 /*************************************************/
26 /*           Global variable                      */
27 /*************************************************/
28 static  VEHICLESENS_DATA_MASTER  gstGpsInterruptFlag;    // NOLINT(readability/nolint)
29
30 /***************************************************************************
31 @brief      VehicleSensInitGpsInterruptFlag<BR>
32          Vehicle sensor SPEED_PULSE initialization function
33 @outline    SPEED_PULSE_FLAG initialization process data master
34 @type      Completion return type
35 @param[in]    none
36 @threshold    none
37 @return      void
38 @retval      none
39 @trace
40 *****************************************************************************/
41 void VehicleSensInitGpsInterruptFlag(void) {
42     memset(&gstGpsInterruptFlag, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
43     gstGpsInterruptFlag.ul_did    = POSHAL_DID_GPS_INTERRUPT_FLAG;
44     gstGpsInterruptFlag.us_size    = VEHICLE_DSIZE_GPS_INTERRUPT_FLAG;
45
46     gstGpsInterruptFlag.uc_data[0]  = VEHICLE_DINIT_GPS_INTERRUPT_FLAG;
47 }
48
49 /***************************************************************************
50 @brief      NAV-CLOCK SET vehicle sensor function
51 @outline    To update the master data NAV-CLOCK.
52 @type      Completion return type
53 @param[in]    SENSOR_MSG_GPSDATA_DAT *pst_data  :  The pointer to GPS incoming message data
54 @threshold    none
55 @return      u_int8
56 @retval      VEHICLESENS_EQ  :   No data changes
57 @retval      VEHICLESENS_NEQ  :   With data changes
58 @trace
59 *****************************************************************************/
60 u_int8 VehicleSensSetGpsInterruptFlag(const LSDRV_LSDATA_G *pst_data) {  // LCOV_EXCL_START 8: dead code.
61     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
62     u_int8 uc_ret;
63     VEHICLESENS_DATA_MASTER *pst_master;
64
65     pst_master = &gstGpsInterruptFlag;
66
67     /** Compare data master and received data */
68     uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
69
70     /** Received data is set in the data master. */
71     pst_master->ul_did    = pst_data->ul_did;
72     pst_master->us_size    = pst_data->uc_size;
73     pst_master->uc_rcvflag  = VEHICLE_RCVFLAG_ON;
74     pst_master->uc_snscnt    = pst_data->uc_sns_cnt;
75     (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
76         (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
77
78     return(uc_ret);
79 }
80
81 /***************************************************************************
82 @brief      Vehicle sensor function NAV-CLOCK GET
83 @outline    Master Data provides the NAV-CLOCK
84 @type      Completion return type
85 @param[in]    SENSOR_MSG_GPSDATA_DAT *pst_data  :  Where to get a pointer to the data master
86 @threshold    none
87 @return      void
88 @retval      none
89 @trace
90 *****************************************************************************/
91 void VehicleSensGetGpsInterruptFlag(VEHICLESENS_DATA_MASTER *pst_data) {
92     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
93     const VEHICLESENS_DATA_MASTER *pst_masterdata;
94
95     pst_masterdata = &gstGpsInterruptFlag;
96
97     /** Store the data master in the specified destination. */
98     pst_data->ul_did    = pst_masterdata->ul_did;
99     pst_data->us_size    = pst_masterdata->us_size;
100     pst_data->uc_rcvflag  = pst_masterdata->uc_rcvflag;
101     pst_data->uc_snscnt  = pst_masterdata->uc_snscnt;
102     (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
103         (const void *)(pst_masterdata->uc_data), (size_t)(pst_masterdata->us_size));
104 }
105 // LCOV_EXCL_STOP