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.
17 /***************************************************************************
18 @file VehicleSens_Did_Nav_Velned_g.cpp
19 @detail Master vehicle sensor data(VEHICLE_DID_GPS_UBLOX_NAV_VELNED)
20 *****************************************************************************/
22 #include <vehicle_service/positioning_base_library.h>
23 #include "VehicleSens_DataMaster.h"
25 /*************************************************/
27 /*************************************************/
28 static VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT gstNavVelned_g; // NOLINT(readability/nolint)
30 /***************************************************************************
31 @brief NAV-VELNED vehicle sensor initialization function
32 @outline NAV-VELNED initialization process data master
33 @type Completion return type
39 *****************************************************************************/
40 void VehicleSensInitNavVelnedG(void) {
41 memset(&gstNavVelned_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT));
42 gstNavVelned_g.ul_did = VEHICLE_DID_GPS_UBLOX_NAV_VELNED;
43 gstNavVelned_g.us_size = VEHICLE_DSIZE_GPS_UBLOX_NAV_VELNED + VEHICLE_DSIZE_GPS_UBLOX_HEADER_SIZE;
44 gstNavVelned_g.uc_data[0] = VEHICLE_DINIT_GPS_UBLOX_NAV_VELNED;
47 /***************************************************************************
48 @brief NAV-VELNED SET vehicle sensor function
49 @outline To update the master data NAV-VELNED.
50 @type Completion return type
51 @param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : A pointer to the received data message or the direct line
54 @retval VEHICLESENS_EQ : No data changes
55 @retval VEHICLESENS_NEQ : With data changes
57 *****************************************************************************/
58 u_int8 VehicleSensSetNavVelnedG(const SENSOR_MSG_GPSDATA_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
59 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
61 VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
63 pst_master = &gstNavVelned_g;
65 /** Compare data master and received data */
66 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
68 /** Received data is set in the data master. */
69 pst_master->ul_did = pst_data->ul_did;
70 pst_master->us_size = pst_data->us_size;
71 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
72 pst_master->uc_sensor_cnt = pst_data->uc_sns_cnt;
73 pst_master->uc_gpscnt_flag = pst_data->uc_gps_cnt_flag;
75 memcpy(pst_master->uc_data, pst_data->uc_data, pst_data->us_size);
80 /***************************************************************************
81 @brief Vehicle sensor function NAV-VELNED GET
82 @outline Master Data provides the NAV-VELNED
83 @type Completion return type
84 @param[in] SENSOR_MSG_GPSDATA_DAT *pst_data : Where to get a pointer to the data master
89 *****************************************************************************/
90 void VehicleSensGetNavVelnedG(SENSOR_MSG_GPSDATA_DAT *pst_data) {
91 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
92 const VEHICLESENS_DATA_MASTER_GPS_UBLOX_FORMAT *pst_master;
94 pst_master = &gstNavVelned_g;
96 /** Store the data master in the specified destination. */
97 pst_data->ul_did = pst_master->ul_did;
98 pst_data->us_size = pst_master->us_size;
99 pst_data->uc_rcv_flag = pst_master->uc_rcvflag;
100 pst_data->uc_sns_cnt = pst_master->uc_sensor_cnt;
101 pst_data->uc_gps_cnt_flag = pst_master->uc_gpscnt_flag;
102 memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);