diff options
author | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-10-22 09:06:18 +0900 |
---|---|---|
committer | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-10-22 09:06:18 +0900 |
commit | 00ab09fac9701443fdff616fdcc274809a03d4d7 (patch) | |
tree | 03aa078b69aa17d12c77f7d4b74cf6f3a93ffefd /positioning/client | |
parent | fa6fa9f4ee5486b30d223914e1a6e50d4d3adf71 (diff) |
vs-positioning branch 0.1sandbox/ToshikazuOhiwa/vs-positioning
Diffstat (limited to 'positioning/client')
46 files changed, 1304 insertions, 2418 deletions
diff --git a/positioning/client/Makefile b/positioning/client/Makefile index e7ee7443..d7fce284 100644 --- a/positioning/client/Makefile +++ b/positioning/client/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/positioning/client/include/CanInput_API.h b/positioning/client/include/CanInput_API.h index 46e86da9..1449b25a 100644 --- a/positioning/client/include/CanInput_API.h +++ b/positioning/client/include/CanInput_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/CanInput_API_private.h b/positioning/client/include/CanInput_API_private.h index cae7e031..d7c8e8e5 100644 --- a/positioning/client/include/CanInput_API_private.h +++ b/positioning/client/include/CanInput_API_private.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ *****************************************************************************/ typedef struct { T_APIMSG_MSGBUF_HEADER hdr; /* Message header */ - u_int8 data[CANINPUT_MSGBUF_DSIZE]; /* Message data (Localtime) */ + uint8_t data[CANINPUT_MSGBUF_DSIZE]; /* Message data (Localtime) */ } CANINPUT_MSG_INFO; /************************************************************************ diff --git a/positioning/client/include/Clock_API.h b/positioning/client/include/Clock_API.h index 372e39ad..19879994 100644 --- a/positioning/client/include/Clock_API.h +++ b/positioning/client/include/Clock_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/CommonDefine.h b/positioning/client/include/CommonDefine.h index 82fed306..2e9e3e6c 100644 --- a/positioning/client/include/CommonDefine.h +++ b/positioning/client/include/CommonDefine.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,40 +59,7 @@ #define POS_SNS__CWORD82__PJRDC_GP_3 (0x20U) //!< \~english PJRDC_GP_3 sentence /* NMEA Receive Flag */ -#define POS_SNS_GPS_NMEA_GGA (0x00000001U) //!< \~english GGA sentence -#define POS_SNS_GPS_NMEA_GLL (0x00000002U) //!< \~english GLL sentence -#define POS_SNS_GPS_NMEA_GSA (0x00000004U) //!< \~english GSA sentence -#define POS_SNS_GPS_NMEA_GST (0x00000008U) //!< \~english GST sentence -#define POS_SNS_GPS_NMEA_RMC (0x00000010U) //!< \~english RMC sentence -#define POS_SNS_GPS_NMEA_VTG (0x00000020U) //!< \~english VTG sentence -#define POS_SNS_GPS_NMEA_GSV1 (0x00000040U) //!< \~english GSV1 sentence -#define POS_SNS_GPS_NMEA_GSV2 (0x00000080U) //!< \~english GSV2 sentence -#define POS_SNS_GPS_NMEA_GSV3 (0x00000100U) //!< \~english GSV3 sentence -#define POS_SNS_GPS_NMEA_GSV4 (0x00000200U) //!< \~english GSV4 sentence -#define POS_SNS_GPS_NMEA_GSV5 (0x00000400U) //!< \~english GSV5 sentence - -#define POS_SNS_GPS_NMEA_PASCD (0x00000800U) //!< \~english pascd sentence - -/** - * @enum POS_SNS_GPS_NMEA_SNO - * \~english type of NMEA - */ -typedef enum { - POS_SNS_GPS_NMEA_SNO_GGA = 0, //!< \~english GGA sentence - POS_SNS_GPS_NMEA_SNO_GLL, //!< \~english GLL sentence - POS_SNS_GPS_NMEA_SNO_GSA, //!< \~english GSA sentence - POS_SNS_GPS_NMEA_SNO_GST, //!< \~english GST sentence - POS_SNS_GPS_NMEA_SNO_RMC, //!< \~english RMC sentence - POS_SNS_GPS_NMEA_SNO_VTG, //!< \~english VTG sentence - POS_SNS_GPS_NMEA_SNO_GSV1, //!< \~english GSV1 sentence - POS_SNS_GPS_NMEA_SNO_GSV2, //!< \~english GSV2 sentence - POS_SNS_GPS_NMEA_SNO_GSV3, //!< \~english GSV3 sentence - POS_SNS_GPS_NMEA_SNO_GSV4, //!< \~english GSV4 sentence - POS_SNS_GPS_NMEA_SNO_GSV5, //!< \~english GSV5 sentence - - POS_SNS_GPS_NMEA_SNO_PASCD, //!< \~english pascd sentence - POS_SNS_GPS_NMEA_SNO_MAX //!< \~english MAX sentence(invalid) -} POS_SNS_GPS_NMEA_SNO; +#define POS_SNS_GPS_NMEA_PASCD (0x01000000U) //!< \~english pascd sentence typedef u_int16 PNO; //!< \~english PNo. diff --git a/positioning/client/include/DR_API.h b/positioning/client/include/DR_API.h index fde5034e..6362f8cf 100644 --- a/positioning/client/include/DR_API.h +++ b/positioning/client/include/DR_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/DeadReckoning_DbgLogSim.h b/positioning/client/include/DeadReckoning_DbgLogSim.h index 34d5243c..bd57de70 100644 --- a/positioning/client/include/DeadReckoning_DbgLogSim.h +++ b/positioning/client/include/DeadReckoning_DbgLogSim.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/Dead_Reckoning_API.h b/positioning/client/include/Dead_Reckoning_API.h index a42aa904..bd2e0318 100644 --- a/positioning/client/include/Dead_Reckoning_API.h +++ b/positioning/client/include/Dead_Reckoning_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,7 +107,9 @@ typedef struct { /* Set "0" for initial sensor transmission and "1" for periodic transmission. */ u_int8 sens_cnt; /* Sensor data transmission counter value Set "0" at initial transmission of sensor */ Struct_PulseRevTbl pulse_rev_tbl; /* Vehicle speed/REV Data table */ - Struct_GyroTbl gyro_tbl; /* Gyro data table */ + Struct_GyroTbl gyro_x_tbl; /* Gyro(X axis) data table */ + Struct_GyroTbl gyro_y_tbl; /* Gyro(Y axis) data table */ + Struct_GyroTbl gyro_z_tbl; /* Gyro(Z axis) data table */ } Struct_SensData; /* GPS data */ diff --git a/positioning/client/include/Dead_Reckoning_Local_Api.h b/positioning/client/include/Dead_Reckoning_Local_Api.h index 42fb004d..c513e9b0 100644 --- a/positioning/client/include/Dead_Reckoning_Local_Api.h +++ b/positioning/client/include/Dead_Reckoning_Local_Api.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/Gps_API_private.h b/positioning/client/include/Gps_API_private.h index adf538b4..7026ce97 100644 --- a/positioning/client/include/Gps_API_private.h +++ b/positioning/client/include/Gps_API_private.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/INI_API.h b/positioning/client/include/INI_API.h index 734bc92c..f16a4c62 100644 --- a/positioning/client/include/INI_API.h +++ b/positioning/client/include/INI_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/Naviinfo_API.h b/positioning/client/include/Naviinfo_API.h index 59898e48..12caa84f 100644 --- a/positioning/client/include/Naviinfo_API.h +++ b/positioning/client/include/Naviinfo_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ *****************************************************************************/ typedef struct { T_APIMSG_MSGBUF_HEADER hdr; /* Message header */ -// NAVIINFO_ALL dat; /* Message data section */ + NAVIINFO_ALL dat; /* Message data section */ } NAVIINFO_DELIVER_MSG; /***************************************************************************** @@ -102,7 +102,7 @@ typedef struct { #ifdef __cplusplus extern "C" { #endif -//extern int32 VehicleSetVehicleData(PNO pid, VEHICLE_MSG_SEND_DAT *p_data); +extern int32 VehicleSetVehicleData(PNO pid, VEHICLE_MSG_SEND_DAT *p_data); #ifdef __cplusplus } #endif diff --git a/positioning/client/include/POS_common_private.h b/positioning/client/include/POS_common_private.h index 531ef6a9..4dd98a25 100644 --- a/positioning/client/include/POS_common_private.h +++ b/positioning/client/include/POS_common_private.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,11 @@ * Definition * *---------------------------------------------------------------------------------*/ /*--- for message ---*/ +/* + * Maximum receive message size + * - Set the value based on the message receiving buffer size of the local thread + */ +#define MAX_MSG_BUF_SIZE (4096) /* command ID */ #define CID_POSIF_SET_DATA 0x0790 /* set data command ID */ diff --git a/positioning/client/include/POS_private.h b/positioning/client/include/POS_private.h index 05a52480..9f022028 100644 --- a/positioning/client/include/POS_private.h +++ b/positioning/client/include/POS_private.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ #include "POS_common_private.h" #include <asm/unistd.h> #include <other_service/VP_GetEnv.h> +#include <other_service/env_vehicleparameterlibrary.h> #include "CommonDefine.h" /*---------------------------------------------------------------------------------* * Function Prototype * @@ -42,8 +43,8 @@ /* Shared Library Value Area Check Function */ inline UNIT_TYPE GetEnvSupportInfo(void); inline BOOL ChkUnitType(UNIT_TYPE type); -inline RET_API MunMapDeviceIo(HANDLE dev, u_int32 map_size); -inline RET_API MilliSecSleep(u_int32 mill_time); +inline RET_API MunMapDeviceIo(HANDLE dev, uint32_t map_size); +inline RET_API MilliSecSleep(uint32_t mill_time); inline POS_RET_API PosChkParam8(int8_t data, int8_t min, int8_t max, const char* fn, int32_t line); inline POS_RET_API PosChkParam16(int16_t data, int16_t min, int16_t max, const char* fn, int32_t line); inline POS_RET_API PosChkParam32(int32_t data, int32_t min, int32_t max, const char* fn, int32_t line); @@ -60,9 +61,9 @@ inline SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name, /* General Functions in Shared Libraries */ inline EventID VehicleCreateEvent(PNO pno); inline RET_API VehicleDeleteEvent(EventID event_id); -inline RET_API VehicleLinkShareData(void **share_top, u_int32 *share_size, u_int16 *offset); -inline RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, u_int16 offset); -inline RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data); +inline RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset); +inline RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, uint16_t offset); +inline RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data); inline BOOL VehicleGetResource(void); inline void VehicleReleaseResource(void); inline uint32_t GetTid(void); @@ -81,22 +82,34 @@ inline uint32_t GetTid(void); * Inline Functions * *---------------------------------------------------------------------------------*/ UNIT_TYPE GetEnvSupportInfo(void) { - UNIT_TYPE ret_type = UNIT_TYPE_UNKNOWN; + UNIT_TYPE ret_type = UNIT_TYPE_GRADE1; + char env_area[VP_MAX_LENGTH]; char env_grade[VP_MAX_LENGTH]; char* p_env_grade = env_grade; + char* p_env_area = env_area; - VP_GetEnv(VEHICLEPARAMETERLIBRARY_GRADE, p_env_grade); + /* + * Note. + * This feature branches processing depending on the area and grade type. + */ - if (0 == strcmp(p_env_grade, "GRADE1")) { - ret_type = UNIT_TYPE_GRADE1; - } else { - /* - * Note. - * This feature branches processing depending on the unit type. - */ + VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_AREA, p_env_area); + + if (0 == strcmp(p_env_area, "AREA1")) { ret_type = UNIT_TYPE_GRADE2; + } else if (0 == strcmp(p_env_area, "AREA2")) { + memset(&env_grade, 0x00, sizeof(env_grade)); + VP_GetEnv(VP_VEHICLEPARAMETERLIBRARY_GRADE, p_env_grade); + if (0 == strcmp(p_env_grade, "_CWORD95_") || + 0 == strcmp(p_env_grade, "_CWORD101_") || + 0 == strcmp(p_env_grade, "_CWORD61_")) { + ret_type = UNIT_TYPE_GRADE2; + } + } else { + // NOP } + return ret_type; } @@ -114,11 +127,11 @@ BOOL ChkUnitType(UNIT_TYPE type) { return ret; } -RET_API MunMapDeviceIo(HANDLE dev, u_int32 map_size) { +RET_API MunMapDeviceIo(HANDLE dev, uint32_t map_size) { return RET_NORMAL; } -RET_API MilliSecSleep(u_int32 mill_time) { +RET_API MilliSecSleep(uint32_t mill_time) { switch (mill_time) { case 0: { @@ -352,36 +365,36 @@ inline POS_RET_API PosChkParamU32(uint32_t data, uint32_t min, uint32_t max, con inline POS_RET_API PosSetProc(DID did, void *p_data, uint16_t size, uint8_t is_event) { POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */ RET_API ret_api = RET_NORMAL; /* API return value */ -// POS_MSGINFO snd_msg; /* Message */ + POS_MSGINFO snd_msg; /* Message */ EventID event_id; /* Event ID */ -// int32_t event_val; /* Event value */ + int32_t event_val; /* Event value */ PNO pno; /* Calling thread PNO */ uint32_t pid; /* Process ID */ uint32_t tid; /* Thread ID */ char name[128]; /* Data size check */ -// if (POS_MSG_INFO_DSIZE < size) { -// ret = POS_RET_ERROR_PARAM; -// } else { + if (POS_MSG_INFO_DSIZE < size) { + ret = POS_RET_ERROR_PARAM; + } else { /* Resource acquisition */ if (VehicleGetResource() == TRUE) { /* Message data */ /* _CWORD71_ processing speed(Memset modification) */ /* Initialization of areas that do not contain values */ -// snd_msg.pno = 0; -// snd_msg.rcv_flag = 0; -// snd_msg.reserve = 0; -// -// snd_msg.did = did; -// snd_msg.size = size; -// memcpy(snd_msg.data, p_data, size); + snd_msg.pno = 0; + snd_msg.rcv_flag = 0; + snd_msg.reserve = 0; + + snd_msg.did = did; + snd_msg.size = size; + memcpy(snd_msg.data, p_data, size); if (TRUE == is_event) { /* After requesting data setting,Wait for the setting completion(Event Wait) */ /* Event Generation */ - pid = static_cast<u_int32>(getpid()); + pid = static_cast<uint32_t>(getpid()); tid = GetTid(); snprintf(name, sizeof(name), "PS_p%u_t%u", pid, tid); @@ -389,38 +402,37 @@ inline POS_RET_API PosSetProc(DID did, void *p_data, uint16_t size, uint8_t is_e event_id = VehicleCreateEvent(pno); /* Set the source Pno of message data */ -// snd_msg.pno = pno; + snd_msg.pno = pno; if (0 != event_id) { /* Successful event generation */ /* Send NAVI Sensor Data Setting to Vehicle Sensor */ -// ret_api = VehicleSndMsg(pno, -// PNO_VEHICLE_SENSOR, -// CID_POSIF_SET_DATA, -// -//// (u_int16)sizeof(POS_MSGINFO), (const void *)&snd_msg); -// (u_int16)sizeof(POS_MSGINFO) - POS_MSG_INFO_DSIZE + snd_msg.size, /* variable length */ -// (const void *)&snd_msg); -// -// if (RET_NORMAL == ret_api) { -// /* If the data setup process is successful,Wait for a completion event */ -// ret_api = _pb_WaitEvent(event_id, -// SAPI_EVWAIT_VAL, -// VEHICLE_RET_ERROR_MIN, -// VEHICLE_RET_NORMAL, &event_val, POS_API_TIME_OUT_MS); -// if (RET_NORMAL != ret_api) { -// /* Return an internal error */ -// ret = POS_RET_ERROR_INNER; -// } else { -// /* Return from Event Wait */ -// /* Set event value (processing result) as return value */ -// ret = (POS_RET_API)event_val; -// } -// } else { -// /* Message transmission processing failed */ -// ret = POS_RET_ERROR_INNER; -// } + ret_api = VehicleSndMsg(pno, + PNO_VEHICLE_SENSOR, + CID_POSIF_SET_DATA, + + (uint16_t)sizeof(POS_MSGINFO) - POS_MSG_INFO_DSIZE + snd_msg.size, /* variable length */ + (const void *)&snd_msg); + + if (RET_NORMAL == ret_api) { + /* If the data setup process is successful,Wait for a completion event */ + ret_api = _pb_WaitEvent(event_id, + SAPI_EVWAIT_VAL, + VEHICLE_RET_ERROR_MIN, + VEHICLE_RET_NORMAL, &event_val, POS_API_TIME_OUT_MS); + if (RET_NORMAL != ret_api) { + /* Return an internal error */ + ret = POS_RET_ERROR_INNER; + } else { + /* Return from Event Wait */ + /* Set event value (processing result) as return value */ + ret = (POS_RET_API)event_val; + } + } else { + /* Message transmission processing failed */ + ret = POS_RET_ERROR_INNER; + } /* Event deletion */ ret_api = VehicleDeleteEvent(event_id); } else { @@ -431,13 +443,13 @@ inline POS_RET_API PosSetProc(DID did, void *p_data, uint16_t size, uint8_t is_e /* After setting data,Immediate termination */ /* Send NAVI Sensor Data Setting to Vehicle Sensor */ -// ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME, -// CID_POSIF_SET_DATA, -// sizeof(POS_MSGINFO), reinterpret_cast<void*>(&snd_msg), 0); -// if (ret_api != RET_NORMAL) { -// /* Message transmission failure */ -// ret = POS_RET_ERROR_INNER; -// } + ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME, + CID_POSIF_SET_DATA, + sizeof(POS_MSGINFO), reinterpret_cast<void*>(&snd_msg), 0); + if (ret_api != RET_NORMAL) { + /* Message transmission failure */ + ret = POS_RET_ERROR_INNER; + } } } else { /* Insufficient resource */ @@ -445,7 +457,7 @@ inline POS_RET_API PosSetProc(DID did, void *p_data, uint16_t size, uint8_t is_e } /* Resource release */ VehicleReleaseResource(); -// } + } return ret; } @@ -465,16 +477,16 @@ inline POS_RET_API PosSetProc(DID did, void *p_data, uint16_t size, uint8_t is_e * POS_RET_ERROR_DID Unregistered ID<br> */ inline POS_RET_API PosGetProc(DID did, void *p_data, uint16_t dest_size) { - POS_RET_API ret; /* Return value */ - RET_API ret_api; /* System API return value */ - EventID event_id; /* Event ID */ - int32 event_val; /* Event value */ + POS_RET_API ret; /* Return value */ + RET_API ret_api; /* System API return value */ + EventID event_id; /* Event ID */ + int32_t event_val; /* Event value */ void *share_top; /* Start address of shared memory */ - u_int32 share_size; /* Size of shared memory area */ - u_int16 offset; /* Offset to free shared memory area */ + uint32_t share_size; /* Size of shared memory area */ + uint16_t offset; /* Offset to free shared memory area */ VEHICLE_SHARE_BLOCK_DAT *share_dat; /* Address of free shared memory area */ VEHICLE_MSG_GET_VEHICLE_DATA_DAT data; /* Message data */ - PNO pno; /* Calling thread PNO */ + PNO pno; /* Calling thread PNO */ uint32_t pid; /* Process ID */ uint32_t tid; /* Thread ID */ char name[128]; @@ -487,7 +499,7 @@ inline POS_RET_API PosGetProc(DID did, void *p_data, uint16_t dest_size) { memset(reinterpret_cast<void *>(&data), 0, sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT)); /* Event Generation */ - pid = static_cast<u_int32>(getpid()); + pid = static_cast<uint32_t>(getpid()); tid = GetTid(); snprintf(name, sizeof(name), "PG_p%u_t%u", pid, tid); @@ -637,7 +649,7 @@ inline SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name, DID did, u_int8 ret_api = VehicleSndMsg(pno, PNO_VEHICLE_SENSOR, CID_VEHICLEIF_DELIVERY_ENTRY, - (u_int16)sizeof(VEHICLE_MSG_DELIVERY_ENTRY_DAT), (const void *)&data); + (uint16_t)sizeof(VEHICLE_MSG_DELIVERY_ENTRY_DAT), (const void *)&data); if (RET_NORMAL == ret_api) { /* Message transmission processing is successful */ @@ -738,7 +750,7 @@ inline RET_API VehicleDeleteEvent(EventID event_id) { * RETURN : RET_NORMAL : Normal completion * : RET_ERROR : There is no shared memory area. ******************************************************************************/ -inline RET_API VehicleLinkShareData(void **share_top, u_int32 *share_size, u_int16 *offset) { +inline RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset) { RET_API ret_api; /* System API return value */ SemID sem_id; /* Semaphore ID */ VEHICLE_SHARE *share_top_tmp; @@ -807,7 +819,7 @@ inline RET_API VehicleLinkShareData(void **share_top, u_int32 *share_size, u_int * RETURN : RET_NORMAL : Normal completion * : RET_ERROR : There is no shared memory area./semaphore error ******************************************************************************/ -inline RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, u_int16 offset) { +inline RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, uint16_t offset) { RET_API ret_api; /* System API return value */ SemID sem_id; /* Semaphore ID */ int32 i; @@ -857,7 +869,7 @@ inline RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, u_int16 offset) * : RET_ERRMSGFULL : Message queue overflows * : RET_ERRPARAM : Buffer size error ******************************************************************************/ -inline RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data) { +inline RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data) { VEHICLE_MSG_BUF msg_buf; /* message buffer */ T_APIMSG_MSGBUF_HEADER *msg_hdr; /* Pointer to the message header */ RET_API ret_api; /* Return value */ @@ -905,13 +917,13 @@ inline RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len /* Internal Process Transmission and Reception Messages */ ret_api = _pb_SndMsg(pno_dest, - (u_int16)(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len), + (uint16_t)(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len), reinterpret_cast<void *>(&msg_buf), 0); } else { /* External Process Transmission and Reception Messages */ ret_api = _pb_SndMsg_Ext(thread_name, cid, - (u_int16)(msg_len), /* Ignore->MISRA-C++:2008 Rule 5-0-5 */ + (uint16_t)(msg_len), /* Ignore->MISRA-C++:2008 Rule 5-0-5 */ reinterpret_cast<void *>(&(msg_buf.data)), 0); } FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "-"); diff --git a/positioning/client/include/POS_sensor_private.h b/positioning/client/include/POS_sensor_private.h index a324eae7..1e1497f9 100644 --- a/positioning/client/include/POS_sensor_private.h +++ b/positioning/client/include/POS_sensor_private.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,15 +108,6 @@ typedef struct { } SENSOR_INTERNAL_MSG_BUF; /******************************************************************************** - * TAG TG_GPS_RET_TIMESET_MSG - * ABSTRACT :GPS Time Setting Response Message Structure - ********************************************************************************/ -typedef struct { - T_APIMSG_MSGBUF_HEADER header; /* Message header */ - uint64_t status; /* Response status */ -} TG_GPS_RET_TIMESET_MSG; - -/******************************************************************************** * TAG :TG_GPSTIME * ABSTRACT :GPS Absolute Time Structure * NOTE : diff --git a/positioning/client/include/SensorLocation_API.h b/positioning/client/include/SensorLocation_API.h index 4befe2d4..ae7f20a0 100644 --- a/positioning/client/include/SensorLocation_API.h +++ b/positioning/client/include/SensorLocation_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/SensorLocation_API_private.h b/positioning/client/include/SensorLocation_API_private.h index fa2ab503..d37d9eb3 100644 --- a/positioning/client/include/SensorLocation_API_private.h +++ b/positioning/client/include/SensorLocation_API_private.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/SensorMotion_API.h b/positioning/client/include/SensorMotion_API.h index 24e0e97b..2db5511b 100644 --- a/positioning/client/include/SensorMotion_API.h +++ b/positioning/client/include/SensorMotion_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/Sensor_API.h b/positioning/client/include/Sensor_API.h index f86a2891..b49b4ac5 100644 --- a/positioning/client/include/Sensor_API.h +++ b/positioning/client/include/Sensor_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,24 +33,4 @@ typedef struct { uint16_t wkn; /**< GPS rollover base week number */ } SENSOR_WKNROLLOVER; -/************************************************************************ -* prototype declalation * -************************************************************************/ -/*[SENSOR_API public API]*/ -#ifdef __cplusplus -extern "C" { -#endif -SENSOR_RET_API SensorPkgDeliveryEntry(PNO pno, u_int8 pkg_num, DID *did, u_int8 ctrl_flg, u_int8 delivery_timing); -SENSOR_RET_API SensorPkgDeliveryEntryExt(PNO pno, u_int8 pkg_num, DID *did, u_int8 ctrl_flg, u_int8 delivery_timing); -int32 SensorGetSensorPkgData(PNO pno, u_int8 pkg_num, DID *did, void *dest_data, u_int16 dest_size); -RET_API SensorReqGpsReset(PNO proc_no, u_int8 mode, RID req_id); -SENSOR_RET_API GpsGetGpsInterruptSignal(GPS_INTERRUPT *gps_interrupt); -SENSOR_RET_API SensorGetGyroConnectStatus(u_int8 *gyro_connect_status); -SENSOR_RET_API GpsGetValidEphemerisNumberOnShutdown(u_int8 *valid_ephemeris_num); -SENSOR_RET_API ClockGetLocalTimeOnShutdown(LOCALTIME *local_time); -int32 VehicleGetVehicleData(PNO pno, DID did, void *dest_data, u_int16 dest_size); -#ifdef __cplusplus -} -#endif - #endif // POSITIONING_CLIENT_INCLUDE_SENSOR_API_H_ diff --git a/positioning/client/include/Sensor_API_private.h b/positioning/client/include/Sensor_API_private.h index 9314316c..c3b5f54d 100644 --- a/positioning/client/include/Sensor_API_private.h +++ b/positioning/client/include/Sensor_API_private.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ /************************************************************************ * Macro definitions * ************************************************************************/ -#define SENSOR_PUBLIC_DID_NUM 25 +#define SENSOR_PUBLIC_DID_NUM 31 /*----------------------------------------------------------------------* * Shared Memory Related Extensions * @@ -105,8 +105,8 @@ * ABSTRACT : Shared memory management area ************************************************************************/ typedef struct { - u_int8 lock_info[SENSOR_SHARE_BLOCK_NUM]; /* Usages */ - u_int8 reserve[501]; /* 512-11 */ + uint8_t lock_info[SENSOR_SHARE_BLOCK_NUM]; /* Usages */ + uint8_t reserve[501]; /* 512-11 */ } SENSOR_SHARE_MNG; /************************************************************************ @@ -114,10 +114,10 @@ typedef struct { * ABSTRACT : Shared memory data area(Data section details) ************************************************************************/ typedef struct { - u_int8 pkg_num; /* Number of packages */ - u_int8 reserve[3]; - u_int16 offset[SENSOR_PKG_DELIVERY_MAX]; /* Offset value */ - u_int8 data[SENSOR_SHARE_BLOCK_DSIZE]; /* Data portion */ + uint8_t pkg_num; /* Number of packages */ + uint8_t reserve[3]; + uint16_t offset[SENSOR_PKG_DELIVERY_MAX]; /* Offset value */ + uint8_t data[SENSOR_SHARE_BLOCK_DSIZE]; /* Data portion */ } SENSOR_SHARE_BLOCK_DAT_DAT; /************************************************************************ @@ -125,8 +125,8 @@ typedef struct { * ABSTRACT : Shared memory data area(One block) ************************************************************************/ typedef struct { - u_int16 size; /* Size of the data */ - u_int8 reserve[2]; + uint16_t size; /* Size of the data */ + uint8_t reserve[2]; SENSOR_SHARE_BLOCK_DAT_DAT data; /* Data portion */ } SENSOR_SHARE_BLOCK_DAT; @@ -157,12 +157,12 @@ typedef struct { * Function prototype * ************************************************************************/ RET_API PosDeleteEvent(EventID event_id); -RET_API SensorLinkShareData(void **share_top, u_int32 *share_size, u_int16 *offset); -RET_API SensorUnLinkShareData(SENSOR_SHARE *share_top, u_int16 offset); +RET_API SensorLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset); +RET_API SensorUnLinkShareData(SENSOR_SHARE *share_top, uint16_t offset); EventID PosCreateEvent(PNO pno); -void SensorSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src); -RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data); +void SensorSetShareData(void *share_top, uint16_t offset, const void *data_src, uint16_t size_src); +RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data); BOOL SensorJudgeDid(DID did, uint8_t mode); diff --git a/positioning/client/include/Sensor_Common_API.h b/positioning/client/include/Sensor_Common_API.h index f2c8c6d4..5631e837 100644 --- a/positioning/client/include/Sensor_Common_API.h +++ b/positioning/client/include/Sensor_Common_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,146 +41,95 @@ /* VEHICLE__DID */ /* ++ PastModel002 Support_UBX_Protocol_DID */ -#define VEHICLE_DID_GPS_UBLOX_NAV_POSLLH 0x00000000 -#define VEHICLE_DID_GPS_UBLOX_NAV_STATUS 0x00000001 -#define VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC 0x00000002 -#define VEHICLE_DID_GPS_UBLOX_NAV_VELNED 0x00000003 -#define VEHICLE_DID_GPS_UBLOX_NAV_DOP 0x00000004 -#define VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS 0x00000005 -#define VEHICLE_DID_GPS_UBLOX_NAV_SVINFO 0x00000006 -#define VEHICLE_DID_GPS_UBLOX_NAV_CLOCK 0x00000007 -#define VEHICLE_DID_GPS_UBLOX_MON_HW 0x00000008 -#define VEHICLE_DID_GPS_UBLOX_ACK_ACK 0x00000009 -#define VEHICLE_DID_GPS_UBLOX_ACK_NAK 0x0000000A -#define VEHICLE_DID_GPS_UBLOX_CFG_RST 0x0000000B -#define VEHICLE_DID_GPS_UBLOX_AID_INI 0x0000000C -#define VEHICLE_DID_GPS_UBLOX_AID_EPH 0x0000000D -#define VEHICLE_DID_GPS_UBLOX_CFG_MSG 0x0000000E -#define VEHICLE_DID_GPS_UBLOX_CFG_NAVX5 0x0000000F +#define VEHICLE_DID_GPS_UBLOX_NAV_POSLLH 0x80000060 +#define VEHICLE_DID_GPS_UBLOX_NAV_STATUS 0x80000061 +#define VEHICLE_DID_GPS_UBLOX_NAV_TIMEUTC 0x80000062 +#define VEHICLE_DID_GPS_UBLOX_NAV_VELNED 0x80000063 +#define VEHICLE_DID_GPS_UBLOX_NAV_DOP 0x80000064 +#define VEHICLE_DID_GPS_UBLOX_NAV_TIMEGPS 0x80000065 +#define VEHICLE_DID_GPS_UBLOX_NAV_SVINFO 0x80000066 +#define VEHICLE_DID_GPS_UBLOX_NAV_CLOCK 0x80000067 +#define VEHICLE_DID_GPS_UBLOX_MON_HW 0x80000068 +#define VEHICLE_DID_GPS_UBLOX_ACK_ACK 0x80000069 +#define VEHICLE_DID_GPS_UBLOX_ACK_NAK 0x8000006A +#define VEHICLE_DID_GPS_UBLOX_CFG_RST 0x8000006B +#define VEHICLE_DID_GPS_UBLOX_AID_INI 0x8000006C +#define VEHICLE_DID_GPS_UBLOX_AID_EPH 0x8000006D +#define VEHICLE_DID_GPS_UBLOX_CFG_MSG 0x8000006E +#define VEHICLE_DID_GPS_UBLOX_CFG_NAVX5 0x8000006F /* -- PastModel002 Support_UBX_Protocol_DID */ /* ++ used internally by the DR */ -#define VEHICLE_DID_GPS_COUNTER 0x00000010 -#define VEHICLE_DID_GYRO_EXT 0x00000011 /* 3 to 14bit A/D value,0bit:REV */ - -#define VEHICLE_DID_DR_LONGITUDE 0x00000012 -#define VEHICLE_DID_DR_LATITUDE 0x00000013 -#define VEHICLE_DID_DR_ALTITUDE 0x00000014 -#define VEHICLE_DID_DR_SPEED 0x00000015 -#define VEHICLE_DID_DR_HEADING 0x00000016 -#define VEHICLE_DID_DR_SNS_COUNTER 0x00000017 -#define VEHICLE_DID_DR_GYRO_OFFSET 0x00000018 -#define VEHICLE_DID_DR_GYRO_SCALE_FACTOR 0x00000019 -#define VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL 0x0000001A -#define VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR 0x0000001B -#define VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL 0x0000001C +#define VEHICLE_DID_GPS_COUNTER 0x8000001B +#define VEHICLE_DID_GYRO_EXT 0x80000027 + +#define VEHICLE_DID_DR_LONGITUDE 0x80000070 +#define VEHICLE_DID_DR_LATITUDE 0x80000071 +#define VEHICLE_DID_DR_ALTITUDE 0x80000072 +#define VEHICLE_DID_DR_SPEED 0x80000073 +#define VEHICLE_DID_DR_HEADING 0x80000074 +#define VEHICLE_DID_DR_SNS_COUNTER 0x80000075 +#define VEHICLE_DID_DR_GYRO_OFFSET 0x80000078 +#define VEHICLE_DID_DR_GYRO_SCALE_FACTOR 0x80000079 +#define VEHICLE_DID_DR_GYRO_SCALE_FACTOR_LEVEL 0x8000007A +#define VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR 0x8000007B +#define VEHICLE_DID_DR_SPEED_PULSE_SCALE_FACTOR_LEVEL 0x8000007C /* -- used internally by the DR */ /* ++ PastModel002 Support_DID */ -#define VEHICLE_DID_GYRO_TROUBLE 0x0000001D -#define VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL 0x0000001E -#define VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL 0x0000001F -#define VEHICLE_DID_GYRO_CONNECT_STATUS 0x00000020 -#define VEHICLE_DID_VALID_EPH_NUM 0x00000021 +#define VEHICLE_DID_GYRO_TROUBLE 0x80000080 +#define VEHICLE_DID_MAIN_GPS_INTERRUPT_SIGNAL 0x80000081 +#define VEHICLE_DID_SYS_GPS_INTERRUPT_SIGNAL 0x80000082 +#define VEHICLE_DID_GYRO_CONNECT_STATUS 0x80000083 +#define VEHICLE_DID_VALID_EPH_NUM 0x80000084 /* -- PastModel002 Support_DID */ /* ++ Not supported by UBX_Protocol */ -#define VEHICLE_DID_2WD4WD 0x00000022 -#define VEHICLE_DID_TEST 0x00000023 -#define VEHICLE_DID_VTRADAPTER 0x00000024 -#define VEHICLE_DID_AUXADAPTER 0x00000025 -#define VEHICLE_DID_PANELTEMP 0x00000026 -#define VEHICLE_DID_MINIJACK 0x00000027 -#define VEHICLE_DID_SIRF_BINARY 0x00000028 -#define VEHICLE_DID_RTC 0x00000029 -#define VEHICLE_DID_SATELLITE_STATUS 0x0000002A -#define VEHICLE_DID_LOCATION 0x0000002B -#define VEHICLE_DID_BACKDOOR_LINE 0x0000002C -#define VEHICLE_DID_ADIM_LINE 0x0000002D -#define VEHICLE_DID_BACKDOOR_CAN 0x0000002E -#define VEHICLE_DID_ADIM_CAN 0x0000002F -#define VEHICLE_DID_GGA 0x00000030 -#define VEHICLE_DID_GLL 0x00000031 -#define VEHICLE_DID_GSA 0x00000032 -#define VEHICLE_DID_GSV 0x00000033 -#define VEHICLE_DID_RMC 0x00000034 -#define VEHICLE_DID_VTG 0x00000035 -#define VEHICLE_DID_TOUCH 0x00000036 -#define VEHICLE_DID_KEY 0x00000037 -#define VEHICLE_DID_REMO 0x00000038 -#define VEHICLE_DID_VSC1S03 0x00000039 -#define VEHICLE_DID_ECO1S01 0x0000003A -#define VEHICLE_DID_ENG1F07 0x0000003B -#define VEHICLE_DID_ENG1S03 0x0000003C -#define VEHICLE_DID_ACN1S04 0x0000003D -#define VEHICLE_DID_ACN1S05 0x0000003E -#define VEHICLE_DID_ACN1S06 0x0000003F -#define VEHICLE_DID_ACN1S08 0x00000040 -#define VEHICLE_DID_ACN1S07 0x00000041 -#define VEHICLE_DID_EHV1S90 0x00000042 -#define VEHICLE_DID_ECT1S92 0x00000043 -#define VEHICLE_DID_ENG1S28 0x00000044 -#define VEHICLE_DID_BGM1S01 0x00000045 -#define VEHICLE_DID_ENG1F03 0x00000046 -#define VEHICLE_DID_CAA1N01 0x00000047 -#define VEHICLE_DID_MET1S01 0x00000048 -#define VEHICLE_DID_MET1S03 0x00000049 -#define VEHICLE_DID_MET1S04 0x0000004A -#define VEHICLE_DID_MET1S05 0x0000004B -#define VEHICLE_DID_MET1S07 0x0000004C -#define VEHICLE_DID_BDB1S01 0x0000004D -#define VEHICLE_DID_BDB1S03 0x0000004E -#define VEHICLE_DID_BDB1S08 0x0000004F -#define VEHICLE_DID_BDB1F03 0x00000050 -#define VEHICLE_DID_TPM1S02 0x00000051 -#define VEHICLE_DID_TPM1S03 0x00000052 -#define VEHICLE_DID_ENG1S92 0x00000053 -#define VEHICLE_DID_MMT1S52 0x00000054 -#define VEHICLE_DID_EPB1S01 0x00000055 -#define VEHICLE_DID_GPS__CWORD82__NMEA 0x00000056 -#define VEHICLE_DID_GPS__CWORD82__SETINITIAL 0x00000057 -#define VEHICLE_DID_GPS__CWORD82__SETRMODE 0x00000058 -#define VEHICLE_DID_GPS__CWORD82__SETRMODEEX 0x00000059 -#define VEHICLE_DID_GPS__CWORD82__SELSENT 0x0000005A -#define VEHICLE_DID_GPS__CWORD82__SETSBAS 0x0000005B -#define VEHICLE_DID_GPS__CWORD82__SETCONF1 0x0000005C -#define VEHICLE_DID_GPS__CWORD82__SETCONF2 0x0000005D -#define VEHICLE_DID_GPS__CWORD82__NMEA_GGA_INTERNAL 0x0000005E -#define VEHICLE_DID_GPS__CWORD82__NMEA_DGGA_INTERNAL 0x0000005F -#define VEHICLE_DID_GPS__CWORD82__NMEA_VTG_INTERNAL 0x00000060 -#define VEHICLE_DID_GPS__CWORD82__NMEA_RMC_INTERNAL 0x00000061 -#define VEHICLE_DID_GPS__CWORD82__NMEA_DRMC_INTERNAL 0x00000062 -#define VEHICLE_DID_GPS__CWORD82__NMEA_GLL_INTERNAL 0x00000063 -#define VEHICLE_DID_GPS__CWORD82__NMEA_DGLL_INTERNAL 0x00000064 -#define VEHICLE_DID_GPS__CWORD82__NMEA_GSA_INTERNAL 0x00000065 -#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV1_INTERNAL 0x00000066 -#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV2_INTERNAL 0x00000067 -#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV3_INTERNAL 0x00000068 -#define VEHICLE_DID_GPS__CWORD82__NMEA_PJRDC_GP_3_INTERNAL 0x00000069 -#define VEHICLE_DID_LOCATION_LONLAT 0x0000006A -#define VEHICLE_DID_LOCATION_ALTITUDE 0x0000006B -#define VEHICLE_DID_MOTION_SPEED 0x0000006C -#define VEHICLE_DID_MOTION_HEADING 0x0000006D -#define VEHICLE_DID_GPS_TIME 0x0000006E -#define VEHICLE_DID_NAVIINFO_DIAG_GPS 0x0000006F -#define VEHICLE_DID_GPSWEEKCOR_CNT 0x00000070 - -#define VEHICLE_DID_GPS_CUSTOMDATA_NAVI 0x00000071 -#define VEHICLE_DID_LOCATION_LONLAT_NAVI 0x00000072 -#define VEHICLE_DID_LOCATION_ALTITUDE_NAVI 0x00000073 -#define VEHICLE_DID_MOTION_SPEED_NAVI 0x00000074 -#define VEHICLE_DID_MOTION_HEADING_NAVI 0x00000075 -#define VEHICLE_DID_SETTINGTIME 0x00000076 - -#define VEHICLE_DID_LOCATIONINFO_NMEA_NAVI 0x00000077 - -#define VEHICLE_DID_MOTION_SPEED_INTERNAL 0x00000078 - -#define VEHICLE_DID_GPS_TIME_RAW 0x00000079U /* QAC 1281 */ -#define VEHICLE_DID_GPS_WKNROLLOVER 0x0000007AU /* QAC 1281 */ - -#define VEHICLE_DID_SPEED_PULSE_VEHICLE (0x00000080UL) +#define VEHICLE_DID_LOCATION 0x80000020 +#define VEHICLE_DID_GPS__CWORD82__NMEA POS_DID_GPS__CWORD82__NMEA +#define VEHICLE_DID_GPS__CWORD82__SETINITIAL POS_DID_GPS__CWORD82__SETINITIAL +#define VEHICLE_DID_GPS__CWORD82__SETRMODE 0x80000034 +#define VEHICLE_DID_GPS__CWORD82__SETRMODEEX POS_DID_GPS__CWORD82__SETRMODEEX +#define VEHICLE_DID_GPS__CWORD82__SELSENT POS_DID_GPS__CWORD82__SELSENT +#define VEHICLE_DID_GPS__CWORD82__SETSBAS 0x80000037 +#define VEHICLE_DID_GPS__CWORD82__SETCONF1 0x80000038 +#define VEHICLE_DID_GPS__CWORD82__SETCONF2 0x80000039 +#define VEHICLE_DID_GPS__CWORD82__NMEA_GGA_INTERNAL 0xA050 +#define VEHICLE_DID_GPS__CWORD82__NMEA_DGGA_INTERNAL 0xA051 +#define VEHICLE_DID_GPS__CWORD82__NMEA_VTG_INTERNAL 0xA052 +#define VEHICLE_DID_GPS__CWORD82__NMEA_RMC_INTERNAL 0xA053 +#define VEHICLE_DID_GPS__CWORD82__NMEA_DRMC_INTERNAL 0xA054 +#define VEHICLE_DID_GPS__CWORD82__NMEA_GLL_INTERNAL 0xA055 +#define VEHICLE_DID_GPS__CWORD82__NMEA_DGLL_INTERNAL 0xA056 +#define VEHICLE_DID_GPS__CWORD82__NMEA_GSA_INTERNAL 0xA057 +#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV1_INTERNAL 0xA058 +#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV2_INTERNAL 0xA059 +#define VEHICLE_DID_GPS__CWORD82__NMEA_GSV3_INTERNAL 0xA060 +#define VEHICLE_DID_GPS__CWORD82__NMEA_PJRDC_GP_3_INTERNAL 0xA061 +#define VEHICLE_DID_LOCATION_LONLAT 0x80000095 +#define VEHICLE_DID_LOCATION_ALTITUDE 0x80000096 +#define VEHICLE_DID_MOTION_SPEED 0x80000062 +#define VEHICLE_DID_MOTION_HEADING 0x80000097 +#define VEHICLE_DID_GPS_TIME 0x80000098 +#define VEHICLE_DID_NAVIINFO_DIAG_GPS 0x80000099 +#define VEHICLE_DID_GPSWEEKCOR_CNT 0x8000009A + +#define VEHICLE_DID_GPS_CUSTOMDATA_NAVI 0x800000A0 +#define VEHICLE_DID_LOCATION_LONLAT_NAVI 0x800000A1 +#define VEHICLE_DID_LOCATION_ALTITUDE_NAVI 0x800000A2 +#define VEHICLE_DID_MOTION_SPEED_NAVI 0x800000A3 +#define VEHICLE_DID_MOTION_HEADING_NAVI 0x800000A4 +#define VEHICLE_DID_SETTINGTIME 0x800000A5 + +#define VEHICLE_DID_LOCATIONINFO_NMEA_NAVI 0x800000A6 + +#define VEHICLE_DID_MOTION_SPEED_INTERNAL 0x800000B0 + +#define VEHICLE_DID_GPS_TIME_RAW 0x800000B1U /* QAC 1281 */ +#define VEHICLE_DID_GPS_WKNROLLOVER 0x800000B2U /* QAC 1281 */ + +#define VEHICLE_DID_SPEED_PULSE_VEHICLE (0x80000044UL) /* -- Not supported by UBX_Protocol */ diff --git a/positioning/client/include/VehicleDebug_API.h b/positioning/client/include/VehicleDebug_API.h index 101da4fc..e0c9ef20 100644 --- a/positioning/client/include/VehicleDebug_API.h +++ b/positioning/client/include/VehicleDebug_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/Vehicle_API.h b/positioning/client/include/Vehicle_API.h index cd50827e..78450c54 100644 --- a/positioning/client/include/Vehicle_API.h +++ b/positioning/client/include/Vehicle_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,7 +94,7 @@ typedef struct { ************************************************************************/ typedef struct { T_APIMSG_MSGBUF_HEADER hdr; /* Message header */ -// VEHICLE_MSG_SEND_DAT data; /* Message data */ + VEHICLE_MSG_SEND_DAT data; /* Message data */ } VEHICLE_MSG_SEND; /* -- GPS _CWORD82_ support */ diff --git a/positioning/client/include/Vehicle_API_Dummy.h b/positioning/client/include/Vehicle_API_Dummy.h index ad7a7f31..b242ac6d 100644 --- a/positioning/client/include/Vehicle_API_Dummy.h +++ b/positioning/client/include/Vehicle_API_Dummy.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/include/Vehicle_API_private.h b/positioning/client/include/Vehicle_API_private.h index dfe082dd..ad92ddbf 100644 --- a/positioning/client/include/Vehicle_API_private.h +++ b/positioning/client/include/Vehicle_API_private.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,7 +118,7 @@ typedef struct { * Function prototype * ************************************************************************/ RET_API VehicleDeleteEvent(EventID event_id); -RET_API VehicleLinkShareData(void **share_top, u_int32 *share_size, u_int16 *offset); +RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset); RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, u_int16 offset); EventID VehicleCreateEvent(PNO pno); void PosSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src); diff --git a/positioning/client/include/vehicle_service/POS_common_API.h b/positioning/client/include/vehicle_service/POS_common_API.h index fb1b834a..5ee30055 100644 --- a/positioning/client/include/vehicle_service/POS_common_API.h +++ b/positioning/client/include/vehicle_service/POS_common_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ * Incluce * *---------------------------------------------------------------------------------*/ #include <vehicle_service/POS_define.h> -//#include <gps_hal.h> +#include <gps_hal.h> /*---------------------------------------------------------------------------------* * Definition * @@ -61,11 +61,42 @@ /* Command ID */ /* Vehicle sensor information notification CID (Rate information) */ -#define CID_POSIF_REGISTER_LISTENER_SPEED (0x0203) //!< \~english Delivery speed + +/** + * \~english @brief Delivery speed command ID + * \~english @brief If you want to catch above envents, use NSFW like below. + * \~english @code + * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_SPEED, CBCallbackA); + * @endcode + */ +#define CID_POSIF_REGISTER_LISTENER_SPEED (0x0203) + +/** + * \~english @brief Delivery longitude and latitude command ID + * \~english @brief If you want to catch above envents, use NSFW like below. + * \~english @code + * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_LONLAT, CBCallbackA); + * @endcode + */ #define CID_POSIF_REGISTER_LISTENER_LONLAT 0x0781 -//!< \~english Delivery longitude and latitude -#define CID_POSIF_REGISTER_LISTENER_ALTITUDE 0x0782 //!< \~english Delivery altitude -#define CID_POSIF_REGISTER_LISTENER_HEADING 0x0783 //!< \~english Delivery heading + +/** + * \~english @brief Delivery altitude command ID + * \~english @brief If you want to catch above envents, use NSFW like below. + * \~english @code + * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_ALTITUDE, CBCallbackA); + * @endcode + */ +#define CID_POSIF_REGISTER_LISTENER_ALTITUDE 0x0782 + +/** + * \~english @brief Delivery heading command ID + * \~english @brief If you want to catch above envents, use NSFW like below. + * \~english @code + * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_HEADING, CBCallbackA); + * @endcode + */ +#define CID_POSIF_REGISTER_LISTENER_HEADING 0x0783 /*---------------------------------------------------------------------------------* * Typedef declaration * @@ -94,7 +125,7 @@ typedef struct { * \~english longitude and latitude information data delivery message */ typedef struct { -// SENSORLOCATION_LONLATINFO_DAT data; + SENSORLOCATION_LONLATINFO_DAT data; //!< \~english longitude and latitude information data } SENSORLOCATION_MSG_LONLATINFO; @@ -103,7 +134,7 @@ typedef struct { * \~english altitude information data delivery message */ typedef struct { -// SENSORLOCATION_ALTITUDEINFO_DAT data; //!< \~english altitude information data + SENSORLOCATION_ALTITUDEINFO_DAT data; //!< \~english altitude information data } SENSORLOCATION_MSG_ALTITUDEINFO; /** @@ -111,7 +142,7 @@ typedef struct { * \~english heading information data delivery message */ typedef struct { -// SENSORMOTION_HEADINGINFO_DAT data; //!< \~english heading information data + SENSORMOTION_HEADINGINFO_DAT data; //!< \~english heading information data } SENSORMOTION_MSG_HEADINGINFO; /** @@ -119,7 +150,7 @@ typedef struct { * \~english speed information data delivery message */ typedef struct { -// SENSORMOTION_SPEEDINFO_DAT data; //!< \~english speed information data + SENSORMOTION_SPEEDINFO_DAT data; //!< \~english speed information data } SENSORMOTION_MSG_SPEEDINFO; @@ -264,7 +295,7 @@ extern "C" { /// Notification of message /// - After registered successfully, vehicle sensor information will been sent as system API \n /// message with following format.\n -/// Command ID : CID_POSIF_REGISTER_LISTENER_LONLAT \n +/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_LONLAT \n /// message structure /// \~english @code /// typedef struct { @@ -278,8 +309,6 @@ extern "C" { /// uint8_t getMethod; /* get method */ /// uint8_t SyncCnt; /* Synchrony count */ /// uint8_t isEnable; /* enable or not */ -/// uint8_t isExistDR; /* DR exist or not[not used] */ -/// uint8_t DRStatus /* DR status[not used] */ /// uint8_t posSts; /* position status */ /// uint16_t posAcc; /* Position accuracy */ /// int32_t Longitude; /* Longitude */ @@ -346,7 +375,7 @@ POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, PCSTR notifyName, uint8_t uc /// \~english @param [in] ucDeliveryTiming /// - uint8_t - Delivery timing(change/update) /// \~english @param [in] ucGetMethod -/// - uint8_t - Get method(GPS/Navi/Not specified) +/// - uint8_t - Get method(GPS/Not specified) /// /// \~english @par /// - Delivery control flag(ucCtrlFlg) @@ -361,7 +390,6 @@ POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, PCSTR notifyName, uint8_t uc /// vehicle sensor. /// - Get method(ucGetMethod) /// - SENSOR_GET_METHOD_GPS - GPS. The altitude from GPS will be deliveried. -/// - SENSOR_GET_METHOD_NAVI - Navi. The altitude from Navigation will be deliveried. /// - SENSOR_GET_METHOD_AUTO - Not specified. The altitude will be deliveried according to \n /// the current environment /// - Avaliable method is descriped as following in each environment. \n @@ -454,7 +482,7 @@ POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, PCSTR notifyName, uint8_t uc /// \~english @par /// Notification of message /// - After registered successfully, vehicle sensor will send system API message with following format. \n -/// Command ID : CID_POSIF_REGISTER_LISTENER_ALTITUDE \n +/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_ALTITUDE \n /// message structure /// \~english @code /// typedef struct { @@ -467,21 +495,17 @@ POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, PCSTR notifyName, uint8_t uc /// uint8_t getMethod; /* get method */ /// uint8_t SyncCnt; /* synchrony count */ /// uint8_t isEnable; /* enable or not */ -/// uint8_t isExistDR; /* DR exist or not[not used] */ -/// uint8_t DRStatus /* DR status[not used] */ /// uint8_t Reserve[3]; /* Reserve */ /// int32_t Altitude; /* Altitude(unit:0.01m) */ /// } SENSORLOCATION_ALTITUDEINFO_DAT; /// @endcode /// - Get method(getMethod) /// - SENSOR_GET_METHOD_GPS - altitude from GPS -/// - SENSOR_GET_METHOD_NAVI - altitude from Navigation /// - Synchrony count(SyncCnt) /// - Count for position data synchronous \n /// When delivery altitude and heading data, position data can be synchronized by SyncCnt. \n /// But the data of different method can not be synchronized by SyncCnt.\n -/// example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by SyncCnt.\n -/// example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be +/// example: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by SyncCnt.\n /// synchronized by SyncCnt. \n /// Caution: The sensor count in sensor data delivery is another data. /// - Enable or not(isEnable) \n @@ -491,7 +515,6 @@ POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, PCSTR notifyName, uint8_t uc /// - when GPS data specified, Altitude is invalid at following condition(so [not avaliable] provieded): /// - Immediately after system start, GPS unit has not received current location data and GPS unit status \n /// is not positioning fix -/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified /// - If the status is [not avaliable], data following can not be guaranteed. /// - Altitude /// - altitude data(unit 0.01m) @@ -629,7 +652,7 @@ POS_RET_API POS_RegisterListenerAltitude(HANDLE hApp, PCSTR notifyName, uint8_t /// \~english @par /// Notification of message /// - After registered successfully, vehicle sensor will send system API message with following format. \n -/// Command ID : CID_POSIF_REGISTER_LISTENER_SPEED \n +/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_SPEED \n /// message structure /// \~english @code /// typedef struct { @@ -642,9 +665,7 @@ POS_RET_API POS_RegisterListenerAltitude(HANDLE hApp, PCSTR notifyName, uint8_t /// uint8_t getMethod; /* get method */ /// uint8_t SyncCnt; /* synchrony count */ /// uint8_t isEnable; /* enable or not */ -/// uint8_t isExistDR; /* DR exist or not[not used] */ /// uint8_t Reserve1[3]; /* Reserve */ -/// uint8_t DRStatus /* DR status[not used] */ /// uint16_t Speed; /* speed(unit:0.01m/sec) */ /// uint8_t Reserve2[2]; /* Reserve */ /// } SENSORMOTION_SPEEDINFO_DAT; @@ -707,7 +728,6 @@ POS_RET_API POS_RegisterListenerSpeed(HANDLE hApp, PCSTR notifyName, uint8_t ucC /// vehicle sensor. /// - Get method(ucGetMethod) /// - SENSOR_GET_METHOD_GPS - GPS. The heading from GPS will be deliveried. -/// - SENSOR_GET_METHOD_NAVI - Navi. The heading from Navi will be deliveried. /// - SENSOR_GET_METHOD_AUTO - Not specified. The heading will be deliveried \n /// according to the current environment /// - Avaliable method is descriped as following in each environment. \n @@ -798,7 +818,7 @@ POS_RET_API POS_RegisterListenerSpeed(HANDLE hApp, PCSTR notifyName, uint8_t ucC /// \~english @par /// Notification of message /// - After registered successfully, vehicle sensor will send system API message with following format. \n -/// Command ID : CID_POSIF_REGISTER_LISTENER_HEADING \n +/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_HEADING \n /// message structure /// \~english @code /// typedef struct { @@ -811,8 +831,6 @@ POS_RET_API POS_RegisterListenerSpeed(HANDLE hApp, PCSTR notifyName, uint8_t ucC /// uint8_t getMethod; /* get method */ /// uint8_t SyncCnt; /* sync count */ /// uint8_t isEnable; /* enable or not */ -/// uint8_t isExistDR; /* DR exist or not[not used] */ -/// uint8_t DRStatus /* DR status[not used] */ /// uint8_t posSts; /* position status */ /// uint8_t Reserve1[2]; /* Reserve */ /// uint16_t Heading; /* heading(unit:0.01degree) */ @@ -889,8 +907,6 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// uint8_t getMethod; /* get method */ /// uint8_t SyncCnt; /* sync count */ /// uint8_t isEnable; /* enable or not */ -/// uint8_t isExistDR; /* DR exist or not[not used] */ -/// uint8_t DRStatus /* DR status[not used] */ /// uint8_t posSts; /* position status */ /// uint16_t posAcc; /* Position accuracy */ /// int32_t Longitude; /* Longitude */ @@ -1025,7 +1041,7 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// - POS_RegisterListenerLonLat /// //////////////////////////////////////////////////////////////////////////////////////////// -//POS_RET_API POS_GetLonLat(HANDLE hApp, SENSORLOCATION_LONLATINFO_DAT *dat, uint9_t ucGetMethod); +POS_RET_API POS_GetLonLat(HANDLE hApp, SENSORLOCATION_LONLATINFO_DAT *dat, uint8_t ucGetMethod); //////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup tag_Positioning @@ -1037,12 +1053,11 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// \~english @param [out] dat /// - SENSORLOCATION_ALTITUDEINFO_DAT* - output pointer to altitude data /// \~english @param [in] ucGetMethod -/// - uint8_t - Get method(GPS/Navi/Not specified) +/// - uint8_t - Get method(GPS/Not specified) /// /// \~english @par /// - Get method(ucGetMethod) /// - SENSOR_GET_METHOD_GPS - GPS The altitude from GPS will be deliveried. -/// - SENSOR_GET_METHOD_NAVI - Navi The altitude from Navi will be deliveried. /// - SENSOR_GET_METHOD_AUTO - Not specified The altitude will be deliveried \n /// according to the current environment /// - Avaliable method is descriped as following in each environment. \n @@ -1056,21 +1071,17 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// uint8_t getMethod; /* get method */ /// uint8_t SyncCnt; /* sync count */ /// uint8_t isEnable; /* enable or not */ -/// uint8_t isExistDR; /* DR exist or not[not used] */ -/// uint8_t DRStatus /* DR status[not used] */ /// uint8_t Reserve[3]; /* Reserve */ /// int32_t Altitude; /* Altitude(unit:0.01m) */ /// } SENSORLOCATION_ALTITUDEINFO_DAT; /// @endcode /// - Get method(getMethod) /// - SENSOR_GET_METHOD_GPS - altitude from GPS -/// - SENSOR_GET_METHOD_NAVI - altitude from Navi /// - Synchrony count(SyncCnt) /// - Count for position data synchronous \n /// When delivery altitude and heading data, position data can be synchronized by this count. \n /// But the data of different method can not be synchronized by this count. \n -/// example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n -/// example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n +/// example: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n /// synchronized by the count. \n /// Caution: The sensor count in sensor data delivery is another data. /// - Enable or not(isEnable)\n @@ -1080,7 +1091,6 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// - Altitude is invalid at following condition when GPS data specified, so [not avaliable] provieded /// - Immediately after system start, GPS unit has not received current location data and GPS unit \n /// status is not positioning fix -/// - If it is not initialization status, certainly provide [avaliable] when Navi data specified /// - If the status is [not avaliable], data following can not be guaranteed. /// - Altitude /// - altitude data(unit 0.01m) @@ -1178,7 +1188,7 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// \~english @see /// - POS_RegisterListenerAltitude //////////////////////////////////////////////////////////////////////////////////////////// -//POS_RET_API POS_GetAltitude(HANDLE hApp, SENSORLOCATION_ALTITUDEINFO_DAT *dat, uint8_t ucGetMethod); +POS_RET_API POS_GetAltitude(HANDLE hApp, SENSORLOCATION_ALTITUDEINFO_DAT *dat, uint8_t ucGetMethod); //////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup tag_Positioning @@ -1210,16 +1220,13 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// uint8_t getMethod; /* get method */ /// uint8_t SyncCnt; /* sync count */ /// uint8_t isEnable; /* enable or not */ -/// uint8_t isExistDR; /* DR exist or not[not used] */ /// uint8_t Reserve1[3]; /* Reserve */ -/// uint8_t DRStatus /* DR status[not used] */ /// uint16_t Speed; /* speed(unit:0.01m/sec) */ /// uint8_t Reserve2[2]; /* Reserve */ /// } SENSORMOTION_SPEEDINFO_DAT; /// @endcode /// - Get method(getMethod) /// - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried. -/// - SENSOR_GET_METHOD_NAVI - speed from Navi /// - Sync count(SyncCnt) /// - 0. /// - Enable or not(isEnable) \n @@ -1327,7 +1334,7 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// - POS_RegisterListenerSpeed /// //////////////////////////////////////////////////////////////////////////////////////////// -//POS_RET_API POS_GetSpeed(HANDLE hApp, SENSORMOTION_SPEEDINFO_DAT *dat, uint8_t ucGetMethod); +POS_RET_API POS_GetSpeed(HANDLE hApp, SENSORMOTION_SPEEDINFO_DAT *dat, uint8_t ucGetMethod); //////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup tag_Positioning @@ -1343,8 +1350,9 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// /// \~english @par /// - Get method(ucGetMethod) -/// - SENSOR_GET_METHOD_GPS - GPS The altitude from GPS will be deliveried. -/// - SENSOR_GET_METHOD_NAVI - Navi The altitude from Navi will be deliveried. +/// - SENSOR_GET_METHOD_GPS - GPS The heading from GPS will be deliveried. +/// - SENSOR_GET_METHOD_NAVI - Navi The heading from Navi will be deliveried. +/// - SENSOR_GET_METHOD_AUTO - Not specified The heading which most suitable in current environment \n /// - Avaliable method is descriped as following in each environment. \n /// In corresponding environment, the SENSOR_GET_METHOD_AUTO is set as default. \n /// In corresponding environment, if the unsupported method has been specified, \n @@ -1356,8 +1364,6 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// uint8_t getMethod; /* get method */ /// uint8_t SyncCnt; /* sync count */ /// uint8_t isEnable; /* enable or not */ -/// uint8_t isExistDR; /* DR exist or not[not used] */ -/// uint8_t DRStatus /* DR status[not used] */ /// uint8_t posSts; /* position status */ /// uint8_t Reserve1[2]; /* Reserve */ /// uint16_t Heading; /* heading(unit:0.01degree) */ @@ -1485,7 +1491,7 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, PCSTR notifyName, uint8_t u /// - POS_RegisterListenerHeading /// //////////////////////////////////////////////////////////////////////////////////////////// -//POS_RET_API POS_GetHeading(HANDLE hApp, SENSORMOTION_HEADINGINFO_DAT *dat, uint8_t ucGetMethod); +POS_RET_API POS_GetHeading(HANDLE hApp, SENSORMOTION_HEADINGINFO_DAT *dat, uint8_t ucGetMethod); //////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup tag_Positioning @@ -1648,64 +1654,6 @@ POS_RET_API POS_SetSpeedInfo(HANDLE hApp, uint16_t navispeed); //////////////////////////////////////////////////////////////////////////////////////////// POS_RET_API POS_SetLocationInfo(HANDLE hApp, POS_POSDATA* pstPosData); -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup tag_Positioning -/// \~english @par Brief -/// - Set location NMEA information -/// -/// \~english @param [in] hApp -/// - HANDLE - App Handle -/// \~english @param [in] locationInfo -/// - POS_POSDATA * - pointer to location information NMEA -/// -/// \~english @retval POS_RET_NORMAL normal finish -/// \~english @retval POS_RET_ERROR_PARAM parameter error -/// \~english @retval POS_RET_ERROR_INNER internal error -/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported -/// \~english @retval SENSOR_RET_ERROR_NOSUPPORT unsupported -/// \~english @retval POS_RET_ERROR_RESOURCE lack of resource -/// -/// \~english @par Precondition -/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of \n -/// the Dispatcher for App are completed. -/// - Availability of positioning service is TRUE. -/// -/// \~english @par changes of internal status -/// - There is no changes of internal status -/// -/// \~english @par Failure condition -/// - The parameter hApp is NULL [POS_RET_ERROR_PARAM] -/// - The length in parameter locationInfo is invalid value(0). [POS_RET_ERROR_PARAM] -/// - The length in parameter locationInfo is abnormal value(> LOCATIONINFO_NMEA_MAX). [POS_RET_ERROR_PARAM] -/// - The count of message in message queue is reach to max [POS_RET_ERROR_RESOURCE] -/// - The count of mutex is reach to max [POS_RET_ERROR_RESOURCE] -/// - The count of item in ProcessName-ProcessNo convert table is reach to max [POS_RET_ERROR_RESOURCE] -/// - The message queue name has not been registered in control table. [POS_RET_ERROR_INNER] -/// - Message transfer HANDLE create failed. [POS_RET_ERROR_INNER] -/// - Message transfer HANDLE get failed from internal table. [POS_RET_ERROR_INNER] -/// - Location NMEA data setting message transfer failed. [POS_RET_ERROR_INNER] -/// -/// \~english @par Detail -/// - Call this API to set location nmea to vehicle sensor. \n -/// This API will finish when get the return value. \n -/// The location set by this API is saved in positioning as the location calculated by Navi. \n -/// -/// \~english @par -/// - Please note the following points when use this API. -/// - This API is only called by Navi proxy. -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -/// \~english @see -/// - None -/// -////////////////////////////////////////////////////////////////////////////////////////////yy -POS_RET_API POS_SetLocationInfoNmea(HANDLE hApp, POS_LOCATIONINFO_NMEA* locationInfo); - #ifdef __cplusplus } #endif diff --git a/positioning/client/include/vehicle_service/POS_define.h b/positioning/client/include/vehicle_service/POS_define.h index 3971c047..2ea918da 100644 --- a/positioning/client/include/vehicle_service/POS_define.h +++ b/positioning/client/include/vehicle_service/POS_define.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ */ #include <native_service/frameworkunified_types.h> -//#include <gps_hal.h> +#include <gps_hal.h> /*---------------------------------------------------------------------------------* * Definition * @@ -48,7 +48,7 @@ /* SENSOR_RET_API */ #define SENSOR_RET_NORMAL 0 //!< \~english normal finish #define SENSOR_RET_ERROR_PID (-1) //!< \~english thread ID error -#define SENSOR_RET_ERROR_DID (-2) //!< \~english data ID error +#define SENSOR_RET_ERROR_DID (-2) //!< \~english unregistered data ID error #define SENSOR_RET_ERROR_DID_DIS (-3) //!< \~english data ID not CAN ID #define SENSOR_RET_ERROR_PARAM (-4) //!< \~english parameter error #define SENSOR_RET_ERROR_BUFFULL (-5) //!< \~english buffer full error diff --git a/positioning/client/include/vehicle_service/POS_gps_API.h b/positioning/client/include/vehicle_service/POS_gps_API.h index 865966c4..41e8e01e 100644 --- a/positioning/client/include/vehicle_service/POS_gps_API.h +++ b/positioning/client/include/vehicle_service/POS_gps_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ * Incluce * *---------------------------------------------------------------------------------*/ #include <vehicle_service/POS_define.h> -//#include <gps_hal.h> +#include <gps_hal.h> /*---------------------------------------------------------------------------------* * Typedef declaration * @@ -54,7 +54,7 @@ typedef int32_t NAVIINFO_RET_API; * \~english @brief GPS time setting result delivery command ID * \~english @brief If you want to catch above envents, use NSFW like below. * \~english @code - * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(test_params_->h_app,"POS_Main", CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ, CBCallbackA); + * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(h_app,POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ, CBCallbackA); * @endcode */ #define CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ 0x0780 @@ -316,7 +316,7 @@ int32_t POS_ReqGPSSetting(HANDLE hApp, SENSOR_MSG_SEND_DAT *p_data); /// related to data ID [NAVIINFO_RET_ERROR_RESOURCE] /// - The count of message in message queue is reach to max [NAVIINFO_RET_ERROR_RESOURCE] /// - The count of mutex is reach to max [NAVIINFO_RET_ERROR_RESOURCE] -/// - The count of item in ProcessName-ProcessNo convert table is reach to max [SENSOR_RET_ERROR_RESOURCE] +/// - The count of item in ProcessName-ProcessNo convert table is reach to max [NAVIINFO_RET_ERROR_RESOURCE] /// - The message queue name has not been registered in control table. [NAVIINFO_RET_ERROR_INNER] /// - Message transfer HANDLE create failed. [NAVIINFO_RET_ERROR_INNER] /// - Message transfer HANDLE get failed from internal table. [NAVIINFO_RET_ERROR_INNER] @@ -339,7 +339,7 @@ int32_t POS_ReqGPSSetting(HANDLE hApp, SENSOR_MSG_SEND_DAT *p_data); /// \~english @see /// - POS_GetGPSInfo //////////////////////////////////////////////////////////////////////////////////////////// -//NAVIINFO_RET_API POS_SetGPSInfo(HANDLE hApp, NAVIINFO_ALL *navilocinfo); +NAVIINFO_RET_API POS_SetGPSInfo(HANDLE hApp, NAVIINFO_ALL *navilocinfo); //////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup tag_Positioning @@ -520,7 +520,7 @@ int32_t POS_ReqGPSSetting(HANDLE hApp, SENSOR_MSG_SEND_DAT *p_data); /// \~english @see /// - POS_SetGPSInfo //////////////////////////////////////////////////////////////////////////////////////////// -//NAVIINFO_RET_API POS_GetGPSInfo(HANDLE hApp, NAVIINFO_DIAG_GPS *navidiaginfo); +NAVIINFO_RET_API POS_GetGPSInfo(HANDLE hApp, NAVIINFO_DIAG_GPS *navidiaginfo); //////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup tag_Positioning @@ -640,49 +640,6 @@ POS_RET_API POS_ReqGPSReset(HANDLE hApp, PCSTR ResName, uint8_t mode); //////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup tag_Positioning /// \~english @par Brief -/// - Get GPS device version -/// -/// \~english @param [in] hApp -/// - HANDLE - App Handle -/// \~english @param [in] buf_size -/// - uint8_t - size of the output buffer -/// \~english @param [out] buf -/// - int8_t* - output buffer of storing GPS version -/// \~english @param [out] size -/// - uint8_t* - the size of getting GPS version data -/// -/// \~english @retval POS_RET_ERROR_NOSUPPORT unsupported -/// -/// \~english @par Precondition -/// - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) \n -/// of the Dispatcher for App are completed. -/// - Availability of positioning service is TRUE. -/// -/// \~english @par changes of internal status -/// - There is no changes of internal status -/// -/// \~english @par Detail -/// - Call this API to get GPS device version from vehicle sensor. -/// -/// \~english @par -/// - Please note the following points when use this API. -/// - Current enviroment does not support to get GPS version, and certainly return POS_RET_ERROR_NOSUPPORT. -/// -/// -/// \~english @par Classification -/// - Public -/// -/// \~english @par Type -/// - Fire and Forget -/// -/// \~english @see -/// - None -//////////////////////////////////////////////////////////////////////////////////////////// -POS_RET_API POS_GetGPSVersion(HANDLE hApp, uint8_t buf_size, int8_t* buf, uint8_t* size); - -//////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup tag_Positioning -/// \~english @par Brief /// - Register GPS time setting request delivery /// /// \~english @param [in] hApp @@ -777,7 +734,7 @@ POS_RET_API POS_GetGPSVersion(HANDLE hApp, uint8_t buf_size, int8_t* buf, uint8_ /// Notification of message /// - After registered successfully, vehicle sensor information will be sent by system \n /// API message with following format. \n -/// Command ID : CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ \n +/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_GPS_TIME_SET_REQ \n /// time info structure \n /// The year, month, date, hour, minute and second should be the format set to GPS /// \~english @code @@ -877,7 +834,7 @@ POS_RET_API POS_RegisterListenerGPSTimeSetReq(HANDLE hApp, PCSTR notifyName, uin /// \~english @see /// - POS_GetGPStime //////////////////////////////////////////////////////////////////////////////////////////// -//POS_RET_API POS_SetGPStime(HANDLE hApp, POS_DATETIME* pstDateTime); +POS_RET_API POS_SetGPStime(HANDLE hApp, POS_DATETIME* pstDateTime); //////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup tag_Positioning @@ -984,7 +941,6 @@ POS_RET_API POS_RegisterListenerGPSTimeSetReq(HANDLE hApp, PCSTR notifyName, uin /// - The same destination thread name has already been registered /// - The registered delivery data updated and normal return.(first delivery) /// - To one delivery destination, the same data will not be duplication deliveried at same timing. -/// - Although registering can be finished, but the data will not be deliveried. /// - After call this API, if the delivery destination thread name has changed, please call this API again. /// /// \~english @par @@ -1168,7 +1124,7 @@ SENSOR_RET_API POS_RegisterListenerGPStime(HANDLE hApp, PCSTR notifyName, uint8_ /// \~english @see /// - POS_SetGPStime //////////////////////////////////////////////////////////////////////////////////////////// -//POS_RET_API POS_GetGPStime(HANDLE hApp, SENSOR_GPSTIME* dat); +POS_RET_API POS_GetGPStime(HANDLE hApp, SENSOR_GPSTIME* dat); #ifdef __cplusplus } diff --git a/positioning/client/include/vehicle_service/POS_sensor_API.h b/positioning/client/include/vehicle_service/POS_sensor_API.h index eade3790..a7a35c4a 100644 --- a/positioning/client/include/vehicle_service/POS_sensor_API.h +++ b/positioning/client/include/vehicle_service/POS_sensor_API.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,24 +44,35 @@ #define POS_DID_SPEED_KMPH 0x80000013 //!< \~english Data ID of KMPH speed #define POS_DID_SNS_COUNTER 0x8000001A //!< \~english Data ID of sensor counter -#define POS_DID_GYRO 0x80000014 //!< \~english Data ID of gyro +#define POS_DID_GYRO_X 0x80000014 //!< \~english Data ID of X axis gyro +#define POS_DID_GYRO_Y 0x80000085 //!< \~english Data ID of Y axis gyro +#define POS_DID_GYRO_Z 0x80000086 //!< \~english Data ID of Z axis gyro +#define POS_DID_GYRO POS_DID_GYRO_X +//!< \~english Data ID of POS_DID_GYRO is same as POS_DID_GYRO_X #define POS_DID_GSNS_X 0x80000015 //!< \~english Data ID of x axis gsensor #define POS_DID_GSNS_Y 0x80000016 //!< \~english Data ID of Y axis gsensor +#define POS_DID_GSNS_Z 0x80000026 //!< \~english Data ID of Z axis gsensor #define POS_DID_REV 0x80000017 //!< \~english Data ID of reverse signal #define POS_DID_GPS_ANTENNA 0x80000019 //!< \~english Data ID of GPS antenna status #define POS_DID_SPEED_PULSE_FST 0x80000028 //!< \~english Data ID of first time speed pulse -#define POS_DID_GYRO_FST 0x80000029 //!< \~english Data ID of first time gyro +#define POS_DID_GYRO_X_FST 0x80000029 //!< \~english Data ID of first time X axis gyro +#define POS_DID_GYRO_Y_FST 0x80000043 //!< \~english Data ID of first time Y axis gyro +#define POS_DID_GYRO_Z_FST 0x80000023 //!< \~english Data ID of first time Z axis gyro +#define POS_DID_GYRO_FST POS_DID_GYRO_X_FST +//!< \~~english Data ID of POS_DID_GYRO_FST is same as POS_DID_GYRO_X_FST #define POS_DID_REV_FST 0x8000007E //!< \~english Data ID of first time reverse signal #define POS_DID_GYRO_TEMP 0x80000090 //!< \~english Data ID of gyro temperature #define POS_DID_GYRO_TEMP_FST 0x80000091 //!< \~english Data ID of first time gyro temperature -#define POS_DID_GSNS_X_FST 0x80000092 +#define POS_DID_GSNS_X_FST 0x80000087 //!< \~english Data ID of first time x axis gsensor -#define POS_DID_GSNS_Y_FST 0x80000093 +#define POS_DID_GSNS_Y_FST 0x80000088 //!< \~english Data ID of first time Y axis gsensor +#define POS_DID_GSNS_Z_FST 0x80000089 +//!< \~english Data ID of first time Z axis gsensor #define POS_DID_PULSE_TIME 0x8000003A //!< \~english Data ID of pulse time #define POS_DID_GPS__CWORD82__NMEA 0x80000030U @@ -77,13 +88,25 @@ #define POS_DID_GPS_CLOCK_FREQ 0x800000B4U //!< \~english Data ID of GPS time frequency data +/** + * \~english @brief Delivery sensor extra package command ID + * \~english @brief If you want to catch above envents, use NSFW like below. + * \~english @code + * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA, CBCallbackA); + * @endcode + */ #define CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA 0x0700 -//!< \~english sensor extra package register command ID +/** + * \~english @brief Delivery sensor information command ID + * \~english @brief If you want to catch above envents, use NSFW like below. + * \~english @code + * l_eStatus = FrameworkUnifiedAttachCallbackToDispatcher(h_app, POS_NTFY_SEND_THREAD, CID_POSIF_REGISTER_LISTENER_SENSOR_DATA, CBCallbackA); + * @endcode + */ #define CID_POSIF_REGISTER_LISTENER_SENSOR_DATA 0x0200 -//!< \~english sensor information register command ID -#define SENSOR_MSGBUF_DSIZE 2264 +#define SENSOR_MSGBUF_DSIZE 4096 //!< \~english message body maximum size #define SENSOR_VSHEAD_DSIZE 36 @@ -92,8 +115,12 @@ #define SENSOR_VSINFO_DSIZE (SENSOR_MSGBUF_DSIZE - SENSOR_VSHEAD_DSIZE) //!< \~english vehicle sensor data size -#define SENSOR_MSG_VSINFO_DSIZE 1272 +// Same name/value is defined, but client doesn't include HAL header. +// It defines SENSOR_MSG_VSINFO_DSIZE if not included HAL. +#ifndef HAL_API_POSITIONING_HAL_H_ +#define SENSOR_MSG_VSINFO_DSIZE 1904u //!< \~english vehicle sensor message body maximum size +#endif #define SENSOR_PKG_DELIVERY_MAX 16 //!< \~english number of data ID per a package @@ -161,15 +188,19 @@ extern "C" { /// - buffer pointer of the data ID array in package(pulDid) \n /// The data ID set to the first in pulDid is the delivery key. \n /// If the data ID not one of the following be set, return SENSOR_RET_ERROR_PARAM. -/// - POS_DID_SNS_COUNTER - sensor counter(get from sys) -/// - POS_DID_GYRO - gyro output -/// - POS_DID_SPEED_PULSE - speed pulse(count of pulse) +/// - POS_DID_SNS_COUNTER - sensor counter +/// - POS_DID_GYRO_X - gyro output (X axis) +/// - POS_DID_GYRO_Y - gyro output (Y axis) +/// - POS_DID_GYRO_Z - gyro output (Z axis) +/// - POS_DID_SPEED_PULSE - speed pulse /// - POS_DID_REV - REV signal(0:forward 1:backward) -/// - POS_DID_GSNS_X - Gsensor output X axis(15 to 4bit A/D value) -/// - POS_DID_GSNS_Y - Gsensor output Y axis(15 to 4bit A/D value) +/// - POS_DID_GSNS_X - Gsensor output X axis +/// - POS_DID_GSNS_Y - Gsensor output Y axis +/// - POS_DID_GSNS_Z - Gsensor output Z axis /// - POS_DID_GYRO_TEMP - gyro temperature -/// - POS_DID_PULSE_TIME - pulse time(32bit pulse time store count(0-32), \n -/// 32bitx max32 time between pulse[ micro s](1-4294967295 micro s)) \n +/// - POS_DID_PULSE_TIME - pulse time\n +/// \~english @par +/// - Because positioning is G/W between Navi and HAL, value depends on the design of HAL. /// \~english @par /// - Note:The Gsensor output is 0 in the environment without Gsensor hardware.\n /// \~english @par @@ -266,43 +297,43 @@ extern "C" { /// This API return the result of registering. \n /// The data from sensor data received to registering will be deliveried. \n /// The first delivery data is the sensor data(max 64 number of sensor counter, \n -/// reverse signal,gyro temperature, max 640 number of gyro output,speed pulse,Gsensor output(X axis), \n -/// Gsensor output(Y axis), max 2048 number of pulse time) in 6.4 second. \n +/// reverse signal,gyro temperature, max 640 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis), \n +/// speed pulse,Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis), max 2048 number of pulse time) in 6.4 second. \n /// If the data number is more than max number, delivery the data in newest 6.4 second. \n -/// If the sensor data accumulated more than max number, set VEHICLE_SNS_BREAK to data missing information.\n +/// If the sensor data accumulated more than max number, set VEHICLE_SNS_BREAK to data missing information. \n /// If sensor data number is more than the data number send in one time(10 number of \n -/// sensor counter,reverse signal,gyro temperature, 100 number of gyro output,speed pulse, \n -/// Gsensor output(X axis),Gsensor output(Y axis), 320 number of pulse time), \n -/// the new data is divided into partitions(every partition with 10 number of sensor counter, \n -/// reverse signal,gyro temperature, 100 number of gyro output,speed pulse,Gsensor output(X axis), \n -/// Gsensor output(Y axis), 320 number of pulse time) to delivery. \n +/// sensor counter,reverse signal,gyro temperature, 100 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis), \n +/// speed pulse, Gsensor output(X axis),Gsensor output(Y axis), Gsensor output(Z axis), 320 number of pulse time), \n +/// the old data is divided into partitions(every partition with 10 number of sensor counter, \n +/// reverse signal,gyro temperature, 100 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis), \n +/// speed pulse,Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis), 320 number of pulse time) to delivery. \n /// The last message for first delivery is the message that the partition count equal to partition No. \n /// After first delivery, the message data(1 number of sensor counter,reverse signal, \n -/// gyro temperature, 10 number of gyro output,speed pulse,Gsensor output(X axis), \n -/// Gsensor output(Y axis), 32 number of pulse time) deliveried. \n +/// gyro temperature, 10 number of gyro output(X axis), gyro output(X axis), gyro output(Z axis),speed pulse, \n +/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis), 32 number of pulse time) deliveried. \n /// And because the data missing information, divided partition count, \n /// diveided partition No is not used, they will be set to 0 in message.\n /// (sample)The sensor data in 6.4 second divided to delivery -/// - 1st message(sensor counter,reverse signal,gyro temperature=10 number, gyro output,speed pulse, \n -/// Gsensor output(X axis),Gsensor output(Y axis)=100 number,pulse time=320 number), divided \n -/// partition count=7,divided partition No=1) -/// - 2nd message(sensor counter,reverse signal,gyro temperature=10 number, gyro output,speed pulse, \n -/// Gsensor output(X axis),Gsensor output(Y axis)=100 number,pulse time=320 number), divided \n -/// partition count=7,divided partition No=2) -/// - 3rd message(sensor counter,reverse signal,gyro temperature=10 number, gyro output,speed pulse, \n -/// Gsensor output(X axis),Gsensor output(Y axis)=100 number,pulse time=320 number), divided \n +/// - 1st message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n +/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n +/// partition count=7, divided partition No=1) +/// - 2nd message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n +/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n +/// partition count=7, divided partition No=2) +/// - 3rd message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n +/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n /// partition count=7,divided partition No=3) -/// - 4th message(sensor counter,reverse signal,gyro temperature=10 number, gyro output,speed pulse, \n -/// Gsensor output(X axis),Gsensor output(Y axis)=100 number,pulse time=320 number), divided \n +/// - 4th message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n +/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n /// partition count=7,divided partition No=4) -/// - 5th message(sensor counter,reverse signal,gyro temperature=10 number, gyro output,speed pulse, \n -/// Gsensor output(X axis),Gsensor output(Y axis)=100 number,pulse time=320 number), divided \n +/// - 5th message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n +/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n /// partition count=7,divided partition No=5) -/// - 6th message(sensor counter,reverse signal,gyro temperature=10 number, gyro output,speed pulse, \n -/// Gsensor output(X axis),Gsensor output(Y axis)=100 number,pulse time=320 number), divided \n +/// - 6th message(sensor counter, reverse signal, gyro temperature=10 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n +/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=100 number, pulse time=320 number), divided \n /// partition count=7,divided partition No=6) -/// - 7th message(sensor counter,reverse signal,gyro temperature=10 number, gyro output,speed pulse, \n -/// Gsensor output(X axis),Gsensor output(Y axis)=100 number,pulse time=320 number), divided \n +/// - 7th message(sensor counter, reverse signal, gyro temperature=4 number, gyro output(X axis), gyro output(Y axis), gyro output(Z axis), speed pulse, \n +/// Gsensor output(X axis), Gsensor output(Y axis), Gsensor output(Z axis)=40 number, pulse time=128 number), divided \n /// partition count=7,divided partition No=7) /// /// \~english @par @@ -320,10 +351,10 @@ extern "C" { /// \~english @par /// message structure /// - After success to register, vehicle sensor will send message as system API message with following format. -/// Command ID : CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA \n +/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_PKG_SENSOR_DATA \n /// Definition of structure /// \~english @code -/// #define SENSOR_MSGBUF_DSIZE 2264 /* max size of message body */ +/// #define SENSOR_MSGBUF_DSIZE 4096 /* max size of message body */ /// #define SENSOR_VSHEAD_DSIZE 36 /* vehicle sensor header size(1+3+16*2) */ /// #define SENSOR_PKG_DELIVERY_MAX 16 /* max number of Data ID in package */ /// #define SENSOR_VSINFO_DSIZE (SENSOR_MSGBUF_DSIZE - SENSOR_VSHEAD_DSIZE) @@ -496,10 +527,10 @@ SENSOR_RET_API POS_RegisterListenerPkgSensData(HANDLE hApp, PCSTR notifyName, /// - After success to register, vehicle sensor will send message as system API message with following format. /// - If the register successed, certainly delivery first data. And then delivery data according to /// the delivery timing. \n -/// Command ID : CID_POSIF_REGISTER_LISTENER_SENSOR_DATA \n +/// Command ID : @ref CID_POSIF_REGISTER_LISTENER_SENSOR_DATA \n /// /// \~english @code -/// #define SENSOR_MSG_VSINFO_DSIZE 1272 /* max size of message body */ +/// #define SENSOR_MSG_VSINFO_DSIZE 1904 /* max size of message body */ /// typedef struct /// { /// DID did; /* data ID */ @@ -543,18 +574,23 @@ SENSOR_RET_API POS_RegisterListenerSensData(HANDLE hApp, PCSTR notifyName, DI /// \~english @par /// - Data ID of vehicle info(ulDid) /// - POS_DID_SPEED_PULSE - speed pulse(count of pulse) -/// - POS_DID_GYRO - gyro output(16bit A/D value) -/// - POS_DID_GSNS_X - Gsensor output (X axis)(12bit A/D value(left justified:15 to 4bit)) -/// - POS_DID_GSNS_Y - Gsensor output (Y axis)(12bit A/D value(left justified:15 to 4bit)) +/// - POS_DID_GYRO_X - gyro output (X axis) +/// - POS_DID_GYRO_Y - gyro output (Y axis) +/// - POS_DID_GYRO_Z - gyro output (Z axis) +/// - POS_DID_GSNS_X - Gsensor output (X axis) +/// - POS_DID_GSNS_Y - Gsensor output (Y axis) +/// - POS_DID_GSNS_Z - Gsensor output (Z axis) /// - POS_DID_GPS_ANTENNA - GPS antenna connection status /// - POS_DID_GPS__CWORD82__NMEA - GPS NMEA(_CWORD82_) /// - POS_DID_GPS__CWORD82__FULLBINARY - GPS _CWORD82_ full binary(_CWORD82_) /// - POS_DID_GPS_NMEA - GPS NMEA /// - POS_DID_GYRO_TEMP - gyro temperature -/// - POS_DID_GPS_CLOCK_DRIFT - GPS clock drift([ns/s]) -/// - POS_DID_GPS_CLOCK_FREQ - GPS clock frequency([Hz]) +/// - POS_DID_GPS_CLOCK_DRIFT - GPS clock drift +/// - POS_DID_GPS_CLOCK_FREQ - GPS clock frequency /// - The avaliable data ID of each hardware type is as following. /// \~english @par +/// - Because positioning is G/W between Navi and HAL, value depends on the design of HAL. +/// \~english @par /// - Note:The Gsensor output is 0 in the environment without Gsensor hardware. /// - vehicle sensor data buffer size(usDestSize) \n /// Please note it is the size of output buffer, not the size of data. diff --git a/positioning/client/include/vehicle_service/positioning.h b/positioning/client/include/vehicle_service/positioning.h index 28dc0b20..a5a1e562 100644 --- a/positioning/client/include/vehicle_service/positioning.h +++ b/positioning/client/include/vehicle_service/positioning.h @@ -1,5 +1,5 @@ // -// @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION. +// @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/positioning/client/src/CanInput_API/common/CanInput_API.cpp b/positioning/client/src/CanInput_API/common/CanInput_API.cpp deleted file mode 100644 index ebf69dd8..00000000 --- a/positioning/client/src/CanInput_API/common/CanInput_API.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/******************************************************************************* - * File name : CanInput_API.cpp - * System name : PastModel002 - * Sub System name : CanInput_API library - * Program name : CanInput_API - * Module configuration: CanInputInitialize() Initialization - * : CanInputSndMsg() Send a message - ******************************************************************************/ - -/************************************************************************ - * Include * - ***********************************************************************/ -#include <vehicle_service/positioning_base_library.h> -#include "CanInput_API.h" -#include "CanInput_API_private.h" - -/************************************************************************ -* Global variable * -************************************************************************/ - -/************************************************************************ -* Definition * -************************************************************************/ - -/******************************************************************************* - * MODULE : CanInputInitialize - * ABSTRACT : Initialization - * FUNCTION : CanInput_API Initialization - * ARGUMENT : None - * NOTE : - * RETURN : CAN_INPUT_RET_NORMAL : Successful completion - * : CAN_INPUT_RET_ERROR : An error has occurred - ******************************************************************************/ -CAN_INPUT_RET_API CanInputInitialize(void) { - RET_API ret_sys; - CAN_INPUT_RET_API ret_api; - - /* _CWORD64_api Initialization */ - ret_sys = _pb_Setup_CWORD64_API(NULL); - - if (ret_sys == RET_NORMAL) { - ret_api = CAN_INPUT_RET_NORMAL; - } else { - ret_api = CAN_INPUT_RET_ERROR; - } - - return ret_api; -} - -/******************************************************************************* - * MODULE : CanInputSndMsg - * ABSTRACT : Send a message - * FUNCTION : Send a message to VehicleSens_thread - * ARGUMENT : pno : Thread ID - * : cid : Command ID - * : msg_len : Data size - * : *msg_data : Pointer to the data buffer - * NOTE : - * RETURN : CAN_INPUT_RET_NORMAL : Successful completion - * : CAN_INPUT_RET_ERROR_PARAM : Parameter error - * : CAN_INPUT_RET_ERROR : An error has occurred - ******************************************************************************/ -CAN_INPUT_RET_API CanInputSndMsg(PNO pno, CID cid, u_int16 msg_len, const void *msg_data) { - CAN_INPUT_RET_API ret_api; - CANINPUT_MSG_INFO msg_buf; - - - if (cid == CANINPUT_CID_LOCALTIME_NOTIFICATION) { - if (msg_len <= sizeof(msg_buf.data)) { - RET_API ret_sys; - u_int16 msg_size; - - - /* Initialization message buffer */ - (void)memset(reinterpret_cast<void *>(&msg_buf), 0, sizeof(msg_buf)); - - /*--------------------------------------------------------------* - * Create a message header * - *--------------------------------------------------------------*/ - /* Set only the required data */ - msg_buf.hdr.hdr.sndpno = pno; /* source PNO */ - msg_buf.hdr.hdr.cid = cid; /* Command ID */ - msg_buf.hdr.hdr.msgbodysize = msg_len; /* Data size */ - - /*--------------------------------------------------------------* - * Create a message data * - *--------------------------------------------------------------*/ - if ((msg_len != 0) && (msg_data != NULL)) { - (void)memcpy(reinterpret_cast<void *>(&msg_buf.data), msg_data, (size_t)msg_len); - } - - msg_size = sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len; - - /*--------------------------------------------------------------* - * Send a message * - *--------------------------------------------------------------*/ - ret_sys = _pb_SndMsg(PNO_VEHICLE_SENSOR, /* destination PNO */ - msg_size, /* message size */ - reinterpret_cast<void *>(&msg_buf), /* message buffer */ - 0); /* Unused Argument */ - - if (ret_sys == RET_NORMAL) { - ret_api = CAN_INPUT_RET_NORMAL; - } else { - ret_api = CAN_INPUT_RET_ERROR; - } - } else { - /* Argument error(Data size) */ - ret_api = CAN_INPUT_RET_ERROR_PARAM; - } - } else { - /* Argument error(Command ID) */ - ret_api = CAN_INPUT_RET_ERROR_PARAM; - } - - return ret_api; -} - diff --git a/positioning/client/src/DR_API/common/DR_API.cpp b/positioning/client/src/DR_API/common/DR_API.cpp deleted file mode 100644 index a7416b48..00000000 --- a/positioning/client/src/DR_API/common/DR_API.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/****************************************************************************** -@file DR_API.cpp -@detail DR_API Functions -@lib libDR_API.so -******************************************************************************/ - -/***************************************************************************** - * Include * - *****************************************************************************/ -#include <vehicle_service/positioning_base_library.h> -#include "DR_API.h" -#include "DR_API_private.h" - -#define DR_API_DEBUG 0 - -static EventID DrCreateEvent(PNO pno); -static RET_API DrDeleteEvent(EventID event_id); -static RET_API DrSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data); - -/****************************************************************************** -@brief DrSetMapMatchingData<BR> - Map matching information setting -@outline Set up map matching information. -@param[in] PNO pno : Thread ID -@param[in] MAP_MATCHING_DATA* map_matching_data : Map matching information<BR> -@param[out] none -@return DR_EXT_RET_API -@retval DR_EXT_RET_NORMAL : Normal completion -@retval DR_EXT_RET_ERROR : Parameter error -*******************************************************************************/ -DR_EXT_RET_API DrSetMapMatchingData(PNO pno, MAP_MATCHING_DATA* map_matching_data) { - DR_EXT_RET_API ret = DR_EXT_RET_NORMAL; /* Return value of this function */ - RET_API ret_api = RET_NORMAL; /* System API return value */ - -#if DR_API_DEBUG - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DR_API : DrSetMapMatchingData \r\n"); - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "\r\n lat[0x%08X] lon[0x%08X] sts[0x%02X] \r\n", - map_matching_data->position_info.latitude, - map_matching_data->position_info.longitude, - map_matching_data->position_info.status); - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "rate[0x%04X] sts[0x%02X] ort[0x%04X] sts[0x%02X] \r\n Sts[0x%08X] \r\n", - map_matching_data->rate_info.rate, - map_matching_data->rate_info.status, - map_matching_data->orient_info.orient, - map_matching_data->orient_info.status, - map_matching_data->status); -#endif - - /*--------------------------------------------------------------* - * Send map matching information * - *--------------------------------------------------------------*/ - /* Messaging */ - ret_api = DrSndMsg(pno, - PNO_VEHICLE_SENSOR, - CID_DR_MAP_MATCHING_DATA, - (u_int16)sizeof(MAP_MATCHING_DATA), (const void *)map_matching_data); - - if (RET_NORMAL == ret_api) { - ret = DR_EXT_RET_NORMAL; - } else { - ret = DR_EXT_RET_ERROR; - } - -#if DR_API_DEBUG - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "DR_API : DrSetMapMatchingData return[0x%X] \r\n", ret); -#endif - - return ret; -} - -/****************************************************************************** -@brief DrClearBackupData<BR> - DR backup data initialization -@outline Initialize the DR backup data. -@param[in] PNO pno : Thread ID -@param[out] none -@return DR_EXT_RET_API -@retval DR_EXT_RET_NORMAL : Clear success -@retval DR_EXT_RET_ERROR : Clear failed -*******************************************************************************/ -DR_EXT_RET_API DrClearBackupData(PNO pno) { - EventID event_id = 0; /* Event ID */ - int32 event_val = 0; /* Event value */ - RET_API ret_api = RET_NORMAL; /* System API return value */ - DR_EXT_RET_API ret = DR_EXT_RET_NORMAL; /* Return value */ - u_char data; /* Message data(Dummy) */ - - /* Event Generation */ - event_id = DrCreateEvent(pno); - - if (event_id != 0) { - /* Successful event generation */ - /* Messaging(Notify VehicleSens_thread) */ - ret_api = DrSndMsg(pno, - PNO_VEHICLE_SENSOR, - CID_DR_CLEAR_BACKUP_DATA, - 0U, /* Message size is set to 0 */ - (const void *)&data); /* Message data(Dummy) -> Errors by NULL */ - if (ret_api == RET_NORMAL) { - /* Message transmission process succeeded */ - /* Waiting for completion event from vehicle sensor thread */ - ret_api = _pb_WaitEvent(event_id, - SAPI_EVWAIT_VAL, - DR_RET_ERROR_MIN, DR_EXT_RET_NORMAL, &event_val, INFINITE); - if (ret_api == RET_NORMAL) { - /* Return from Event Wait */ - if (event_val == RET_NORMAL) { - /* Clear success */ - ret = DR_EXT_RET_NORMAL; - } else { - /* Clear failed */ - ret = DR_EXT_RET_ERROR; - } - } else { - /* Failed to wait for event */ - ret = DR_EXT_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_WaitEvent Failed"); - } - } else { - /* Message transmission failure */ - ret = DR_EXT_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "DrSndMsg Failed"); - } - /* Event deletion */ - (void)DrDeleteEvent(event_id); - } else { - /* Event generation failure */ - ret = DR_EXT_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "DrCreateEvent Failed"); - } - - return ret; -} - -/******************************************************************************* - * MODULE : DrSndMsg - * ABSTRACT : Message transmission processing - * FUNCTION : Send a message to the specified PNO - * ARGUMENT : pno_src : Source PNO - * : pno_dest : Destination PNO - * : cid : Command ID - * : msg_len : Message data body length - * : *msg_data : Pointer to message data - * NOTE : - * RETURN : RET_NORMAL : Normal completion - * : RET_ERRNOTRDY : Destination process is not wakeup - * : RET_ERRMSGFULL : Message queue overflows - * : RET_ERRPARAM : Buffer size error - ******************************************************************************/ -static RET_API DrSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data) { - DR_MSG_BUF msg_buf; - RET_API ret_api; - - if (msg_data != NULL) { - /* Initialization message buffe */ - (void)memset(reinterpret_cast<void *>(&msg_buf), 0, sizeof(DR_MSG_BUF)); - - /*--------------------------------------------------------------* - * Create a message header * - *--------------------------------------------------------------*/ - msg_buf.stHdr.hdr.sndpno = pno_src; /* source PNO */ - msg_buf.stHdr.hdr.cid = cid; /* Command ID */ - msg_buf.stHdr.hdr.msgbodysize = msg_len; /* Data size */ - - /*--------------------------------------------------------------* - * Create a message data * - *--------------------------------------------------------------*/ - if (msg_len != 0) { - (void)memcpy(reinterpret_cast<void *>(msg_buf.ucData), msg_data, (size_t)msg_len); - } - /*--------------------------------------------------------------* - * Send messages * - *--------------------------------------------------------------*/ - ret_api = _pb_SndMsg(pno_dest, /* destination PNO */ - (u_int16)(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len), /* message size */ - reinterpret_cast<void *>(&msg_buf), /* message buffer */ - 0); /* Unused Argument */ - } else { - /* Argument error(Pointer to the data buffer) */ - ret_api = RET_ERRPARAM; - } - - return ret_api; -} - -/******************************************************************************* - * MODULE : DrCreateEvent - * ABSTRACT : Event creation process - * FUNCTION : Generate an event - * ARGUMENT : pno : Thread ID - * NOTE : - * RETURN : Non-zero : Event ID - * : Zero : Event generation failure - ******************************************************************************/ -static EventID DrCreateEvent(PNO pno) { - EventID event_id; /* Event ID */ - int8 event_name[32]; /* Event name character string buffer */ - - /* Initialization of event name character string buffer */ - (void)memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name)); - - /* Event name creation */ - snprintf(event_name, sizeof(event_name), "DR_API_%X", pno); - - /* Event Generation */ - event_id = _pb_CreateEvent(_CWORD64_EVENT_MANUALRESET_OFF, DR_EVENT_VAL_INIT, event_name); - - if (event_id == 0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_CreateEvent"); - } - - return event_id; -} - -/******************************************************************************* - * MODULE : DrDeleteEvent - * ABSTRACT : Event deletion processing - * FUNCTION : Delete events - * ARGUMENT : event_id : Event ID of the event to delete - * NOTE : - * RETURN : RET_NORMAL : Normal completion - * : RET_EV_NONE : Specified event does not exist - ******************************************************************************/ -static RET_API DrDeleteEvent(EventID event_id) { - return (_pb_DeleteEvent(event_id)); -} - diff --git a/positioning/client/src/POS_common_API/Common_API.cpp b/positioning/client/src/POS_common_API/Common_API.cpp index ceabb18c..f266decd 100644 --- a/positioning/client/src/POS_common_API/Common_API.cpp +++ b/positioning/client/src/POS_common_API/Common_API.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ * @param[in] notifyName PCSTR - Destination thread name * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery) * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating) - * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/DR/Not specified) + * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified) * * @return POS_RET_NORMAL Normal completion(Include illegal)<br> * POS_RET_ERROR_BUFFULL Buffer-full<br> @@ -80,12 +80,15 @@ POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, // NOLINT(readability/nolin /* Supported HW Configuration Check */ type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { /* GRADE1 */ ret = POS_RET_NORMAL; - if ((ucGetMethod == SENSOR_GET_METHOD_GPS) || - (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + if (ucGetMethod == SENSOR_GET_METHOD_GPS) { did = VEHICLE_DID_LOCATION_LONLAT; + } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) || + (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + did = VEHICLE_DID_LOCATION_LONLAT_NAVI; } else { /* End as a parameter error abnormality except for GPS/unspecified acquisition method */ ret = POS_RET_ERROR_PARAM; @@ -138,7 +141,7 @@ POS_RET_API POS_RegisterListenerLonLat(HANDLE hApp, // NOLINT(readability/nolin * @param[in] notifyName PCSTR - Destination thread name * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery) * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating) - * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/DR/Not specified) + * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified) * * @return POS_RET_NORMAL Normal completion(Include illegal)<br> * POS_RET_ERROR_PARAM Parameter error<br> @@ -235,7 +238,7 @@ POS_RET_API POS_RegisterListenerAltitude(HANDLE hApp, // NOLINT(readability/nol * @param[in] notifyName PCSTR - Destination thread name * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery) * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating) - * @param[in] ucGetMethod uint8_t - Acquisition method(POS/Navigation/DR/Not specified) + * @param[in] ucGetMethod uint8_t - Acquisition method(POS/Navigation/Not specified) * * @return POS_RET_NORMAL Normal completion(Include illegal)<br> * POS_RET_ERROR_BUFFULL Buffer-full<br> @@ -280,11 +283,12 @@ POS_RET_API POS_RegisterListenerSpeed(HANDLE hApp, // NOLINT(readability/nolint if (UNIT_TYPE_GRADE1 == type) { /* GRADE1 */ ret = POS_RET_NORMAL; - if ((ucGetMethod == SENSOR_GET_METHOD_POS) || - (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + if (ucGetMethod == SENSOR_GET_METHOD_POS) { did = VEHICLE_DID_MOTION_SPEED_INTERNAL; + } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) || + (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + did = VEHICLE_DID_MOTION_SPEED_NAVI; } else { - /* End as a parameter error abnormality except for POS/unspecified acquisition method */ ret = POS_RET_ERROR_PARAM; } } else if (UNIT_TYPE_GRADE2 == type) { @@ -335,7 +339,7 @@ POS_RET_API POS_RegisterListenerSpeed(HANDLE hApp, // NOLINT(readability/nolint * @param[in] notifyName PCSTR - Destination thread name * @param[in] ucCtrlFlg uint8_t - Delivery control(Delivery registration/Delivery stop/Resume delivery) * @param[in] ucDeliveryTiming uint8_t - Delivery timing(Changing/Updating) - * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/DR/Not specified) + * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified) * * @return POS_RET_NORMAL Normal completion(Include illegal)<br> * POS_RET_ERROR_PARAM Parameter error<br> @@ -378,9 +382,11 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/noli if (UNIT_TYPE_GRADE1 == type) { /* GRADE1 */ ret = POS_RET_NORMAL; - if ((ucGetMethod == SENSOR_GET_METHOD_GPS) || - (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + if (ucGetMethod == SENSOR_GET_METHOD_GPS) { did = VEHICLE_DID_MOTION_HEADING; + } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) || + (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + did = VEHICLE_DID_MOTION_HEADING_NAVI; } else { /* End as a parameter error abnormality except for GPS/unspecified acquisition method */ ret = POS_RET_ERROR_PARAM; @@ -431,7 +437,7 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/noli * * @param[in] hApp HANDLE - Application handle * @param[in] dat SENSORLOCATION_LONLATINFO_DAT* - Pointer to the acquired latitude/longitude information storage destination - * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/DR/Not specified) + * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified) * * @return POS_RET_NORMAL Normal completion(Include illegal)<br> * POS_RET_ERROR_PARAM Parameter error<br> @@ -439,69 +445,71 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/noli * POS_RET_ERROR_INNER Internal error * */ -//POS_RET_API POS_GetLonLat(HANDLE hApp, // NOLINT(readability/nolint) -// SENSORLOCATION_LONLATINFO_DAT *dat, // NOLINT(readability/nolint) -// uint8_t ucGetMethod) { // NOLINT(readability/nolint) -// POS_RET_API ret = POS_RET_NORMAL; /* Return value */ -// UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ -// DID did = VEHICLE_DID_LOCATION_LONLAT; /* DID */ -// int32 ret_get_proc; /* POS_GetProc Return Values */ -// -// /* Internal debug log output */ -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); -// -// /* Arguments & Support Configuration Check */ -// if (hApp == NULL) { -// /* If the handler is NULL, the process terminates with an error. */ -// ret = POS_RET_ERROR_PARAM; -// } else if (dat == NULL) { -// /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */ -// ret = POS_RET_ERROR_PARAM; -// } else { -// /* Positioning Base API initialization */ -// _pb_Setup_CWORD64_API(hApp); -// -// /* Supported HW Configuration Check */ -// type = GetEnvSupportInfo(); -// if (UNIT_TYPE_GRADE1 == type) { -// /* GRADE1 */ -// if ((ucGetMethod == SENSOR_GET_METHOD_GPS) || -// (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { -// did = VEHICLE_DID_LOCATION_LONLAT; -// } else { -// /* End as a parameter error abnormality except for GPS/unspecified acquisition method */ -// ret = POS_RET_ERROR_PARAM; -// } -// } else if (UNIT_TYPE_GRADE2 == type) { -// /* -// * Note. -// * This feature branches processing depending on the unit type. -// */ -// ret = POS_RET_ERROR_NOSUPPORT; -// } else { -// /* Environment error */ -// ret = POS_RET_ERROR_NOSUPPORT; -// } -// } -// -// /* Sensor information acquisition */ -// if (ret == POS_RET_NORMAL) { -// /* Data acquisition process */ -// ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORLOCATION_LONLATINFO_DAT)); -// if (static_cast<int32>(sizeof(SENSORLOCATION_LONLATINFO_DAT)) > ret_get_proc) { -// /** Failed to acquire */ -// if (ret_get_proc == POS_RET_ERROR_RESOURCE) { -// /** Insufficient resource */ -// ret = POS_RET_ERROR_RESOURCE; -// } else { -// ret = POS_RET_ERROR_INNER; -// } -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); -// } -// } -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); -// return ret; -//} +POS_RET_API POS_GetLonLat(HANDLE hApp, // NOLINT(readability/nolint) + SENSORLOCATION_LONLATINFO_DAT *dat, // NOLINT(readability/nolint) + uint8_t ucGetMethod) { // NOLINT(readability/nolint) + POS_RET_API ret = POS_RET_NORMAL; /* Return value */ + UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ + DID did = VEHICLE_DID_LOCATION_LONLAT; /* DID */ + int32_t ret_get_proc; /* POS_GetProc Return Values */ + + /* Internal debug log output */ + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); + + /* Arguments & Support Configuration Check */ + if (hApp == NULL) { + /* If the handler is NULL, the process terminates with an error. */ + ret = POS_RET_ERROR_PARAM; + } else if (dat == NULL) { + /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */ + ret = POS_RET_ERROR_PARAM; + } else { + /* Positioning Base API initialization */ + _pb_Setup_CWORD64_API(hApp); + + /* Supported HW Configuration Check */ + type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { + /* GRADE1 */ + if (ucGetMethod == SENSOR_GET_METHOD_GPS) { + did = VEHICLE_DID_LOCATION_LONLAT; + } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) || + (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + did = VEHICLE_DID_LOCATION_LONLAT_NAVI; + } else { + /* End as a parameter error abnormality except for GPS/unspecified acquisition method */ + ret = POS_RET_ERROR_PARAM; + } + } else if (UNIT_TYPE_GRADE2 == type) { + /* + * Note. + * This feature branches processing depending on the unit type. + */ + ret = POS_RET_ERROR_NOSUPPORT; + } else { + /* Environment error */ + ret = POS_RET_ERROR_NOSUPPORT; + } + } + + /* Sensor information acquisition */ + if (ret == POS_RET_NORMAL) { + /* Data acquisition process */ + ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORLOCATION_LONLATINFO_DAT)); + if (static_cast<int32_t>(sizeof(SENSORLOCATION_LONLATINFO_DAT)) > ret_get_proc) { + /* Failed to acquire */ + if (ret_get_proc == POS_RET_ERROR_RESOURCE) { + /* Insufficient resource */ + ret = POS_RET_ERROR_RESOURCE; + } else { + ret = POS_RET_ERROR_INNER; + } + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); + return ret; +} /** * @brief @@ -511,7 +519,7 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/noli * * @param[in] hApp HANDLE - Application handle * @param[in] dat SENSORLOCATION_ALTITUDEINFO_DAT* - Pointer to the acquired altitude information storage destination - * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/DR/Not specified) + * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Not specified) * * @return POS_RET_NORMAL Normal completion(Include illegal)<br> * POS_RET_ERROR_PARAM Parameter error<br> @@ -519,68 +527,68 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/noli * POS_RET_ERROR_INNER Internal error * */ -//POS_RET_API POS_GetAltitude(HANDLE hApp, // NOLINT(readability/nolint) -// SENSORLOCATION_ALTITUDEINFO_DAT *dat, // NOLINT(readability/nolint) -// uint8_t ucGetMethod) { // NOLINT(readability/nolint) -// POS_RET_API ret = POS_RET_NORMAL; /* Return value */ -// UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ -// DID did = VEHICLE_DID_LOCATION_ALTITUDE; /* DID */ -// int32 ret_get_proc; /* POS_GetProc Return Values */ -// -// /* Internal debug log output */ -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); -// -// /* Arguments & Support Configuration Check */ -// if (hApp == NULL) { -// /* If the handler is NULL, the process terminates with an error. */ -// ret = POS_RET_ERROR_PARAM; -// } else if (dat == NULL) { -// /* If the altitude data is NULL, it terminates with an abnormal parameter. */ -// ret = POS_RET_ERROR_PARAM; -// } else { -// /* Positioning Base API initialization */ -// _pb_Setup_CWORD64_API(hApp); -// -// /* Supported HW Configuration Check */ -// type = GetEnvSupportInfo(); -// if (UNIT_TYPE_GRADE1 == type) { -// /* GRADE1 */ -// if ((ucGetMethod == SENSOR_GET_METHOD_GPS) || -// (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { -// did = VEHICLE_DID_LOCATION_ALTITUDE; -// } else { -// /* End as a parameter error abnormality except for GPS/unspecified acquisition method */ -// ret = POS_RET_ERROR_PARAM; -// } -// } else if (UNIT_TYPE_GRADE2 == type) { -// /* -// * Note. -// * This feature branches processing depending on the unit type. -// */ -// ret = POS_RET_ERROR_NOSUPPORT; -// } else { -// /* Environment error */ -// ret = POS_RET_ERROR_NOSUPPORT; -// } -// } -// /* Sensor information acquisition */ -// if (ret == POS_RET_NORMAL) { -// /* Data acquisition process */ -// ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORLOCATION_ALTITUDEINFO_DAT)); -// if (static_cast<int32>(sizeof(SENSORLOCATION_ALTITUDEINFO_DAT)) > ret_get_proc) { -// /** Failed to acquire */ -// if (ret_get_proc == POS_RET_ERROR_RESOURCE) { -// /** Insufficient resource */ -// ret = POS_RET_ERROR_RESOURCE; -// } else { -// ret = POS_RET_ERROR_INNER; -// } -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); -// } -// } -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); -// return ret; -//} +POS_RET_API POS_GetAltitude(HANDLE hApp, // NOLINT(readability/nolint) + SENSORLOCATION_ALTITUDEINFO_DAT *dat, // NOLINT(readability/nolint) + uint8_t ucGetMethod) { // NOLINT(readability/nolint) + POS_RET_API ret = POS_RET_NORMAL; /* Return value */ + UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ + DID did = VEHICLE_DID_LOCATION_ALTITUDE; /* DID */ + int32_t ret_get_proc; /* POS_GetProc Return Values */ + + /* Internal debug log output */ + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); + + /* Arguments & Support Configuration Check */ + if (hApp == NULL) { + /* If the handler is NULL, the process terminates with an error. */ + ret = POS_RET_ERROR_PARAM; + } else if (dat == NULL) { + /* If the altitude data is NULL, it terminates with an abnormal parameter. */ + ret = POS_RET_ERROR_PARAM; + } else { + /* Positioning Base API initialization */ + _pb_Setup_CWORD64_API(hApp); + + /* Supported HW Configuration Check */ + type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { + /* GRADE1 */ + if ((ucGetMethod == SENSOR_GET_METHOD_GPS) || + (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + did = VEHICLE_DID_LOCATION_ALTITUDE; + } else { + /* End as a parameter error abnormality except for GPS/unspecified acquisition method */ + ret = POS_RET_ERROR_PARAM; + } + } else if (UNIT_TYPE_GRADE2 == type) { + /* + * Note. + * This feature branches processing depending on the unit type. + */ + ret = POS_RET_ERROR_NOSUPPORT; + } else { + /* Environment error */ + ret = POS_RET_ERROR_NOSUPPORT; + } + } + /* Sensor information acquisition */ + if (ret == POS_RET_NORMAL) { + /* Data acquisition process */ + ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORLOCATION_ALTITUDEINFO_DAT)); + if (static_cast<int32_t>(sizeof(SENSORLOCATION_ALTITUDEINFO_DAT)) > ret_get_proc) { + /* Failed to acquire */ + if (ret_get_proc == POS_RET_ERROR_RESOURCE) { + /* Insufficient resource */ + ret = POS_RET_ERROR_RESOURCE; + } else { + ret = POS_RET_ERROR_INNER; + } + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); + return ret; +} /** * @brief @@ -590,7 +598,7 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/noli * * @param[in] hApp HANDLE - Application handle * @param[in] dat SENSORMOTION_SPEEDINFO_DAT* - Pointer to the acquired car speed information storage destination - * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/DR/Not specified) + * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified) * * @return POS_RET_NORMAL Normal completion(Include illegal)<br> * POS_RET_ERROR_PARAM Parameter error<br> @@ -598,73 +606,75 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/noli * POS_RET_ERROR_INNER Internal error * */ -//POS_RET_API POS_GetSpeed(HANDLE hApp, // NOLINT(readability/nolint) -// SENSORMOTION_SPEEDINFO_DAT *dat, // NOLINT(readability/nolint) -// uint8_t ucGetMethod) { // NOLINT(readability/nolint) -// POS_RET_API ret = POS_RET_NORMAL; /* Return value */ -// UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ -// DID did; /* Data ID */ -// int32 ret_get_proc; /* POS_GetProc Return Values */ -// -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); -// if (hApp == NULL) { -// /* If the handler is NULL, the process terminates with an error. */ -// ret = POS_RET_ERROR_PARAM; -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [hApp = %p]", hApp); -// } else if (dat == NULL) { -// /* When the pointer to the vehicle speed data storage destination is NULL, the pointer terminates with an error in the parameter. */ -// ret = POS_RET_ERROR_PARAM; -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [dat = %p]", dat); -// } else { -// /* Positioning Base API initialization */ -// _pb_Setup_CWORD64_API(hApp); -// -// /* Supported HW Configuration Check */ -// type = GetEnvSupportInfo(); -// if (UNIT_TYPE_GRADE1 == type) { -// /* GRADE1 */ -// ret = POS_RET_NORMAL; -// if ((ucGetMethod == SENSOR_GET_METHOD_POS) || -// (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { -// did = VEHICLE_DID_MOTION_SPEED_INTERNAL; -// } else { -// /* End as a parameter error abnormality except for POS/unspecified acquisition method */ -// ret = POS_RET_ERROR_PARAM; -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, -// "Argument ERROR [type = %d, ucGetMethod = %d]", -// type, ucGetMethod); -// } -// } else if (UNIT_TYPE_GRADE2 == type) { -// /* -// * Note. -// * This feature branches processing depending on the unit type. -// */ -// ret = POS_RET_ERROR_NOSUPPORT; -// } else { -// /* Environment error */ -// ret = POS_RET_ERROR_NOSUPPORT; -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GetEnvSupportInfo ERROR [type = %d]", type); -// } -// } -// -// if (ret == POS_RET_NORMAL) { -// /* Data acquisition process */ -// ret_get_proc = PosGetProc(did, dat, sizeof(SENSORMOTION_SPEEDINFO_DAT)); -// if (static_cast<int32>(sizeof(SENSORMOTION_SPEEDINFO_DAT)) > ret_get_proc) { -// /** Failed to acquire */ -// if (ret_get_proc == POS_RET_ERROR_RESOURCE) { -// /** Insufficient resource */ -// ret = POS_RET_ERROR_RESOURCE; -// } else { -// ret = POS_RET_ERROR_INNER; -// } -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); -// } -// } -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); -// -// return ret; -//} +POS_RET_API POS_GetSpeed(HANDLE hApp, // NOLINT(readability/nolint) + SENSORMOTION_SPEEDINFO_DAT *dat, // NOLINT(readability/nolint) + uint8_t ucGetMethod) { // NOLINT(readability/nolint) + POS_RET_API ret = POS_RET_NORMAL; /* Return value */ + UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ + DID did; /* Data ID */ + int32_t ret_get_proc; /* POS_GetProc Return Values */ + + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); + if (hApp == NULL) { + /* If the handler is NULL, the process terminates with an error. */ + ret = POS_RET_ERROR_PARAM; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [hApp = %p]", hApp); + } else if (dat == NULL) { + /* When the pointer to the vehicle speed data storage destination is NULL, the pointer terminates with an error in the parameter. */ + ret = POS_RET_ERROR_PARAM; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Argument ERROR [dat = %p]", dat); + } else { + /* Positioning Base API initialization */ + _pb_Setup_CWORD64_API(hApp); + + /* Supported HW Configuration Check */ + type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { + /* GRADE1 */ + ret = POS_RET_NORMAL; + if (ucGetMethod == SENSOR_GET_METHOD_POS) { + did = VEHICLE_DID_MOTION_SPEED_INTERNAL; + } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) || + (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + did = VEHICLE_DID_MOTION_SPEED_NAVI; + } else { + /* End as a parameter error abnormality except for POS/unspecified acquisition method */ + ret = POS_RET_ERROR_PARAM; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Argument ERROR [type = %d, ucGetMethod = %d]", + type, ucGetMethod); + } + } else if (UNIT_TYPE_GRADE2 == type) { + /* + * Note. + * This feature branches processing depending on the unit type. + */ + ret = POS_RET_ERROR_NOSUPPORT; + } else { + /* Environment error */ + ret = POS_RET_ERROR_NOSUPPORT; + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GetEnvSupportInfo ERROR [type = %d]", type); + } + } + + if (ret == POS_RET_NORMAL) { + /* Data acquisition process */ + ret_get_proc = PosGetProc(did, dat, sizeof(SENSORMOTION_SPEEDINFO_DAT)); + if (static_cast<int32_t>(sizeof(SENSORMOTION_SPEEDINFO_DAT)) > ret_get_proc) { + /* Failed to acquire */ + if (ret_get_proc == POS_RET_ERROR_RESOURCE) { + /* Insufficient resource */ + ret = POS_RET_ERROR_RESOURCE; + } else { + ret = POS_RET_ERROR_INNER; + } + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); + + return ret; +} /** * @brief @@ -674,7 +684,7 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/noli * * @param[in] hApp HANDLE - Application handle * @param[in] dat SENSORMOTION_HEADINGINFO_DAT* - Pointer to the acquired altitude information storage destination - * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/DR/Not specified) + * @param[in] ucGetMethod uint8_t - Acquisition method(GPS/Navigation/Not specified) * * @return POS_RET_NORMAL Normal completion(Include illegal)<br> * POS_RET_ERROR_PARAM Parameter error<br> @@ -682,68 +692,70 @@ POS_RET_API POS_RegisterListenerHeading(HANDLE hApp, // NOLINT(readability/noli * POS_RET_ERROR_INNER Internal error * */ -//POS_RET_API POS_GetHeading(HANDLE hApp, // NOLINT(readability/nolint) -// SENSORMOTION_HEADINGINFO_DAT *dat, // NOLINT(readability/nolint) -// uint8_t ucGetMethod) { // NOLINT(readability/nolint) -// POS_RET_API ret = POS_RET_NORMAL; /* Return value */ -// UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ -// DID did = VEHICLE_DID_MOTION_HEADING; /* Data ID */ -// int32 ret_get_proc; /* POS_GetProc Return Values */ -// -// /* Internal debug log output */ -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); -// -// /* Arguments & Support Configuration Check */ -// if (hApp == NULL) { -// /* If the handler is NULL, the process terminates with an error. */ -// ret = POS_RET_ERROR_PARAM; -// } else if (dat == NULL) { -// /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */ -// ret = POS_RET_ERROR_PARAM; -// } else { -// /* Positioning Base API initialization */ -// _pb_Setup_CWORD64_API(hApp); -// -// /* Supported HW Configuration Check */ -// type = GetEnvSupportInfo(); -// if (UNIT_TYPE_GRADE1 == type) { -// /* GRADE1 */ -// if ((ucGetMethod == SENSOR_GET_METHOD_GPS) || -// (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { -// did = VEHICLE_DID_MOTION_HEADING; -// } else { -// /* End as a parameter error abnormality except for GPS/unspecified acquisition method */ -// ret = POS_RET_ERROR_PARAM; -// } -// } else if (UNIT_TYPE_GRADE2 == type) { -// /* -// * Note. -// * This feature branches processing depending on the unit type. -// */ -// ret = SENSOR_RET_ERROR_NOSUPPORT; -// } else { -// /* Environment error */ -// ret = SENSOR_RET_ERROR_NOSUPPORT; -// } -// } -// /* Sensor information acquisition */ -// if (ret == POS_RET_NORMAL) { -// /* Data acquisition process */ -// ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORMOTION_HEADINGINFO_DAT)); -// if (static_cast<int32>(sizeof(SENSORMOTION_HEADINGINFO_DAT)) > ret_get_proc) { -// /** Failed to acquire */ -// if (ret_get_proc == POS_RET_ERROR_RESOURCE) { -// /** Insufficient resource */ -// ret = POS_RET_ERROR_RESOURCE; -// } else { -// ret = POS_RET_ERROR_INNER; -// } -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); -// } -// } -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); -// return ret; -//} +POS_RET_API POS_GetHeading(HANDLE hApp, // NOLINT(readability/nolint) + SENSORMOTION_HEADINGINFO_DAT *dat, // NOLINT(readability/nolint) + uint8_t ucGetMethod) { // NOLINT(readability/nolint) + POS_RET_API ret = POS_RET_NORMAL; /* Return value */ + UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ + DID did = VEHICLE_DID_MOTION_HEADING; /* Data ID */ + int32_t ret_get_proc; /* POS_GetProc Return Values */ + + /* Internal debug log output */ + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); + + /* Arguments & Support Configuration Check */ + if (hApp == NULL) { + /* If the handler is NULL, the process terminates with an error. */ + ret = POS_RET_ERROR_PARAM; + } else if (dat == NULL) { + /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */ + ret = POS_RET_ERROR_PARAM; + } else { + /* Positioning Base API initialization */ + _pb_Setup_CWORD64_API(hApp); + + /* Supported HW Configuration Check */ + type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { + /* GRADE1 */ + if (ucGetMethod == SENSOR_GET_METHOD_GPS) { + did = VEHICLE_DID_MOTION_HEADING; + } else if ((ucGetMethod == SENSOR_GET_METHOD_NAVI) || + (ucGetMethod == SENSOR_GET_METHOD_AUTO)) { + did = VEHICLE_DID_MOTION_HEADING_NAVI; + } else { + /* End as a parameter error abnormality except for GPS/unspecified acquisition method */ + ret = POS_RET_ERROR_PARAM; + } + } else if (UNIT_TYPE_GRADE2 == type) { + /* + * Note. + * This feature branches processing depending on the unit type. + */ + ret = SENSOR_RET_ERROR_NOSUPPORT; + } else { + /* Environment error */ + ret = SENSOR_RET_ERROR_NOSUPPORT; + } + } + /* Sensor information acquisition */ + if (ret == POS_RET_NORMAL) { + /* Data acquisition process */ + ret_get_proc = PosGetProc(did, reinterpret_cast<void *>(dat), sizeof(SENSORMOTION_HEADINGINFO_DAT)); + if (static_cast<int32_t>(sizeof(SENSORMOTION_HEADINGINFO_DAT)) > ret_get_proc) { + /** Failed to acquire */ + if (ret_get_proc == POS_RET_ERROR_RESOURCE) { + /** Insufficient resource */ + ret = POS_RET_ERROR_RESOURCE; + } else { + ret = POS_RET_ERROR_INNER; + } + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); + } + } + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); + return ret; +} /** * @brief @@ -792,7 +804,7 @@ POS_RET_API POS_SetSpeedInfo(HANDLE hApp, uint16_t navispeed) { // NOLINT(reada if (ret == POS_RET_NORMAL) { /* Adjustment by unit [1.0km/h]->[0.01m/sec] */ - speed = static_cast<u_int16>(navispeed * 10000 / 360); + speed = static_cast<uint16_t>(navispeed * 10000 / 360); /* Data setting(After setting,Immediate termination) */ ret = PosSetProc(VEHICLE_DID_MOTION_SPEED_NAVI, reinterpret_cast<void *>(&speed), sizeof(uint16_t), FALSE); @@ -867,7 +879,7 @@ POS_RET_API POS_SetLocationInfo(HANDLE hApp, POS_POSDATA* pstPosData) { // NOLI } /* Data setting(After setting,Immediate termination) */ - ret = PosSetProc(VEHICLE_DID_GPS_CUSTOMDATA_NAVI, + ret = PosSetProc(VEHICLE_DID_GPS_CUSTOMDATA_NAVI, // == POSHAL_DID_GPS_CUSTOMDATA_NAVI reinterpret_cast<void *>(pstPosData), sizeof(POS_POSDATA), FALSE); } } @@ -875,66 +887,3 @@ POS_RET_API POS_SetLocationInfo(HANDLE hApp, POS_POSDATA* pstPosData) { // NOLI FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); return ret; } - - -/** - * @brief - * Location Information (NMEA) Setting - * - * Set Location Information (NEMA) - * - * @param[in] hApp HANDLE - Application handle - * @param[in] locationInfo POS_LOCATIONINFO_NEMA - Pointer to location information - * - * @return POS_RET_NORMAL Normal completion(Include illegal)<br> - * POS_RET_ERROR_PARAM Parameter error<br> - * POS_RET_ERROR_INNER Internal error<br> - * POS_RET_ERROR_NOSUPPORT Unsupported environment - * - */ -POS_RET_API POS_SetLocationInfoNmea( HANDLE hApp, POS_LOCATIONINFO_NMEA* locationInfo ) { - POS_RET_API lRet = POS_RET_NORMAL; /* Return value of this function */ - UNIT_TYPE eType = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ - - FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); - - /* Arguments & Support Configuration Check */ - if ((locationInfo == NULL) || (hApp == NULL)) { - lRet = POS_RET_ERROR_PARAM; - } else { - /* Positioning Base API initialization */ - _pb_Setup_CWORD64_API(hApp); - - /* Supported HW Configuration Check */ - eType = GetEnvSupportInfo(); - if ( UNIT_TYPE_GRADE1 == eType ) { - /* GRADE1 */ - lRet = POS_RET_NORMAL; - } else if ( UNIT_TYPE_GRADE2 == eType ) { - /* - * Note. - * This feature branches processing depending on the unit type. - */ - lRet = SENSOR_RET_ERROR_NOSUPPORT; - } else { - /* Environment error */ - lRet = SENSOR_RET_ERROR_NOSUPPORT; - } - } - - if ( lRet == POS_RET_NORMAL ) { - /* check data length */ - if ((locationInfo->length == 0) || (locationInfo->length > LOCATIONINFO_NMEA_MAX)) { - lRet = POS_RET_ERROR_PARAM; - } else { - /* Data setting(After setting,Immediate termination) */ - lRet = PosSetProc( VEHICLE_DID_LOCATIONINFO_NMEA_NAVI, (void*)locationInfo, - locationInfo->length + sizeof(locationInfo->length), FALSE ); - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [lRet = %d]", lRet); - return lRet; -} - - diff --git a/positioning/client/src/POS_common_API/Makefile b/positioning/client/src/POS_common_API/Makefile index 7f4ab1c0..4d7a90fb 100644 --- a/positioning/client/src/POS_common_API/Makefile +++ b/positioning/client/src/POS_common_API/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,20 +17,12 @@ INST_SHLIBS = libPOS_common_API ######### compiled sources ############# -VPATH += ../SensorLocation_API/common - -libPOS_common_API_SRCS += SensorLocation_API.cpp libPOS_common_API_SRCS += Common_API.cpp ######### add include path ############# -CPPFLAGS += -I./ CPPFLAGS += -I../../../server/include/common CPPFLAGS += -I../../include CPPFLAGS += -I../../../server/include/nsfw -CPPFLAGS += -I../SensorLocation_API/common - -CPPFLAGS += -I../Vehicle_API -CPPFLAGS += -I../Vehicle_API/common ######### add compile option ############# CPPFLAGS += -DLINUX -fPIC diff --git a/positioning/client/src/POS_common_API/libPOS_common_API.ver b/positioning/client/src/POS_common_API/libPOS_common_API.ver index 1e7baf59..afc7f3a5 100644 --- a/positioning/client/src/POS_common_API/libPOS_common_API.ver +++ b/positioning/client/src/POS_common_API/libPOS_common_API.ver @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/src/POS_gps_API/Gps_API.cpp b/positioning/client/src/POS_gps_API/Gps_API.cpp index b3da219e..7395f9d6 100644 --- a/positioning/client/src/POS_gps_API/Gps_API.cpp +++ b/positioning/client/src/POS_gps_API/Gps_API.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,9 +67,9 @@ POS_RET_API POS_ReqGPSReset(HANDLE hApp, PCSTR ResName, uint8_t mode) { // NOLI /* Arguments & Support Configuration Check */ if ((hApp == NULL) || (ResName == NULL)) { ret = POS_RET_ERROR_PARAM; -// } else if (GPS_RST_COLDSTART != mode) { -// /* Parameter error except */ -// ret = POS_RET_ERROR_PARAM; + } else if (GPS_RST_COLDSTART != mode) { + /* Parameter error except */ + ret = POS_RET_ERROR_PARAM; } else { /* Positioning Base API initialization */ _pb_Setup_CWORD64_API(hApp); @@ -95,7 +95,7 @@ POS_RET_API POS_ReqGPSReset(HANDLE hApp, PCSTR ResName, uint8_t mode) { // NOLI if (VehicleGetResource() == TRUE) { /* Event Generation */ rs_pno = _pb_CnvName2Pno(ResName); - pid = (u_int32)getpid(); + pid = (uint32_t)getpid(); tid = GetTid(); snprintf(name, sizeof(name), "PR_p%u_t%u", pid, tid); @@ -155,53 +155,6 @@ POS_RET_API POS_ReqGPSReset(HANDLE hApp, PCSTR ResName, uint8_t mode) { // NOLI /** * @brief - * Get GPS version - * - * Get GPS version information - * - * @param[in] hApp HANDLE - Application handle - * @param[in] buf_size uint8_t - Storage size of version information(Byte) - * @param[in] buf int8_t* - Pointer to store the version information - * @param[in] size uint8_t* - Size of the character string written to buf(Byte) - * - * @return POS_RET_NORMAL Normal completion(Include illegal)<br> - * POS_RET_ERROR_PARAM Parameter error<br> - * POS_RET_ERROR_NOSUPPORT Unsupported environment - * - */ -POS_RET_API POS_GetGPSVersion(HANDLE hApp, // NOLINT(readability/nolint) - uint8_t buf_size, - int8_t* buf, // NOLINT(readability/nolint) - uint8_t* size) { - POS_RET_API ret = POS_RET_NORMAL; /* Return value */ - UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ - - FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); - - /* Positioning Base API initialization */ - _pb_Setup_CWORD64_API(hApp); - - /* Supported HW Configuration Check */ - type = GetEnvSupportInfo(); - if (UNIT_TYPE_GRADE1 == type) { - /* GRADE1 */ - ret = POS_RET_ERROR_NOSUPPORT; - } else if (UNIT_TYPE_GRADE2 == type) { - /* - * Note. - * This feature branches processing depending on the unit type. - */ - ret = POS_RET_ERROR_NOSUPPORT; - } else { - /* Environment error */ - ret = POS_RET_ERROR_NOSUPPORT; - } - FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); - return ret; -} - -/** - * @brief * GPS time setting request delivery registration * * Register delivery of GPS time setting request @@ -295,67 +248,67 @@ POS_RET_API POS_RegisterListenerGPSTimeSetReq(HANDLE hApp, // NOLINT(readabilit * POS_RET_ERROR_NOSUPPORT Unsupported environment * */ -//POS_RET_API POS_SetGPStime(HANDLE hApp, POS_DATETIME* pstDateTime) { // NOLINT(readability/nolint) -// POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */ -// UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ -// -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); -// -// /* Arguments & Support Configuration Check */ -// if ((pstDateTime == NULL) || (hApp == NULL)) { -// ret = POS_RET_ERROR_PARAM; -// } else { -// /* Positioning Base API initialization */ -// _pb_Setup_CWORD64_API(hApp); -// -// /* Supported HW Configuration Check */ -// type = GetEnvSupportInfo(); -// if (UNIT_TYPE_GRADE1 == type) { -// /* GRADE1 */ -// ret = POS_RET_NORMAL; -// } else if (UNIT_TYPE_GRADE2 == type) { -// /* -// * Note. -// * This feature branches processing depending on the unit type. -// */ -// ret = POS_RET_ERROR_NOSUPPORT; -// } else { -// /* Environment error */ -// ret = POS_RET_ERROR_NOSUPPORT; -// } -// } -// -// if (ret == POS_RET_NORMAL) { -// /* Parameter range check */ -// /* Month */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->month, 1, 12)) { -// return POS_RET_ERROR_PARAM; -// } -// /* Day */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->date, 1, 31)) { -// return POS_RET_ERROR_PARAM; -// } -// /* Hour */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->hour, 0, 23)) { -// return POS_RET_ERROR_PARAM; -// } -// /* Minutes */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->minute, 0, 59)) { -// return POS_RET_ERROR_PARAM; -// } -// /* Second */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->second, 0, 59)) { -// return POS_RET_ERROR_PARAM; -// } -// -// /* Data setting(Immediate recovery)*/ -// ret = PosSetProc(VEHICLE_DID_SETTINGTIME, -// reinterpret_cast<void*>(pstDateTime), sizeof(POS_DATETIME), FALSE); -// } -// -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); -// return ret; -//} +POS_RET_API POS_SetGPStime(HANDLE hApp, POS_DATETIME* pstDateTime) { // NOLINT(readability/nolint) + POS_RET_API ret = POS_RET_NORMAL; /* Return value of this function */ + UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ + + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); + + /* Arguments & Support Configuration Check */ + if ((pstDateTime == NULL) || (hApp == NULL)) { + ret = POS_RET_ERROR_PARAM; + } else { + /* Positioning Base API initialization */ + _pb_Setup_CWORD64_API(hApp); + + /* Supported HW Configuration Check */ + type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { + /* GRADE1 */ + ret = POS_RET_NORMAL; + } else if (UNIT_TYPE_GRADE2 == type) { + /* + * Note. + * This feature branches processing depending on the unit type. + */ + ret = POS_RET_ERROR_NOSUPPORT; + } else { + /* Environment error */ + ret = POS_RET_ERROR_NOSUPPORT; + } + } + + if (ret == POS_RET_NORMAL) { + /* Parameter range check */ + /* Month */ + if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->month, 1, 12)) { + return POS_RET_ERROR_PARAM; + } + /* Day */ + if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->date, 1, 31)) { + return POS_RET_ERROR_PARAM; + } + /* Hour */ + if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->hour, 0, 23)) { + return POS_RET_ERROR_PARAM; + } + /* Minutes */ + if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->minute, 0, 59)) { + return POS_RET_ERROR_PARAM; + } + /* Second */ + if (POS_RET_ERROR == POS_CHKPARAMU8(pstDateTime->second, 0, 59)) { + return POS_RET_ERROR_PARAM; + } + + /* Data setting(Immediate recovery)*/ + ret = PosSetProc(VEHICLE_DID_SETTINGTIME, + reinterpret_cast<void*>(pstDateTime), sizeof(POS_DATETIME), FALSE); + } + + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); + return ret; +} /** * @brief @@ -448,56 +401,56 @@ SENSOR_RET_API POS_RegisterListenerGPStime(HANDLE hApp, // NOLINT(readability/n * POS_RET_ERROR_NOSUPPORT Unsupported environment * */ -//POS_RET_API POS_GetGPStime(HANDLE hApp, SENSOR_GPSTIME* dat) { // NOLINT(readability/nolint) -// POS_RET_API ret = POS_RET_NORMAL; /* Return value */ -// UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ -// DID did = VEHICLE_DID_GPS_TIME; /* DID */ -// int32 ret_get_proc; /* POS_GetProc Return Values */ -// -// /* Internal debug log output */ -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); -// -// /* Arguments & Support Configuration Check */ -// if (hApp == NULL) { -// /* If the handler is NULL, the process terminates with an error. */ -// ret = POS_RET_ERROR_PARAM; -// } else if (dat == NULL) { -// /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */ -// ret = POS_RET_ERROR_PARAM; -// } else { -// /* Positioning Base API initialization */ -// _pb_Setup_CWORD64_API(hApp); -// -// /* Supported HW Configuration Check */ -// type = GetEnvSupportInfo(); -// if (UNIT_TYPE_GRADE1 == type) { -// ret = POS_RET_NORMAL; -// } else { -// /* -// * Note. -// * This feature branches processing depending on the unit type. -// */ -// ret = POS_RET_ERROR_NOSUPPORT; -// } -// } -// -// /* Sensor information acquisition */ -// if (ret == POS_RET_NORMAL) { -// /* Data acquisition process */ -// ret_get_proc = PosGetProc(did, reinterpret_cast<void*>(dat), sizeof(SENSOR_GPSTIME)); -// if (static_cast<int32>(sizeof(SENSOR_GPSTIME)) > ret_get_proc) { -// /** Failed to acquire */ -// if (ret_get_proc == POS_RET_ERROR_RESOURCE) { -// /** Insufficient resource */ -// ret = POS_RET_ERROR_RESOURCE; -// } else { -// ret = POS_RET_ERROR_INNER; -// } -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); -// } -// } -// -// FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); -// -// return ret; -//} +POS_RET_API POS_GetGPStime(HANDLE hApp, SENSOR_GPSTIME* dat) { // NOLINT(readability/nolint) + POS_RET_API ret = POS_RET_NORMAL; /* Return value */ + UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ + DID did = VEHICLE_DID_GPS_TIME; /* DID */ + int32_t ret_get_proc; /* POS_GetProc Return Values */ + + /* Internal debug log output */ + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "+"); + + /* Arguments & Support Configuration Check */ + if (hApp == NULL) { + /* If the handler is NULL, the process terminates with an error. */ + ret = POS_RET_ERROR_PARAM; + } else if (dat == NULL) { + /* If the longitude/latitude data is NULL, it ends with an abnormal parameter. */ + ret = POS_RET_ERROR_PARAM; + } else { + /* Positioning Base API initialization */ + _pb_Setup_CWORD64_API(hApp); + + /* Supported HW Configuration Check */ + type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { + ret = POS_RET_NORMAL; + } else { + /* + * Note. + * This feature branches processing depending on the unit type. + */ + ret = POS_RET_ERROR_NOSUPPORT; + } + } + + /* Sensor information acquisition */ + if (ret == POS_RET_NORMAL) { + /* Data acquisition process */ + ret_get_proc = PosGetProc(did, reinterpret_cast<void*>(dat), sizeof(SENSOR_GPSTIME)); + if (static_cast<int32_t>(sizeof(SENSOR_GPSTIME)) > ret_get_proc) { + /* Failed to acquire */ + if (ret_get_proc == POS_RET_ERROR_RESOURCE) { + /* Insufficient resource */ + ret = POS_RET_ERROR_RESOURCE; + } else { + ret = POS_RET_ERROR_INNER; + } + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PosGetProc ERROR [ret = %d]", ret); + } + } + + FRAMEWORKUNIFIEDLOG(ZONE_26, __FUNCTION__, "- [ret = %d]", ret); + + return ret; +} diff --git a/positioning/client/src/POS_gps_API/Makefile b/positioning/client/src/POS_gps_API/Makefile index a2de3c80..c6391a9e 100644 --- a/positioning/client/src/POS_gps_API/Makefile +++ b/positioning/client/src/POS_gps_API/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,13 +17,10 @@ INST_SHLIBS = libPOS_gps_API ######### compiled sources ############# -VPATH += ../POS_naviinfo_API/variant/awnavi/src - libPOS_gps_API_SRCS += Gps_API.cpp libPOS_gps_API_SRCS += Naviinfo_API.cpp ######### add include path ############# -CPPFLAGS += -I./ CPPFLAGS += -I../../../server/include/common CPPFLAGS += -I../../include CPPFLAGS += -I../../../server/include/nsfw diff --git a/positioning/client/src/POS_gps_API/Naviinfo_API.cpp b/positioning/client/src/POS_gps_API/Naviinfo_API.cpp new file mode 100644 index 00000000..cfe04ff8 --- /dev/null +++ b/positioning/client/src/POS_gps_API/Naviinfo_API.cpp @@ -0,0 +1,404 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/****************************************************************************** +@file Naviinfo_API.cpp +@detail Naviinfo_API Functions +@lib libNaviinfo_API.so +******************************************************************************/ + +/***************************************************************************** + * Include * + *****************************************************************************/ +#include "Naviinfo_API.h" +#include <vehicle_service/POS_define.h> +#include <vehicle_service/POS_sensor_API.h> +#include <vehicle_service/POS_gps_API.h> +#include "Vehicle_API_Dummy.h" +#include "POS_private.h" +#include <native_service/frameworkunified_types.h> // NOLINT(build/include_order) + +void PosCnvGpsInfo(NAVIINFO_ALL *navi_loc_info); + + +/** + * @brief + * GPS information setting + * + * Set GPS information + * + * @param[in] hApp HANDLE - Application handle + * @param[in] navilocinfo NAVIINFO_ALL* - Pointer to GPS information storage area + * + * @return NAVIINFO_RET_NORMAL Normal completion<br> + * NAVIINFO_RET_ERROR_PARAM Parameter error<br> + * NAVIINFO_RET_ERROR_INNER Internal error<br> + * NAVIINFO_RET_ERROR_NOSUPPORT Unsupported environment + * + */ +NAVIINFO_RET_API POS_SetGPSInfo(HANDLE hApp, NAVIINFO_ALL *navilocinfo) +{ + NAVIINFO_RET_API ret = NAVIINFO_RET_NORMAL; /* Return value of this function */ + UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ + NAVIINFO_ALL navi_loc_info_tmp; /* Conversion quantity area */ + RET_API ret_api; + + /** NULL checking */ + if (navilocinfo == NULL) { + /** Parameter error */ + ret = NAVIINFO_RET_ERROR_PARAM; + } else if (hApp == NULL) { + /** Parameter error */ + ret = NAVIINFO_RET_ERROR_PARAM; + } else { + /* Positioning Base API initialization */ + _pb_Setup_CWORD64_API(hApp); + + /* Supported HW Configuration Check */ + type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { + /* GRADE1 */ + ret = NAVIINFO_RET_NORMAL; + } else if (UNIT_TYPE_GRADE2 == type) { + /* + * Note. + * This feature branches processing depending on the unit type. + */ + ret = NAVIINFO_RET_ERROR_NOSUPPORT; + } else { + /* Environment error */ + ret = NAVIINFO_RET_ERROR_NOSUPPORT; + } + } + + if (ret == NAVIINFO_RET_NORMAL) { + /* Parameter range check */ + if (navilocinfo->stNaviGps.tdsts != 0) { /* Other than ""Time not calibrated after receiver reset"" */ + /* Positioning status information */ + if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stDiagGps.stFix.ucFixSts, 0, 2)) { + return NAVIINFO_RET_ERROR_PARAM; + } + /* Latitude */ + if (POS_RET_ERROR == POS_CHKPARAM32(navilocinfo->stDiagGps.stFix.stWgs84.lLat, -82944000, 82944000)) { + return NAVIINFO_RET_ERROR_PARAM; + } + /* Longitude */ + if (POS_RET_ERROR == POS_CHKPARAM32(navilocinfo->stDiagGps.stFix.stWgs84.lLon, -165888000, 165888000)) { + return NAVIINFO_RET_ERROR_PARAM; + } + /* Measurement Azimuth */ + if (POS_RET_ERROR == POS_CHKPARAMU16(navilocinfo->stNaviGps.heading, 0, 3599)) { + return NAVIINFO_RET_ERROR_PARAM; + } + /* UTC(Month) */ + if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.month, 1, 12)) { + return NAVIINFO_RET_ERROR_PARAM; + } + /* UTC(Day) */ + if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.date, 1, 31)) { + return NAVIINFO_RET_ERROR_PARAM; + } + /* UTC(Hour) */ + if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.hour, 0, 23)) { + return NAVIINFO_RET_ERROR_PARAM; + } + /* UTC(Minutes) */ + if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.minute, 0, 59)) { + return NAVIINFO_RET_ERROR_PARAM; + } + /* UTC(Second) */ + if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.second, 0, 59)) { + return NAVIINFO_RET_ERROR_PARAM; + } + } + /* Date and Time Status */ + if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.tdsts, 0, 2)) { + return NAVIINFO_RET_ERROR_PARAM; + } + + /* Copy to conversion area */ + memcpy(&navi_loc_info_tmp, navilocinfo, sizeof(NAVIINFO_ALL)); + /** Data unit conversion */ + PosCnvGpsInfo(&navi_loc_info_tmp); + + /* Resource acquisition */ + if (VehicleGetResource() == TRUE) { + + /** Send navigation information to vehicle sensor */ + ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME, + CID_NAVIINFO_DELIVER, + sizeof(NAVIINFO_ALL), + reinterpret_cast<void*>(&navi_loc_info_tmp), 0); + if (ret_api != RET_NORMAL) { + /** Message transmission failure */ + ret = NAVIINFO_RET_ERROR_INNER; + } + } else { + /* When resource shortage occurs, the system terminates with an insufficient resource error. */ + ret = NAVIINFO_RET_ERROR_RESOURCE; + } + /* Resource release */ + VehicleReleaseResource(); + } + + return ret; +} + +/** + * @brief + * GPS information acquisition + * + * Access GPS information + * + * @param[in] hApp HANDLE - Application handle + * @param[in] navidiaginfo NAVIINFO_DIAG_GPS* - Pointer to GPS information storage area + * + * @return NAVIINFO_RET_NORMAL Normal completion<br> + * NAVIINFO_RET_ERROR_PARAM Parameter error<br> + * NAVIINFO_RET_ERROR_INNER Internal error<br> + * NAVIINFO_RET_ERROR_NOSUPPORT Unsupported environment + * + */ +NAVIINFO_RET_API POS_GetGPSInfo(HANDLE hApp, NAVIINFO_DIAG_GPS *navidiaginfo) +{ + NAVIINFO_RET_API ret = NAVIINFO_RET_NORMAL; /* Return value of this function */ + UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ + int32_t ret_veh; /* VehicleAPI Return Values */ + NAVIINFO_DIAG_GPS dest_data; /* Data acquisition area */ + + /** NULL checking */ + if (navidiaginfo == NULL) { + /** Parameter error */ + ret = NAVIINFO_RET_ERROR_PARAM; + } else if (hApp == NULL) { + /** Parameter error */ + ret = NAVIINFO_RET_ERROR_PARAM; + } else { + /* Positioning Base API initialization */ + _pb_Setup_CWORD64_API(hApp); + + /* Supported HW Configuration Check */ + type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { + /* GRADE1 */ + ret = NAVIINFO_RET_NORMAL; + } else if (UNIT_TYPE_GRADE2 == type) { + /* + * Note. + * This feature branches processing depending on the unit type. + */ + ret = NAVIINFO_RET_ERROR_NOSUPPORT; + } else { + /* Environment error */ + ret = NAVIINFO_RET_ERROR_NOSUPPORT; + } + } + + if (ret == NAVIINFO_RET_NORMAL) { + /** Acquisition of navigation data for Diag provide */ + ret_veh = PosGetProc( + (DID)VEHICLE_DID_NAVIINFO_DIAG_GPS, + reinterpret_cast<void*>(&dest_data), + (u_int16)sizeof(dest_data)); + + if (static_cast<int32_t>(sizeof(NAVIINFO_DIAG_GPS)) > ret_veh) { + /** Failed to acquire */ + if (ret_veh == POS_RET_ERROR_RESOURCE) { + ret = NAVIINFO_RET_ERROR_RESOURCE; + } else { + ret = NAVIINFO_RET_ERROR_INNER; + } + } else { + /** Successful acquisition */ + memcpy( navidiaginfo, &dest_data, sizeof(NAVIINFO_DIAG_GPS)); + } + } + + return ret; +} + +/* ++ GPS _CWORD82_ support */ +/** + * @brief + * GPS setting transmission request + * + * Requesting GPS Settings with Complete Return + * + * @param[in] hApp HANDLE - Application handle + * @param[in] p_data SENSOR_MSG_SEND_DAT* - GPS setting information to be sent + * + * @return SENSOR_RET_NORMAL Normal completion<br> + * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br> + * SENSOR_RET_ERROR_PARAM Parameter error<br> + * SENSOR_RET_ERROR_DID Unregistered DID<br> + * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment + * + */ +int32 POS_ReqGPSSetting(HANDLE hApp, SENSOR_MSG_SEND_DAT *p_data) { /* Ignore->MISRA-C++:2008 Rule 7-1-2 */ + SENSOR_RET_API ret = SENSOR_RET_NORMAL; /* Return value */ + RET_API ret_api; /* System API return value */ + uint16_t expected_size; /* Message size for the specified DID */ + + UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ + + if (hApp == NULL) { + /* Parameter error */ + ret = SENSOR_RET_ERROR_PARAM; + } + + if (ret == SENSOR_RET_NORMAL) { + /* Positioning Base API initialization */ + _pb_Setup_CWORD64_API(hApp); + + /* Argument check (DID) + Size calculation */ + if (p_data != reinterpret_cast<SENSOR_MSG_SEND_DAT*>(NULL)) { + switch (p_data->did) { + case VEHICLE_DID_GPS__CWORD82__SETINITIAL: + { + expected_size = 71; + break; + } + case VEHICLE_DID_GPS__CWORD82__SETRMODE: + { + expected_size = 50; + break; + } + case VEHICLE_DID_GPS__CWORD82__SETRMODEEX: + { + expected_size = 63; + break; + } + case VEHICLE_DID_GPS__CWORD82__SELSENT: + { + expected_size = 21; + break; + } + case VEHICLE_DID_GPS__CWORD82__SETSBAS: + { + expected_size = 34; + break; + } + case VEHICLE_DID_GPS__CWORD82__SETCONF1: + { + expected_size = 37; + break; + } + case VEHICLE_DID_GPS__CWORD82__SETCONF2: + { + expected_size = 45; + break; + } + default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */ + ret = SENSOR_RET_ERROR_DID; + break; + } + } else { + ret = SENSOR_RET_ERROR_PARAM; + } + } + + /* Supported HW Configuration Check */ + if (ret == SENSOR_RET_NORMAL) { + type = GetEnvSupportInfo(); + if (UNIT_TYPE_GRADE1 == type) { + /* GRADE1 */ + ret = SENSOR_RET_NORMAL; + } else if (UNIT_TYPE_GRADE2 == type) { + /* + * Note. + * This feature branches processing depending on the unit type. + */ + ret = SENSOR_RET_ERROR_NOSUPPORT; + } else { + /* Environment error */ + ret = SENSOR_RET_ERROR_NOSUPPORT; + } + } + + if (ret == SENSOR_RET_NORMAL) { + /* Argument check (Size)*/ + if (expected_size != p_data->usSize) { + ret = SENSOR_RET_ERROR_PARAM; + } else { + /* Message buffer initialization */ + + /* Create message data */ + + /* Resource acquisition */ + if (VehicleGetResource() == TRUE) { + /* External Process Transmission and Reception Messages */ + FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__, + "POSITIONING: POS_ReqGPSSetting() --> cid = %d", + CID_SENSORIF__CWORD82__REQUEST); + ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME, + CID_SENSORIF__CWORD82__REQUEST, + sizeof(SENSOR_MSG_SEND_DAT), + reinterpret_cast<void *>(p_data), 0); + FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__, "POSITIONING: POS_ReqGPSSetting() <--"); + + if (ret_api != RET_NORMAL) { + ret = SENSOR_RET_ERROR_CREATE_EVENT; + } + } else { + /* When resource shortage occurs, the system terminates with an insufficient resource error. */ + ret = SENSOR_RET_ERROR_RESOURCE; + } + /* Resource release */ + VehicleReleaseResource(); + } + } + + return ret; +} +/* -- GPS _CWORD82_ support */ + +/** + * @brief + * GPS information conversion process + * + * Convert GPS information to a format to be provided to the vehicle sensor + * + * @param[in] none + * @param[in] navi_loc_info NAVIINFO_ALL* - GPS information pointer + * + * @return none + */ +void PosCnvGpsInfo(NAVIINFO_ALL *navi_loc_info) { + int32_t altitude; + int64_t tmp; + uint16_t heading; + + /* Unit conversion of fix altitude[1m]->[0.01m] */ + tmp = (int64_t)((int64_t)(navi_loc_info->stNaviGps.altitude) * 100); + if (tmp > static_cast<int32_t>(0x7FFFFFFF)) { + /* +Overflow of digits */ + altitude = static_cast<int32_t>(0x7FFFFFFF); + } else if (tmp < static_cast<int32_t>(0x80000000)) { /* Ignore->MISRA-C:2004 Rule 3.1 */ + /* -Overflow of digits */ + altitude = static_cast<int32_t>(0x80000000); /* Ignore->MISRA-C:2004 Rule 3.1 */ + } else { + altitude = static_cast<int32_t>(tmp); + } + navi_loc_info->stNaviGps.altitude = altitude; + + /* Measurement Azimuth Conversion[0.Once]->[0.01 degree] */ + heading = navi_loc_info->stNaviGps.heading; + heading = static_cast<uint16_t>(heading - ((heading / 3600) * 3600)); + heading = static_cast<uint16_t>(heading * 10); + navi_loc_info->stNaviGps.heading = heading; + + return; +} diff --git a/positioning/client/src/POS_gps_API/libPOS_gps_API.ver b/positioning/client/src/POS_gps_API/libPOS_gps_API.ver index 93578dec..038c99ec 100644 --- a/positioning/client/src/POS_gps_API/libPOS_gps_API.ver +++ b/positioning/client/src/POS_gps_API/libPOS_gps_API.ver @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/src/POS_naviinfo_API/variant/awnavi/src/Naviinfo_API.cpp b/positioning/client/src/POS_naviinfo_API/variant/awnavi/src/Naviinfo_API.cpp deleted file mode 100644 index 38f821f6..00000000 --- a/positioning/client/src/POS_naviinfo_API/variant/awnavi/src/Naviinfo_API.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/****************************************************************************** -@file Naviinfo_API.cpp -@detail Naviinfo_API Functions -@lib libNaviinfo_API.so -******************************************************************************/ - -/***************************************************************************** - * Include * - *****************************************************************************/ -#include "Naviinfo_API.h" -#include <vehicle_service/POS_define.h> -#include <vehicle_service/POS_sensor_API.h> -#include <vehicle_service/POS_gps_API.h> -#include "Vehicle_API_Dummy.h" -#include "POS_private.h" -#include <native_service/frameworkunified_types.h> // NOLINT(build/include_order) - -//void PosCnvGpsInfo(NAVIINFO_ALL *navi_loc_info); - - -/** - * @brief - * GPS information setting - * - * Set GPS information - * - * @param[in] hApp HANDLE - Application handle - * @param[in] navilocinfo NAVIINFO_ALL* - Pointer to GPS information storage area - * - * @return NAVIINFO_RET_NORMAL Normal completion<br> - * NAVIINFO_RET_ERROR_PARAM Parameter error<br> - * NAVIINFO_RET_ERROR_INNER Internal error<br> - * NAVIINFO_RET_ERROR_NOSUPPORT Unsupported environment - * - */ -//NAVIINFO_RET_API POS_SetGPSInfo(HANDLE hApp, NAVIINFO_ALL *navilocinfo) -//{ -// NAVIINFO_RET_API ret = NAVIINFO_RET_NORMAL; /* Return value of this function */ -// UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ -// NAVIINFO_ALL navi_loc_info_tmp; /* Conversion quantity area */ -// RET_API ret_api; -// -// /** NULL checking */ -// if (navilocinfo == NULL) { -// /** Parameter error */ -// ret = NAVIINFO_RET_ERROR_PARAM; -// } else if (hApp == NULL) { -// /** Parameter error */ -// ret = NAVIINFO_RET_ERROR_PARAM; -// } else { -// /* Positioning Base API initialization */ -// _pb_Setup_CWORD64_API(hApp); -// -// /* Supported HW Configuration Check */ -// type = GetEnvSupportInfo(); -// if (UNIT_TYPE_GRADE1 == type) { -// /* GRADE1 */ -// ret = NAVIINFO_RET_NORMAL; -// } else if (UNIT_TYPE_GRADE2 == type) { -// /* -// * Note. -// * This feature branches processing depending on the unit type. -// */ -// ret = NAVIINFO_RET_ERROR_NOSUPPORT; -// } else { -// /* Environment error */ -// ret = NAVIINFO_RET_ERROR_NOSUPPORT; -// } -// } -// -// if (ret == NAVIINFO_RET_NORMAL) { -// /* Parameter range check */ -// if (navilocinfo->stNaviGps.tdsts != 0) { /* Other than ""Time not calibrated after receiver reset"" */ -// /* Positioning status information */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stDiagGps.stFix.ucFixSts, 0, 2)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// /* Latitude */ -// if (POS_RET_ERROR == POS_CHKPARAM32(navilocinfo->stDiagGps.stFix.stWgs84.lLat, -82944000, 82944000)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// /* Longitude */ -// if (POS_RET_ERROR == POS_CHKPARAM32(navilocinfo->stDiagGps.stFix.stWgs84.lLon, -165888000, 165888000)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// /* Measurement Azimuth */ -// if (POS_RET_ERROR == POS_CHKPARAMU16(navilocinfo->stNaviGps.heading, 0, 3599)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// /* UTC(Month) */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.month, 1, 12)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// /* UTC(Day) */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.date, 1, 31)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// /* UTC(Hour) */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.hour, 0, 23)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// /* UTC(Minutes) */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.minute, 0, 59)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// /* UTC(Second) */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.utc.second, 0, 59)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// } -// /* Date and Time Status */ -// if (POS_RET_ERROR == POS_CHKPARAMU8(navilocinfo->stNaviGps.tdsts, 0, 2)) { -// return NAVIINFO_RET_ERROR_PARAM; -// } -// -// /* Copy to conversion area */ -// memcpy(&navi_loc_info_tmp, navilocinfo, sizeof(NAVIINFO_ALL)); -// /** Data unit conversion */ -// PosCnvGpsInfo(&navi_loc_info_tmp); -// -// /* Resource acquisition */ -// if (VehicleGetResource() == TRUE) { -// -// /** Send navigation information to vehicle sensor */ -// ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME, -// CID_NAVIINFO_DELIVER, -// sizeof(NAVIINFO_ALL), -// reinterpret_cast<void*>(&navi_loc_info_tmp), 0); -// if (ret_api != RET_NORMAL) { -// /** Message transmission failure */ -// ret = NAVIINFO_RET_ERROR_INNER; -// } -// } else { -// /* When resource shortage occurs, the system terminates with an insufficient resource error. */ -// ret = NAVIINFO_RET_ERROR_RESOURCE; -// } -// /* Resource release */ -// VehicleReleaseResource(); -// } -// -// return ret; -//} - -/** - * @brief - * GPS information acquisition - * - * Access GPS information - * - * @param[in] hApp HANDLE - Application handle - * @param[in] navidiaginfo NAVIINFO_DIAG_GPS* - Pointer to GPS information storage area - * - * @return NAVIINFO_RET_NORMAL Normal completion<br> - * NAVIINFO_RET_ERROR_PARAM Parameter error<br> - * NAVIINFO_RET_ERROR_INNER Internal error<br> - * NAVIINFO_RET_ERROR_NOSUPPORT Unsupported environment - * - */ -//NAVIINFO_RET_API POS_GetGPSInfo(HANDLE hApp, NAVIINFO_DIAG_GPS *navidiaginfo) -//{ -// NAVIINFO_RET_API ret = NAVIINFO_RET_NORMAL; /* Return value of this function */ -// UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ -// int32 ret_veh; /* VehicleAPI Return Values */ -// NAVIINFO_DIAG_GPS dest_data; /* Data acquisition area */ -// -// /** NULL checking */ -// if (navidiaginfo == NULL) { -// /** Parameter error */ -// ret = NAVIINFO_RET_ERROR_PARAM; -// } else if (hApp == NULL) { -// /** Parameter error */ -// ret = NAVIINFO_RET_ERROR_PARAM; -// } else { -// /* Positioning Base API initialization */ -// _pb_Setup_CWORD64_API(hApp); -// -// /* Supported HW Configuration Check */ -// type = GetEnvSupportInfo(); -// if (UNIT_TYPE_GRADE1 == type) { -// /* GRADE1 */ -// ret = NAVIINFO_RET_NORMAL; -// } else if (UNIT_TYPE_GRADE2 == type) { -// /* -// * Note. -// * This feature branches processing depending on the unit type. -// */ -// ret = NAVIINFO_RET_ERROR_NOSUPPORT; -// } else { -// /* Environment error */ -// ret = NAVIINFO_RET_ERROR_NOSUPPORT; -// } -// } -// -// if (ret == NAVIINFO_RET_NORMAL) { -// /** Acquisition of navigation data for Diag provide */ -// ret_veh = PosGetProc( -// (DID)VEHICLE_DID_NAVIINFO_DIAG_GPS, -// reinterpret_cast<void*>(&dest_data), -// (u_int16)sizeof(dest_data)); -// -// if (static_cast<int32>(sizeof(NAVIINFO_DIAG_GPS)) > ret_veh) { -// /** Failed to acquire */ -// if (ret_veh == POS_RET_ERROR_RESOURCE) { -// ret = NAVIINFO_RET_ERROR_RESOURCE; -// } else { -// ret = NAVIINFO_RET_ERROR_INNER; -// } -// } else { -// /** Successful acquisition */ -// memcpy( navidiaginfo, &dest_data, sizeof(NAVIINFO_DIAG_GPS)); -// } -// } -// -// return ret; -//} - -/* ++ GPS _CWORD82_ support */ -/** - * @brief - * GPS setting transmission request - * - * Requesting GPS Settings with Complete Return - * - * @param[in] hApp HANDLE - Application handle - * @param[in] p_data SENSOR_MSG_SEND_DAT* - GPS setting information to be sent - * - * @return SENSOR_RET_NORMAL Normal completion<br> - * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br> - * SENSOR_RET_ERROR_PARAM Parameter error<br> - * SENSOR_RET_ERROR_DID Unregistered DID<br> - * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment - * - */ -int32 POS_ReqGPSSetting(HANDLE hApp, SENSOR_MSG_SEND_DAT *p_data) { /* Ignore->MISRA-C++:2008 Rule 7-1-2 */ - SENSOR_RET_API ret = SENSOR_RET_NORMAL; /* Return value */ - RET_API ret_api; /* System API return value */ - u_int16 expected_size; /* Message size for the specified DID */ - - UNIT_TYPE type = UNIT_TYPE_NONE; /* Supported HW Configuration Type */ - - if (hApp == NULL) { - /* Parameter error */ - ret = SENSOR_RET_ERROR_PARAM; - } - - if (ret == SENSOR_RET_NORMAL) { - /* Positioning Base API initialization */ - _pb_Setup_CWORD64_API(hApp); - - /* Argument check (DID) + Size calculation */ - if (p_data != reinterpret_cast<SENSOR_MSG_SEND_DAT*>(NULL)) { - switch (p_data->did) { - case VEHICLE_DID_GPS__CWORD82__SETINITIAL: - { - expected_size = 71; - break; - } - case VEHICLE_DID_GPS__CWORD82__SETRMODE: - { - expected_size = 50; - break; - } - case VEHICLE_DID_GPS__CWORD82__SETRMODEEX: - { - expected_size = 63; - break; - } - case VEHICLE_DID_GPS__CWORD82__SELSENT: - { - expected_size = 21; - break; - } - case VEHICLE_DID_GPS__CWORD82__SETSBAS: - { - expected_size = 34; - break; - } - case VEHICLE_DID_GPS__CWORD82__SETCONF1: - { - expected_size = 37; - break; - } - case VEHICLE_DID_GPS__CWORD82__SETCONF2: - { - expected_size = 45; - break; - } - default: /* Ignore->MISRA-C++:2008 Rule 6-3-1, 6-4-1 */ - ret = SENSOR_RET_ERROR_DID; - break; - } - } else { - ret = SENSOR_RET_ERROR_PARAM; - } - } - - /* Supported HW Configuration Check */ - if (ret == SENSOR_RET_NORMAL) { - type = GetEnvSupportInfo(); - if (UNIT_TYPE_GRADE1 == type) { - /* GRADE1 */ - ret = SENSOR_RET_NORMAL; - } else if (UNIT_TYPE_GRADE2 == type) { - /* - * Note. - * This feature branches processing depending on the unit type. - */ - ret = SENSOR_RET_ERROR_NOSUPPORT; - } else { - /* Environment error */ - ret = SENSOR_RET_ERROR_NOSUPPORT; - } - } - - if (ret == SENSOR_RET_NORMAL) { - /* Argument check (Size)*/ - if (expected_size != p_data->usSize) { - ret = SENSOR_RET_ERROR_PARAM; - } else { - /* Message buffer initialization */ - - /* Create message data */ - - /* Resource acquisition */ - if (VehicleGetResource() == TRUE) { - /* External Process Transmission and Reception Messages */ - FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__, - "POSITIONING: POS_ReqGPSSetting() --> cid = %d", - CID_SENSORIF__CWORD82__REQUEST); - ret_api = _pb_SndMsg_Ext(POS_THREAD_NAME, - CID_SENSORIF__CWORD82__REQUEST, - sizeof(SENSOR_MSG_SEND_DAT), - reinterpret_cast<void *>(p_data), 0); - FRAMEWORKUNIFIEDLOG(ZONE_27, __FUNCTION__, "POSITIONING: POS_ReqGPSSetting() <--"); - - if (ret_api != RET_NORMAL) { - ret = SENSOR_RET_ERROR_CREATE_EVENT; - } - } else { - /* When resource shortage occurs, the system terminates with an insufficient resource error. */ - ret = SENSOR_RET_ERROR_RESOURCE; - } - /* Resource release */ - VehicleReleaseResource(); - } - } - - return ret; -} -/* -- GPS _CWORD82_ support */ - -/** - * @brief - * GPS information conversion process - * - * Convert GPS information to a format to be provided to the vehicle sensor - * - * @param[in] none - * @param[in] navi_loc_info NAVIINFO_ALL* - GPS information pointer - * - * @return none - */ -//void PosCnvGpsInfo(NAVIINFO_ALL *navi_loc_info) { -// int32 altitude; -// int64_t tmp; -// u_int16 heading; -// -// /* Unit conversion of fix altitude[1m]->[0.01m] */ -// tmp = (int64_t)((int64_t)(navi_loc_info->stNaviGps.altitude) * 100); -// if (tmp > static_cast<int32>(0x7FFFFFFF)) { -// /* +Overflow of digits */ -// altitude = static_cast<int32>(0x7FFFFFFF); -// } else if (tmp < static_cast<int32>(0x80000000)) { /* Ignore->MISRA-C:2004 Rule 3.1 */ -// /* -Overflow of digits */ -// altitude = static_cast<int32>(0x80000000); /* Ignore->MISRA-C:2004 Rule 3.1 */ -// } else { -// altitude = static_cast<int32>(tmp); -// } -// navi_loc_info->stNaviGps.altitude = altitude; -// -// /* Measurement Azimuth Conversion[0.Once]->[0.01 degree] */ -// heading = navi_loc_info->stNaviGps.heading; -// heading = static_cast<u_int16>(heading - ((heading / 3600) * 3600)); -// heading = static_cast<u_int16>(heading * 10); -// navi_loc_info->stNaviGps.heading = heading; -// -// return; -//} diff --git a/positioning/client/src/POS_sensor_API/Makefile b/positioning/client/src/POS_sensor_API/Makefile index bde53d22..a4f627f4 100644 --- a/positioning/client/src/POS_sensor_API/Makefile +++ b/positioning/client/src/POS_sensor_API/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,21 +17,14 @@ INST_SHLIBS = libPOS_sensor_API ######### compiled sources ############# -VPATH += ../Vehicle_API/common ./common - libPOS_sensor_API_SRCS += Sensor_API.cpp libPOS_sensor_API_SRCS += Vehicle_API.cpp ######### add include path ############# -CPPFLAGS += -I./ -CPPFLAGS += -I./common/ CPPFLAGS += -I../../../server/include/common CPPFLAGS += -I../../include CPPFLAGS += -I../../../server/include/nsfw -CPPFLAGS += -I../Vehicle_API -CPPFLAGS += -I../Vehicle_API/common - ######### add compile option ############# CPPFLAGS += -DLINUX -fPIC diff --git a/positioning/client/src/POS_sensor_API/common/Sensor_API.cpp b/positioning/client/src/POS_sensor_API/Sensor_API.cpp index a015998f..179eb926 100644 --- a/positioning/client/src/POS_sensor_API/common/Sensor_API.cpp +++ b/positioning/client/src/POS_sensor_API/Sensor_API.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,24 +19,21 @@ * System name :GPF * Subsystem name :Sensor I/F library * Program name :SensorI/F API - * Module configuration :SensorPkgDeliveryEntry() Vehicle sensor information package delivery registration - * :SensorGetSensorPkgData() Vehicle sensor information package acquisition ******************************************************************************/ #include <stdio.h> -#include "Sensor_API.h" +#include <vehicle_service/POS_sensor_API.h> +#include <vehicle_service/POS_define.h> +#include <vehicle_service/POS_sensor_API.h> +#include <vehicle_service/positioning_base_library.h> +#include "POS_sensor_private.h" +#include "Sensor_Common_API.h" #include "Sensor_API_private.h" -/* ++ GPS _CWORD82_ support */ -#include "Vehicle_API_Dummy.h" -/* -- GPS _CWORD82_ support */ - #include "Sensor_Common_API.h" +#include "Vehicle_API_Dummy.h" #include "Vehicle_API_private.h" #include "Naviinfo_API.h" -#include <vehicle_service/POS_define.h> -#include <vehicle_service/POS_sensor_API.h> #include "POS_private.h" -#include <vehicle_service/positioning_base_library.h> /*************************************************/ /* Global variable */ @@ -51,31 +48,37 @@ */ static const SENSOR_RET_PKG g_ret_list_reg_lis_pkg_sens_data[SENSOR_PUBLIC_DID_NUM] = { /* GRADE2 GRADE1 DID (Key) */ - {TRUE, FALSE, POS_DID_SPEED_PULSE }, - {FALSE, FALSE, POS_DID_SPEED_KMPH }, - {TRUE, FALSE, POS_DID_GYRO }, - {TRUE, FALSE, POS_DID_GSNS_X }, - {TRUE, FALSE, POS_DID_GSNS_Y }, - {FALSE, FALSE, POS_DID_GPS_ANTENNA }, - {TRUE, FALSE, POS_DID_SNS_COUNTER }, - {FALSE, FALSE, POS_DID_SPEED_PULSE_FST }, - {FALSE, FALSE, POS_DID_GYRO_FST }, - {FALSE, FALSE, POS_DID_GPS__CWORD82__NMEA }, - {FALSE, FALSE, POS_DID_GPS__CWORD82___CWORD44_GP4 }, - {FALSE, FALSE, POS_DID_GPS__CWORD82__FULLBINARY }, - {FALSE, FALSE, POS_DID_GPS_NMEA }, - {TRUE, FALSE, POS_DID_REV }, - {FALSE, FALSE, POS_DID_REV_FST }, - {TRUE, FALSE, POS_DID_GYRO_TEMP }, - {FALSE, FALSE, POS_DID_GYRO_TEMP_FST }, - {FALSE, FALSE, POS_DID_GSNS_X_FST }, - {FALSE, FALSE, POS_DID_GSNS_Y_FST }, - {TRUE, FALSE, POS_DID_PULSE_TIME }, - {FALSE, FALSE, POS_DID_GPS_CLOCK_DRIFT }, - {FALSE, FALSE, POS_DID_GPS_CLOCK_FREQ }, - {FALSE, FALSE, VEHICLE_DID_GPS_TIME }, /* For local use */ - {FALSE, FALSE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */ - {FALSE, FALSE, VEHICLE_DID_GPS_WKNROLLOVER } /* For local use */ + {TRUE, TRUE, POS_DID_SPEED_PULSE }, + {FALSE, TRUE, POS_DID_SPEED_KMPH }, + {TRUE, TRUE, POS_DID_GYRO_X }, + {TRUE, TRUE, POS_DID_GYRO_Y }, + {TRUE, TRUE, POS_DID_GYRO_Z }, + {TRUE, TRUE, POS_DID_GSNS_X }, + {TRUE, TRUE, POS_DID_GSNS_Y }, + {TRUE, TRUE, POS_DID_GSNS_Z }, + {FALSE, TRUE, POS_DID_GPS_ANTENNA }, + {TRUE, TRUE, POS_DID_SNS_COUNTER }, + {FALSE, TRUE, POS_DID_SPEED_PULSE_FST }, + {FALSE, TRUE, POS_DID_GYRO_X_FST }, + {FALSE, TRUE, POS_DID_GYRO_Y_FST }, + {FALSE, TRUE, POS_DID_GYRO_Z_FST }, + {FALSE, TRUE, POS_DID_GPS__CWORD82__NMEA }, + {FALSE, TRUE, POS_DID_GPS__CWORD82___CWORD44_GP4 }, + {FALSE, TRUE, POS_DID_GPS__CWORD82__FULLBINARY }, + {FALSE, TRUE, POS_DID_GPS_NMEA }, + {TRUE, TRUE, POS_DID_REV }, + {FALSE, TRUE, POS_DID_REV_FST }, + {TRUE, TRUE, POS_DID_GYRO_TEMP }, + {FALSE, TRUE, POS_DID_GYRO_TEMP_FST }, + {FALSE, TRUE, POS_DID_GSNS_X_FST }, + {FALSE, TRUE, POS_DID_GSNS_Y_FST }, + {FALSE, TRUE, POS_DID_GSNS_Z_FST }, + {TRUE, TRUE, POS_DID_PULSE_TIME }, + {FALSE, TRUE, POS_DID_GPS_CLOCK_DRIFT }, + {FALSE, TRUE, POS_DID_GPS_CLOCK_FREQ }, + {FALSE, TRUE, VEHICLE_DID_GPS_TIME }, /* For local use */ + {FALSE, TRUE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */ + {FALSE, TRUE, VEHICLE_DID_GPS_WKNROLLOVER} /* For local use */ }; /** @@ -84,30 +87,36 @@ static const SENSOR_RET_PKG g_ret_list_reg_lis_pkg_sens_data[SENSOR_PUBLIC_DID_N static const SENSOR_RET_PKG g_ret_list_reg_lis_sens_data[SENSOR_PUBLIC_DID_NUM] = { /* GRADE2 GRADE1 DID (Key) */ {TRUE, TRUE, POS_DID_SPEED_PULSE }, - {FALSE, FALSE, POS_DID_SPEED_KMPH }, - {TRUE, FALSE, POS_DID_GYRO }, - {TRUE, FALSE, POS_DID_GSNS_X }, - {TRUE, FALSE, POS_DID_GSNS_Y }, + {FALSE, TRUE, POS_DID_SPEED_KMPH }, + {TRUE, TRUE, POS_DID_GYRO_X }, + {TRUE, TRUE, POS_DID_GYRO_Y }, + {TRUE, TRUE, POS_DID_GYRO_Z }, + {TRUE, TRUE, POS_DID_GSNS_X }, + {TRUE, TRUE, POS_DID_GSNS_Y }, + {TRUE, TRUE, POS_DID_GSNS_Z }, {TRUE, TRUE, POS_DID_GPS_ANTENNA }, - {FALSE, FALSE, POS_DID_SNS_COUNTER }, - {TRUE, FALSE, POS_DID_SPEED_PULSE_FST }, - {TRUE, FALSE, POS_DID_GYRO_FST }, - {TRUE, FALSE, POS_DID_GPS__CWORD82__NMEA }, - {FALSE, FALSE, POS_DID_GPS__CWORD82___CWORD44_GP4 }, - {TRUE, FALSE, POS_DID_GPS__CWORD82__FULLBINARY }, + {FALSE, TRUE, POS_DID_SNS_COUNTER }, + {TRUE, TRUE, POS_DID_SPEED_PULSE_FST }, + {TRUE, TRUE, POS_DID_GYRO_X_FST }, + {TRUE, TRUE, POS_DID_GYRO_Y_FST }, + {TRUE, TRUE, POS_DID_GYRO_Z_FST }, + {TRUE, TRUE, POS_DID_GPS__CWORD82__NMEA }, + {FALSE, TRUE, POS_DID_GPS__CWORD82___CWORD44_GP4 }, + {TRUE, TRUE, POS_DID_GPS__CWORD82__FULLBINARY }, {FALSE, TRUE, POS_DID_GPS_NMEA }, - {FALSE, FALSE, POS_DID_REV }, - {TRUE, FALSE, POS_DID_REV_FST }, - {TRUE, FALSE, POS_DID_GYRO_TEMP }, - {TRUE, FALSE, POS_DID_GYRO_TEMP_FST }, - {TRUE, FALSE, POS_DID_GSNS_X_FST }, - {TRUE, FALSE, POS_DID_GSNS_Y_FST }, - {FALSE, FALSE, POS_DID_PULSE_TIME }, + {FALSE, TRUE, POS_DID_REV }, + {TRUE, TRUE, POS_DID_REV_FST }, + {TRUE, TRUE, POS_DID_GYRO_TEMP }, + {TRUE, TRUE, POS_DID_GYRO_TEMP_FST }, + {TRUE, TRUE, POS_DID_GSNS_X_FST }, + {TRUE, TRUE, POS_DID_GSNS_Y_FST }, + {TRUE, TRUE, POS_DID_GSNS_Z_FST }, + {FALSE, TRUE, POS_DID_PULSE_TIME }, {FALSE, TRUE, POS_DID_GPS_CLOCK_DRIFT }, {FALSE, TRUE, POS_DID_GPS_CLOCK_FREQ }, - {FALSE, FALSE, VEHICLE_DID_GPS_TIME }, /* For local use */ - {FALSE, FALSE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */ - {FALSE, FALSE, VEHICLE_DID_GPS_WKNROLLOVER } /* For local use */ + {FALSE, TRUE, VEHICLE_DID_GPS_TIME }, /* For local use */ + {FALSE, TRUE, VEHICLE_DID_GPS_TIME_RAW }, /* For local use */ + {FALSE, TRUE, VEHICLE_DID_GPS_WKNROLLOVER } /* For local use */ }; /** @@ -116,25 +125,31 @@ static const SENSOR_RET_PKG g_ret_list_reg_lis_sens_data[SENSOR_PUBLIC_DID_NUM] static const SENSOR_RET_PKG g_ret_list_get_sens_data[SENSOR_PUBLIC_DID_NUM] = { /* GRADE2 GRADE1 DID (Key) */ {TRUE, TRUE, POS_DID_SPEED_PULSE }, - {FALSE, FALSE, POS_DID_SPEED_KMPH }, - {TRUE, FALSE, POS_DID_GYRO }, - {TRUE, FALSE, POS_DID_GSNS_X }, - {TRUE, FALSE, POS_DID_GSNS_Y }, + {FALSE, TRUE, POS_DID_SPEED_KMPH }, + {TRUE, TRUE, POS_DID_GYRO_X }, + {TRUE, TRUE, POS_DID_GYRO_Y }, + {TRUE, TRUE, POS_DID_GYRO_Z }, + {TRUE, TRUE, POS_DID_GSNS_X }, + {TRUE, TRUE, POS_DID_GSNS_Y }, + {TRUE, TRUE, POS_DID_GSNS_Z }, {TRUE, TRUE, POS_DID_GPS_ANTENNA }, - {FALSE, FALSE, POS_DID_SNS_COUNTER }, - {FALSE, FALSE, POS_DID_SPEED_PULSE_FST }, - {FALSE, FALSE, POS_DID_GYRO_FST }, - {TRUE, FALSE, POS_DID_GPS__CWORD82__NMEA }, - {FALSE, FALSE, POS_DID_GPS__CWORD82___CWORD44_GP4 }, - {TRUE, FALSE, POS_DID_GPS__CWORD82__FULLBINARY }, + {FALSE, TRUE, POS_DID_SNS_COUNTER }, + {FALSE, TRUE, POS_DID_SPEED_PULSE_FST }, + {FALSE, TRUE, POS_DID_GYRO_X_FST }, + {FALSE, TRUE, POS_DID_GYRO_Y_FST }, + {FALSE, TRUE, POS_DID_GYRO_Z_FST }, + {TRUE, TRUE, POS_DID_GPS__CWORD82__NMEA }, + {FALSE, TRUE, POS_DID_GPS__CWORD82___CWORD44_GP4 }, + {TRUE, TRUE, POS_DID_GPS__CWORD82__FULLBINARY }, {FALSE, TRUE, POS_DID_GPS_NMEA }, - {FALSE, FALSE, POS_DID_REV }, - {FALSE, FALSE, POS_DID_REV_FST }, - {TRUE, FALSE, POS_DID_GYRO_TEMP }, - {FALSE, FALSE, POS_DID_GYRO_TEMP_FST }, - {FALSE, FALSE, POS_DID_GSNS_X_FST }, - {FALSE, FALSE, POS_DID_GSNS_Y_FST }, - {FALSE, FALSE, POS_DID_PULSE_TIME }, + {FALSE, TRUE, POS_DID_REV }, + {FALSE, TRUE, POS_DID_REV_FST }, + {TRUE, TRUE, POS_DID_GYRO_TEMP }, + {FALSE, TRUE, POS_DID_GYRO_TEMP_FST }, + {FALSE, TRUE, POS_DID_GSNS_X_FST }, + {FALSE, TRUE, POS_DID_GSNS_Y_FST }, + {FALSE, TRUE, POS_DID_GSNS_Z_FST }, + {FALSE, TRUE, POS_DID_PULSE_TIME }, {FALSE, TRUE, POS_DID_GPS_CLOCK_DRIFT }, {FALSE, TRUE, POS_DID_GPS_CLOCK_FREQ }, {FALSE, TRUE, VEHICLE_DID_GPS_TIME }, /* For local use */ @@ -260,9 +275,9 @@ SENSOR_RET_API POS_RegisterListenerPkgSensData(HANDLE hApp, BOOL ret_b; RET_API ret_api; /* System API return value */ EventID event_id; /* Event ID */ - int32 event_val; /* Event value */ + int32_t event_val; /* Event value */ SENSOR_MSG_DELIVERY_ENTRY_DAT data; /* Message data */ - int32 i; /* Generic counters */ + int32_t i; /* Generic counters */ PNO ch_pno; /* Converted internal PNO */ UNIT_TYPE type; /* Supported HW Configuration Type */ @@ -363,19 +378,14 @@ SENSOR_RET_API POS_RegisterListenerPkgSensData(HANDLE hApp, data.ctrl_flg = ucCtrlFlg; data.event_id = event_id; for (i = 0; i < ucPkgNum; i++) { - if (pulDid[i] == POS_DID_GYRO) { - /* Replaced because POS_DID_GYRO is treated internally as VEHICLE_DID_GYRO_EXT. */ - data.did[i] = VEHICLE_DID_GYRO_EXT; - } else { - data.did[i] = pulDid[i]; - } + data.did[i] = pulDid[i]; } /* Messaging */ ret_api = PosSndMsg(ch_pno, PNO_VEHICLE_SENSOR, CID_SENSORIF_PKG_DELIVERY_ENTRY_EXT, - (u_int16)sizeof(SENSOR_MSG_DELIVERY_ENTRY_DAT), + (uint16_t)sizeof(SENSOR_MSG_DELIVERY_ENTRY_DAT), (const void *)&data); if (RET_NORMAL == ret_api) { @@ -485,12 +495,12 @@ RET_API PosDeleteEvent(EventID event_id) { * RETURN : RET_NORMAL : Normal completion * : RET_ERROR : There is no shared memory area. ******************************************************************************/ -RET_API SensorLinkShareData(void **share_top, u_int32 *share_size, u_int16 *offset) { // LCOV_EXCL_START 8:dead code +RET_API SensorLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset) { // LCOV_EXCL_START 8:dead code AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert RET_API ret_api; /* System API return value */ SemID sem_id; /* Semaphore ID */ SENSOR_SHARE *share_top_tmp; - int32 i; + int32_t i; /* Initialization */ ret_api = RET_ERROR; @@ -519,7 +529,7 @@ RET_API SensorLinkShareData(void **share_top, u_int32 *share_size, u_int16 *offs share_top_tmp->mng.lock_info[i] = SENSOR_SHARE_LOCK; /* Calculate the offset to the block */ - *offset = static_cast<u_int16>(i * SENSOR_SHARE_BLOCK_SIZE); + *offset = static_cast<uint16_t>(i * SENSOR_SHARE_BLOCK_SIZE); /* Normal completion */ ret_api = RET_NORMAL; @@ -556,11 +566,11 @@ RET_API SensorLinkShareData(void **share_top, u_int32 *share_size, u_int16 *offs * RETURN : RET_NORMAL : Normal completion * : RET_ERROR : There is no shared memory area./semaphore error ******************************************************************************/ -RET_API SensorUnLinkShareData(SENSOR_SHARE *share_top, u_int16 offset) { // LCOV_EXCL_START 8:dead code +RET_API SensorUnLinkShareData(SENSOR_SHARE *share_top, uint16_t offset) { // LCOV_EXCL_START 8:dead code AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert RET_API ret_api; /* System API return value */ SemID sem_id; /* Semaphore ID */ - int32 i; + int32_t i; /* Initialization */ ret_api = RET_ERROR; @@ -604,12 +614,12 @@ RET_API SensorUnLinkShareData(SENSOR_SHARE *share_top, u_int16 offset) { // LCO * NOTE : * RETURN : void ******************************************************************************/ -void SensorSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) +void SensorSetShareData(void *share_top, uint16_t offset, const void *data_src, uint16_t size_src) { // LCOV_EXCL_START 8:dead code // NOLINT(whitespace/line_length) AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert SENSOR_SHARE_BLOCK_DAT *share_dat; /* Calculate Shared Memory Write Address */ - share_dat = reinterpret_cast<SENSOR_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top) + offset); + share_dat = reinterpret_cast<SENSOR_SHARE_BLOCK_DAT *>(reinterpret_cast<uint8_t *>(share_top) + offset); /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */ /* Clear Shared Memory */ @@ -638,7 +648,7 @@ void SensorSetShareData(void *share_top, u_int16 offset, const void *data_src, u * : RET_ERRMSGFULL : Message queue overflows * : RET_ERRPARAM : Buffer size error ******************************************************************************/ -RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data) { +RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, uint16_t msg_len, const void *msg_data) { SENSOR_INTERNAL_MSG_BUF msg_buf; /* message buffer */ T_APIMSG_MSGBUF_HEADER *msg_hdr; /* Pointer to the message header */ RET_API ret_api; /* Return value */ @@ -684,7 +694,7 @@ RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const voi /* Internal Process Transmission and Reception Messages */ ret_api = _pb_SndMsg(pno_dest, - (u_int16)(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len),/* Ignore->MISRA-C++:2008 Rule 5-0-5 */ + (uint16_t)(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len),/* Ignore->MISRA-C++:2008 Rule 5-0-5 */ reinterpret_cast<void *>(&msg_buf), 0); } else { /* Internal debug log output */ @@ -694,7 +704,7 @@ RET_API PosSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const voi /* External Process Transmission and Reception Messages */ ret_api = _pb_SndMsg_Ext(thread_name, cid, - (u_int16)(msg_len), /* Ignore->MISRA-C++:2008 Rule 5-0-5 */ + (uint16_t)(msg_len), /* Ignore->MISRA-C++:2008 Rule 5-0-5 */ reinterpret_cast<void *>(&(msg_buf.data)), 0); } /* If RET_ERROR,Register a dialog if called from a Vehicle related thread */ /* Task_30332 */ @@ -758,18 +768,17 @@ POS_RET_API POS_GetSensData(HANDLE hApp, DID did, void *dest_data, uint16_t dest } } -// if (ret == NAVIINFO_RET_NORMAL) { -// /* Judge DID*/ -// ret_b = SENSOR_DID_JUDGE_GET(did); -// if (ret_b == FALSE) { -// /* An unacceptable ID is regarded as a parameter error. */ -// ret = POS_RET_ERROR_PARAM; -// } else { -// /* Data acquisition process */ -// ret = PosGetProc(did, dest_data, dest_size); -// } -// } + if (ret == NAVIINFO_RET_NORMAL) { + /* Judge DID*/ + ret_b = SENSOR_DID_JUDGE_GET(did); + if (ret_b == FALSE) { + /* An unacceptable ID is regarded as a parameter error. */ + ret = POS_RET_ERROR_PARAM; + } else { + /* Data acquisition process */ + ret = PosGetProc(did, dest_data, dest_size); + } + } return ret; } - diff --git a/positioning/client/src/Vehicle_API/common/Vehicle_API.cpp b/positioning/client/src/POS_sensor_API/Vehicle_API.cpp index 27487d15..3cd97f86 100644 --- a/positioning/client/src/Vehicle_API/common/Vehicle_API.cpp +++ b/positioning/client/src/POS_sensor_API/Vehicle_API.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver b/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver index 5cb4bc2b..10fd95bc 100644 --- a/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver +++ b/positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/positioning/client/src/SensorLocation_API/common/SensorLocation_API.cpp b/positioning/client/src/SensorLocation_API/common/SensorLocation_API.cpp deleted file mode 100644 index f39c9e17..00000000 --- a/positioning/client/src/SensorLocation_API/common/SensorLocation_API.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/****************************************************************************** -@file SensorLocation_API.cpp -@detail SensorLocation_API Functions -@lib libSensorLocation_API.so -******************************************************************************/ - -/***************************************************************************** - * Include * - *****************************************************************************/ -#include <vehicle_service/positioning_base_library.h> -#include "SensorLocation_API.h" -#include "Vehicle_API.h" -#include "Vehicle_API_Dummy.h" -#include "SensorLocation_API_private.h" - -static RET_API SensorLocationGetLonLatOnShutdownGetData(LONLAT *lonlat); - -/******************************************************************************* -* MODULE : SensorLocationGetLonLatOnShutdownGetData -* ABSTRACT : Obtain position at shutdown -* FUNCTION : Gets the location at shutdown from shared memory -* ARGUMENT : LONLAT * lonlat : Latitude/Longitude -* NOTE : -* RETURN : RET_NORMAL : Successful acquisition -* : RET_ERROR : Failed to acquire -* : RET_ERRPARAM : Parameter error -******************************************************************************/ -static RET_API SensorLocationGetLonLatOnShutdownGetData(LONLAT *lonlat) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - RET_API ret = RET_NORMAL; - RET_API ret_api; - LONLAT *share_mem; /* Store Shared Memory Address */ - u_int32 share_mem_size; /* Size of the linked shared memory */ - - if (lonlat == NULL) { - ret = RET_ERRPARAM; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lonlat is NULL\r\n"); - } else { - /* Link to shared memory */ - ret_api = _pb_LinkShareData(const_cast<char *>(LONLAT_SHARE_NAME), - reinterpret_cast<void **>(&share_mem), &share_mem_size); - /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */ - - if (ret_api == RET_NORMAL) { - /* Link to shared memory successful */ - - /* Get shutdown location from shared memory */ - *lonlat = *share_mem; - } else { - /* Failed to link to shared memory */ - ret = RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't link shared memory\r\n"); - } - } - - return ret; -} -// LCOV_EXCL_STOP - -/****************************************************************************** -@brief SensorLocationGetLonLatOnShutdown<BR> - Obtain position at shutdown -@outline Get location information at shutdown. -@param[in] none -@param[out] LONLAT* lonlat: Pointer to the acquired latitude/longitude information storage destination -@return SENSORLOCATION_RET_API -@retval SENSORLOCATION_RET_NORMAL : Normal completion -@retval SENSORLOCATION_RET_ERROR_INNER : Internal error -*******************************************************************************/ -SENSORLOCATION_RET_API SensorLocationGetLonLatOnShutdown(LONLAT *lonlat) { // LCOV_EXCL_START 8:dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SENSORLOCATION_RET_API ret; - RET_API ret_api; /* API return value */ - RET_API ret_tmp; - SemID sem_id; /* Semaphore ID */ - - if (lonlat != NULL) { - /* Get Semaphore ID */ - sem_id = _pb_CreateSemaphore(const_cast<char *>(LONLAT_SEMAPHO_NAME)); - - if (sem_id != 0) { /* Because the return value of _pb_CreateSemaphore is not defined in #define,Evaluate directly */ - /* Semaphore ID successfully acquired */ - - /* Semaphore Lock */ - ret_api = _pb_SemLock(sem_id); - - if (ret_api == RET_NORMAL) { - /* Semaphore lock successful */ - - /* Obtain position at shutdown */ - ret_tmp = SensorLocationGetLonLatOnShutdownGetData(lonlat); - - if (ret_tmp == RET_NORMAL) { - /* Position acquisition at shutdown successful */ - ret = SENSORLOCATION_RET_NORMAL; - } else { - /* Location acquisition at shutdown failed */ - ret = SENSORLOCATION_RET_ERROR_INNER; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SensorLocationGetLonLatOnShutdownGetData failed"); - } - - /* Semaphore unlock */ - ret_api = _pb_SemUnlock(sem_id); - if (ret_api != RET_NORMAL) { - /* Semaphore unlock failure */ - ret = SENSORLOCATION_RET_ERROR_INNER; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemUnlock failed"); - } - } else { - /* Semaphore lock failed */ - ret = SENSORLOCATION_RET_ERROR_INNER; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock failed"); - } - } else { - /* Semaphore ID acquisition failure */ - ret = SENSORLOCATION_RET_ERROR_INNER; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0"); - } - } else { - ret = SENSORLOCATION_RET_ERROR_INNER; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lonlat == NULL"); - } - - return ret; -} -// LCOV_EXCL_STOP diff --git a/positioning/client/src/VehicleDebug_API/common/VehicleDebug_API.cpp b/positioning/client/src/VehicleDebug_API/common/VehicleDebug_API.cpp deleted file mode 100644 index 7ac19b2f..00000000 --- a/positioning/client/src/VehicleDebug_API/common/VehicleDebug_API.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/****************************************************************************** -@file VehicleDebug_API.cpp -@detail VehicleDebug_API Functions -@lib libVehicleDebug_API.so -******************************************************************************/ - -/***************************************************************************** - * Include * - *****************************************************************************/ -#include <vehicle_service/positioning_base_library.h> -#include "VehicleDebug_API.h" -#include "VehicleDebug_API_private.h" - -static VEHICLEDEBUG_RET_API VehicleDebugSndMsg(PNO pno_src, - PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data); -static RET_API SensorGetLogSettingGetData(u_int32 *log_sw, u_int8 *severity); -static EventID SensorGetLogSettingCreateEvent(PNO pno); -static RET_API SensorGetLogSettingDeleteEvent(EventID event_id); - -/******************************************************************************* -* MODULE : SensorGetLogSettingGetData -* ABSTRACT : Get Log Settings from Shared Memory -* FUNCTION : Get log settings from shared memory -* ARGUMENT : u_int32* log_sw : Log type -* : u_int8* severity : Output level -* NOTE : -* RETURN : RET_NORMAL : Successful acquisition -* : RET_ERROR : Failed to acquire -* : RET_ERRPARAM : Parameter error -******************************************************************************/ -static RET_API SensorGetLogSettingGetData(u_int32 *log_sw, u_int8 *severity) { - RET_API ret = RET_NORMAL; - RET_API ret_api; /* API return value */ - VEHICLEDEBUG_MSG_LOGINFO_DAT *share_mem; /* Store Shared Memory Address */ - u_int32 share_mem_size; /* Size of the linked shared memory */ - - if (log_sw == NULL || severity == NULL) { - ret = RET_ERRPARAM; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "log_sw == NULL or severity == NULL\r\n"); - } else { - /* Link to shared memory */ - ret_api = _pb_LinkShareData(const_cast<char*>(LOG_SETTING_SHARE_MEMORY_NAME), - reinterpret_cast<void **>(&share_mem), &share_mem_size); - /* #QAC confirmation Rule11.4 Use structure for member reference(Cast according to shared memory link IF) */ - - if (ret_api == RET_NORMAL) { - /* Link to shared memory successful */ - if (share_mem_size == VEHICLEDEBUG_MSGBUF_DSIZE) { - /* When the size of the linked shared memory is correct */ - - /* Get log type/output level from shared memory */ - *log_sw = share_mem->log_sw; - (void)memcpy(reinterpret_cast<void *>(severity), - (const void *)(share_mem->severity), sizeof(share_mem->severity)); - } else { - /* The size of the linked shared memory is incorrect. */ - ret = RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Bad shared memory size\r\n"); - } - } else { - /* Failed to link to shared memory */ - ret = RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't link shared memory\r\n"); - } - } - - return ret; -} - -/******************************************************************************* -* MODULE : SensorGetLogSettingCreateEvent -* ABSTRACT : Event Generation -* FUNCTION : Generate an event -* ARGUMENT : PNO pno : Destination thread ID -* NOTE : -* RETURN : EventID event_id : Event ID (Event set failed if 0) -******************************************************************************/ -static EventID SensorGetLogSettingCreateEvent(PNO pno) { - EventID event_id; /* Event ID */ - int8 event_name[32]; /* Event name character string buffer */ - - /* Initialization of event name character string buffer */ - (void)memset(reinterpret_cast<void *>(event_name), 0, sizeof(event_name)); - - /* Event name creation */ - snprintf(event_name, sizeof(event_name), "VehicleDebug_%X", pno); - - /* Event Generation */ - event_id = _pb_CreateEvent(_CWORD64_EVENT_MANUALRESET_OFF, VEHICLEDEBUG_EVENT_VAL_INIT, event_name); - - return event_id; -} - -/******************************************************************************* - * MODULE : SensorGetLogSettingDeleteEvent - * ABSTRACT : Event deletion processing - * FUNCTION : Delete events - * ARGUMENT : event_id : Event ID of the event to delete - * NOTE : - * RETURN : RET_NORMAL : Normal completion - * : RET_EV_NONE : Specified event does not exist - ******************************************************************************/ -static RET_API SensorGetLogSettingDeleteEvent(EventID event_id) { - return(_pb_DeleteEvent(event_id)); -} - -/******************************************************************************* -@brief SensorGetLogSetting<BR> - Log setting acquisition -@outline Get the log settings. -@param[in] PNO pno : Destination thread ID -@param[out] u_int32* log_sw : Log type -@param[out] u_int8* severity : Output level -@return SENSORMOTION_RET_API -@retval VEHICLEDEBUG_RET_NORMAL : Successful acquisition -@retval VEHICLEDEBUG_RET_ERROR : Acquisition failure error -*******************************************************************************/ -VEHICLEDEBUG_RET_API SensorGetLogSetting(PNO pno, u_int32 *log_sw, u_int8 *severity) { - VEHICLEDEBUG_RET_API ret; - RET_API ret_api; /* API return value */ - RET_API ret_tmp; - EventID event_id; /* Event ID */ - int32 event_val; /* Event value */ - SemID sem_id; /* Semaphore ID */ - VEHICLEDEBUG_MSG_LOGINFO_DAT data; /* Message data(Dummy) */ - - if (log_sw == NULL || severity == NULL) { - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "log_sw == NULL or severity == NULL\r\n"); - } else { - /* Set of events */ - event_id = SensorGetLogSettingCreateEvent(pno); - - if (event_id != 0) { - /* Event Set Success */ - - /* Messaging(Notify VehicleSens_thread) */ - /* Because it uses shared memory for data retrieval,Message body does not need to be sent */ - ret_api = VehicleDebugSndMsg(pno, - PNO_VEHICLE_SENSOR, - CID_VEHICLEDEBUG_LOG_GET, - 0, /* Message size is set to 0 */ - (const void *)&data); /* Message data(Dummy) -> Errors by NULL */ - - if (ret_api == RET_NORMAL) { - /* Message transmission success */ - - /* Wait for completion event */ - ret_api = _pb_WaitEvent(event_id, - SAPI_EVWAIT_VAL, - VEHICLEDEBUG_RET_ERROR_MIN, VEHICLEDEBUG_RET_NORMAL, &event_val, INFINITE); - if (ret_api == RET_NORMAL) { - /* Return from Event Wait */ - if (event_val == VEHICLEDEBUG_RET_NORMAL) { - /* Log setting acquisition function succeeded */ - - /* Get Semaphore ID */ - sem_id = _pb_CreateSemaphore(const_cast<char *>(SENSOR_LOG_SETTING_SEMAPHO_NAME)); - - /* Because the return value of _pb_CreateSemaphore is not defined in #define,Evaluate directly */ - if (sem_id != 0) { - /* Semaphore ID successfully acquired */ - /* Semaphore Lock */ - ret_api = _pb_SemLock(sem_id); - - if (ret_api == RET_NORMAL) { - /* Semaphore lock successful */ - - /* Get Log Settings from Shared Memory */ - ret_tmp = SensorGetLogSettingGetData(log_sw, severity); - - if (ret_tmp == RET_NORMAL) { - /* Log setting acquisition success */ - ret = VEHICLEDEBUG_RET_NORMAL; - } else { - /* Log setting acquisition failure */ - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SensorGetLogSettingGetData Failed"); - } - - /* Semaphore unlock */ - ret_api = _pb_SemUnlock(sem_id); - if (ret_api != RET_NORMAL) { - /* Semaphore unlock failure */ - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemUnlock Failed"); - } - } else { - /* Semaphore lock failed */ - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_SemLock Failed"); - } - } else { - /* Semaphore ID acquisition failure */ - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "sem_id == 0"); - } - } else { - /* Log setting acquisition function failed */ - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "event_val != VEHICLEDEBUG_RET_NORMAL"); - } - } else { - /* _pb_WaitEvent failed */ - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "_pb_WaitEvent Failed"); - } - } else { - /* Message transmission failure */ - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "VehicleDebugSndMsg Failed"); - } - /* Event deletion */ - (void)SensorGetLogSettingDeleteEvent(event_id); - } else { - /* Event set failed */ - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "event_id == 0"); - } - } - - return ret; -} - -/******************************************************************************* -@brief SensorSetLogStatus<BR> - Log Setting Request -@outline Configure the log. -@param[in] PNO pno : Destination thread ID -@param[in] u_int32 log_sw : Log type - Correspond to the log output by each bit. - 0th bit : Location Log Output Settings(0:OFF 1:ON) -@param[in] u_int8* severity : Output level(Not used) -@param[out] None -@return SENSORMOTION_RET_API -@retval VEHICLEDEBUG_RET_NORMAL : Setting success -@retval VEHICLEDEBUG_RET_ERROR : Setting failed -*******************************************************************************/ -VEHICLEDEBUG_RET_API SensorSetLogStatus(PNO pno, u_int32 log_sw, u_int8 *severity) { - RET_API ret_api = RET_NORMAL; /* System API return value */ - VEHICLEDEBUG_RET_API ret = VEHICLEDEBUG_RET_NORMAL; /* Return value */ - VEHICLEDEBUG_MSG_LOGINFO_DAT data; /* Message data */ - - if (severity != NULL) { - /* Message configuration */ - data.log_sw = log_sw; - (void)memcpy(reinterpret_cast<void *>(&(data.severity[0])), (const void *)(severity), sizeof(data.severity)); - - /* Messaging */ - ret_api = VehicleDebugSndMsg(pno, - PNO_VEHICLE_SENSOR, - CID_VEHICLEDEBUG_LOG_SET, - (u_int16)sizeof(VEHICLEDEBUG_MSG_LOGINFO_DAT), - (const void *)&data); - if (ret_api == RET_NORMAL) { - ret = VEHICLEDEBUG_RET_NORMAL; - } else { - ret = VEHICLEDEBUG_RET_ERROR; - } - } else { - ret = VEHICLEDEBUG_RET_ERROR; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "severity == NULL"); - } - - return ret; -} - -/******************************************************************************* - * MODULE : VehicleDebugSndMsg - * ABSTRACT : Message transmission processing - * FUNCTION : Send a message to the specified PNO - * ARGUMENT : pno_src : Source PNO - * : pno_dest : Destination PNO - * : cid : Command ID - * : msg_len : Message data body length - * : *msg_data : Pointer to message data - * NOTE : - * RETURN : RET_NORMAL : Normal completion - * : RET_ERRNOTRDY : Destination process is not wakeup - * : RET_ERRMSGFULL : Message queue overflows - * : RET_ERRPARAM : Buffer size error - ******************************************************************************/ -static VEHICLEDEBUG_RET_API VehicleDebugSndMsg(PNO pno_src, - PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data) { - VEHICLEDEBUG_MSG_BUF msg_buf; - RET_API ret_api; - - if (msg_data != NULL) { - /* Initialization message buffe */ - (void)memset(reinterpret_cast<void *>(&msg_buf), 0, sizeof(VEHICLEDEBUG_MSG_BUF)); - - /*--------------------------------------------------------------* - * Create a message header * - *--------------------------------------------------------------*/ - msg_buf.hdr.hdr.sndpno = pno_src; /* source PNO */ - msg_buf.hdr.hdr.cid = cid; /* Command ID */ - msg_buf.hdr.hdr.msgbodysize = msg_len; /* Data size */ - - /*--------------------------------------------------------------* - * Create a message data * - *--------------------------------------------------------------*/ - if (msg_len != 0) { - (void)memcpy(reinterpret_cast<void *>(&msg_buf.data) , msg_data, sizeof(msg_buf.data)); - } - /*--------------------------------------------------------------* - * Send messages * - *--------------------------------------------------------------*/ - ret_api = _pb_SndMsg(pno_dest, /* destination PNO */ - static_cast<u_int16>(sizeof(T_APIMSG_MSGBUF_HEADER) + msg_len),/* message size */ - reinterpret_cast<void *><&msg_buf>, /* message buffer */ - 0); /* Unused Argument */ - } else { - /* Argument error(Pointer to the data buffer) */ - ret_api = VEHICLEDEBUG_RET_ERROR_PARAM; - } - - return ret_api; -} |