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_MotionSpeed_g.cpp
21 * Vehicle Speed Information Data Master Management(NMEA information)
24 /*---------------------------------------------------------------------------------*
26 *---------------------------------------------------------------------------------*/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
29 #include "CommonDefine.h"
31 /*---------------------------------------------------------------------------------*
33 *---------------------------------------------------------------------------------*/
34 static VEHICLESENS_DATA_MASTER gstMotionSpeed_g; // NOLINT(readability/nolint)
36 /*---------------------------------------------------------------------------------*
38 *---------------------------------------------------------------------------------*/
41 * Speed information data master initialization process(NMEA information)
43 void VehicleSensInitMotionSpeedG(void) {
44 SENSORMOTION_SPEEDINFO_DAT st_speed;
46 memset(&gstMotionSpeed_g, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
48 /** Data ID setting */
49 gstMotionSpeed_g.ul_did = VEHICLE_DID_MOTION_SPEED;
50 /** Data size setting */
51 gstMotionSpeed_g.us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
52 /** Data content setting */
53 memset(&st_speed, 0x00, sizeof(st_speed));
54 st_speed.getMethod = SENSOR_GET_METHOD_GPS;
55 st_speed.SyncCnt = 0x00;
56 st_speed.isEnable = SENSORMOTION_STATUS_DISABLE;
57 memcpy(&gstMotionSpeed_g.uc_data[0], &st_speed, sizeof(st_speed));
62 * Rate information data master SET process(NMEA information)
64 * @param[in] *pst_speed - SENSORMOTION_SPEEDINFO_DAT Pointer to vehicle speed information
66 * @return VEHICLESENS_EQ : No data change<br>
67 * VEHICLESENS_NEQ : Data change
69 u_int8 VehicleSensSetMotionSpeedG(const SENSORMOTION_SPEEDINFO_DAT *pst_speed) { // LCOV_EXCL_START 8: dead code.
70 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
72 VEHICLESENS_DATA_MASTER *pst_master;
74 pst_master = &gstMotionSpeed_g;
76 /** With the contents of the current data master,Compare received data */
77 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
79 /** Received data is set in the data master. */
80 pst_master->ul_did = VEHICLE_DID_MOTION_SPEED;
81 pst_master->us_size = sizeof(SENSORMOTION_SPEEDINFO_DAT);
82 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
83 memset(pst_master->uc_data, 0x00, sizeof(pst_master->uc_data));
84 memcpy(pst_master->uc_data, pst_speed, sizeof(SENSORMOTION_SPEEDINFO_DAT));
91 * Speed information data master GET processing(NMEA information)
93 * @param[out] *pst_speed - VEHICLESENS_DATA_MASTER Pointer to the data master acquisition destination
95 void VehicleSensGetMotionSpeedG(VEHICLESENS_DATA_MASTER *pst_data) {
96 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
97 const VEHICLESENS_DATA_MASTER *pst_master;
99 pst_master = &gstMotionSpeed_g;
101 /* Store the data master in the specified destination. */
102 pst_data->ul_did = pst_master->ul_did;
103 pst_data->us_size = pst_master->us_size;
104 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
105 memcpy(pst_data->uc_data, pst_master->uc_data, pst_master->us_size);