common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / vehicleservice / positioning / server / src / Sensor / VehicleSens_Did_GpsNmea_g.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
19  *  VehicleSens_Did_GpsNmea_g.cpp
20  * @brief
21  */
22
23 /*---------------------------------------------------------------------------------*
24  * Include Files
25  *---------------------------------------------------------------------------------*/
26
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
29 #include "gps_hal.h"
30
31 /*---------------------------------------------------------------------------------*
32  * Global Value
33  *---------------------------------------------------------------------------------*/
34 static  VEHICLESENS_DATA_MASTER_GPS_FORMAT  gstGpsNmea_g;    // NOLINT(readability/nolint)
35
36 /**
37  * @brief
38  *   Vehicle sensor GPS_NMEA initialization processing
39  */
40 void VehicleSensInitGpsNmeaG(void) {
41     memset(&gstGpsNmea_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
42     gstGpsNmea_g.ul_did  = POSHAL_DID_GPS_NMEA;
43     gstGpsNmea_g.us_size = VEHICLE_DSIZE_GPS_FORMAT;
44 }
45
46 /**
47  * @brief
48  *   Vehicle sensor GPS_NMEA SET processing
49  *
50  * @param[in]  Pointer to received message data
51  *
52  * @return     VEHICLESENS_EQ   No data change<BR>
53  *             VEHICLESENS_NEQ Data change
54  */
55 u_int8 VehicleSensSetGpsNmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
56     u_int8 uc_ret;
57     VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
58
59     pst_master = &gstGpsNmea_g;
60
61     /* Compare data master and received data */
62     uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
63
64     /* Received data is set in the data master. */
65     pst_master->ul_did        = pst_data->ul_did;
66     pst_master->us_size       = pst_data->us_size;
67     pst_master->uc_rcvflag    = VEHICLE_RCVFLAG_ON;
68     memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
69
70     return(uc_ret);
71 }
72
73 /**
74  * @brief
75  *   Vehicle sensor GPS_NMEA GET processing
76  *
77  * @param[out]  pst_data Pointer to the data master acquisition destination
78  */
79 void VehicleSensGetGpsNmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
80     const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
81
82     pst_master = &gstGpsNmea_g;
83
84     /* Store the data master in the specified destination. */
85     pst_data->ul_did    = pst_master->ul_did;
86     pst_data->us_size    = pst_master->us_size;
87     pst_data->uc_rcv_flag  = pst_master->uc_rcvflag;
88     memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);  /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
89 }