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 name :VehicleSens_DeliveryCtrl.cpp
20 * Subsystem name :Vehicle sensor process
21 * Program name :Vehicle Sensor Destination Management
22 * Module configuration VehicleSensInitDeliveryCtrlTbl() Vehicle sensor delivery destination management table initialization function
23 * VehicleSensInitDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management area initialization function
24 * VehicleSensInitPkgDeliveryTblMng() Vehicle Sensor Package Delivery Management Table Initialization Function
25 * VehicleSensEntryDeliveryCtrl() Vehicle sensor delivery destination management registration function
26 * VehicleSensAddDeliveryCtrlTbl() Vehicle sensor delivery destination management table addition function
27 * VehicleSensUpdateDeliveryCtrlTbl() Vehicle sensor delivery destination management table update function
28 * VehicleSensUpdatePkgDeliveryCtrlTbl() Vehicle Sensor Delivery Destination Management Table Package Delivery Data Update Function
29 * VehicleSensAddDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management addition function
30 * VehicleSensUpdateDeliveryCtrlTblMng() Vehicle sensor delivery destination management table management update function
31 * VehicleSensAddPkgDeliveryTblMng() Vehicle Sensor Package Delivery Management Table Additional Function
32 * VehicleSensEntryPkgDeliveryCtrl() Vehicle sensor package delivery management registration function
33 * VehicleSensMakeDeliveryPnoTbl() Vehicle Sensor Destination PNO Table Creation Function
34 * VehicleSensAddPnoTbl() Vehicle Sensor Destination PNO Table Addition Function
35 * VehicleSensDeliveryProc() Vehicle Sensor Data Delivery Process
36 * VehicleSensFirstDelivery() Vehicle Sensor Initial Data Delivery Process
37 * VehicleSensFirstPkgDelivery() Vehicle Sensor Initial Package Data Delivery Process
38 ******************************************************************************/
40 #include <vehicle_service/positioning_base_library.h>
41 #include <vehicle_service/POS_common_API.h>
42 #include <vehicle_service/POS_gps_API.h>
43 #include "VehicleSens_DeliveryCtrl.h"
44 #include "Dead_Reckoning_Local_Api.h"
45 #include "SensorLog.h"
46 #include "POS_private.h"
48 #define VEHICLE_SENS_DELIVERY_CTRL_DEBUG 0
49 #define VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG 0
51 #define GYRO_NORMAL (0U)
52 #define GYRO_ERROR (1U)
53 #define GYRO_UNFIXED (2U)
55 #define _pb_strcat(pdest, psrc, size) (strncat(pdest, psrc, size) , (0))
57 /*************************************************/
59 /*************************************************/
60 static VEHICLESENS_DELIVERY_CTRL_TBL g_stdelivery_ctrl_tbl;
61 static VEHICLESENS_DELIVERY_CTRL_TBL_MNG g_stdelivery_ctrl_tbl_mng;
62 static VEHICLESENS_PKG_DELIVERY_TBL_MNG g_stpkgdelivery_tbl_mng;
63 static VEHICLESENS_DELIVERY_PNO_TBL g_stdelivery_pno_tbl;
65 /* ++ PastModel002 response DR */
66 static VEHICLESENS_DELIVERY_CTRL_TBL g_stdelivery_ctrl_tbl_dr;
67 static VEHICLESENS_DELIVERY_CTRL_TBL_MNG g_stdelivery_ctrl_tbl_mng_dr;
68 static VEHICLESENS_DELIVERY_PNO_TBL g_stdelivery_pno_tbl_dr;
70 /* -- PastModel002 response DR */
72 #if CONFIG_HW_PORTSET_TYPE_C
73 u_int16 gusSeqNum; /* Sequence number for split transmission */
76 /*******************************************************************************
77 * MODULE : VehicleSensInitDeliveryCtrlTbl
78 * ABSTRACT : Vehicle sensor delivery destination management table initialization function
79 * FUNCTION : Delivery destination management table initialization processing
82 ******************************************************************************/
83 void VehicleSensInitDeliveryCtrlTbl(void) {
84 memset(&g_stdelivery_ctrl_tbl, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL));
87 /*******************************************************************************
88 * MODULE : VehicleSensInitDeliveryCtrlTblMng
89 * ABSTRACT : Vehicle Sensor DR Internal Delivery Destination Management Table Management Area Initialization Function
90 * FUNCTION : Delivery destination management table management area initialization processing
94 ******************************************************************************/
95 void VehicleSensInitDeliveryCtrlTblMng(void) {
96 memset(&g_stdelivery_ctrl_tbl_mng, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL_MNG));
99 /* ++ PastModel002 response DR */
100 /*******************************************************************************
101 * MODULE : VehicleSensInitDeliveryCtrlTblDR
102 * ABSTRACT : Vehicle sensor delivery destination management table initialization function
103 * FUNCTION : DR distribution target management table initialization processing
106 ******************************************************************************/
107 void VehicleSensInitDeliveryCtrlTblDR(void) { // LCOV_EXCL_START 8: dead code.
108 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
109 memset(&g_stdelivery_ctrl_tbl_dr, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL));
113 /*******************************************************************************
114 * MODULE : VehicleSensInitDeliveryCtrlTblMngDR
115 * ABSTRACT : Vehicle sensor delivery destination management table management area initialization function
116 * FUNCTION : Initialization processing for the management table area of the delivery destination management table for DR
120 ******************************************************************************/
121 void VehicleSensInitDeliveryCtrlTblMngDR(void) { // LCOV_EXCL_START 8 : dead code
122 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
123 memset(&g_stdelivery_ctrl_tbl_mng_dr, 0x00, sizeof(VEHICLESENS_DELIVERY_CTRL_TBL_MNG));
127 /* -- PastModel002 response DR */
129 /*******************************************************************************
130 * MODULE : VehicleSensInitPkgDeliveryTblMng
131 * ABSTRACT : Vehicle Sensor Package Delivery Management Table Initialization Function
132 * FUNCTION : Delivery Package Management Table Initialization Processing
136 ******************************************************************************/
137 void VehicleSensInitPkgDeliveryTblMng(void) {
138 memset(&g_stpkgdelivery_tbl_mng, 0x00, sizeof(VEHICLESENS_PKG_DELIVERY_TBL_MNG));
141 #if CONFIG_HW_PORTSET_TYPE_C
142 /*******************************************************************************
143 * MODULE : VehicleSensInitSeqNum
144 * ABSTRACT : Sequence number initialization function for split transmission
145 * FUNCTION : Sequence number initialization processing for split transmission
149 ******************************************************************************/
150 void VehicleSensInitSeqNum(void) {
155 /*******************************************************************************
156 * MODULE : VehicleSensEntryDeliveryCtrl
157 * ABSTRACT : Vehicle sensor delivery destination management registration function
158 * FUNCTION : Shipping management table,Update the shipping management table management.
159 * ARGUMENT : pst_delivery_entry : Pointer to the delivery registration information
161 * RETURN : VEHICLE_RET_NORMAL :Successful registration
162 ******************************************************************************/
163 VEHICLE_RET_API VehicleSensEntryDeliveryCtrl(const VEHICLE_MSG_DELIVERY_ENTRY *pst_delivery_entry) {
165 u_int8 uc_action_type = VEHICLESENS_ACTION_TYPE_ADD;
167 DID ulentry_did = pst_delivery_entry->data.did;
168 VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data = NULL;
169 VEHICLE_RET_API ret = VEHICLE_RET_NORMAL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
170 BOOL bexist_flag = FALSE;
172 /* Check if the data ID exists. */
173 uc_did_flag = VehicleSensCheckDid(ulentry_did);
174 if (uc_did_flag == 0) { // LCOV_EXCL_BR_LINE 6:alway be 1
175 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
177 ret = VEHICLE_RET_ERROR_DID; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */ // LCOV_EXCL_LINE 8: dead code // NOLINT(whitespace/line_length)
180 /* Check the number of registered shipments. */
181 if ((ret == VEHICLE_RET_NORMAL) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
182 (g_stdelivery_ctrl_tbl.us_dnum >= VEHICLESENS_DELIVERY_INFO_MAX)) {
183 /* Return the FULL of delivery registrations*/
184 ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
187 if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
188 /* Duplicate delivery registration check*/
189 for (i = 0; i < g_stdelivery_ctrl_tbl.us_dnum; i++) {
190 if ((g_stdelivery_ctrl_tbl.st_ctrl_data[i].ul_did == ulentry_did) &&
191 (g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pno == pst_delivery_entry->data.pno) &&
192 (g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_method == VEHICLESENS_DELIVERY_METHOD_NORMAL)) {
193 /* When the same shipping address (PNO) and shipping DID are already registered,Update registration information and exit */
194 g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_chg_type = pst_delivery_entry->data.delivery_timing;
200 if (bexist_flag == TRUE) {
201 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
202 "Duplicate DID=0x%x PNO=0x%x ChgType=%d",
204 pst_delivery_entry->data.pno,
205 pst_delivery_entry->data.delivery_timing);
207 /* By searching for the delivery registration of the relevant DID,Hold the address. */
208 for (i = 0; i < g_stdelivery_ctrl_tbl_mng.us_dnum; i++) {
209 if (g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ulentry_did) {
210 uc_action_type = VEHICLESENS_ACTION_TYPE_UPDATE;
211 pst_existing_mng_data = &g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i];
214 /* Add to the shipping management table.*/
215 VehicleSensAddDeliveryCtrlTbl(pst_delivery_entry);
217 /* Processing when updating existing data*/
218 if (uc_action_type == VEHICLESENS_ACTION_TYPE_UPDATE) {
219 /* Update the shipping management table.*/
220 VehicleSensUpdateDeliveryCtrlTbl(pst_existing_mng_data);
222 /* Update the shipping destination management table management information.*/
223 VehicleSensUpdateDeliveryCtrlTblMng(pst_existing_mng_data);
224 } else { /* Newly added processing*/
225 /* Add to the shipping management table management information.*/
226 VehicleSensAddDeliveryCtrlTblMng(pst_delivery_entry);
230 return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
233 /*******************************************************************************
234 * MODULE : VehicleSensAddDeliveryCtrlTbl
235 * ABSTRACT : Vehicle sensor delivery destination management table addition function
236 * FUNCTION : Add to the shipping management table.
237 * ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
240 ******************************************************************************/
241 void VehicleSensAddDeliveryCtrlTbl(const VEHICLE_MSG_DELIVERY_ENTRY *pst_delivery_entry) {
242 VEHICLESENS_DELIVERY_CTRL_TBL_DATA *pst_ctrl_data;
244 pst_ctrl_data = &g_stdelivery_ctrl_tbl.st_ctrl_data[g_stdelivery_ctrl_tbl.us_dnum];
245 pst_ctrl_data->ul_did = pst_delivery_entry->data.did;
246 pst_ctrl_data->us_pno = pst_delivery_entry->data.pno;
247 pst_ctrl_data->uc_chg_type = pst_delivery_entry->data.delivery_timing;
248 pst_ctrl_data->uc_ctrl_flg = pst_delivery_entry->data.ctrl_flg;
249 pst_ctrl_data->us_link_idx = VEHICLESENS_LINK_INDEX_END;
250 pst_ctrl_data->us_pkg_start_idx = VEHICLESENS_LINK_INDEX_END;
251 pst_ctrl_data->us_pkg_end_idx = VEHICLESENS_LINK_INDEX_END;
252 pst_ctrl_data->uc_method = VEHICLESENS_DELIVERY_METHOD_NORMAL;
253 g_stdelivery_ctrl_tbl.us_dnum = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum + 1);
256 /*******************************************************************************
257 * MODULE : VehicleSensUpdateDeliveryCtrlTbl
258 * ABSTRACT : Vehicle sensor delivery destination management table update function
259 * FUNCTION : Update the shipping management table.
260 * ARGUMENT : *pstExistingMngData : Pointer to the previous data information with the same data ID
263 ******************************************************************************/
264 void VehicleSensUpdateDeliveryCtrlTbl(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) {
265 /* Ignore->MISRA-C++:2008 Rule 7-1-2 */
266 /* Update Link Index Only.
267 For indexes of usEndIdx values matching the data IDs in the target management table
268 Making usLinkIdx an Index-Registered Index */
269 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
270 g_stdelivery_ctrl_tbl.st_ctrl_data[pst_existing_mng_data->us_end_idx].us_link_idx =
271 static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
274 /*******************************************************************************
275 * MODULE : VehicleSensUpdatePkgDeliveryCtrlTbl
276 * ABSTRACT : Vehicle Sensor Delivery Destination Management Table Package Delivery Data Update Function
277 * FUNCTION : Updating Package Delivery Data in the Destination Management Table.
278 * ARGUMENT : us_dnum : Number of data items in the package delivery management table
279 * : us_pkg_num : Number of packages to create
282 ******************************************************************************/
283 void VehicleSensUpdatePkgDeliveryCtrlTbl(u_int16 us_dnum, u_int16 us_pkg_num) {
284 VEHICLESENS_DELIVERY_CTRL_TBL_DATA *pst_ctrl_data;
285 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
286 pst_ctrl_data = &g_stdelivery_ctrl_tbl.st_ctrl_data[g_stdelivery_ctrl_tbl.us_dnum - 1];
287 pst_ctrl_data->us_pkg_start_idx = us_dnum;
288 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
289 pst_ctrl_data->us_pkg_end_idx = static_cast<u_int16>(us_dnum + us_pkg_num - 1);
290 pst_ctrl_data->uc_method = VEHICLESENS_DELIVERY_METHOD_PACKAGE;
293 /*******************************************************************************
294 * MODULE : VehicleSensAddDeliveryCtrlTblMng
295 * ABSTRACT : Vehicle sensor delivery destination management table management addition function
296 * FUNCTION : Add to the shipping management table management.
297 * ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
300 ******************************************************************************/
301 void VehicleSensAddDeliveryCtrlTblMng(const VEHICLE_MSG_DELIVERY_ENTRY *pst_delivery_entry) {
302 VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_ctrl_mng_data;
304 pst_ctrl_mng_data = &g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[g_stdelivery_ctrl_tbl_mng.us_dnum];
305 pst_ctrl_mng_data->ul_did = pst_delivery_entry->data.did;
306 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
307 pst_ctrl_mng_data->us_start_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1);
308 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
309 pst_ctrl_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1);
310 pst_ctrl_mng_data->usdlvry_entry_num++;
311 g_stdelivery_ctrl_tbl_mng.us_dnum++;
314 /*******************************************************************************
315 * MODULE : VehicleSensUpdateDeliveryCtrlTblMng
316 * ABSTRACT : Vehicle sensor delivery destination management table management update function
317 * FUNCTION : Update the shipping management table management.
318 * ARGUMENT : *pst_existing_mng_data : Pointer to the previous data information with the same data ID
321 ******************************************************************************/
322 void VehicleSensUpdateDeliveryCtrlTblMng(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) {
323 /* Update only the end index and the number of registered shipping destinations. */
324 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
325 pst_existing_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl.us_dnum - 1);
326 pst_existing_mng_data->usdlvry_entry_num++;
329 /*******************************************************************************
330 * MODULE : VehicleSensAddPkgDeliveryTblMng
331 * ABSTRACT : Vehicle Sensor Package Delivery Management Table Additional Function
332 * FUNCTION : Add to the shipping management table management.
333 * ARGUMENT : *pst_pkg : Pointer to package delivery registration information
336 ******************************************************************************/
337 void VehicleSensAddPkgDeliveryTblMng(const SENSOR_MSG_DELIVERY_ENTRY *pst_pkg) {
338 int32 i; /* Generic counters */
340 /* Data ID registration */
341 /* Registration of delivery data index */
342 for (i = 0; i < (pst_pkg->data.pkg_num); i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
343 g_stpkgdelivery_tbl_mng.st_pkg_data[g_stpkgdelivery_tbl_mng.us_dnum].ul_did = pst_pkg->data.did[i];
344 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
345 g_stpkgdelivery_tbl_mng.st_pkg_data[g_stpkgdelivery_tbl_mng.us_dnum].usdlvry_idx = \
346 static_cast<u_int16>(g_stpkgdelivery_tbl_mng.us_dnum + 1);
347 g_stpkgdelivery_tbl_mng.us_dnum++;
349 /* The final delivery data index overwrites the terminating code */
350 g_stpkgdelivery_tbl_mng.st_pkg_data[g_stpkgdelivery_tbl_mng.us_dnum - 1].usdlvry_idx = VEHICLESENS_LINK_INDEX_END;
353 /*******************************************************************************
354 * MODULE : VehicleSensEntryPkgDeliveryCtrl
355 * ABSTRACT : Vehicle sensor package delivery management registration function
356 * FUNCTION : Shipping management table,Destination management table management,Update the package delivery management table.
357 * ARGUMENT : *pst_pkg : Pointer to package delivery registration information
359 * RETURN : VEHICLE_RET_NORMAL : Successful registration
360 ******************************************************************************/
361 VEHICLE_RET_API VehicleSensEntryPkgDeliveryCtrl(const SENSOR_MSG_DELIVERY_ENTRY *pst_pkg ,
362 u_int8 uc_ext_chk) { /* Ignore->MISRA-C++:2008 Rule 6-6-5 */
365 u_int8 uc_action_type = VEHICLESENS_ACTION_TYPE_ADD;
366 VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data = NULL;
367 VEHICLE_MSG_DELIVERY_ENTRY st_delivery_entry;
368 u_int16 us_boundary_adj; /* For boundary adjustment */
369 u_int16 us_next_offset; /* For size calculation */
370 VEHICLE_RET_API ret = VEHICLE_RET_NORMAL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
371 BOOL bexist_flag = FALSE;
373 /* Check if the data ID exists. */
374 for (i = 0; i < (pst_pkg->data.pkg_num); i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
375 if (VEHICLESENS_INVALID == VehicleSensCheckDid(pst_pkg->data.did[i])) { // LCOV_EXCL_BR_LINE 200: always Valid
376 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
377 ret = VEHICLE_RET_ERROR_DID; // // LCOV_EXCL_LINE 8 :dead code
378 /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
382 /* Check the number of registered shipments. */
383 if ((ret == VEHICLE_RET_NORMAL) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
384 (VEHICLESENS_DELIVERY_INFO_MAX <= g_stdelivery_ctrl_tbl.us_dnum)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
385 /* Return the FULL of delivery registrations*/
386 ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
389 /* Check the number of registered package shipments. */
390 if ((ret == VEHICLE_RET_NORMAL) && /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
391 (VEHICLESENS_PKG_DELIVERY_INFO_MAX < (g_stpkgdelivery_tbl_mng.us_dnum + pst_pkg->data.pkg_num))) {
392 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
393 /* Return the FULL of delivery registrations*/
394 ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
397 if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
398 /* Check that the size of the buffer to be delivered does not exceed the maximum size. */
399 /* For boundary adjustment */
400 us_boundary_adj = (u_int16)VEHICLESENS_BIT1 | (u_int16)VEHICLESENS_BIT0;
401 for (i = 0; i < pst_pkg->data.pkg_num; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
403 /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
404 #if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
405 if (uc_ext_chk == VEHICLESENS_EXT_OFF) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */ // LCOV_EXCL_BR_LINE 200: VEHICLESENS_EXT_OFF passed in function is dead code // NOLINT(whitespace/line_length)
406 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
407 us_next_offset = VehicleSensGetDataMasterOffset(pst_pkg->data.did[i]); // LCOV_EXCL_LINE 8: dead code
409 us_next_offset = VehicleSensGetDataMasterExtOffset(pst_pkg->data.did[i]);
412 us_next_offset = VehicleSensGetDataMasterOffset(pst_pkg->data.did[i]);
414 /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
415 /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
416 if ((us_next_offset & us_boundary_adj) != 0) {
417 /* If you need to adjust */
418 /* Mask Lower Bit Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
419 us_next_offset = static_cast<u_int16>(us_next_offset & ~us_boundary_adj);
420 us_next_offset = static_cast<u_int16>(us_next_offset + (u_int16)VEHICLESENS_BIT2); /* Add numbers */
422 us_size = static_cast<u_int16>(us_size + us_next_offset); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
424 if (SENSOR_VSINFO_DSIZE < us_size) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
425 /* Return the FULL of delivery registrations(Exceed the size of the buffer to be delivered due to the combination of packages)*/
426 ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
430 if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
431 for (i = 0; i < g_stdelivery_ctrl_tbl.us_dnum; i++) {
432 if ((g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pno == pst_pkg->data.pno) &&
433 (g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_method == VEHICLESENS_DELIVERY_METHOD_PACKAGE)) {
434 /* When the same shipping address (PNO) is already registered,Update registration information and exit */
435 g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_chg_type = pst_pkg->data.delivery_timing;
441 if (bexist_flag == TRUE) {
442 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Duplicate PNO=0x%x ChgType=%d",
443 pst_pkg->data.pno, pst_pkg->data.delivery_timing);
445 /* By searching for the delivery registration of the relevant DID,Hold the address. */
446 for (i = 0; i < g_stdelivery_ctrl_tbl_mng.us_dnum; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
447 if (g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did == pst_pkg->data.did[0]) {
448 uc_action_type = VEHICLESENS_ACTION_TYPE_UPDATE;
449 pst_existing_mng_data = &g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i];
452 /* Type conversion,And copies of the data section(Because the header is unused,Not involved) */
453 memset(reinterpret_cast<void *>(&st_delivery_entry),
454 static_cast<int32>(0),
455 (size_t)sizeof(VEHICLE_MSG_DELIVERY_ENTRY));
456 st_delivery_entry.data.did = pst_pkg->data.did[0];
457 st_delivery_entry.data.pno = pst_pkg->data.pno;
458 st_delivery_entry.data.delivery_timing = pst_pkg->data.delivery_timing;
459 st_delivery_entry.data.ctrl_flg = pst_pkg->data.ctrl_flg;
460 st_delivery_entry.data.event_id = pst_pkg->data.event_id;
461 /* Add to the shipping management table.*/
462 VehicleSensAddDeliveryCtrlTbl(&st_delivery_entry);
464 /* Processing when updating existing data*/
465 /* Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
466 if (uc_action_type == VEHICLESENS_ACTION_TYPE_UPDATE) {
467 /* Update the shipping management table.*/
468 VehicleSensUpdateDeliveryCtrlTbl(pst_existing_mng_data);
470 /* Update the shipping destination management table management information.*/
471 VehicleSensUpdateDeliveryCtrlTblMng(pst_existing_mng_data);
472 } else { /* Newly added processing*/
473 /* Add to the shipping management table management information.*/
474 VehicleSensAddDeliveryCtrlTblMng(&st_delivery_entry);
477 /* Updating Package Relationship Data in the Destination Management Table.*/
478 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
479 VehicleSensUpdatePkgDeliveryCtrlTbl(g_stpkgdelivery_tbl_mng.us_dnum, pst_pkg->data.pkg_num);
480 /* Add to the package delivery management table.*/
481 VehicleSensAddPkgDeliveryTblMng(pst_pkg);
485 return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
488 /*******************************************************************************
489 * MODULE : VehicleSensMakeDeliveryPnoTbl
490 * ABSTRACT : Vehicle sensor delivery destination PNO table creation function
491 * FUNCTION : Create the shipping destination PNO table
492 * ARGUMENT : ul_did Data ID
493 * Change_type Delivery Trigger
495 * RETURN : VEHICLESENS_DELIVERY_PNO_TBL* Pointer to the shipping PNO table
496 ******************************************************************************/
497 VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTbl(DID ul_did, u_int8 change_type) {
499 u_int8 uc_ctrl_tbl_mng_data_list;
500 u_int16 us_index = 0;
503 /* Get the start index and count of the corresponding data ID. */
504 uc_ctrl_tbl_mng_data_list = static_cast<u_int8>(
505 (sizeof(g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data)) /
506 (sizeof(g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[0])));
507 for (i = 0; i < uc_ctrl_tbl_mng_data_list; i++) {
508 /* Stores the information of the corresponding DID.. */
509 if (g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did == ul_did) {
510 us_index = g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].us_start_idx;
511 us_dnum = g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].usdlvry_entry_num;
516 /* Create a PNO list */
517 g_stdelivery_pno_tbl.us_dnum = 0;
518 if (change_type == VEHICLESENS_CHGTYPE_CHG) {
519 /* Processing when delivery timing is changed*/
520 for (i = 0; i < us_dnum; i++) {
521 /* Functionalization by Increasing Structure Members */
522 VehicleSensAddPnoTbl(us_index);
523 us_index = g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_link_idx;
526 /* Processing when delivery timing is update */
527 for (i = 0; i < us_dnum; i++) {
528 if (VEHICLE_DELIVERY_TIMING_UPDATE == g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].uc_chg_type) {
529 /* Functionalization by Increasing Structure Members */
530 VehicleSensAddPnoTbl(us_index);
532 us_index = g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_link_idx;
535 return(&g_stdelivery_pno_tbl);
538 /*******************************************************************************
539 * MODULE : VehicleSensAddPnoTbl
540 * ABSTRACT : Vehicle Sensor Destination PNO Table Addition Function
541 * FUNCTION : Add to the shipping PNO table.
542 * ARGUMENT : us_index : Index of the referenced destination management table
545 ******************************************************************************/
546 void VehicleSensAddPnoTbl(u_int16 us_index) {
547 u_int16 us_pno_tbl_idx;
549 us_pno_tbl_idx = g_stdelivery_pno_tbl.us_dnum;
550 g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].us_pno = \
551 g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_pno;
552 g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].us_pkg_start_idx = \
553 g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_pkg_start_idx;
554 g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].us_pkg_end_idx = \
555 g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].us_pkg_end_idx;
556 g_stdelivery_pno_tbl.st_pno_data[us_pno_tbl_idx].uc_method = \
557 g_stdelivery_ctrl_tbl.st_ctrl_data[us_index].uc_method;
558 g_stdelivery_pno_tbl.us_dnum++;
561 /*******************************************************************************
562 * MODULE : VehicleSensDeliveryGPS
563 * ABSTRACT : Vehicle Sensor Data Delivery Process
564 * FUNCTION : Deliver data to a destination.
565 * ARGUMENT : ul_did :Data ID
566 * uc_chg_type :Delivery timing
567 * uc_get_method :Acquisition method
570 ******************************************************************************/
571 u_int8 VehicleSensDeliveryGPS(DID ul_did, u_int8 uc_get_method, u_int8 uc_current_get_method, int32 pno_index,
573 VEHICLESENS_DATA_MASTER* stmaster,
574 const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) {
575 #if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
576 SENSORLOCATION_MSG_LONLATINFO *plonlat_msg;
577 SENSORLOCATION_MSG_ALTITUDEINFO *paltitude_msg;
578 SENSORMOTION_MSG_HEADINGINFO *pheading_msg;
581 SENSOR_MSG_GPSDATA_DAT gps_master;
582 VEHICLESENS_DELIVERY_FORMAT delivery_data;
585 RET_API ret = RET_NORMAL; /* API return value */
586 u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
588 VehicleSensGetGpsDataMaster(ul_did, uc_current_get_method, &gps_master);
590 if (ul_did == POSHAL_DID_GPS_TIME) {
591 /* GPS time,Because there is no header in the message to be delivered,
592 Padding deliveryData headers */
593 (void)memcpy(reinterpret_cast<void*>(&delivery_data),
594 reinterpret_cast<void*>(&gps_master.uc_data[0]), gps_master.us_size);
595 length = gps_master.us_size;
596 senslog_len = length;
597 *cid = CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME;
598 } else if (ul_did == VEHICLE_DID_LOCATION_LONLAT) {
599 plonlat_msg = reinterpret_cast<SENSORLOCATION_MSG_LONLATINFO*>(&delivery_data);
600 /* Acquire the applicable data information from the data master..*/
601 VehicleSensGetDataMaster(ul_did, uc_current_get_method, stmaster);
602 (void)memcpy(reinterpret_cast<void*>(&(plonlat_msg->data)),
603 reinterpret_cast<void*>(&(stmaster->uc_data[0])), stmaster->us_size);
604 length = (u_int16)(stmaster->us_size);
605 senslog_len = length;
606 *cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
607 } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE) {
608 paltitude_msg = reinterpret_cast<SENSORLOCATION_MSG_ALTITUDEINFO*>(&delivery_data);
609 /* Acquire the applicable data information from the data master..*/
610 VehicleSensGetDataMaster(ul_did, uc_get_method, stmaster);
611 (void)memcpy(reinterpret_cast<void*>(&(paltitude_msg->data)),
612 reinterpret_cast<void*>(&stmaster->uc_data[0]), stmaster->us_size);
613 length = (u_int16)(stmaster->us_size);
614 senslog_len = length;
615 *cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE;
616 } else if (ul_did == VEHICLE_DID_MOTION_HEADING) {
617 pheading_msg = reinterpret_cast<SENSORMOTION_MSG_HEADINGINFO*>(&delivery_data);
618 /* Acquire the applicable data information from the data master..*/
619 VehicleSensGetDataMaster(ul_did, uc_get_method, stmaster);
620 (void)memcpy(reinterpret_cast<void*>(&(pheading_msg->data)),
621 reinterpret_cast<void*>(&stmaster->uc_data[0]), stmaster->us_size);
622 length = (u_int16)(stmaster->us_size);
623 senslog_len = length;
624 *cid = CID_POSIF_REGISTER_LISTENER_HEADING;
626 delivery_data.header.did = gps_master.ul_did;
627 delivery_data.header.size = gps_master.us_size;
628 delivery_data.header.rcv_flag = gps_master.uc_rcv_flag;
629 delivery_data.header.sensor_cnt = gps_master.uc_sns_cnt;
630 (void)memcpy(reinterpret_cast<void *>(&delivery_data.data[0]),
631 reinterpret_cast<void *>(&gps_master.uc_data[0]),
632 (size_t)delivery_data.header.size);
634 length = static_cast<u_int16>((u_int16)sizeof(delivery_data.header) + \
635 delivery_data.header.size);
636 senslog_len = delivery_data.header.size;
637 *cid = CID_VEHICLESENS_VEHICLE_INFO;
640 /* Call Vehicle Sensor Information Notification Transmission Process.*/
641 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
642 pst_pno_tbl->st_pno_data[pno_index].us_pno,
643 static_cast<CID>(*cid),
645 (const void *)&delivery_data);
646 uc_result = SENSLOG_RES_SUCCESS;
647 if (ret != RET_NORMAL) {
648 uc_result = SENSLOG_RES_FAIL;
650 if (*cid != CID_VEHICLESENS_VEHICLE_INFO) {
651 SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did,
652 pst_pno_tbl->st_pno_data[pno_index].us_pno,
653 reinterpret_cast<uint8_t *>(&delivery_data),
654 senslog_len, uc_result);
656 SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did,
657 pst_pno_tbl->st_pno_data[pno_index].us_pno,
658 reinterpret_cast<uint8_t *>(&(delivery_data.data[0])),
659 senslog_len, uc_result);
664 u_int8 VehicleSensDeliveryFst(DID ul_did, u_int8 uc_get_method, int32 pno_index,
665 const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) {
666 VEHICLESENS_DATA_MASTER_FST st_master_fst; /* Master of initial sensor data */
667 VEHICLESENS_DATA_MASTER_FST st_master_fst_temp; /* For temporary storage */
669 RET_API ret = RET_NORMAL; /* API return value */
670 u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
671 (void)memset(reinterpret_cast<void *>(&st_master_fst),
673 sizeof(VEHICLESENS_DATA_MASTER_FST));
674 (void)memset(reinterpret_cast<void *>(&st_master_fst_temp),
676 sizeof(VEHICLESENS_DATA_MASTER_FST));
677 VehicleSensGetDataMasterFst(ul_did, uc_get_method, &st_master_fst);
678 if (st_master_fst.partition_flg == 1) {
679 /* When the partitioning flag is enabled,Or exceeds the size that can be sent,Perform split transmission */
680 memcpy(&st_master_fst_temp, &st_master_fst, sizeof(VEHICLESENS_DATA_MASTER_FST));
681 if ((ul_did == POSHAL_DID_GYRO_X_FST) || /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
682 (ul_did == POSHAL_DID_GYRO_Y_FST) ||
683 (ul_did == POSHAL_DID_GYRO_Z_FST) ||
684 (ul_did == POSHAL_DID_GSNS_X_FST) ||
685 (ul_did == POSHAL_DID_GSNS_Y_FST) ||
686 (ul_did == POSHAL_DID_GSNS_Z_FST)) {
688 /* Call Vehicle Sensor Information Notification Transmission Process.*/
689 /* Size of data that can be transmitted in one division(Same size definition used)*/
690 st_master_fst_temp.us_size = LSDRV_FSTSNS_DSIZE_GYRO_X;
691 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
692 pst_pno_tbl->st_pno_data[pno_index].us_pno,
693 CID_VEHICLESENS_VEHICLE_INFO,
694 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
695 static_cast<u_int16>(st_master_fst_temp.us_size + 8),
696 (const void *)&st_master_fst_temp);
697 uc_result = SENSLOG_RES_SUCCESS;
698 if (ret != RET_NORMAL) {
699 uc_result = SENSLOG_RES_FAIL;
701 SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
703 pst_pno_tbl->st_pno_data[pno_index].us_pno,
704 reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
705 st_master_fst_temp.us_size,
709 /* Call Vehicle Sensor Information Notification Transmission Process.*/
710 (void)memset(reinterpret_cast<void *>(&st_master_fst_temp.uc_data[0]),
712 sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
713 /* Size of the data - Transmission size(Same size definition used)Ignore->MISRA-C++:2008 Rule 5-0-5 */
714 st_master_fst_temp.us_size = static_cast<u_int16>(st_master_fst.us_size - \
715 LSDRV_FSTSNS_DSIZE_GYRO_X);
716 memcpy(&st_master_fst_temp.uc_data[0],
717 &st_master_fst.uc_data[LSDRV_FSTSNS_DSIZE_GYRO_X],
718 st_master_fst_temp.us_size);
719 /* Ignore->MISRA-C++:2008 Rule 5-0-5 #Coverity_19347 */
720 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
721 pst_pno_tbl->st_pno_data[pno_index].us_pno,
722 CID_VEHICLESENS_VEHICLE_INFO,
723 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
724 static_cast<u_int16>(st_master_fst_temp.us_size + 8),
725 (const void *)&st_master_fst_temp);
726 uc_result = SENSLOG_RES_SUCCESS;
727 if (ret != RET_NORMAL) {
728 uc_result = SENSLOG_RES_FAIL;
730 SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
732 pst_pno_tbl->st_pno_data[pno_index].us_pno,
733 reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
734 st_master_fst_temp.us_size,
736 } else if (ul_did == POSHAL_DID_REV_FST) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
738 /* Call Vehicle Sensor Information Notification Transmission Process.*/
739 /* Size of data that can be transmitted in one division */
740 st_master_fst_temp.us_size = LSDRV_FSTSNS_DSIZE_REV;
741 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
742 pst_pno_tbl->st_pno_data[pno_index].us_pno,
743 CID_VEHICLESENS_VEHICLE_INFO,
744 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
745 static_cast<u_int16>(st_master_fst_temp.us_size + 8),
746 (const void *)&st_master_fst_temp);
747 uc_result = SENSLOG_RES_SUCCESS;
748 if (ret != RET_NORMAL) {
749 uc_result = SENSLOG_RES_FAIL;
751 SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
753 pst_pno_tbl->st_pno_data[pno_index].us_pno,
754 reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
755 st_master_fst_temp.us_size,
759 /* Call Vehicle Sensor Information Notification Transmission Process.*/
760 (void)memset(reinterpret_cast<void *>(&st_master_fst_temp.uc_data[0]),
762 sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
763 /* Size of the data - Transmission size Ignore->MISRA-C++:2008 Rule 5-0-5 */
764 st_master_fst_temp.us_size = static_cast<u_int16>(st_master_fst.us_size - \
765 LSDRV_FSTSNS_DSIZE_REV);
766 /* Ignore->MISRA-C++:2008 Rule 5-0-5 #Coverity_19347 */
767 memcpy(&st_master_fst_temp.uc_data[0],
768 &st_master_fst.uc_data[LSDRV_FSTSNS_DSIZE_REV],
769 st_master_fst_temp.us_size);
770 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
771 pst_pno_tbl->st_pno_data[pno_index].us_pno,
772 CID_VEHICLESENS_VEHICLE_INFO,
773 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
774 static_cast<u_int16>(st_master_fst_temp.us_size + 8),
775 (const void *)&st_master_fst_temp);
776 uc_result = SENSLOG_RES_SUCCESS;
777 if (ret != RET_NORMAL) {
778 uc_result = SENSLOG_RES_FAIL;
780 SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
782 pst_pno_tbl->st_pno_data[pno_index].us_pno,
783 reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
784 st_master_fst_temp.us_size,
788 /* Call Vehicle Sensor Information Notification Transmission Process.*/
789 /* Size of data that can be transmitted in one division(Same size definition used)*/
790 st_master_fst_temp.us_size = LSDRV_FSTSNS_DSIZE_GYRO_TEMP;
791 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
792 pst_pno_tbl->st_pno_data[pno_index].us_pno,
793 CID_VEHICLESENS_VEHICLE_INFO,
794 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
795 static_cast<u_int16>(st_master_fst_temp.us_size + 8),
796 (const void *)&st_master_fst_temp);
797 uc_result = SENSLOG_RES_SUCCESS;
798 if (ret != RET_NORMAL) {
799 uc_result = SENSLOG_RES_FAIL;
801 SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
803 pst_pno_tbl->st_pno_data[pno_index].us_pno,
804 reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
805 st_master_fst_temp.us_size,
808 /* Call Vehicle Sensor Information Notification Transmission Process.*/
809 (void)memset(reinterpret_cast<void *>(&st_master_fst_temp.uc_data[0]),
811 sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
812 /* Size of the data - Transmission size(Same size definition used)Ignore->MISRA-C++:2008 Rule 5-0-5 */
813 st_master_fst_temp.us_size = static_cast<u_int16>(st_master_fst.us_size - \
814 LSDRV_FSTSNS_DSIZE_GYRO_TEMP);
815 memcpy(&st_master_fst_temp.uc_data[0],
816 &st_master_fst.uc_data[LSDRV_FSTSNS_DSIZE_GYRO_TEMP],
817 st_master_fst_temp.us_size); /* Ignore->MISRA-C++:2008 Rule 5-0-5 #Coverity_19347*/
818 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
819 pst_pno_tbl->st_pno_data[pno_index].us_pno,
820 CID_VEHICLESENS_VEHICLE_INFO,
821 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
822 static_cast<u_int16>(st_master_fst_temp.us_size + 8),
823 (const void *)&st_master_fst_temp);
824 uc_result = SENSLOG_RES_SUCCESS;
825 if (ret != RET_NORMAL) {
826 uc_result = SENSLOG_RES_FAIL;
828 SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
830 pst_pno_tbl->st_pno_data[pno_index].us_pno,
831 reinterpret_cast<uint8_t *>(&(st_master_fst_temp.uc_data[0])),
832 st_master_fst_temp.us_size,
836 /* Call Vehicle Sensor Information Notification Transmission Process.*/
837 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
838 pst_pno_tbl->st_pno_data[pno_index].us_pno,
839 CID_VEHICLESENS_VEHICLE_INFO,
840 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
841 static_cast<u_int16>(st_master_fst.us_size + 8),
842 (const void *)&st_master_fst);
843 uc_result = SENSLOG_RES_SUCCESS;
844 if (ret != RET_NORMAL) {
845 uc_result = SENSLOG_RES_FAIL;
847 SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
849 pst_pno_tbl->st_pno_data[pno_index].us_pno,
850 reinterpret_cast<uint8_t *>(&(st_master_fst.uc_data[0])),
851 st_master_fst.us_size,
858 u_int8 VehicleSensDeliveryGyro(DID ul_did, u_int8 uc_current_get_method, int32 pno_index, const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
859 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
860 RET_API ret = RET_NORMAL; /* API return value */
861 u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
863 VEHICLESENS_DATA_MASTER_GYRO_TROUBLE st_master_gyro_trouble;
864 SENSORMOTION_MSG_GYROTROUBLEINFO_DAT st_msg_gyro_trouble_info;
867 st_msg_gyro_trouble_info.reserve = 0;
869 VehicleSensGetDataMasterGyroTrouble(ul_did, uc_current_get_method, &st_master_gyro_trouble);
871 /* Size storage(GYROTROUBLE) */
872 st_msg_gyro_trouble_info.size = st_master_gyro_trouble.us_size;
874 /* Set the GyroTrouble */
875 (void)memcpy(reinterpret_cast<void *>(&(st_msg_gyro_trouble_info.gyro_trouble)),
876 reinterpret_cast<void *>(&(st_master_gyro_trouble.uc_data)),
877 sizeof(st_msg_gyro_trouble_info.gyro_trouble));
879 #if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
880 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
881 "#[DIAG] ul_did = VEHICLE_DID_GYRO_TROUBLE");
882 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
883 "#[DIAG] st_msg_gyro_trouble_info.size = %d", st_msg_gyro_trouble_info.size);
884 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
885 "#[DIAG] st_msg_gyro_trouble_info.gyro_trouble = 0x%08X \r\n",
886 st_msg_gyro_trouble_info.gyro_trouble);
887 #endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
888 /* Since the undefined state is not a device specification,Do not deliver to the app side */
889 if (st_msg_gyro_trouble_info.gyro_trouble != GYRO_UNFIXED) {
891 /* Send GyroTrouble to API-caller */
892 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
893 pst_pno_tbl->st_pno_data[pno_index].us_pno,
894 CID_VEHICLE_SENSORMOTION_GYROTROUBLE,
895 sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
896 (const void *)&st_msg_gyro_trouble_info);
897 uc_result = SENSLOG_RES_SUCCESS;
898 if (ret != RET_NORMAL) {
899 uc_result = SENSLOG_RES_FAIL;
901 SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
903 pst_pno_tbl->st_pno_data[pno_index].us_pno,
904 reinterpret_cast<uint8_t *>(&st_msg_gyro_trouble_info),
905 sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
907 #if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
908 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] GyroTrouble Delivery");
909 #endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
915 void VehicleSensDeliveryAntenna(DID ul_did, u_int8 uc_current_get_method, int32 pno_index, const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
916 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
917 VEHICLESENS_DATA_MASTER_GPS_ANTENNA_STATUS gps_antenna_status;
918 VEHICLESENS_DELIVERY_FORMAT delivery_data;
921 VehicleSensGetDataMasterGpsAntennaStatus(ul_did, uc_current_get_method, &gps_antenna_status);
923 delivery_data.header.did = gps_antenna_status.ul_did;
924 delivery_data.header.size = gps_antenna_status.us_size;
925 delivery_data.header.rcv_flag = gps_antenna_status.uc_rcvflag;
926 delivery_data.header.sensor_cnt = gps_antenna_status.uc_sensor_cnt;
927 (void)memcpy(reinterpret_cast<void *>(&delivery_data.data[0]),
928 reinterpret_cast<void *>(&gps_antenna_status.uc_data),
929 (size_t)delivery_data.header.size);
931 length = static_cast<u_int16>(static_cast<u_int32>(sizeof(delivery_data.header)) + delivery_data.header.size);
933 /* Call Vehicle Sensor Information Notification Transmission Process.*/
934 (void)VehicleSndMsg(PNO_VEHICLE_SENSOR,
935 pst_pno_tbl->st_pno_data[pno_index].us_pno,
936 CID_VEHICLESENS_VEHICLE_INFO,
938 (const void *)&delivery_data);
942 u_int8 VehicleSensDeliveryOther(DID ul_did, u_int8 uc_current_get_method, int32 pno_index,
943 u_int32* cid, // NOLINT(readability/nolint)
944 VEHICLESENS_DATA_MASTER* stmaster, // NOLINT(readability/nolint)
945 const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl) {
946 RET_API ret = RET_NORMAL; /* API return value */
947 u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
949 if (ul_did == VEHICLE_DID_LOCATION_LONLAT_NAVI) {
950 *cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
951 } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE_NAVI) { // LCOV_EXCL_BR_LINE 6:VEHICLE_DID_LOCATION_ALTITUDE_NAVI no API to pass in // NOLINT(whitespace/line_length)
952 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
953 *cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE; // LCOV_EXCL_LINE 8: dead code
954 } else if ((ul_did == VEHICLE_DID_MOTION_SPEED_NAVI) ||
955 (ul_did == VEHICLE_DID_MOTION_SPEED_INTERNAL)) {
956 *cid = CID_VEHICLE_SENSORMOTION_SPEED;
957 } else if (ul_did == VEHICLE_DID_MOTION_HEADING_NAVI) {
958 *cid = CID_POSIF_REGISTER_LISTENER_HEADING;
959 } else if (ul_did == VEHICLE_DID_SETTINGTIME) {
960 *cid = CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ;
961 } else { // LCOV_EXCL_BR_LINE 6: cannot be this one
962 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
963 *cid = 0xFFFF; /* DID error */ // LCOV_EXCL_LINE 8: dead code
966 /* Send vehicle sensor information notification */
967 if (*cid == 0xFFFF) { // LCOV_EXCL_BR_LINE 6: cannot be this one
968 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
970 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unknown DID [%d]", ul_did);
972 /* Acquire the applicable data information from the data master..*/
973 (void)memset(reinterpret_cast<void *>(stmaster), 0x00, sizeof(VEHICLESENS_DATA_MASTER));
974 VehicleSensGetDataMaster(ul_did, uc_current_get_method, stmaster);
976 /* Call Vehicle Sensor Information Notification Transmission Process.*/
977 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
978 pst_pno_tbl->st_pno_data[pno_index].us_pno,
979 static_cast<CID>(*cid),
980 (u_int16)(stmaster->us_size),
981 (const void *)&(stmaster->uc_data[0]));
982 uc_result = SENSLOG_RES_SUCCESS;
983 if (ret != RET_NORMAL) {
984 uc_result = SENSLOG_RES_FAIL;
986 SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
988 pst_pno_tbl->st_pno_data[pno_index].us_pno,
989 reinterpret_cast<uint8_t *>(&(stmaster->uc_data[0])),
997 void VehicleSensDeliveryProc(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method) {
998 VEHICLESENS_DATA_MASTER stmaster; /* Data master of normal data */
999 const VEHICLESENS_DELIVERY_PNO_TBL *pst_pno_tbl; /* Vehicle Sensor Destination PNO Table Pointer */
1000 SENSOR_PKG_MSG_VSINFO st_pkg_master; /* Data master for package delivery */
1002 uint8_t uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
1004 /* Obtain the data acquisition method from the Vehicle Selection Item List */
1005 uint8_t uc_current_get_method = VehicleSensGetSelectionItemList(ul_did);
1007 if (uc_current_get_method == uc_get_method) {
1008 /* When the data acquisition methods match (= delivery target) */
1010 /* Obtain the shipping destination PNO */
1011 pst_pno_tbl = (const VEHICLESENS_DELIVERY_PNO_TBL *) VehicleSensMakeDeliveryPnoTbl(ul_did, uc_chg_type);
1013 if ((pst_pno_tbl->us_dnum) > 0) {
1014 /* When there is a shipping destination PNO registration */
1015 /* For boundary adjustment */
1016 uint16_t us_boundary_adj = (u_int16) VEHICLESENS_BIT1 | (u_int16) VEHICLESENS_BIT0; /* #012 */
1017 /* Vehicle sensor information notification transmission process */
1018 for (uint32_t i = 0; i < (pst_pno_tbl->us_dnum); i++) {
1019 if (VEHICLESENS_DELIVERY_METHOD_PACKAGE == pst_pno_tbl->st_pno_data[i].uc_method) {
1020 /* When the delivery method is the package method */
1021 (void) memset(reinterpret_cast<void *>(&st_pkg_master), 0, sizeof(SENSOR_PKG_MSG_VSINFO));
1023 uint16_t us_index = pst_pno_tbl->st_pno_data[i].us_pkg_start_idx;
1024 uint8_t uc_data_cnt = 0U;
1025 uint16_t us_offset = 0U;
1026 for (uint32_t j = 0; j < SENSOR_PKG_DELIVERY_MAX; j++) {
1027 DID ul_pkg_did = g_stpkgdelivery_tbl_mng.st_pkg_data[us_index].ul_did; /* Get DID */
1028 st_pkg_master.usOffset[uc_data_cnt] = us_offset; /* Offset setting */
1029 uc_current_get_method = VehicleSensGetSelectionItemList(ul_pkg_did); /* Data collection way */
1030 if (VEHICLESENS_GETMETHOD_GPS == uc_current_get_method) {
1031 VehicleSensGetGpsDataMaster(ul_pkg_did, uc_current_get_method,
1032 reinterpret_cast<SENSOR_MSG_GPSDATA_DAT *>(&st_pkg_master.ucData[us_offset]));
1035 VehicleSensGetDataMaster(ul_pkg_did, uc_current_get_method,
1036 reinterpret_cast<VEHICLESENS_DATA_MASTER *>(&st_pkg_master.ucData[us_offset]));
1038 uc_data_cnt++; /* Data count increment */
1039 if ((us_index == pst_pno_tbl->st_pno_data[i].us_pkg_end_idx)
1040 || (VEHICLESENS_LINK_INDEX_END == g_stpkgdelivery_tbl_mng.st_pkg_data[us_index].usdlvry_idx)) {
1041 st_pkg_master.ucDNum = uc_data_cnt; /* To save the number of data */
1045 /* By creating the following processing contents,Need to obtain an offset value */
1046 uint16_t us_next_offset = VehicleSensGetDataMasterOffset(ul_pkg_did); /* Next offset calculation */
1047 /* Boundary adjustment of data size */
1048 if ((us_next_offset & us_boundary_adj) != 0) {
1049 /* If you need to adjust */
1050 /* Mask Lower Bit */
1051 us_next_offset = static_cast<u_int16>(us_next_offset & ~us_boundary_adj);
1053 us_next_offset = static_cast<u_int16>(us_next_offset + (u_int16) VEHICLESENS_BIT2);
1055 us_offset = static_cast<u_int16>(us_offset + us_next_offset);
1056 /* Get next index */
1057 us_index = g_stpkgdelivery_tbl_mng.st_pkg_data[us_index].usdlvry_idx;
1060 RET_API ret = PosSndMsg(PNO_VEHICLE_SENSOR, pst_pno_tbl->st_pno_data[i].us_pno,
1061 CID_SENSOR_PKG_INFO, (u_int16) sizeof(SENSOR_PKG_MSG_VSINFO), (const void *) &st_pkg_master);
1062 uc_result = SENSLOG_RES_SUCCESS;
1063 if (ret != RET_NORMAL) {
1064 uc_result = SENSLOG_RES_FAIL;
1066 SensLogWriteOutputData(SENSLOG_DATA_O_SYS_PKG, 0, pst_pno_tbl->st_pno_data[i].us_pno,
1067 reinterpret_cast<uint8_t *>(&st_pkg_master), sizeof(SENSOR_PKG_MSG_VSINFO), uc_result);
1070 /* When the delivery system is normal */
1071 /* Acquire the applicable data information from the data master..*/
1072 if (VEHICLESENS_GETMETHOD_GPS == uc_current_get_method) {
1073 uc_result = VehicleSensDeliveryGPS(ul_did, uc_get_method, uc_current_get_method, i, &cid, &stmaster,
1076 else if ((VEHICLESENS_GETMETHOD_NAVI == uc_get_method) || // NOLINT(readability/braces)
1077 (VEHICLESENS_GETMETHOD_OTHER == uc_get_method) || (VEHICLESENS_GETMETHOD_INTERNAL == uc_get_method)) {
1078 uc_result = VehicleSensDeliveryOther(ul_did, uc_current_get_method, i, &cid, &stmaster, pst_pno_tbl);
1081 #if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
1082 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1083 else if ((ul_did == POSHAL_DID_GYRO_X_FST) || // NOLINT(readability/braces)
1084 (ul_did == POSHAL_DID_GYRO_Y_FST) || // NOLINT(readability/braces)
1085 (ul_did == POSHAL_DID_GYRO_Z_FST) || // NOLINT(readability/braces)
1086 (ul_did == POSHAL_DID_REV_FST) ||
1087 (ul_did == POSHAL_DID_GYRO_TEMP_FST) ||
1088 (ul_did == POSHAL_DID_GSNS_X_FST) ||
1089 (ul_did == POSHAL_DID_GSNS_Y_FST) ||
1090 (ul_did == POSHAL_DID_GSNS_Z_FST) ||
1091 (ul_did == POSHAL_DID_SPEED_PULSE_FST)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1092 /* Acquire the applicable data information from the data master for the initial sensor..*/
1093 uc_result = VehicleSensDeliveryFst(ul_did, uc_get_method, i, pst_pno_tbl);
1096 else if (ul_did == VEHICLE_DID_GYRO_TROUBLE) { // LCOV_EXCL_BR_LINE 6:DID is not used
1097 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1098 uc_result = VehicleSensDeliveryGyro(ul_did, uc_current_get_method, i, pst_pno_tbl); // LCOV_EXCL_LINE 8: dead code // NOLINT(whitespace/line_length)
1100 else { // NOLINT(readability/braces)
1101 (void) memset(reinterpret_cast<void *>(&stmaster), 0x00, sizeof(stmaster));
1102 VehicleSensGetDataMaster(ul_did, uc_current_get_method, &stmaster);
1104 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1105 RET_API ret = VehicleSndMsg(PNO_VEHICLE_SENSOR, pst_pno_tbl->st_pno_data[i].us_pno,
1106 CID_VEHICLESENS_VEHICLE_INFO, (u_int16) sizeof(VEHICLESENS_DATA_MASTER), (const void *) &stmaster);
1107 uc_result = SENSLOG_RES_SUCCESS;
1108 if (ret != RET_NORMAL) {
1109 uc_result = SENSLOG_RES_FAIL;
1111 SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, pst_pno_tbl->st_pno_data[i].us_pno,
1112 reinterpret_cast<uint8_t *>(&(stmaster.uc_data[0])), stmaster.us_size, uc_result);
1120 u_int8 VehicleSensFirstDeliverySens(PNO us_pno, DID ul_did, u_int8 uc_get_method,
1121 VEHICLESENS_DATA_MASTER_FST* stmaster_fst,
1122 VEHICLESENS_DATA_MASTER_FST* stmaster_fst_temp) {
1123 RET_API ret = RET_NORMAL; /* API return value */
1124 u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
1125 /* Acquire the applicable data information from the data master for the initial sensor..*/
1126 (void)memset(reinterpret_cast<void *>(stmaster_fst), 0, sizeof(VEHICLESENS_DATA_MASTER_FST));
1127 (void)memset(reinterpret_cast<void *>(stmaster_fst_temp), 0, sizeof(VEHICLESENS_DATA_MASTER_FST));
1128 VehicleSensGetDataMasterFst(ul_did, uc_get_method, stmaster_fst);
1130 /* Internal debug log output */
1131 FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
1132 "[LOG:POSHAL_DID_GYRO_FST,POSHAL_DID_SPEED_PULSE_FST]");
1134 if (stmaster_fst->partition_flg == 1) {
1135 /* When the partitioning flag is enabled,Or exceeds the size that can be sent,Perform split transmission */
1136 memcpy(stmaster_fst_temp, stmaster_fst, sizeof(VEHICLESENS_DATA_MASTER_FST));
1137 if ((ul_did == POSHAL_DID_GYRO_X_FST) || /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1138 (ul_did == POSHAL_DID_GYRO_Y_FST) ||
1139 (ul_did == POSHAL_DID_GYRO_Z_FST) ||
1140 (ul_did == POSHAL_DID_GSNS_X_FST) ||
1141 (ul_did == POSHAL_DID_GSNS_Y_FST) ||
1142 (ul_did == POSHAL_DID_GSNS_Z_FST)) {
1143 /* Internal debug log output */
1144 FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
1145 "[CALL:VehicleSndMsg:INPOSHAL_DID_GYRO_FST Partition]");
1148 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1149 /* Size of data that can be transmitted in one division(Same size definition used) */
1150 stmaster_fst_temp->us_size = LSDRV_FSTSNS_DSIZE_GYRO_X;
1151 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1153 CID_VEHICLESENS_VEHICLE_INFO,
1154 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
1155 static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
1156 (const void *)stmaster_fst_temp);
1157 uc_result = SENSLOG_RES_SUCCESS;
1158 if (ret != RET_NORMAL) {
1159 uc_result = SENSLOG_RES_FAIL;
1161 SensLogWriteOutputData(SENSLOG_DATA_O_SYS,
1164 reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
1165 stmaster_fst_temp->us_size,
1169 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1170 (void)memset(reinterpret_cast<void *>(&stmaster_fst_temp->uc_data[0]),
1172 sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
1173 /* Size of the data - Transmission size(Same size definition used) Ignore->MISRA-C++:2008 Rule 5-0-5 */
1174 stmaster_fst_temp->us_size = static_cast<u_int16>(stmaster_fst->us_size - LSDRV_FSTSNS_DSIZE_GYRO_X);
1175 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1176 memcpy(&stmaster_fst_temp->uc_data[0],
1177 &stmaster_fst->uc_data[LSDRV_FSTSNS_DSIZE_GYRO_X],
1178 stmaster_fst_temp->us_size);
1179 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1181 CID_VEHICLESENS_VEHICLE_INFO,
1182 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
1183 static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
1184 (const void *)stmaster_fst_temp);
1185 uc_result = SENSLOG_RES_SUCCESS;
1186 if (ret != RET_NORMAL) {
1187 uc_result = SENSLOG_RES_FAIL;
1189 SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
1190 reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
1191 stmaster_fst_temp->us_size, uc_result);
1192 } else if (ul_did == POSHAL_DID_REV_FST) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1193 /* Internal debug log output */
1194 FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
1195 "[CALL:VehicleSndMsg:INPOSHAL_DID_REV_FST Partition]");
1198 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1199 stmaster_fst_temp->us_size = LSDRV_FSTSNS_DSIZE_REV; /* Size of data that can be transmitted in one division */
1200 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1202 CID_VEHICLESENS_VEHICLE_INFO,
1203 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
1204 static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
1205 (const void *)stmaster_fst_temp);
1206 uc_result = SENSLOG_RES_SUCCESS;
1207 if (ret != RET_NORMAL) {
1208 uc_result = SENSLOG_RES_FAIL;
1210 SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
1211 reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
1212 stmaster_fst_temp->us_size, uc_result);
1215 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1216 (void)memset(reinterpret_cast<void *>(&stmaster_fst_temp->uc_data[0]),
1218 sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
1219 /* Size of the data - Transmission size Ignore->MISRA-C++:2008 Rule 5-0-5 */
1220 stmaster_fst_temp->us_size = static_cast<u_int16>(stmaster_fst->us_size - LSDRV_FSTSNS_DSIZE_REV);
1221 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1222 memcpy(&stmaster_fst_temp->uc_data[0],
1223 &stmaster_fst->uc_data[LSDRV_FSTSNS_DSIZE_REV],
1224 stmaster_fst_temp->us_size);
1225 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1227 CID_VEHICLESENS_VEHICLE_INFO,
1228 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
1229 static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
1230 (const void *)stmaster_fst_temp);
1231 uc_result = SENSLOG_RES_SUCCESS;
1232 if (ret != RET_NORMAL) {
1233 uc_result = SENSLOG_RES_FAIL;
1235 SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
1236 reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
1237 stmaster_fst_temp->us_size, uc_result);
1239 /* Internal debug log output */
1240 FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__,
1241 "[CALL:Vehicle_SndMsg:POSHAL_DID_SPEED_PULSE_FST Partition]");
1244 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1245 /* Size of data that can be transmitted in one division(Same size definition used) */
1246 stmaster_fst_temp->us_size = LSDRV_FSTSNS_DSIZE_GYRO_TEMP;
1247 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1249 CID_VEHICLESENS_VEHICLE_INFO,
1250 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
1251 static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
1252 (const void *)stmaster_fst_temp);
1253 uc_result = SENSLOG_RES_SUCCESS;
1254 if (ret != RET_NORMAL) {
1255 uc_result = SENSLOG_RES_FAIL;
1257 SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
1258 reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
1259 stmaster_fst_temp->us_size, uc_result);
1262 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1263 (void)memset(reinterpret_cast<void *>(&stmaster_fst_temp->uc_data[0]),
1265 sizeof(u_int8) * VEHICLE_DSIZE_DATA_MASTER_FST);
1266 /* Size of the data - Transmission size(Same size definition used) Ignore->MISRA-C++:2008 Rule 5-0-5 */
1267 stmaster_fst_temp->us_size = static_cast<u_int16>(stmaster_fst->us_size - LSDRV_FSTSNS_DSIZE_GYRO_TEMP);
1268 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1269 memcpy(&stmaster_fst_temp->uc_data[0],
1270 &stmaster_fst->uc_data[LSDRV_FSTSNS_DSIZE_GYRO_TEMP],
1271 stmaster_fst_temp->us_size);
1272 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1274 CID_VEHICLESENS_VEHICLE_INFO,
1275 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
1276 static_cast<u_int16>(stmaster_fst_temp->us_size + 8),
1277 (const void *)stmaster_fst_temp);
1278 uc_result = SENSLOG_RES_SUCCESS;
1279 if (ret != RET_NORMAL) {
1280 uc_result = SENSLOG_RES_FAIL;
1282 SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
1283 reinterpret_cast<uint8_t *>(&(stmaster_fst_temp->uc_data[0])),
1284 stmaster_fst_temp->us_size, uc_result);
1287 /* Internal debug log output */
1288 FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "[CALL:VehicleSndMsg]");
1290 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1291 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1293 CID_VEHICLESENS_VEHICLE_INFO,
1294 /* Data size + data information Ignore->MISRA-C++:2008 Rule 5-0-5 */
1295 static_cast<u_int16>(stmaster_fst->us_size + 8),
1296 (const void *)stmaster_fst);
1297 uc_result = SENSLOG_RES_SUCCESS;
1298 if (ret != RET_NORMAL) {
1299 uc_result = SENSLOG_RES_FAIL;
1301 SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
1302 reinterpret_cast<uint8_t *>(&(stmaster_fst->uc_data[0])),
1303 stmaster_fst->us_size, uc_result);
1309 u_int8 VehicleSensFirstDeliveryOther(PNO us_pno, DID ul_did, u_int8 uc_get_method,
1311 VEHICLESENS_DATA_MASTER* stmaster) {
1312 RET_API ret = RET_NORMAL; /* API return value */
1313 u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
1315 if (ul_did == VEHICLE_DID_LOCATION_LONLAT_NAVI) {
1316 *cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
1317 } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE_NAVI) { // LCOV_EXCL_BR_LINE 6:VEHICLE_DID_LOCATION_ALTITUDE_NAVI no API to pass in // NOLINT(whitespace/line_length)
1318 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1319 *cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE; // LCOV_EXCL_LINE 8: dead code
1320 } else if ((ul_did == VEHICLE_DID_MOTION_SPEED_NAVI) ||
1321 (ul_did == VEHICLE_DID_MOTION_SPEED_INTERNAL)) {
1322 *cid = CID_VEHICLE_SENSORMOTION_SPEED;
1323 } else if (ul_did == VEHICLE_DID_MOTION_HEADING_NAVI) {
1324 *cid = CID_POSIF_REGISTER_LISTENER_HEADING;
1325 } else if (ul_did == VEHICLE_DID_SETTINGTIME) {
1326 *cid = CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ;
1327 } else { // LCOV_EXCL_BR_LINE 6: cannot be this one
1328 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1329 *cid = 0xFFFF; /* DID error */ // LCOV_EXCL_LINE 8: dead code
1332 /* Vehicle sensor information notification transmission */
1333 if (*cid == 0xFFFF) { // LCOV_EXCL_BR_LINE 6: cannot be this one
1335 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1336 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unknown DID [%d]", ul_did); // LCOV_EXCL_LINE 8: dead code // NOLINT(whitespace/line_length)
1338 /* Acquire the applicable data information from the data master..*/
1339 (void)memset(reinterpret_cast<void *>(stmaster), 0x00, sizeof(VEHICLESENS_DATA_MASTER));
1340 VehicleSensGetDataMaster(ul_did, uc_get_method, stmaster);
1342 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1343 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1345 static_cast<CID>(*cid),
1346 (u_int16)stmaster->us_size,
1347 (const void *)&(stmaster->uc_data[0]));
1348 uc_result = SENSLOG_RES_SUCCESS;
1349 if (ret != RET_NORMAL) {
1350 uc_result = SENSLOG_RES_FAIL;
1352 SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED,
1355 reinterpret_cast<uint8_t *>(&(stmaster->uc_data[0])),
1362 /*******************************************************************************
1363 * MODULE : VehicleSensFirstDelivery
1364 * ABSTRACT : Vehicle Sensor Initial Data Delivery Process
1365 * FUNCTION : Deliver the initial data to the destination.
1366 * ARGUMENT : us_pno :Addresses for delivery NO
1370 ******************************************************************************/
1371 void VehicleSensFirstDelivery(PNO us_pno, DID ul_did) {
1372 u_int8 uc_get_method;
1373 VEHICLESENS_DATA_MASTER stmaster;
1374 #if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
1375 VEHICLESENS_DATA_MASTER_FST stMasterFst; /* Master of initial sensor data */
1376 VEHICLESENS_DATA_MASTER_FST stMasterFst_temp; /* For temporary storage */
1378 SENSORLOCATION_MSG_LONLATINFO *pLonLatMsg;
1379 SENSORLOCATION_MSG_ALTITUDEINFO *pAltitudeMsg;
1380 SENSORMOTION_MSG_HEADINGINFO *pHeadingMsg;
1381 RET_API ret = RET_NORMAL; /* API return value */
1382 u_int8 uc_result = SENSLOG_RES_SUCCESS; /* Send/Receive result */
1385 /* Internal debug log output */
1386 FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+ [ul_did = 0x%x us_pno:0x%x]", ul_did, us_pno);
1388 /* Obtain the data acquisition method.*/
1389 uc_get_method = VehicleSensGetSelectionItemList(ul_did);
1391 if (VEHICLESENS_GETMETHOD_GPS == uc_get_method) {
1392 SENSOR_MSG_GPSDATA_DAT gps_master;
1393 VEHICLESENS_DELIVERY_FORMAT delivery_data;
1395 u_int16 senslog_len;
1397 VehicleSensGetGpsDataMaster(ul_did, uc_get_method, &gps_master);
1399 if (ul_did == POSHAL_DID_GPS_TIME) {
1400 /* GPS time,Because there is no header in the message to be delivered,Padding deliveryData headers */
1401 (void)memcpy(reinterpret_cast<void*>(&delivery_data),
1402 reinterpret_cast<void*>(&gps_master.uc_data[0]), gps_master.us_size);
1403 length = gps_master.us_size;
1404 senslog_len = length;
1405 cid = CID_VEHICLESENS_VEHICLE_INFO_GPS_TIME;
1406 } else if (ul_did == VEHICLE_DID_LOCATION_LONLAT) {
1407 pLonLatMsg = reinterpret_cast<SENSORLOCATION_MSG_LONLATINFO*>(&delivery_data);
1408 /* Acquire the applicable data information from the data master..*/
1409 VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
1410 (void)memcpy(reinterpret_cast<void*>(&(pLonLatMsg->data)),
1411 reinterpret_cast<void*>(&(stmaster.uc_data[0])), stmaster.us_size);
1412 length = (u_int16)stmaster.us_size;
1413 senslog_len = length;
1414 cid = CID_POSIF_REGISTER_LISTENER_LONLAT;
1415 } else if (ul_did == VEHICLE_DID_LOCATION_ALTITUDE) {
1416 pAltitudeMsg = reinterpret_cast<SENSORLOCATION_MSG_ALTITUDEINFO*>(&delivery_data);
1417 /* Acquire the applicable data information from the data master..*/
1418 VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
1419 (void)memcpy(reinterpret_cast<void*>(&(pAltitudeMsg->data)),
1420 reinterpret_cast<void*>(&stmaster.uc_data[0]), stmaster.us_size);
1421 length = (u_int16)stmaster.us_size;
1422 senslog_len = length;
1423 cid = CID_POSIF_REGISTER_LISTENER_ALTITUDE;
1424 } else if (ul_did == VEHICLE_DID_MOTION_HEADING) {
1425 pHeadingMsg = reinterpret_cast<SENSORMOTION_MSG_HEADINGINFO*>(&delivery_data);
1426 /* Acquire the applicable data information from the data master..*/
1427 VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
1428 (void)memcpy(reinterpret_cast<void*>(&(pHeadingMsg->data)),
1429 reinterpret_cast<void*>(&stmaster.uc_data[0]), stmaster.us_size);
1430 length = (u_int16)stmaster.us_size;
1431 senslog_len = length;
1432 cid = CID_POSIF_REGISTER_LISTENER_HEADING;
1435 delivery_data.header.did = gps_master.ul_did;
1436 delivery_data.header.size = gps_master.us_size;
1437 delivery_data.header.rcv_flag = gps_master.uc_rcv_flag;
1438 delivery_data.header.sensor_cnt = gps_master.uc_sns_cnt;
1439 (void)memcpy(reinterpret_cast<void *>(&delivery_data.data[0]),
1440 reinterpret_cast<void *>(&gps_master.uc_data[0]),
1441 (size_t)delivery_data.header.size);
1443 length = static_cast<u_int16>((u_int16)sizeof(delivery_data.header) + delivery_data.header.size);
1444 senslog_len = delivery_data.header.size;
1445 cid = CID_VEHICLESENS_VEHICLE_INFO;
1448 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1449 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1451 static_cast<CID>(cid),
1453 (const void *)&delivery_data);
1454 uc_result = SENSLOG_RES_SUCCESS;
1455 if (ret != RET_NORMAL) {
1456 uc_result = SENSLOG_RES_FAIL;
1458 if (cid != CID_VEHICLESENS_VEHICLE_INFO) {
1459 SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did, us_pno,
1460 reinterpret_cast<uint8_t *>(&delivery_data), senslog_len, uc_result);
1462 SensLogWriteOutputData(SENSLOG_DATA_O_UNSPECIFIED, ul_did, us_pno,
1463 reinterpret_cast<uint8_t *>(&(delivery_data.data[0])), senslog_len, uc_result);
1466 else if ((VEHICLESENS_GETMETHOD_NAVI == uc_get_method) || // NOLINT(readability/braces)
1467 (VEHICLESENS_GETMETHOD_OTHER == uc_get_method) ||
1468 (VEHICLESENS_GETMETHOD_INTERNAL == uc_get_method)) {
1469 uc_result = VehicleSensFirstDeliveryOther(us_pno, ul_did, uc_get_method, &cid, &stmaster);
1471 #if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
1472 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1473 else if ((ul_did == POSHAL_DID_GYRO_X_FST) || // NOLINT(readability/braces)
1474 (ul_did == POSHAL_DID_GYRO_Y_FST) || // NOLINT(readability/braces)
1475 (ul_did == POSHAL_DID_GYRO_Z_FST) || // NOLINT(readability/braces)
1476 (ul_did == POSHAL_DID_REV_FST) ||
1477 (ul_did == POSHAL_DID_GYRO_TEMP_FST) ||
1478 (ul_did == POSHAL_DID_GSNS_X_FST) ||
1479 (ul_did == POSHAL_DID_GSNS_Y_FST) ||
1480 (ul_did == POSHAL_DID_GSNS_Z_FST) ||
1481 (ul_did == POSHAL_DID_SPEED_PULSE_FST)) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1482 /* Acquire the applicable data information from the data master for the initial sensor..*/
1483 uc_result = VehicleSensFirstDeliverySens(us_pno, ul_did, uc_get_method, &stMasterFst, &stMasterFst_temp);
1486 else if (ul_did == VEHICLE_DID_GYRO_TROUBLE) { // LCOV_EXCL_BR_LINE 8 : DID in not used
1487 // LCOV_EXCL_START 8: DID is not used
1488 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1489 VEHICLESENS_DATA_MASTER_GYRO_TROUBLE st_master_gyro_trouble;
1490 SENSORMOTION_MSG_GYROTROUBLEINFO_DAT st_msg_gyro_trouble_info;
1492 /* Initialization */
1493 st_master_gyro_trouble.uc_reserve = 0;
1494 st_msg_gyro_trouble_info.reserve = 0;
1496 VehicleSensGetDataMasterGyroTrouble(ul_did, uc_get_method, &st_master_gyro_trouble);
1498 /* Size storage(GYROTROUBLE) */
1499 st_msg_gyro_trouble_info.size = st_master_gyro_trouble.us_size;
1501 /* Set the GyroTrouble */
1502 (void)memcpy(reinterpret_cast<void *>(&(st_msg_gyro_trouble_info.gyro_trouble)),
1503 reinterpret_cast<void *>(&(st_master_gyro_trouble.uc_data)),
1504 sizeof(st_msg_gyro_trouble_info.gyro_trouble));
1506 #if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
1507 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] ul_did = VEHICLE_DID_GYRO_TROUBLE");
1508 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
1509 "#[DIAG] st_msg_gyro_trouble_info.size = %d",
1510 st_msg_gyro_trouble_info.size);
1511 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
1512 "#[DIAG] st_msg_gyro_trouble_info.gyro_trouble = 0x%08X \r\n",
1513 st_msg_gyro_trouble_info.gyro_trouble);
1514 #endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
1515 /* Since the undefined state is not a device specification,Do not deliver to the app for the first time */
1516 if (st_msg_gyro_trouble_info.gyro_trouble != GYRO_UNFIXED) {
1518 /* Send GyroTrouble to API-caller */
1519 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1521 CID_VEHICLE_SENSORMOTION_GYROTROUBLE,
1522 sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
1523 (const void *)&st_msg_gyro_trouble_info);
1524 uc_result = SENSLOG_RES_SUCCESS;
1525 if (ret != RET_NORMAL) {
1526 uc_result = SENSLOG_RES_FAIL;
1528 SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
1529 reinterpret_cast<uint8_t *>(&st_msg_gyro_trouble_info),
1530 sizeof(SENSORMOTION_MSG_GYROTROUBLEINFO_DAT),
1532 #if VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG
1533 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "#[DIAG] GyroTrouble FirstDelivery");
1534 #endif /* VEHICLE_SENS_DELIVERY_CTRL_DEBUG_DIAG */
1538 else { // NOLINT(readability/braces)
1539 (void)memset(reinterpret_cast<void *>(&stmaster), 0x00, sizeof(stmaster));
1540 /* Acquire the applicable data information from the data master..*/
1541 VehicleSensGetDataMaster(ul_did, uc_get_method, &stmaster);
1543 /* Call Vehicle Sensor Information Notification Transmission Process.*/
1544 ret = VehicleSndMsg(PNO_VEHICLE_SENSOR,
1546 CID_VEHICLESENS_VEHICLE_INFO,
1547 (u_int16)sizeof(VEHICLESENS_DATA_MASTER),
1548 (const void *)&stmaster);
1549 uc_result = SENSLOG_RES_SUCCESS;
1550 if (ret != RET_NORMAL) {
1551 uc_result = SENSLOG_RES_FAIL;
1553 SensLogWriteOutputData(SENSLOG_DATA_O_SYS, ul_did, us_pno,
1554 reinterpret_cast<uint8_t *>(&(stmaster.uc_data[0])),
1555 stmaster.us_size, uc_result);
1557 /* Internal debug log output */
1558 FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
1561 /*******************************************************************************
1562 * MODULE : VehicleSensFirstPkgDelivery
1563 * ABSTRACT : Vehicle Sensor Initial Package Data Delivery Process
1564 * FUNCTION : Deliver the initial package data to the destination.
1565 * ARGUMENT : *pst_data :Data portion pointer of the message buffer
1568 ******************************************************************************/
1569 void VehicleSensFirstPkgDelivery(const SENSOR_MSG_DELIVERY_ENTRY_DAT *pst_data) { // LCOV_EXCL_START 8: dead code
1570 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1571 u_int8 uc_get_method; /* Data collection way */
1572 int32 i; /* Generic counters */
1573 SENSOR_PKG_MSG_VSINFO st_pkg_master; /* Data master for package delivery */
1574 DID ul_pkg_did; /* DID for package data acquisition */
1575 u_int16 us_offset = 0; /* For offset calculation */
1576 u_int16 us_next_offset; /* Next offset value */
1577 u_int16 us_boundary_adj; /* For boundary adjustment */
1578 RET_API ret = RET_NORMAL; /* API return value */
1579 u_int8 uc_result = 0; /* Send/Receive result */
1581 (void)memset(reinterpret_cast<void *>(&st_pkg_master), 0, sizeof(SENSOR_PKG_MSG_VSINFO));
1582 /* For boundary adjustment */
1583 us_boundary_adj = (u_int16)VEHICLESENS_BIT1 | (u_int16)VEHICLESENS_BIT0;
1584 for (i = 0; i < pst_data->pkg_num; i++) {
1585 ul_pkg_did = pst_data->did[i]; /* Get DID */
1586 st_pkg_master.usOffset[i] = us_offset; /* Offset setting */
1587 /* Data collection way */
1588 uc_get_method = VehicleSensGetSelectionItemList(ul_pkg_did);
1589 if (VEHICLESENS_GETMETHOD_GPS == uc_get_method) {
1590 VehicleSensGetGpsDataMaster(ul_pkg_did,
1592 reinterpret_cast<SENSOR_MSG_GPSDATA_DAT *>(&st_pkg_master.ucData[us_offset]));
1594 VehicleSensGetDataMaster(ul_pkg_did,
1596 reinterpret_cast<VEHICLESENS_DATA_MASTER *>(&st_pkg_master.ucData[us_offset]));
1598 /* Next offset calculation */
1599 /* Boundary adjustment of data size */
1600 us_next_offset = VehicleSensGetDataMasterOffset(ul_pkg_did);
1601 if ((us_next_offset & us_boundary_adj) != 0) {
1602 /* If you need to adjust */
1603 us_next_offset = static_cast<u_int16>(us_next_offset & ~us_boundary_adj); /* Mask Lower Bit */
1604 us_next_offset = static_cast<u_int16>(us_next_offset + (u_int16)VEHICLESENS_BIT2); /* Add numbers */
1606 us_offset = static_cast<u_int16>(us_offset + us_next_offset);
1609 st_pkg_master.ucDNum = pst_data->pkg_num; /* To save the number of data */
1610 ret = PosSndMsg(PNO_VEHICLE_SENSOR,
1612 CID_SENSOR_PKG_INFO,
1613 (u_int16)sizeof(SENSOR_PKG_MSG_VSINFO),
1614 (const void *)&st_pkg_master);
1615 uc_result = SENSLOG_RES_SUCCESS;
1616 if (ret != RET_NORMAL) {
1617 uc_result = SENSLOG_RES_FAIL;
1619 SensLogWriteOutputData(SENSLOG_DATA_O_SYS_PKG, 0, pst_data->pno,
1620 reinterpret_cast<uint8_t *>(&st_pkg_master),
1621 sizeof(SENSOR_PKG_MSG_VSINFO),
1626 /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
1627 #if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
1628 /*******************************************************************************
1629 * MODULE : VehicleSensFirstPkgDeliveryExt
1630 * ABSTRACT : Vehicle Sensor Initial Expansion Package Data Delivery Process
1631 * FUNCTION : Deliver the initial expansion package data to the destination.
1632 * ARGUMENT : *pst_data :Data portion pointer of the message buffer
1635 ******************************************************************************/
1636 void VehicleSensFirstPkgDeliveryExt(const SENSOR_MSG_DELIVERY_ENTRY_DAT *pst_data) {
1637 u_int8 ucGetMethod; /* Data collection way */
1638 int32 i; /* Generic counters */
1639 static SENSOR_PKG_MSG_VSINFO stPkgMaster; /* Data master for package delivery */
1640 DID ulPkgDid; /* DID for package data acquisition */
1641 u_int16 usOffset = 0; /* For offset calculation */
1642 u_int16 usNextOffset; /* Next offset value */
1643 u_int16 usBoundaryAdj; /* For boundary adjustment */
1644 static VEHICLESENS_DATA_MASTER_EXT stExtDataTemp[11];/* Extended data master temporary storage area */
1645 u_int16 usDataCnt[11] = {0}; /* For storing the number of data items */
1646 u_int8 ucDivideCnt; /* Total number of partitions */
1647 u_int8 ucDivide100Cnt = 0; /* Total number of 100 partitions */
1648 u_int8 ucDivideSendCnt; /* Number of divided transmissions */
1649 u_int16 usDivideSendSize[11] = {0}; /* Split Send Size */
1650 u_int16 ucDivideSendPoint; /* Split transmission data acquisition position */
1651 u_int8 ucDataBreak; /* Storage area of all data undelivered flag */
1652 RET_API ret = RET_NORMAL; /* API return value */
1653 u_int8 uc_result = 0; /* Send/Receive result */
1655 /* Internal debug log output */
1656 FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+");
1658 /* For boundary adjustment */
1659 usBoundaryAdj = (u_int16)VEHICLESENS_BIT1 | (u_int16)VEHICLESENS_BIT0;
1660 /* #Polaris_004 START */ /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
1661 (void)memset(reinterpret_cast<void *>(&stExtDataTemp), 0, sizeof(stExtDataTemp));
1662 for (i = 0; i < pst_data->pkg_num; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1663 ulPkgDid = pst_data->did[i]; /* Get DID */
1664 ucGetMethod = VehicleSensGetSelectionItemList(ulPkgDid); /* Data collection way */
1665 if (VEHICLESENS_GETMETHOD_GPS < ucGetMethod) {
1666 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1667 "VEHICLESENS_DELIVERYCTRL: VehicleSensGetSelectionItemList error :%d\r\n", ucGetMethod);
1670 if ((ulPkgDid == POSHAL_DID_GYRO_EXT) ||
1671 (ulPkgDid == POSHAL_DID_GYRO_X) ||
1672 (ulPkgDid == POSHAL_DID_GYRO_Y) ||
1673 (ulPkgDid == POSHAL_DID_GYRO_Z) ||
1674 (ulPkgDid == POSHAL_DID_GSNS_X) ||
1675 (ulPkgDid == POSHAL_DID_GSNS_Y) ||
1676 (ulPkgDid == POSHAL_DID_GSNS_Z) ||
1677 (ulPkgDid == POSHAL_DID_SPEED_PULSE) ||
1678 (ulPkgDid == POSHAL_DID_REV) ||
1679 (ulPkgDid == POSHAL_DID_GYRO_TEMP) ||
1680 (ulPkgDid == POSHAL_DID_PULSE_TIME) ||
1681 (ulPkgDid == POSHAL_DID_SNS_COUNTER)) {
1682 /* Store in the extended data master information buffer */
1683 VehicleSensGetDataMasterExt(ulPkgDid, ucGetMethod, &stExtDataTemp[i]);
1684 /* Obtain the number of data items */
1685 if ((ulPkgDid == POSHAL_DID_SNS_COUNTER) ||
1686 (ulPkgDid == POSHAL_DID_REV)) {
1687 usDataCnt[i] = stExtDataTemp[i].us_size; /* 1data 1byte */
1688 /* Store the transmission size for 10 items */
1689 usDivideSendSize[i] = 10;
1690 } else if (ulPkgDid == POSHAL_DID_GYRO_TEMP) {
1691 usDataCnt[i] = stExtDataTemp[i].us_size / 2; /* 1data 2byte */
1692 /* Store the transmission size for 10 items */
1693 usDivideSendSize[i] = 20;
1695 else if (ulPkgDid == POSHAL_DID_PULSE_TIME) { // NOLINT(readability/braces)
1696 usDataCnt[i] = stExtDataTemp[i].us_size / 132; /* 1data 132byte */
1697 /* Store the transmission size for 10 items */
1698 usDivideSendSize[i] = 1320;
1700 else { // NOLINT(readability/braces)
1701 usDataCnt[i] = stExtDataTemp[i].us_size / 2; /* 1data 2byte Ignore->MISRA-C++:2008 Rule 5-0-5 */
1702 /* Store the transmission size for 100 items */
1703 usDivideSendSize[i] = 200;
1705 // divide cnt is 100
1706 if (((usDataCnt[i] % VEHICLESENS_PKG_EXT_SEND_MAX_10DATA) > 0) || (usDataCnt[i] == 0)) {
1707 ucDivide100Cnt = static_cast<u_int8>((usDataCnt[i] / VEHICLESENS_PKG_EXT_SEND_MAX_10DATA) + 1);
1709 ucDivide100Cnt = static_cast<u_int8>(usDataCnt[i] / VEHICLESENS_PKG_EXT_SEND_MAX_10DATA);
1714 /* All-data undelivered flag holding Ignore->MISRA-C ++: 2008 Rule 5-0-5 */
1715 ucDataBreak = static_cast<u_int8>(gstPkgTempExt.data_break);
1717 /* From the number of data items in the acquired buffer,Calculate the number of transmissions */
1718 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1719 if (((usDataCnt[0] % VEHICLESENS_PKG_EXT_SEND_MAX) > 0) || (usDataCnt[0] == 0)) {
1720 /* If there is a remainder,,Division result + 1 */
1721 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1722 ucDivideCnt = static_cast<u_int8>((usDataCnt[0] / VEHICLESENS_PKG_EXT_SEND_MAX) + 1);
1724 /* If there is no remainder,,The result of division is the total number of transmissions. */
1725 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1726 ucDivideCnt = static_cast<u_int8>(usDataCnt[0] / VEHICLESENS_PKG_EXT_SEND_MAX);
1729 // if ucDivide100cnt is valid (greater than 0)
1730 ucDivideCnt = (ucDivide100Cnt > 0) ? ucDivide100Cnt : ucDivideCnt;
1732 ucDivideSendCnt = 0; /* Number of divided transmissions */
1733 while (ucDivideSendCnt < ucDivideCnt) {
1734 /* Clear send message buffer */
1735 (void)memset(reinterpret_cast<void *>(&stPkgMaster), 0, sizeof(SENSOR_PKG_MSG_VSINFO));
1737 for (i = 0; i < pst_data->pkg_num; i++) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1738 ulPkgDid = pst_data->did[i]; /* Get DID */
1739 stPkgMaster.usOffset[i] = usOffset; /* Offset setting */
1740 /* copy Data ID of extended data master structure,Size of the data,Receive flag,Reserved */
1741 memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset]),
1742 reinterpret_cast<void *>(&stExtDataTemp[i]), 11);
1743 if ((ulPkgDid == POSHAL_DID_SNS_COUNTER) ||
1744 (ulPkgDid == POSHAL_DID_REV) ||
1745 (ulPkgDid == POSHAL_DID_PULSE_TIME) ||
1746 (ulPkgDid == POSHAL_DID_GYRO_TEMP)) {
1747 if (usDataCnt[i] > VEHICLESENS_PKG_EXT_SEND_MAX) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1748 /* Calculate the data acquisition position */
1749 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1750 ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
1751 /* Update the data size*/
1752 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1753 stPkgMaster.ucData[usOffset + 4] = (u_int8)usDivideSendSize[i];
1754 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1755 stPkgMaster.ucData[usOffset + 5] = (u_int8)(usDivideSendSize[i] >> 8);
1756 /* Create 10 divided transmission data of sensor counters of extended data master structure */
1757 memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
1758 reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
1759 usDivideSendSize[i]); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1760 /* Subtract the number of created transmission data */
1761 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1762 usDataCnt[i] = static_cast<u_int16>(usDataCnt[i] - VEHICLESENS_PKG_EXT_SEND_MAX);
1764 /* Calculate the data acquisition position */
1765 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1766 ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
1767 /* Update the data size*/
1768 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1769 stPkgMaster.ucData[usOffset + 4] = (u_int8)(stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint);
1770 /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
1771 stPkgMaster.ucData[usOffset + 5] = \
1772 (u_int8)((stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint) >> 8);
1773 /* Create the remaining divided send data of sensor counter of extended data master structure */
1774 memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
1775 reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
1776 stExtDataTemp[i].us_size - ucDivideSendPoint); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1777 /* Since all buffers have been created, the number of data is set to 0. */
1781 if (usDataCnt[i] > VEHICLESENS_PKG_EXT_SEND_MAX_10DATA) { /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1782 /* Calculate the data acquisition position */
1783 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1784 ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
1785 /* Update the data size*/
1786 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1787 stPkgMaster.ucData[usOffset + 4] = (u_int8)usDivideSendSize[i];
1788 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1789 stPkgMaster.ucData[usOffset + 5] = (u_int8)(usDivideSendSize[i] >> 8);
1790 /* Create 100 divided transmission data of vehicle sensor data of extended data master structure */
1791 memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
1792 reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
1793 usDivideSendSize[i]); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1794 /* Subtract the number of created transmission data */
1795 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1796 usDataCnt[i] = static_cast<u_int16>(usDataCnt[i] - VEHICLESENS_PKG_EXT_SEND_MAX_10DATA);
1798 /* Calculate the data acquisition position */
1799 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1800 ucDivideSendPoint = static_cast<u_int16>((u_int16)ucDivideSendCnt * usDivideSendSize[i]);
1801 /* Update the data size*/
1802 /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1803 stPkgMaster.ucData[usOffset + 4] = \
1804 (u_int8)(stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint);
1805 /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
1806 stPkgMaster.ucData[usOffset + 5] = \
1807 (u_int8)((stExtDataTemp[i].us_size - (u_int16)ucDivideSendPoint) >> 8);
1808 /* Create the remaining divided transmission data of the vehicle sensor data of the extended data master structure. */
1809 memcpy(reinterpret_cast<void *>(&stPkgMaster.ucData[usOffset + 8]),
1810 reinterpret_cast<void *>(&stExtDataTemp[i].uc_data[ucDivideSendPoint]),
1811 stExtDataTemp[i].us_size - ucDivideSendPoint); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1812 /* Since all buffers have been created, the number of data is set to 0. */
1816 /* Next offset calculation */
1817 /* Boundary adjustment of data size */
1818 usNextOffset = VehicleSensGetDataMasterExtOffset(ulPkgDid);
1819 /* Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-13, 5-0-14, 5-3-1 */
1820 if ((usNextOffset & usBoundaryAdj) != 0) {
1821 /* If you need to adjust */
1822 /* Mask Lower Bit Ignore->MISRA-C++:2008 Rule 5-0-5 Ignore->MISRA-C++:2008 Rule 5-0-21 */
1823 usNextOffset = static_cast<u_int16>(usNextOffset & ~usBoundaryAdj);
1824 usNextOffset = static_cast<u_int16>(usNextOffset + (u_int16)VEHICLESENS_BIT2); /* Add numbers */
1826 usOffset = static_cast<u_int16>(usOffset + usNextOffset); /* Ignore->MISRA-C++:2008 Rule 5-0-5 */
1828 stPkgMaster.ucDNum = pst_data->pkg_num; /* To save the number of data */
1829 stPkgMaster.ucDataBreak = ucDataBreak; /* Set all data undelivered flag */
1830 stPkgMaster.ucDivideCnt = ucDivideCnt; /* Set total number of partitions */
1831 /* Division number setting Ignore->MISRA-C++:2008 Rule 5-0-5 */
1832 stPkgMaster.ucDivideSendCnt = static_cast<uint8_t>(ucDivideSendCnt + 1);
1833 ret = PosSndMsg(PNO_VEHICLE_SENSOR,
1835 CID_SENSOR_PKG_INFO,
1836 (u_int16)sizeof(SENSOR_PKG_MSG_VSINFO),
1837 (const void *)&stPkgMaster);
1838 uc_result = SENSLOG_RES_SUCCESS;
1839 if (ret != RET_NORMAL) {
1840 uc_result = SENSLOG_RES_FAIL;
1842 SensLogWriteOutputData(SENSLOG_DATA_O_SYS_PKG, 0, pst_data->pno,
1843 reinterpret_cast<uint8_t *>(&stPkgMaster),
1844 sizeof(SENSOR_PKG_MSG_VSINFO), uc_result);
1848 /* Package delivery (split) confirmation debug log output */
1849 FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
1850 "### SENS RECV # FST PKG DELIVERY : cnt[%d/7]", ucDivideSendCnt);
1851 if (7 <= ucDivideSendCnt) {
1852 FRAMEWORKUNIFIEDLOG(ZONE_INIT, __FUNCTION__,
1853 "### SENS RECV # FST PKG DELIVERY : last sns_cnt[%d][%d][%d][%d]",
1854 stPkgMaster.ucData[8], stPkgMaster.ucData[9], stPkgMaster.ucData[10], stPkgMaster.ucData[11]);
1857 /* Ignore->MISRA-C++:2008 Rule 2-7-2 */
1859 /* Internal debug log output */
1860 FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-");
1864 /* ++ PastModel002 response DR */
1866 /*******************************************************************************
1867 * MODULE : VehicleSensEntryDeliveryCtrlDR
1868 * ABSTRACT : Internal delivery destination management registration function for vehicle sensor DR
1869 * FUNCTION : Internal distribution destination management table for DR,Update the shipping management table management.
1870 * ARGUMENT : pst_delivery_entry : Pointer to the delivery registration information
1872 * RETURN : VEHICLE_RET_NORMAL :Successful registration
1873 ******************************************************************************/
1874 VEHICLE_RET_API VehicleSensEntryDeliveryCtrlDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *pst_delivery_entry) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
1875 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1877 u_int8 uc_action_type = VEHICLESENS_ACTION_TYPE_ADD;
1879 DID ulentry_did = pst_delivery_entry->data.did;
1880 VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data = NULL;
1881 VEHICLE_RET_API ret = VEHICLE_RET_NORMAL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
1883 /* Check if the data ID exists. */
1884 uc_did_flag = VehicleSensCheckDid(ulentry_did);
1885 if (uc_did_flag == 0) {
1886 ret = VEHICLE_RET_ERROR_DID; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
1889 /* Check the number of registered shipments. */
1890 if ((ret == VEHICLE_RET_NORMAL) &&/* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
1891 (g_stdelivery_ctrl_tbl_dr.us_dnum >= VEHICLESENS_DELIVERY_INFO_MAX)) {
1892 /* Return the FULL of delivery registrations*/
1893 ret = VEHICLE_RET_ERROR_BUFFULL; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
1896 if (ret == VEHICLE_RET_NORMAL) { /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
1897 /* By searching for the delivery registration of the relevant DID,Hold the address. */
1898 for (i = 0; i < g_stdelivery_ctrl_tbl_mng_dr.us_dnum; i++) {
1899 if (g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].ul_did == ulentry_did) {
1900 uc_action_type = VEHICLESENS_ACTION_TYPE_UPDATE;
1901 pst_existing_mng_data = &g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i];
1905 /* Add to the shipping management table.*/
1906 VehicleSensAddDeliveryCtrlTblDR(pst_delivery_entry);
1907 /* Processing when updating existing data*/
1908 if (uc_action_type == VEHICLESENS_ACTION_TYPE_UPDATE) {
1909 /* Update the shipping management table.*/
1910 VehicleSensUpdateDeliveryCtrlTblDR(pst_existing_mng_data);
1912 /* Update the shipping destination management table management information.*/
1913 VehicleSensUpdateDeliveryCtrlTblMngDR(pst_existing_mng_data);
1914 } else { /* Newly added processing*/
1915 /* Add to the shipping management table management information.*/
1916 VehicleSensAddDeliveryCtrlTblMngDR(pst_delivery_entry);
1919 return ret; /* _CWORD71_:QAC++4020:Multiple exit points found. MISRA-C++ Rule 6-6-5 */
1923 /*******************************************************************************
1924 * MODULE : VehicleSensMakeDeliveryPnoTblDR
1925 * ABSTRACT : Vehicle sensor internal delivery destination PNO table creation function for DR
1926 * FUNCTION : Create an internal delivery destination PNO table for DR
1927 * ARGUMENT : ul_did Data ID
1928 * Change_type Delivery Trigger
1930 * RETURN : VEHICLESENS_DELIVERY_PNO_TBL* Pointer to the shipping PNO table
1931 ******************************************************************************/
1932 VEHICLESENS_DELIVERY_PNO_TBL* VehicleSensMakeDeliveryPnoTblDR(DID ul_did, u_int8 change_type) { // LCOV_EXCL_START 8 : dead code // NOLINT(whitespace/line_length)
1933 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1935 u_int8 uc_ctrl_tbl_mng_data_list;
1936 u_int16 us_index = 0;
1937 u_int16 us_dnum = 0;
1939 /* Get the start index and count of the corresponding data ID. */
1940 uc_ctrl_tbl_mng_data_list = static_cast<u_int8>(
1941 (sizeof(g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data)) /
1942 (sizeof(g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[0])));
1944 for (i = 0; i < uc_ctrl_tbl_mng_data_list; i++) {
1945 /* Stores the information of the corresponding DID.. */
1946 if (g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].ul_did == ul_did) {
1947 us_index = g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].us_start_idx;
1948 us_dnum = g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[i].usdlvry_entry_num;
1953 /* Create a PNO list */
1954 (void)memset(reinterpret_cast<void *>(&g_stdelivery_pno_tbl_dr),
1955 static_cast<int32>(0),
1956 (size_t)sizeof(g_stdelivery_pno_tbl_dr));
1957 if (change_type == VEHICLESENS_CHGTYPE_CHG) {
1958 /* Processing when delivery timing is changed*/
1959 for (i = 0; i < us_dnum; i++) {
1960 /* Functionalization by Increasing Structure Members */
1961 VehicleSensAddPnoTblDR(us_index);
1962 us_index = g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_link_idx;
1965 /* Processing when delivery timing is update */
1966 for (i = 0; i < us_dnum; i++) {
1967 if (VEHICLE_DELIVERY_TIMING_UPDATE == g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].uc_chg_type) {
1968 /* Functionalization by Increasing Structure Members */
1969 VehicleSensAddPnoTblDR(us_index);
1971 us_index = g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_link_idx;
1975 return(&g_stdelivery_pno_tbl_dr);
1979 /*******************************************************************************
1980 * MODULE : VehicleSensAddPnoTblDR
1981 * ABSTRACT : Vehicle sensor DR internal delivery destination PNO table addition function
1982 * FUNCTION : Add to the internal DR shipping destination PNO table.
1983 * ARGUMENT : us_index : Index of the referenced destination management table
1986 ******************************************************************************/
1987 void VehicleSensAddPnoTblDR(u_int16 us_index) { // LCOV_EXCL_START 8: dead code
1988 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1989 u_int16 us_pno_tbl_idx;
1991 us_pno_tbl_idx = g_stdelivery_pno_tbl_dr.us_dnum;
1992 g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].us_pno = \
1993 g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_pno;
1994 g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].us_pkg_start_idx = \
1995 g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_pkg_start_idx;
1996 g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].us_pkg_end_idx = \
1997 g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].us_pkg_end_idx;
1998 g_stdelivery_pno_tbl_dr.st_pno_data[us_pno_tbl_idx].uc_method = \
1999 g_stdelivery_ctrl_tbl_dr.st_ctrl_data[us_index].uc_method;
2000 g_stdelivery_pno_tbl_dr.us_dnum++;
2004 /*******************************************************************************
2005 * MODULE : VehicleSensAddDeliveryCtrlTblDR
2006 * ABSTRACT : Vehicle sensor DR internal delivery destination management table addition function
2007 * FUNCTION : Add to the DR internal shipping management table.
2008 * ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
2011 ******************************************************************************/
2012 void VehicleSensAddDeliveryCtrlTblDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *pst_delivery_entry) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
2013 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2014 VEHICLESENS_DELIVERY_CTRL_TBL_DATA *pst_ctrl_data;
2016 pst_ctrl_data = &g_stdelivery_ctrl_tbl_dr.st_ctrl_data[g_stdelivery_ctrl_tbl_dr.us_dnum];
2017 pst_ctrl_data->ul_did = pst_delivery_entry->data.did;
2018 pst_ctrl_data->us_pno = pst_delivery_entry->data.pno;
2019 pst_ctrl_data->uc_chg_type = pst_delivery_entry->data.delivery_timing;
2020 pst_ctrl_data->uc_ctrl_flg = pst_delivery_entry->data.ctrl_flg;
2021 pst_ctrl_data->us_link_idx = VEHICLESENS_LINK_INDEX_END;
2022 pst_ctrl_data->us_pkg_start_idx = VEHICLESENS_LINK_INDEX_END;
2023 pst_ctrl_data->us_pkg_end_idx = VEHICLESENS_LINK_INDEX_END;
2024 pst_ctrl_data->uc_method = VEHICLESENS_DELIVERY_METHOD_NORMAL;
2025 g_stdelivery_ctrl_tbl_dr.us_dnum = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum + 1);
2029 /*******************************************************************************
2030 * MODULE : VehicleSensAddDeliveryCtrlTblMngDR
2031 * ABSTRACT : Internal delivery destination management table management addition function for vehicle sensor DR
2032 * FUNCTION : Add to the DR internal shipping management table management.
2033 * ARGUMENT : *pst_delivery_entry : Pointer to the delivery registration information
2036 ******************************************************************************/
2037 void VehicleSensAddDeliveryCtrlTblMngDR(const DEADRECKONING_MSG_DELIVERY_ENTRY *pst_delivery_entry) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
2038 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2039 VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_ctrl_mng_data;
2041 pst_ctrl_mng_data = &g_stdelivery_ctrl_tbl_mng_dr.st_ctrl_tbl_mng_data[g_stdelivery_ctrl_tbl_mng_dr.us_dnum];
2042 pst_ctrl_mng_data->ul_did = pst_delivery_entry->data.did;
2043 pst_ctrl_mng_data->us_start_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
2044 pst_ctrl_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
2045 pst_ctrl_mng_data->usdlvry_entry_num++;
2046 g_stdelivery_ctrl_tbl_mng_dr.us_dnum++;
2050 /*******************************************************************************
2051 * MODULE : VehicleSensUpdateDeliveryCtrlTblMngDR
2052 * ABSTRACT : Internal delivery destination management table management update function for vehicle sensor DR
2053 * FUNCTION : Update the internal delivery destination management table management for DR.
2054 * ARGUMENT : *pst_existing_mng_data : Pointer to the previous data information with the same data ID
2057 ******************************************************************************/
2058 void VehicleSensUpdateDeliveryCtrlTblMngDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
2059 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2060 /* Update only the end index and the number of registered shipping destinations. */
2061 pst_existing_mng_data->us_end_idx = static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
2062 pst_existing_mng_data->usdlvry_entry_num++;
2066 /*******************************************************************************
2067 * MODULE : VehicleSensUpdateDeliveryCtrlTblDR
2068 * ABSTRACT : Vehicle sensor DR internal delivery destination management table update function
2069 * FUNCTION : Update the internal distribution destination management table for DR.
2070 * ARGUMENT : *pst_existing_mng_data : Pointer to the previous data information with the same data ID
2073 ******************************************************************************/
2074 void VehicleSensUpdateDeliveryCtrlTblDR(VEHICLESENS_DELIVERY_CTRL_TBL_MNG_DATA *pst_existing_mng_data) { // LCOV_EXCL_START 8: dead code // NOLINT(whitespace/line_length)
2075 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2076 /* Update Link Index Only.
2077 For indexes of usEndIdx values matching the data IDs in the target management table
2078 Making usLinkIdx an Index-Registered Index */
2079 g_stdelivery_ctrl_tbl_dr.st_ctrl_data[pst_existing_mng_data->us_end_idx].us_link_idx =
2080 static_cast<u_int16>(g_stdelivery_ctrl_tbl_dr.us_dnum - 1);
2084 /*******************************************************************************
2085 * MODULE : VehicleSensDeliveryProcDR
2086 * ABSTRACT : Internal Data Delivery Process for Vehicle Sensor DR
2087 * FUNCTION : Deliver data to internal DR destinations.
2088 * ARGUMENT : ul_did :Data ID
2089 * uc_chg_type :Delivery timing
2090 * uc_get_method :Acquisition method
2093 ******************************************************************************/
2094 void VehicleSensDeliveryProcDR(DID ul_did, u_int8 uc_chg_type, u_int8 uc_get_method) {
2100 * Obtain dump info(g_stdelivery_ctrl_tbl)
2102 * @param[out] pbuf Dump information
2104 void VehicleSensGetDebugDeliveryCtrlTbl(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
2105 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2106 static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
2107 static uint8_t bufTmp[256];
2110 memset(&buf, 0x00, sizeof(buf));
2111 snprintf(reinterpret_cast<char *>(&(buf)),
2113 "Delivery-Tbl\n DNum:%d", g_stdelivery_ctrl_tbl.us_dnum);
2114 for (i = 0; i < g_stdelivery_ctrl_tbl.us_dnum; i++) {
2118 memset(&bufTmp[0], 0x00, sizeof(bufTmp));
2119 snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
2120 "\n [%02d] did:0x%08x, pno:0x%04x, chgT:0x%02x, ctrlFg:0x%02x, "\
2121 "lnkidx:0x%04x, pkgSidx:0x%04x, pkgEidx:0x%04x, Mth:0x%02x",
2123 g_stdelivery_ctrl_tbl.st_ctrl_data[i].ul_did,
2124 g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pno,
2125 g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_chg_type,
2126 g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_ctrl_flg,
2127 g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_link_idx,
2128 g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pkg_start_idx,
2129 g_stdelivery_ctrl_tbl.st_ctrl_data[i].us_pkg_end_idx,
2130 g_stdelivery_ctrl_tbl.st_ctrl_data[i].uc_method);
2131 _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
2133 memcpy(pbuf, &buf[0], sizeof(buf));
2140 * Obtain dump info(g_stdelivery_ctrl_tbl_mng)
2142 * @param[out] pbuf Dump information
2144 void VehicleSensGetDebugDeliveryCtrlTblMng(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
2145 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2146 static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
2147 static uint8_t bufTmp[256];
2150 memset(&buf, 0x00, sizeof(buf));
2151 snprintf(reinterpret_cast<char *>(&(buf)),
2153 "Delivery-TblMng\n DNum:%d",
2154 g_stdelivery_ctrl_tbl_mng.us_dnum);
2155 for (i = 0; i < g_stdelivery_ctrl_tbl_mng.us_dnum; i++) {
2159 memset(&bufTmp[0], 0x00, sizeof(bufTmp));
2160 snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
2161 "\n [%02d] did:0x%08x, Sidx:0x%04x, Eidx:0x%04x, EntNum:0x%04x",
2163 g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].ul_did,
2164 g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].us_start_idx,
2165 g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].us_end_idx,
2166 g_stdelivery_ctrl_tbl_mng.st_ctrl_tbl_mng_data[i].usdlvry_entry_num);
2167 _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
2169 memcpy(pbuf, &buf[0], sizeof(buf));
2176 * Obtain dump info(g_stpkgdelivery_tbl_mng)
2178 * @param[out] pbuf Dump information
2180 void VehicleSensGetDebugPkgDeliveryTblMng(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
2181 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2182 static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
2183 static uint8_t bufTmp[256];
2186 memset(&buf, 0x00, sizeof(buf));
2187 snprintf(reinterpret_cast<char *>(&(buf)),
2189 "Delivery-PkgTblMng\n DNum:%d",
2190 g_stpkgdelivery_tbl_mng.us_dnum);
2191 for (i = 0; i < g_stpkgdelivery_tbl_mng.us_dnum; i++) {
2195 memset(&bufTmp[0], 0x00, sizeof(bufTmp));
2196 snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
2197 "\n [%02d] did:0x%08x, Didx:0x%04x",
2199 g_stpkgdelivery_tbl_mng.st_pkg_data[i].ul_did,
2200 g_stpkgdelivery_tbl_mng.st_pkg_data[i].usdlvry_idx);
2201 _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
2203 memcpy(pbuf, &buf[0], sizeof(buf));
2210 * Obtain dump info(g_stdelivery_pno_tbl)
2212 * @param[out] pbuf Dump information
2214 void VehicleSensGetDebugDeliveryPnoTbl(void* pbuf) { // LCOV_EXCL_START 7: uesd only in FrameworkunifiedOnDebugDump
2215 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
2216 static uint8_t buf[DEBUG_DUMP_MAX_SIZE];
2217 static uint8_t bufTmp[256];
2220 memset(&buf, 0x00, sizeof(buf));
2221 snprintf(reinterpret_cast<char *>(&(buf)),
2223 "Delivery-PnoTbl\n DNum:%d",
2224 g_stdelivery_pno_tbl.us_dnum);
2225 for (i = 0; i < g_stdelivery_pno_tbl.us_dnum; i++) {
2229 memset(&bufTmp[0], 0x00, sizeof(bufTmp));
2230 snprintf(reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp),
2231 "\n [%02d] pno:0x%04x, pkgSidx:0x%04x, pkgEidx:0x%04x, Mth:0x%02x",
2233 g_stdelivery_pno_tbl.st_pno_data[i].us_pno,
2234 g_stdelivery_pno_tbl.st_pno_data[i].us_pkg_start_idx,
2235 g_stdelivery_pno_tbl.st_pno_data[i].us_pkg_end_idx,
2236 g_stdelivery_pno_tbl.st_pno_data[i].uc_method);
2237 _pb_strcat(reinterpret_cast<char *>(&buf[0]), reinterpret_cast<char *>(&bufTmp[0]), sizeof(bufTmp));
2239 memcpy(pbuf, &buf[0], sizeof(buf));
2243 /* -- PastModel002 support DR */