Remove unused directories and files in video_in_hal
[staging/basesystem.git] / service / vehicle / positioning / server / src / Sensor / VehicleSens_Did_Gps_CWORD82_Nmea_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 name    :VehicleSens_Did_Gps_CWORD82_Nmea_g.cpp
19  *  System name    :_CWORD72_
20  *  Subsystem name  :Vehicle sensor process
21  *  Program name  :Vehicle sensor data master(VEHICLE_DID_GPS__CWORD82__FULLBINARY)
22  *  Module configuration  :VehicleSensInitGps_CWORD82_FullBinaryG()  Vehicle sensor GPS__CWORD82__FULLBINARY initialization function
23  *              :VehicleSensSetGps_CWORD82_FullBinaryG()  Vehicle sensor GPS__CWORD82__FULLBINARY SET function
24  *              :VehicleSensGetGps_CWORD82_FullBinaryG()  Vehicle sensor GPS__CWORD82__FULLBINARY GET function
25  ******************************************************************************/
26
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
29 #include "gps_hal.h"
30
31 /*************************************************/
32 /*           Global variable                      */
33 /*************************************************/
34 static  VEHICLESENS_DATA_MASTER_GPS_FORMAT  gstGps_CWORD82_Nmea_g;    // NOLINT(readability/nolint)
35
36 /*******************************************************************************
37 * MODULE    : VehicleSensInitGps_CWORD82_NmeaG
38 * ABSTRACT  : Vehicle sensor GPS__CWORD82__NMEA initialization function
39 * FUNCTION  : GPS__CWORD82__NMEA data master initialization processing
40 * ARGUMENT  : void
41 * NOTE      :
42 * RETURN    : void
43 ******************************************************************************/
44 void VehicleSensInitGps_CWORD82_NmeaG(void) {
45     memset(&gstGps_CWORD82_Nmea_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_FORMAT));
46     gstGps_CWORD82_Nmea_g.ul_did  = VEHICLE_DID_GPS__CWORD82__NMEA;
47     /* _CWORD82_-only format with a fixed magic number */
48     gstGps_CWORD82_Nmea_g.us_size      = 3                        /* NMEA reception flag + GPS antenna connection information + sensor counter */
49                                   + VEHICLE_DSIZE_GPS_NMEA_DRMC
50                                   + VEHICLE_DSIZE_GPS_NMEA_GSA
51                                   + VEHICLE_DSIZE_GPS_NMEA_GSV_1
52                                   + VEHICLE_DSIZE_GPS_NMEA_GSV_2
53                                   + VEHICLE_DSIZE_GPS_NMEA_GSV_3
54                                   + VEHICLE_DSIZE_GPS_NMEA_PJRDC_GP_3;
55 }
56
57 /*******************************************************************************
58 * MODULE    : VehicleSensSetGps_CWORD82_NmeaG
59 * ABSTRACT  : Vehicle sensor GPS_NMEA SET function
60 * FUNCTION  : Update the GPS__CWORD82___CWORD44__GP4 data master
61 * ARGUMENT  : *pst_data : Pointer to CAN received message data
62 * NOTE      :
63 * RETURN    : VEHICLESENS_EQ   : No data change
64 *             VEHICLESENS_NEQ  : Data change
65 *******************************************************************************/
66 u_int8 VehicleSensSetGps_CWORD82_NmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
67     u_int8 uc_ret;
68     VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
69
70     pst_master = &gstGps_CWORD82_Nmea_g;
71
72     /* Compare data master and received data */
73     uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
74
75     /* Received data is set in the data master. */
76     pst_master->ul_did        = pst_data->ul_did;
77     pst_master->us_size       = pst_data->us_size;
78     pst_master->uc_rcvflag    = VEHICLE_RCVFLAG_ON;
79     memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
80
81     return(uc_ret);
82 }
83
84 /*******************************************************************************
85 * MODULE    : VehicleSensGetGps_CWORD82_NmeaG
86 * ABSTRACT  : Vehicle sensor GPS__CWORD82__NMEA GET function
87 * FUNCTION  : GPS__CWORD82__NMEA Provides a data master
88 * ARGUMENT  : *pst_data : Pointer to the data master acquisition destination
89 * NOTE      :
90 * RETURN    : void
91 ******************************************************************************/
92 void VehicleSensGetGps_CWORD82_NmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
93     const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
94
95     pst_master = &gstGps_CWORD82_Nmea_g;
96
97     /* Store the data master in the specified destination. */
98     pst_data->ul_did    = pst_master->ul_did;
99     pst_data->us_size    = pst_master->us_size;
100     pst_data->uc_rcv_flag  = pst_master->uc_rcvflag;
101     memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);  /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
102 }