common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / vehicleservice / positioning / server / src / Sensor / VehicleSens_Did_GpsTimeRaw_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_GpsTimeRaw_g.cpp
20  * @brief
21  */
22
23 /*---------------------------------------------------------------------------------*
24  * Include Files                                                                                   *
25  *---------------------------------------------------------------------------------*/
26 #include <vehicle_service/positioning_base_library.h>
27 #include "VehicleSens_DataMaster.h"
28
29 /*---------------------------------------------------------------------------------*
30  * Global Value                                                                                   *
31  *---------------------------------------------------------------------------------*/
32 static  VEHICLESENS_DATA_MASTER  gstGpsTimeRaw_g;    // NOLINT(readability/nolint)
33
34 /*---------------------------------------------------------------------------------*
35  * Function                                                                                         *
36  *---------------------------------------------------------------------------------*/
37 /**
38  * @brief
39  *   GPS time information data master initialization processing
40  */
41 void VehicleSensInitGpsTimeRawG(void) {
42     SENSOR_GPSTIME_RAW  st_gps_time_raw;
43
44     memset(&gstGpsTimeRaw_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
45
46     /** Data ID setting */
47     gstGpsTimeRaw_g.ul_did    = POSHAL_DID_GPS_TIME_RAW;
48     /** Data size setting */
49     gstGpsTimeRaw_g.us_size    = sizeof(SENSOR_GPSTIME_RAW);
50     /** Data content setting */
51     memset(&st_gps_time_raw, 0x00, sizeof(st_gps_time_raw));
52     memcpy(&gstGpsTimeRaw_g.uc_data[0], &st_gps_time_raw, sizeof(st_gps_time_raw));
53
54     return;
55 }
56
57 /**
58  * @brief
59  *   Raw GPS Time Data Master SET Processing
60  *
61  * @param[in]  SENSOR_GPSTIME_RAW*
62  *
63  * @return     u_int8
64  */
65 u_int8 VehicleSensSetGpsTimeRawG(const SENSOR_GPSTIME_RAW *pst_gps_time_raw) {
66     u_int8  uc_ret;
67     VEHICLESENS_DATA_MASTER      *pst_master;
68
69     pst_master = &gstGpsTimeRaw_g;
70
71     /** With the contents of the current data master,Compare received data */
72     uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_gps_time_raw, sizeof(SENSOR_GPSTIME_RAW));
73
74     /** Received data is set in the data master. */
75     pst_master->ul_did    = POSHAL_DID_GPS_TIME_RAW;
76     pst_master->us_size    = sizeof(SENSOR_GPSTIME_RAW);
77     pst_master->uc_rcvflag  = VEHICLE_RCVFLAG_ON;
78     memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
79     memcpy(pst_master->uc_data, pst_gps_time_raw, sizeof(SENSOR_GPSTIME_RAW));
80
81     FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__, 
82         "year=%04d, month=%02d, date=%02d, hour=%02d, minute=%02d, second=%02d, tdsts=%d",
83         pst_gps_time_raw->utc.year, pst_gps_time_raw->utc.month, pst_gps_time_raw->utc.date,
84         pst_gps_time_raw->utc.hour, pst_gps_time_raw->utc.minute,
85         pst_gps_time_raw->utc.second, pst_gps_time_raw->tdsts);
86     return(uc_ret);
87 }
88
89 /**
90  * @brief
91  *   Raw GPS time information data master GET processing
92  *
93  * @param[out]  SENSOR_MSG_GPSDATA_DAT*
94  */
95 void VehicleSensGetGpsTimeRawG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
96     const VEHICLESENS_DATA_MASTER *pst_master;
97
98     pst_master = &gstGpsTimeRaw_g;
99
100     /* Store the data master in the specified destination. */
101     pst_data->ul_did    = pst_master->ul_did;
102     pst_data->us_size    = pst_master->us_size;
103     pst_data->uc_rcv_flag  = pst_master->uc_rcvflag;
104     memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);
105
106     return;
107 }