summaryrefslogtreecommitdiffstats
path: root/positioning/client/src/POS_sensor_API
diff options
context:
space:
mode:
authortakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-22 09:06:18 +0900
committertakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-22 09:06:18 +0900
commit00ab09fac9701443fdff616fdcc274809a03d4d7 (patch)
tree03aa078b69aa17d12c77f7d4b74cf6f3a93ffefd /positioning/client/src/POS_sensor_API
parentfa6fa9f4ee5486b30d223914e1a6e50d4d3adf71 (diff)
vs-positioning branch 0.1sandbox/ToshikazuOhiwa/vs-positioning
Diffstat (limited to 'positioning/client/src/POS_sensor_API')
-rw-r--r--positioning/client/src/POS_sensor_API/Makefile9
-rw-r--r--positioning/client/src/POS_sensor_API/Sensor_API.cpp (renamed from positioning/client/src/POS_sensor_API/common/Sensor_API.cpp)217
-rw-r--r--positioning/client/src/POS_sensor_API/Vehicle_API.cpp292
-rw-r--r--positioning/client/src/POS_sensor_API/libPOS_sensor_API.ver2
4 files changed, 407 insertions, 113 deletions
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/POS_sensor_API/Vehicle_API.cpp b/positioning/client/src/POS_sensor_API/Vehicle_API.cpp
new file mode 100644
index 00000000..3cd97f86
--- /dev/null
+++ b/positioning/client/src/POS_sensor_API/Vehicle_API.cpp
@@ -0,0 +1,292 @@
+/*
+ * @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 name :Vehicle_API.cpp
+ * System name :GPF
+ * Subsystem name :Vehicle I/F library
+ * Program name :Vehicle I/F API
+ * Module configuration :POS_RegisterListenerSensData() Vehicle sensor information delivery registration
+ ******************************************************************************/
+#include <vehicle_service/positioning_base_library.h>
+#include <stdio.h>
+#include <vehicle_service/POS_sensor_API.h>
+#include "Sensor_API_private.h"
+#include "Vehicle_API_Dummy.h"
+#include "Vehicle_API_private.h"
+#include "POS_private.h"
+
+/*************************************************/
+/* Global variable */
+/*************************************************/
+
+/*******************************************************************************
+ * initialize
+******************************************************************************/
+VEHICLE_RET_API VehicleInitialize(u_int32 (*sighand)()) { // LCOV_EXCL_START 8:dead code // NOLINT(readability/nolint)
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ RET_API _CWORD64_api_ret;
+ VEHICLE_RET_API ret;
+
+ _CWORD64_api_ret = _pb_Setup_CWORD64_API(NULL);
+
+ if (_CWORD64_api_ret == RET_NORMAL) {
+ ret = RET_NORMAL;
+ } else {
+ ret = RET_ERROR;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
+
+/**
+ * @brief
+ * Vehicle sensor information delivery registration
+ * Register delivery of vehicle sensor information
+ *
+ * @param[in] hApp Application handle
+ * @param[in] notifyName Destination thread name
+ * @param[in] ulDid Pointer to an array of data IDs for vehicle information
+ * @param[in] ucCtrlFlg Delivery control<br>
+ * Delivery registration: SENSOR_DELIVERY_REGIST<br>
+ * Delivery stop: SENSOR_DELIVERY_STOP (Note: Not mounted)<br>
+ * Resume delivery: SENSOR_DELIVERY_RESTART (Note: Not mounted)
+ * @param[in] ucDeliveryTiming Delivery timing<br>
+ * Updating : SENSOR_DELIVERY_TIMING_UPDATE<br>
+ * Changing : SENSOR_DELIVERY_TIMING_CHANGE
+ *
+ * @return SENSOR_RET_NORMAL Successful registration<br>
+ * SENSOR_RET_ERROR_CREATE_EVENT Event generation failure<br>
+ * SENSOR_RET_ERROR_PARAM Parameter error<br>
+ * SENSOR_RET_ERROR_DID Unregistered ID<br>
+ * SENSOR_RET_ERROR_BUFFULL FULL of delivery registers<br>
+ * SENSOR_RET_ERROR_NOSUPPORT Unsupported environment
+ *
+ */
+SENSOR_RET_API POS_RegisterListenerSensData(HANDLE hApp,
+ PCSTR notifyName, DID ulDid, u_int8 ucCtrlFlg, u_int8 ucDeliveryTiming) {
+ SENSOR_RET_API ret; /* Return value */
+ UNIT_TYPE type; /* Supported HW Configuration Type */
+ BOOL ret_b;
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "+");
+
+ /* Check Delivery Control Designation */
+ ret = SENSOR_RET_NORMAL;
+ /* Arguments & Support Configuration Check */
+ if ((ucDeliveryTiming != SENSOR_DELIVERY_TIMING_CHANGE) &&
+ (ucDeliveryTiming != SENSOR_DELIVERY_TIMING_UPDATE)) {
+ /* Change delivery timing,Terminate as a parameter error except update */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (SENSOR_DELIVERY_REGIST != ucCtrlFlg) {
+ /* Parameters other than delivery registration terminated abnormally. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (hApp == NULL) {
+ /* Check Handle */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else if (notifyName == NULL) {
+ /* Check Thread Name */
+ /* NULL terminates with an abnormal parameter */
+ ret = SENSOR_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 = 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 (SENSOR_RET_NORMAL == ret) {
+ /* Judge DID */
+ ret_b = SENSOR_DID_JUDGE_REGLIS(ulDid);
+ if (ret_b == FALSE) {
+ /* An unacceptable ID is regarded as a parameter error. */
+ ret = SENSOR_RET_ERROR_PARAM;
+ } else {
+ /* Delivery registration process */
+ ret = PosRegisterListenerProc(notifyName, ulDid, ucCtrlFlg, ucDeliveryTiming);
+ }
+ }
+
+ /* Internal debug log output */
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "- [ret = %d]", ret);
+
+ return ret;
+}
+
+/*******************************************************************************
+ * MODULE : PosSetShareData
+ * ABSTRACT : Write processing to shared memory
+ * FUNCTION : Write shared memory
+ * ARGUMENT : *share_top : Start address of shared memory
+ * : offset : Offsets to shared memory write destination
+ * : *data_src : Data
+ * : size_src : Size
+ * NOTE :
+ * RETURN : void
+ ******************************************************************************/
+void PosSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src) {
+ VEHICLE_SHARE_BLOCK_DAT *share_dat;
+ /* Calculate Shared Memory Write Address */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top) + offset);
+
+ /* _CWORD71_ processing speed(Memset modification) */
+ /* Clear Shared Memory(Unused area) */
+ share_dat->reserve[0] = 0;
+ share_dat->reserve[1] = 0;
+
+ /* Set write size to shared memory */
+ share_dat->size = size_src;
+
+ /* Set specified data in shared memory */
+ memcpy(reinterpret_cast<void *>(share_dat->data), data_src, (size_t)size_src);
+}
+
+/*******************************************************************************
+* MODULE : VehicleGetDrData
+* ABSTRACT : DR information acquisition
+* FUNCTION : Retrieves DR information (optional data) by returning to completion.
+* ARGUMENT : pno : Thread ID
+* : did : Data ID for DR information
+* : *dest_data : Pointer to the storage destination of DR information
+* : dest_size : Storage destination size of DR information(byte)
+* NOTE :
+* RETURN : Zero or more : Stored data size
+* : VEHICLE_RET_ERROR_CREATE_EVENT : Event generation failure
+* : VEHICLE_RET_ERROR_OUTOF_MEMORY : Shared memory allocation failed
+* : VEHICLE_RET_ERROR_SIZE : Storage destination size error
+* : VEHICLE_RET_ERROR_DID : Unregistered ID
+******************************************************************************/
+int32 VehicleGetDrData(PNO pno, DID did, void *dest_data, u_int16 dest_size) { // LCOV_EXCL_START 8:dead code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ VEHICLE_RET_API ret; /* Return value */
+ RET_API ret_api; /* System API return value */
+ EventID event_id; /* Event ID */
+ int32 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 */
+ VEHICLE_SHARE_BLOCK_DAT *share_dat; /* Address of free shared memory area */
+ VEHICLE_MSG_GET_VEHICLE_DATA_DAT data; /* Message data */
+
+ /* Initialization */
+ event_id = 0;
+ event_val = 0;
+ memset(reinterpret_cast<void *>(&data), 0, sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT));
+
+ /* Event Generation */
+ event_id = VehicleCreateEvent(pno);
+
+ if (0 != event_id) {
+ /* Successful event generation */
+ /* Allocate shared memory */
+ ret_api = VehicleLinkShareData(reinterpret_cast<void **>(&share_top), &share_size, &offset);
+ if (RET_NORMAL != ret_api) {
+ /* Failed to allocate shared memory */
+ ret = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else {
+ /* When the shared memory is allocated successfully */
+
+ /* Calculate start address of free shared memory area */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top) + offset);
+
+ /* Send vehicle sensor information acquisition message */
+ data.did = did;
+ data.pno = pno;
+ data.offset = offset;
+ data.size = VEHICLE_SHARE_BLOCK_DSIZE;
+ data.event_id = event_id;
+ /* Messaging */
+
+ ret_api = VehicleSndMsg(pno,
+ PNO_VEHICLE_SENSOR,
+ CID_VEHICLEIF_GET_DR_DATA,
+ sizeof(VEHICLE_MSG_GET_VEHICLE_DATA_DAT),
+ (const void *)&data);
+
+ if (RET_NORMAL == ret_api) {
+ /* Message transmission processing is successful */
+ /* Wait for completion event from vehicle sensor thread */
+ ret_api = _pb_WaitEvent(event_id,
+ SAPI_EVWAIT_VAL,
+ VEHICLE_RET_ERROR_MIN, VEHICLE_RET_NORMAL, &event_val, INFINITE);
+ if (RET_NORMAL != ret_api) {
+ /* When not put in event wait state */
+ /* Return an event generation failure */
+ ret = VEHICLE_RET_ERROR_CREATE_EVENT;
+ } else {
+ /* Return from Event Wait */
+
+ /* Link to shared memory */
+ ret_api = _pb_LinkShareData(const_cast<char *>(VEHICLE_SHARE_NAME), &share_top, &share_size);
+
+ /* Calculate the address of the shared memory storage area. */
+ share_dat = reinterpret_cast<VEHICLE_SHARE_BLOCK_DAT *>(reinterpret_cast<u_int8 *>(share_top)
+ + offset);
+
+ if (event_val < 0) {
+ /* Vehicle sensor information acquisition failure */
+ ret = (VEHICLE_RET_API)event_val;
+ } else if (RET_NORMAL != ret_api) {
+ /* Shared memory error */
+ ret = VEHICLE_RET_ERROR_OUTOF_MEMORY;
+ } else if (dest_size < share_dat->size) {
+ /* Storage destination size error */
+ ret = VEHICLE_RET_ERROR_SIZE;
+ } else {
+ /* Vehicle sensor information acquisition success */
+
+ /* Copy from shared memory to user memory */
+ memcpy(dest_data, share_dat->data, (size_t)share_dat->size);
+
+ /* Set Write Size to Return Value */
+ ret = static_cast<int32>(share_dat->size);
+ }
+ }
+ } else {
+ /* Message transmission processing failed */
+ /* Return an event generation failure */
+ ret = VEHICLE_RET_ERROR_CREATE_EVENT;
+ }
+ /* Free shared memory */
+ (void)VehicleUnLinkShareData(reinterpret_cast<VEHICLE_SHARE*>(share_top), offset);
+ }
+
+ /* Event deletion */
+ ret_api = VehicleDeleteEvent(event_id);
+
+ } else {
+ /* Event generation failure */
+ ret = VEHICLE_RET_ERROR_CREATE_EVENT;
+ }
+ return ret;
+}
+// LCOV_EXCL_STOP
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.