2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * VehicleSens_Did_GpsNmea_g.cpp
23 /*---------------------------------------------------------------------------------*
25 *---------------------------------------------------------------------------------*/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
31 /*---------------------------------------------------------------------------------*
33 *---------------------------------------------------------------------------------*/
34 static VEHICLESENS_DATA_MASTER_GPS_FORMAT gstGpsNmea_g; // NOLINT(readability/nolint)
38 * Vehicle sensor GPS_NMEA initialization processing
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;
48 * Vehicle sensor GPS_NMEA SET processing
50 * @param[in] Pointer to received message data
52 * @return VEHICLESENS_EQ No data change<BR>
53 * VEHICLESENS_NEQ Data change
55 u_int8 VehicleSensSetGpsNmeaG(const SENSOR_MSG_GPSDATA_DAT *pst_data) {
57 VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
59 pst_master = &gstGpsNmea_g;
61 /* Compare data master and received data */
62 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
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);
75 * Vehicle sensor GPS_NMEA GET processing
77 * @param[out] pst_data Pointer to the data master acquisition destination
79 void VehicleSensGetGpsNmeaG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
80 const VEHICLESENS_DATA_MASTER_GPS_FORMAT *pst_master;
82 pst_master = &gstGpsNmea_g;
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 */