summaryrefslogtreecommitdiffstats
path: root/communication/client_can
diff options
context:
space:
mode:
Diffstat (limited to 'communication/client_can')
-rw-r--r--communication/client_can/Makefile73
-rw-r--r--communication/client_can/include/Canif_API_Local.h103
-rw-r--r--communication/client_can/include/peripheral_service/Canif_API.h1509
-rw-r--r--communication/client_can/include/peripheral_service/communication_can.h28
-rw-r--r--communication/client_can/libCAN_API.ver38
-rw-r--r--communication/client_can/src/Canif_API.cpp852
6 files changed, 2603 insertions, 0 deletions
diff --git a/communication/client_can/Makefile b/communication/client_can/Makefile
new file mode 100644
index 00000000..e94c5261
--- /dev/null
+++ b/communication/client_can/Makefile
@@ -0,0 +1,73 @@
+#
+# @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.
+#
+
+######### installed program #############
+#INST_PROGS =
+
+######### installed library(*.a) #############
+#INST_LIBS =
+
+######### installed shared library(*.so) #############
+INST_SHLIBS = libCAN_API
+
+######### install unit representative headers(*.h) #############
+VPATH += ../server/include/$(COMPONENT_NAME)
+INST_HEADERS += communication_notifications.h communication.h ps_services.h
+
+######### install headers(*.h) #############
+VPATH += ./include/$(COMPONENT_NAME)
+INST_HEADERS += Canif_API.h communication_can.h
+
+######### compiled sources #############
+libCAN_API_SRCS += Canif_API.cpp
+
+######### add source path #############
+VPATH += ./src
+
+######### add include path #############
+CPPFLAGS += -I./include
+CPPFLAGS += -I./../client_lan/include/
+CPPFLAGS += -I./../server/include
+CPPFLAGS += -I./../server/include/private
+CPPFLAGS += -I./../server/include/CAN/TxMsg
+CPPFLAGS += -I./../server/include/CAN/main
+CPPFLAGS += -I./../server/include/main
+CPPFLAGS += -I./../server/include/threads
+
+######### add compile option #############
+CPPFLAGS += -DLINUX -fPIC -fdata-sections -ffunction-sections -DFLG_CORE
+
+CPPFLAGS += -Werror=implicit-function-declaration
+CPPFLAGS += -Werror=format-security
+
+CPPFLAGS += -Wconversion
+CPPFLAGS += -Wint-to-pointer-cast
+CPPFLAGS += -Wpointer-arith
+CPPFLAGS += -Wformat
+
+######### add library path #############
+LDFLAGS += -Wl,-M -Wl,--gc-sections
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+
+######### linked library (static) #############
+
+######### linked library (dynamic) #############
+LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LDLIBS += -Wl,-Bdynamic -lrt
+LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy
+
+include ../../peripheral_service.mk
diff --git a/communication/client_can/include/Canif_API_Local.h b/communication/client_can/include/Canif_API_Local.h
new file mode 100644
index 00000000..9ab205ad
--- /dev/null
+++ b/communication/client_can/include/Canif_API_Local.h
@@ -0,0 +1,103 @@
+/*
+ * @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 Canif_API_Local.h
+ * SYSTEM :_CWORD107_
+ * SUBSYSTEM :Local header for CAN I/F provided APIs
+ * TITLE :Data header files needed to use the CAN I/F API
+ ****************************************************************************/
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_
+
+/************************************************************************
+* Definition *
+************************************************************************/
+
+/* CANDataControl code used in the transmission/reception relationship */
+#define CAN_ID_MASK_CODE 0xE0000000UL // CAN ID Mask Codes
+
+/*********************************************************************
+* Defining Return Values
+***********************************************************************/
+/* Defined in Canif_API.h */
+
+/*********************************************************************
+* Defining Event Generation
+***********************************************************************/
+#define CANIF_API_EVT_INIT 0 /* Initial value of the event */
+#define CANIF_API_ENT_EVT_MIN CANIF_RET_NORMAL /* Minimum Event Wait */
+#define CANIF_API_ENT_EVT_MAX CANIF_RET_ERROR_CREATE_EVENT /* Maximum value waiting for an event */
+
+/*********************************************************************
+* Type definition
+***********************************************************************/
+
+/***********************************************************************
+* CANIF API Functions Prototypes *
+************************************************************************/
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/**
+* \~english Data struct used to transfer CAN data(_CWORD29_)
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ /**
+ * \~english Resource ID
+ */
+ uint8_t ucRid;
+ /**
+ * \~english Data size
+ */
+ uint32_t ulDataSize;
+ /**
+ * \~english OPC
+ */
+ uint16_t opc;
+ /**
+ * \~english Data buffer
+ */
+ uint8_t data[CAN__CWORD29__MEM_SZ];
+} CAN__CWORD29__TRANS_MSG;
+
+/* The most significant part is defined in Canif_API.h. */
+CANIF_RET_API CanifDeliveryEntryCore(HANDLE h_app, PCSTR notify_name, uint8_t can_num, CANID *p_can_id, uint16_t cid);
+CANIF_RET_API Canif_CWORD29_DeliveryEntryCore(const HANDLE h_app, const PCSTR notify_name,
+ const uint8_t opc_num, const uint16_t* const p_opc, const uint16_t cid);
+CANIF_RET_API CanifTransmissionStartCore(HANDLE h_app, PCSTR notify_name, uint8_t rid,
+ uint16_t freq, CAN_DATA *p_data, uint16_t cid);
+CANIF_RET_API CanifTransmissionStopCore(HANDLE h_app, PCSTR notify_name, CANID can_id, uint16_t cid);
+CANIF_RET_API CanifCommandCtrlCore(HANDLE h_app, PCSTR notify_name, uint8_t rid, uint32_t cmd_id, uint16_t cid);
+CANIF_RET_API CanifCommWatchCore(HANDLE h_app, PCSTR notify_name, CANID can_id, DID did,
+ uint8_t ig_cooperation, uint16_t watch_time, uint16_t cid);
+
+void CanifMsgHeaderGenerate(CAN_MSG_DATA *, uint16_t, uint16_t, uint16_t); /* Private Functions */
+CANIF_RET_API CanifSndMsg(CAN_MSG_DATA *); /* Private Functions */
+
+CANIF_RET_API CanifCommWatchExtSndMsgData(uint16_t us_pid, CANID ul_canid, DID ul_did,
+ uint8_t uc_ig, uint16_t us_watch_time); /* Private Functions */
+
+#if defined(__cplusplus)
+}
+#endif
+#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_
diff --git a/communication/client_can/include/peripheral_service/Canif_API.h b/communication/client_can/include/peripheral_service/Canif_API.h
new file mode 100644
index 00000000..d522c5a1
--- /dev/null
+++ b/communication/client_can/include/peripheral_service/Canif_API.h
@@ -0,0 +1,1509 @@
+/*
+ * @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 Canif_API.h
+ * TITLE :Data header files needed to use the CAN I/F API
+ ****************************************************************************/
+
+#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_
+#define COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_
+
+/**
+ * @file Canif_API.h
+ * @~english
+ * @brief Canif API header
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup peripheral_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup communication
+ * @ingroup peripheral_service
+ * @{
+ */
+/** @addtogroup CAN
+ * @ingroup communication
+ * @{
+ */
+
+#include <native_service/frameworkunified_types.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <asm/unistd.h>
+//#include <stub/com_message_header.h>
+
+/**
+ * \~english Debug defination for DeliveryEntry IT Test
+ */
+#define CAN_DEBUG
+
+/**
+ * \~english Defination of Service name
+ */
+#define LAN_SERVICE_CAN "CAN_COM_PROT"
+
+/**
+ * \~english Availability notification of CAN
+ */
+#define NTFY_Communication_CAN_ISAVAILABLE "Communication/CanIsAvailable"
+
+/*********************************************************************
+* Defining Return Values
+***********************************************************************/
+/* Normal system */
+/**
+ * \~english Suceess
+ */
+#define CANIF_RET_NORMAL 1
+/* Abnormal system */
+/**
+ * \~english Parameter error
+ */
+#define CANIF_RET_ERROR_PARAM 2
+/**
+ * \~english Buffer Full
+ */
+#define CANIF_RET_ERROR_BUFFULL 3
+/**
+ * \~english CAN ID FULL
+ */
+#define CANIF_RET_ERROR_CANIDFULL 4
+/**
+ * \~english ID unregister
+ */
+#define CANIF_RET_ERROR_UNDEF 5
+/**
+ * \~english Thread ID unmatched
+ */
+#define CANIF_RET_ERROR_PID 6
+/**
+ * \~english Timer error
+ */
+#define CANIF_RET_ERROR_TIMER 7
+/**
+ * \~english Event Creat Error
+ */
+#define CANIF_RET_ERROR_CREATE_EVENT 8
+/**
+ * \~english Error Cancel
+ */
+#define CANIF_RET_ERROR_CANCEL 9
+/**
+ * \~english Null Pointer
+ */
+#define CANIF_RET_ERROR_NULL 10
+
+/**
+ * \~english Defination of Command ID ( CAN -> user )
+ */
+typedef enum _PS_CommunicationProtocol {
+ /**
+ * \~english Delivery CAN Data
+ */
+ CID_CAN_DATA_DELIVERY = 0x0401,
+ /**
+ * \~english CAN communication stop
+ */
+ CID_CAN_COMM_STOP,
+ /**
+ * \~english CAN communication restore
+ */
+ CID_CAN_COMM_RESTORE,
+ /**
+ * \~english CAN transmission result
+ */
+ CID_CAN_TX_RESULT,
+ /**
+ * \~english CAN _CWORD29_ transmission result
+ */
+ CID_CAN__CWORD29__TX_RESULT,
+ /**
+ * \~english Delivery CAN data(_CWORD29_)
+ */
+ CID_CAN_DIAG_CWORD29__DELIVERY,
+ /**
+ * \~english Delivery CAN command
+ */
+ CID_CAN_CMD_DELIVERY,
+ /**
+ * \~english CAN command transmission result
+ */
+ CID_CAN_CMD_TX_RESULT,
+ /**
+ * \~english Delivery CAN data to CANGW
+ */
+ CID_CAN_CANGW_DELIVERY,
+} PS_CommunicationProtocol;
+
+/**
+ * \~english Defination of Command ID ( CANIF -> CAN )
+ */
+typedef enum _PS_Communication_InternalProtocol {
+ /**
+ * \~english Delivery registration of CAN data
+ */
+ CID_CANIF_DELIVERY_ENTRY = 0x0501,
+ /**
+ * \~english Delivery registration of _CWORD29_data
+ */
+ CID_CANIF__CWORD29__DELIVERY_ENTRY,
+ /**
+ * \~english CAN data transmission start
+ */
+ CID_CANIF_TX_START,
+ /**
+ * \~english CAN data transmission stop
+ */
+ CID_CANIF_TX_STOP,
+ /**
+ * \~english CAN data communication stop watching
+ */
+ CID_CANIF_COMM_WATCH,
+ /**
+ * \~english CAN data(_CWORD29_) transmission
+ */
+ CID_CANIF__CWORD29__TX_START,
+ /**
+ * \~english CAN command control
+ */
+ CID_CANIF_CMD_CTRL,
+ /**
+ * \~english CAN data transmission start
+ */
+ CID_CANIF_TX_BIT_START,
+ /**
+ * \~english CAN data regular transmission stop
+ */
+ CID_CANIF_TX_BIT_STOP,
+} PS_Communication_InternalProtocol;
+
+#ifdef CAN_DEBUG
+/**
+ * \~english Defination of Command ID (Used for debug)
+ */
+typedef enum _PS_Communication_Internal_DebugProtocol {
+ /**
+ * \~english Delivery unregister (Used for debug)
+ */
+ CID_CANIF_DELETE_DELIVERY_ENTRY = 0x0511,
+ /**
+ * \~english CANIF communication data all clear(Used for debug)
+ */
+ CID_CANIF_COMMWATCH_CLEAR_FOR_DEBUG
+} PS_Communication_Internal_DebugProtocol;
+#endif
+
+/*********************************************************************
+* Definitions of CAN command IDs
+***********************************************************************/
+/**
+* \~english Request CAN fuel calculator reset
+*/
+#define CAN_CMDID_FUELCALC_RST_REQ_DELIVERY 0x00
+/**
+* \~english Request CAN startup finished notification
+*/
+#define CAN_CMDID_STARTUP_FIN_REQ_TX 0x01
+/**
+* \~english Request CAN Master reset notification
+*/
+#define CAN_CMDID_MRST_INFO_REQ_TX 0x02
+/**
+* \~english Request CAN version
+*/
+#define CAN_CMDID_VERSION_REQ_TX 0x03
+/**
+* \~english Request CAN connected node notification
+*/
+#define CAN_CMDID_CONNECTION_NODE_REQ_TX 0x04
+/**
+* \~english Request CAN BUS status notification
+* ToDo@Bus error I/F is not required when CanGetBusStatus() is deleted, so it is scheduled to be deleted.
+*/
+#define CAN_CMDID_BUS_STATUS_REQ_TX 0x05
+/**
+* \~english Response of CAN fuel calculator reset
+*/
+#define CAN_CMDID_FUELCALC_REQ_TX 0x06
+/**
+* \~english Receive CAN fuel calculator reset request
+*/
+#define CAN_CMDID_FUELCALC_RST_REQ_RX 0x07
+/**
+* \~english Receive CAN startup finished notification
+*/
+#define CAN_CMDID_STARTUP_FIN_RESP_RX 0x08
+/**
+* \~english Receive CAN Master reset notification
+*/
+#define CAN_CMDID_MRST_INFO_RESP_RX 0x09
+/**
+* \~english Response of CAN version receive
+*/
+#define CAN_CMDID_VERSION_RESP_RX 0x0A
+/**
+* \~english Response of CAN connection node receive
+*/
+#define CAN_CMDID_CONNECTION_NODE_RESP_RX 0x0B
+/**
+* \~english Response of CAN bus status receive
+* ToDo@Bus error I/F is not required when CanGetBusStatus() is deleted, so it is scheduled to be deleted.
+*/
+#define CAN_CMDID_BUS_STATUS_RESP_RX 0x0C
+
+/*********************************************************************
+* Control Flag/Status Definition
+***********************************************************************/
+/* CANData Delivery control flag */
+/**
+* \~english Delivery stop
+*/
+#define CAN_DELIVERY_STOP 0
+/**
+* \~english Delivery restart
+*/
+#define CAN_DELIVARY_RESTART 1
+
+/* CANData Transmission result notification status */
+/**
+* \~english Success
+*/
+#define CAN_SUCCESS 0
+/**
+* \~english Retryout
+*/
+#define CAN_RETRYOUT 1
+/**
+* \~english Send buffer full
+*/
+#define CAN_BUFFERFUL 2
+
+/* IG linkage type */
+/**
+* \~english IG cooperation off
+*/
+#define CAN_IG_COOPERATION_OFF 0
+/**
+* \~english IG cooperation on
+*/
+#define CAN_IG_COOPERATION_ON 1
+
+/* N_TA */
+/**
+* \~english Invalid target address
+*/
+#define CAN_NTA_INVALID 0xFF
+
+/* Others */
+/**
+* \~english The code of resource ID which is not used
+*/
+#define CAN_RID_NOTUSE_CODE 0xFF
+
+/*********************************************************************
+* Data size definition
+***********************************************************************/
+/**
+* \~english MAX CAN data size used to send/receive message
+*/
+#define CAN_DATA_SIZE 63
+/**
+* \~english MAX CAN data size used to send message
+*/
+#define CAN_TXDATA_SIZE 8
+
+/* Data size relationship */
+/**
+* \~english MAX number of delivery entry
+* \~english ((528-16)-12)/4 = 125 12:event ID etc. , 4:size of CAN ID
+*/
+#define CAN_DELIVERY_CANID_ENTRY_MAX 125
+
+/**
+* \~english OPC MAX number of delivery entry
+*/
+#define CAN_DELIVERY_OPC_ENTRY_MAX 255
+
+/* Message size relationship */
+/**
+* \~english MAX size of message buffer
+*/
+#define CAN_MSGBUF_MAX_SIZE 528
+/**
+* \~english Size of message buffer header
+*/
+#define CAN_MSGBUF_HEADER_SIZE 16
+/**
+* \~english MAX size of message buffer header
+*/
+#define CAN_MSGBUF_DATAMAX_SIZE (CAN_MSGBUF_MAX_SIZE - CAN_MSGBUF_HEADER_SIZE)
+
+/**
+* \~english MAX size of CAN command data
+*/
+#define CANCMD_DAT_MAX 68
+
+/**
+* \~english MAX number of CANGW transmission data
+*/
+#define CANGW_SND_NUM_MAX 0x16
+/**
+* \~english MAX length of CANGW DLC
+*/
+#define CANGW_DLC_MAX_SIZE 0x08
+
+/**
+* \~english Memory size used for _CWORD29_ can data
+*/
+#define CAN__CWORD29__MEM_SZ (4100)
+
+/*********************************************************************
+* Type definition
+***********************************************************************/
+/**
+* \~english CAN I/F API return code
+*/
+typedef int32_t CANIF_RET_API;
+/**
+* \~english define of CAN ID type
+*/
+typedef uint32_t CANID;
+
+/**
+* \~english data ID
+*/
+typedef uint32_t DID;
+
+/**
+* \~english Data struct used to transfer CAN data
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID can_id;
+ /**
+ * \~english Data Length
+ */
+ uint8_t dlc;
+ /**
+ * \~english reserve
+ */
+ uint8_t reserve[3];
+ /**
+ * \~english DATA[0] ~ DATA[N]
+ */
+ uint8_t data[CAN_DATA_SIZE];
+ /**
+ * \~english reserve
+ */
+ uint8_t reserve2;
+} CAN_MSG_CANDATA_DAT;
+
+/**
+* \~english Data struct used to transfer CAN message
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english header
+ */
+// T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english data
+ */
+ CAN_MSG_CANDATA_DAT data;
+} CAN_MSG_CANDATA;
+
+/**
+* \~english Data struct used to transfer CAN data to CANGW
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID (upper byte)
+ */
+ uint8_t can_id_high;
+ /**
+ * \~english CAN ID (lower byte)
+ */
+ uint8_t can_id_low;
+ /**
+ * \~english Data Length
+ */
+ uint8_t dlc;
+ /**
+ * \~english data
+ */
+ uint8_t data[CANGW_DLC_MAX_SIZE];
+} CAN_MSG_CANGWDATA_DAT;
+
+/**
+ * \~english Data struct used to transfer CAN _CWORD29_ data.(transfer data from CAN to user)
+ */
+typedef struct {
+ uint16_t opc; //!< \~english OPC
+ uint32_t dlc; //!< \~english Data length(1~4100)
+ uint8_t data[CAN__CWORD29__MEM_SZ]; //!< \~english Data buffer
+} CAN_MSG_CAN__CWORD29_DATA;
+
+/**
+* \~english Message struct used to transfer CAN data to CANGW
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN data
+ */
+ CAN_MSG_CANGWDATA_DAT data[CANGW_SND_NUM_MAX];
+ /**
+ * \~english Number of CAN data(max 22)
+ */
+ uint8_t num;
+} CAN_MSG_CANGWDATA;
+
+/**
+* \~english Data struct used to transfer CAN data
+* \~english (transfer data from user to CANIF API)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID can_id;
+ /**
+ * \~english Data Length
+ */
+ uint8_t dlc;
+ /**
+ * \~english reserve
+ */
+ uint8_t reserve[3];
+ /**
+ * \~english DATA
+ */
+ uint8_t data[CAN_DATA_SIZE + 1];
+} CAN_DATA;
+
+/**
+* \~english Data struct used to transfer CAN data
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ /**
+ * \~english Thread ID used by _CWORD64_
+ */
+ uint32_t ulEventId;
+ /**
+ * \~english Resource ID
+ */
+ uint8_t ucRid; /* Resources ID */
+ /**
+ * \~english Cycle of send message(Unit of 100ms)
+ */
+ uint16_t usFreq;
+ /**
+ * \~english CAN DATA
+ */
+ CAN_DATA stCandata;
+} CAN_TRANSMISSION_START_MSG_DAT;
+
+/**
+* \~english Data struct used to notify transmission result
+* \~english (transfer data from CAN API to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+ /**
+ * \~english Transmission result status
+ */
+ uint8_t ucStatus;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[3];
+} CAN_MSG_SENDSTS_DAT;
+
+/**
+* \~english Message struct used to notify transmission result
+* \~english (transfer message from CAN API to user)
+*/
+typedef struct {
+ /**
+ * \~english header
+ */
+// T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG_SENDSTS_DAT data;
+} CAN_MSG_SENDSTS;
+
+/**
+* \~english Data struct used to notify _CWORD29_ transmission result
+* \~english (transfer data from CAN API to user)
+*/
+typedef struct {
+ /**
+ * \~english OPC
+ */
+ uint16_t usOpc;
+ /**
+ * \~english Transmission result status
+ */
+ uint8_t ucStatus;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[1];
+} CAN_MSG__CWORD29__SENDSTS_DAT;
+
+/**
+* \~english Message struct used to notify _CWORD29_ transmission result
+* \~english (transfer message from CAN API to user)
+*/
+typedef struct {
+ /**
+ * \~english header
+ */
+// T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG__CWORD29__SENDSTS_DAT data;
+} CAN_MSG__CWORD29__SENDSTS;
+
+/**
+* \~english Data struct used for regular transmission stop
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ /**
+ * \~english Event ID that use for _CWORD64_
+ */
+ uint32_t ulEventId;
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+} CAN_FREQ_TRANS_STOP_MSG_DAT;
+
+/**
+* \~english Data struct used for communication stop/restore
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Data ID
+ */
+ DID ulDid;
+} CAN_MSG_COMM_WATCHSTS_DAT;
+
+/**
+* \~english Data struct used for communication stop/restore
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+// T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG_COMM_WATCHSTS_DAT data;
+} CAN_MSG_COMM_WATCHSTS;
+
+/**
+* \~english Data struct used for delivery entry
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Addresses for delivery ID */
+ /**
+ * \~english Event ID use for _CWORD64_
+ */
+ uint32_t ulEventId;
+ /**
+ * \~english Number of CAN ID entry
+ */
+ uint16_t usCanNum;
+ /**
+ * \~english CAN ID entry array
+ */
+ CANID ulCanid[CAN_DELIVERY_CANID_ENTRY_MAX];
+} CAN_DELIVERY_ENTRY;
+
+/**
+* \~english _CWORD29_data struct used for delivery entry
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ /**
+ * \~english Number of OPC entry
+ */
+ uint16_t usOpcNum;
+ /**
+ * \~english OPC entry array
+ */
+ uint16_t usOpc[CAN_DELIVERY_OPC_ENTRY_MAX];
+} CAN__CWORD29__DELIVERY_ENTRY;
+
+/**
+* \~english Data struct used for communication stop
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP]; /* Destination thread name */
+ /**
+ * \~english Event ID
+ */
+ uint32_t ulEvtId;
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+ /**
+ * \~english Data ID
+ */
+ DID ulDid;
+ /**
+ * \~english Watch time for commuication stop (Unit of 100ms)
+ */
+ uint16_t usWatchTime;
+} CAN_COMM_WATCH_MSG_DAT;
+
+/**
+* \~english Data struct used for CAN command control
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ // uint32_t notifyId; /* Transfer to: ID */
+ /**
+ * \~english Event ID
+ */
+ uint32_t ulEvtId;
+ /**
+ * \~english Resource ID
+ */
+ uint8_t ucRid;
+ /**
+ * \~english CAN command ID
+ */
+ uint8_t ucCmdid;
+} CAN_CMD_CTRL_MSG_DAT;
+
+/**
+* \~english Data struct used for CAN command delivery
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN command ID
+ */
+ uint8_t cmd_id;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[3];
+ /**
+ * \~english Data
+ */
+ uint8_t data[CANCMD_DAT_MAX];
+} CAN_MSG_CANCMD_DAT;
+
+/**
+* \~english Message struct used for CAN command delivery
+* \~english (transfer message from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+// T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_MSG_CANCMD_DAT data;
+} CAN_MSG_CANCMD;
+
+/**
+* \~english Data struct used for CAN command transmission result
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english CAN command ID(same as delivery format)
+ */
+ uint32_t cmd_id;
+ /**
+ * \~english Delivery result status
+ */
+ uint8_t status;
+ /**
+ * \~english Reserve
+ */
+ uint8_t reserve[3];
+} CAN_CMD_MSG_SENDSTS_DAT;
+
+/**
+* \~english Data struct used for CAN command transmission result
+* \~english (transfer data from CAN to user)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+// T_APIMSG_MSGBUF_HEADER_COMM hdr;
+ /**
+ * \~english Data
+ */
+ CAN_CMD_MSG_SENDSTS_DAT data;
+} CAN_CMD_MSG_SENDSTS;
+
+/**
+* \~english Data struct for receiving message(work data)
+*/
+typedef struct {
+ /**
+ * \~english Header
+ */
+// T_APIMSG_MSGBUF_HEADER_COMM stHead;
+ /**
+ * \~english Data
+ */
+ uint8_t ucData[CAN_MSGBUF_DATAMAX_SIZE];
+} CAN_MSG_DATA;
+
+/**
+* \~english CAN data struct of communication stop registration
+* \~english (transfer data from CANIF API to CAN)
+*/
+typedef struct {
+ /**
+ * \~english Delivery target thread name
+ */
+ char notifyName[MAX_NAME_SIZE_APP];
+ /**
+ * \~english Event ID for _CWORD64_
+ */
+ uint32_t ulEvtId;
+ /**
+ * \~english CAN ID
+ */
+ CANID ulCanid;
+ /**
+ * \~english Data ID
+ */
+ DID ulDid;
+ /**
+ * \~english Watch time for communication stop(Unit of 100ms)
+ */
+ uint16_t usWatchTime;
+ /**
+ * \~english has IG coopration or not
+ */
+ uint8_t ucIg;
+} CAN_COMM_WATCHEXT_MSG_DAT;
+
+/**
+* \~english Mask data struct for CAN data
+*/
+typedef struct {
+ /**
+ * \~english Mask data
+ */
+ uint8_t dat[CAN_TXDATA_SIZE];
+} CAN_DATA_MASK;
+
+/**
+* \~english Data struct used for CAN data transmission
+*/
+typedef struct {
+ /**
+ * \~english Transmission data
+ */
+ uint8_t dat[CAN_TXDATA_SIZE];
+} CAN_DATA_BIT;
+
+/**
+* \~english Data struct used for CAN data transmission registration
+*/
+typedef struct {
+ /**
+ * \~english CAN ID
+ */
+ CANID id;
+ /**
+ * \~english Mask data
+ */
+ CAN_DATA_MASK mask;
+ /**
+ * \~english Transmission data
+ */
+ CAN_DATA_BIT dat;
+ /**
+ * \~english Cycle of regular transmission
+ */
+ uint32_t freq;
+} CAN_TRANS_START_MSG_DAT;
+
+/***********************************************************************
+* CANIF API Functions Prototypes *
+************************************************************************/
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*******************************************************************************
+ * MODULE : Canif_DeliveryEntry
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_DeliveryEntry
+/// \~english @par Brief
+/// Delivery registration of CAN data
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] can_num
+/// uint8_t - Number of delivery registration CAN ID
+/// \~english @param [in] p_can_id
+/// CANID* - Pointer of delivery registration CAN ID array
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - can_num is 0 or bigger than 125.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID pointer is null.[CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Delivery registration of CAN data. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_DeliveryEntry(HANDLE h_app, PCSTR notify_name,
+ uint8_t can_num, CANID *p_can_id);
+
+/*******************************************************************************
+ * MODULE : Canif_Diag_CWORD29_DeliveryEntry
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_Diag_CWORD29_DeliveryEntry
+/// \~english @par Brief
+/// Delivery registration of _CWORD29_data
+/// \~english @param [in] h_app
+/// const HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// const PCSTR - Delivery target thread name
+/// \~english @param [in] opc_num
+/// const uint8_t - Number of delivery registration OPC
+/// \~english @param [in] p_opc
+/// const uint16_t* const - Pointer of delivery registration OPC array
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// - notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - opc_num is 0.[CANIF_RET_ERROR_PARAM]
+/// - OPC pointer is null.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Delivery registration of _CWORD29_data. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_Diag_CWORD29_DeliveryEntry(const HANDLE h_app, const PCSTR notify_name,
+ const uint8_t opc_num, const uint16_t* const p_opc);
+
+/*******************************************************************************
+ * MODULE : Canif_TransmissionStart
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_TransmissionStart
+/// \~english @par Brief
+/// CAN data transmission starting
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] rid
+/// uint8_t - Resource ID for CAN data transmission result notification
+/// \~english @param [in] freq
+/// uint16_t - Cycle of regular transmission
+/// \~english @param [in] p_data
+/// CAN_DATA* - Pointer of transmission data
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - Transmission data pointer is null.[CANIF_RET_ERROR_PARAM]
+/// - DLC size is bigger than 8 bytes.[CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - The transmission of the CAN data starts(Regular/One). \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_TransmissionStart(HANDLE h_app, PCSTR notify_name,
+ uint8_t rid, uint16_t freq, CAN_DATA *p_data);
+
+/*******************************************************************************
+ * MODULE : Canif_TransmissionStop
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_TransmissionStop
+/// \~english @par Brief
+/// CAN data regular transmission stop
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] can_id
+/// CANID - CAN ID
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - CAN data regular transmission stop. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_TransmissionStop(HANDLE h_app, PCSTR notify_name, CANID can_id);
+
+/*******************************************************************************
+ * MODULE : Canif_Diag_CWORD29_Transmission
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_Diag_CWORD29_Transmission
+/// \~english @par Brief
+/// Transmission of CAN data (_CWORD29_) transmission
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] opc
+/// const uint16_t - OPC
+/// \~english @param [in] rid
+/// uint8_t - Resource ID
+/// \~english @param [in] data_size
+/// uint32_t - Data size
+/// \~english @param [in] p_data
+/// uint8_t* - Pointer of transmission data
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - Transmission data pointer is null.[CANIF_RET_ERROR_PARAM]
+/// - DLC size is bigger than 8 bytes.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - Transmission of CAN data (_CWORD29_) transmission notification. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_Diag_CWORD29_Transmission(HANDLE h_app,
+ PCSTR notify_name,
+ const uint16_t opc,
+ uint8_t rid,
+ uint32_t data_size,
+ uint8_t *p_data);
+
+/*******************************************************************************
+ * MODULE : Canif_CommandCtrl
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_CommandCtrl
+/// \~english @par Brief
+/// CAN command control
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] rid
+/// uint8_t - Resource ID
+/// \~english @param [in] cmd_id
+/// uint32_t - CAN command ID(32bit)
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - CAN command ID is invalid.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - Transmission control of CAN command. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_CommandCtrl(HANDLE h_app, PCSTR notify_name, uint8_t rid,
+ uint32_t cmd_id);
+
+/*******************************************************************************
+ * MODULE : Canif_CommWatch
+ ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_CommWatch
+/// \~english @par Brief
+/// CAN data regular transmission stop
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] notify_name
+/// PCSTR - Delivery target thread name
+/// \~english @param [in] can_id
+/// CANID - CAN ID
+/// \~english @param [in] did
+/// DID - Data ID
+/// \~english @param [in] watch_time
+/// uint16_t - Communication watch suspension time(Unit of 100ms)
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes.
+/// [CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - CAN data regular transmission stop. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_CommWatch(HANDLE h_app, PCSTR notify_name, CANID can_id,
+ DID did, uint16_t watch_time);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_TransStart
+/// \~english @par Brief
+/// Transmission CAN Command
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] can_id
+/// CANID - CAN ID
+/// \~english @param [in] mask
+/// CAN_DATA_MASK* - Mask Data
+/// \~english @param [in] dat
+/// CAN_DATA_BIT* - Transmission Data
+/// \~english @param [in] freq
+/// uint32_t - Transmission Cycle
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Transmission Cycle is bigger than 0xFFFF.[CANIF_RET_ERROR_PARAM]
+/// - CAN ID is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Mask Data is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Transmission Data is NULL.[CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - Start Transmission CAN Command API. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_TransStart(HANDLE h_app, CANID can_id, CAN_DATA_MASK *mask,
+ CAN_DATA_BIT *dat, uint32_t freq);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_TransStop
+/// \~english @par Brief
+/// Stop periodic transmission of CAN Command
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @param [in] can_id
+/// CANID - CAN ID
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// - can_id is NULL.[CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Stop periodic Transmission of CAN Command API. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_TransStop(HANDLE h_app, CANID can_id);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_Send
+/// \~english @par Brief
+/// Transmission CAN Command(for OpeningMovie)
+/// \~english @param [in] can_id
+/// CANID - CAN ID
+/// \~english @param [in] mask
+/// CAN_DATA_MASK* - Mask Data
+/// \~english @param [in] dat
+/// CAN_DATA_BIT* - Transmission Data
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Mask Data is NULL.[CANIF_RET_ERROR_PARAM]
+/// - Transmission Data is NULL.[CANIF_RET_ERROR_PARAM]
+/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// ASync
+/// \~english @par Detail
+/// - CAN Command Send API. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_Send(CANID can_id, CAN_DATA_MASK *mask, CAN_DATA_BIT *dat);
+
+#ifdef CAN_DEBUG
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup Canif_Debug_Delete_AllDeliveryEntryList
+/// \~english @par Brief
+/// Delete all delivery entry
+/// \~english @param [in] h_app
+/// HANDLE - Handle for application
+/// \~english @retval CANIF_RET_NORMAL Normality
+/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter
+/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination
+/// \~english @par Prerequisite
+/// None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - h_app is NULL.[CANIF_RET_ERROR_PARAM]
+/// - malloc failed to get the message queue management information area
+/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - malloc failed to get the message queue name storage area for
+/// transmission to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - mq_open failed to open the message queue for transmission
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - The session message queue to communication service is full.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - The transmission file descriptor of the session
+/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL]
+/// - The interruption by the system call (signal) occurred while
+/// transmitting the session message to communication service.
+/// [CANIF_RET_ERROR_CANCEL]
+/// - Any error occurred in the transmission of the session message
+/// to communication service. [CANIF_RET_ERROR_CANCEL]
+/// - It failed to access to the shared memory for the transmission of
+/// session message to communication service. [CANIF_RET_ERROR_CANCEL]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Delete all delivery entry. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+CANIF_RET_API Canif_Debug_Delete_AllDeliveryEntryList(HANDLE h_app);
+#endif
+
+/** @}*/ // end of CAN
+/** @}*/ // end of communication
+/** @}*/ // end of peripheral_service
+/** @}*/ // end of BaseSystem
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_
diff --git a/communication/client_can/include/peripheral_service/communication_can.h b/communication/client_can/include/peripheral_service/communication_can.h
new file mode 100644
index 00000000..59cc1bd2
--- /dev/null
+++ b/communication/client_can/include/peripheral_service/communication_can.h
@@ -0,0 +1,28 @@
+//
+// @copyright Copyright (c) 2017-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.
+//
+
+#ifndef PERIPHERALSERVICE_COMMUNICATIONCAN_H_ // NOLINT(build/header_guard)
+#define PERIPHERALSERVICE_COMMUNICATIONCAN_H_ // NOLINT(build/header_guard)
+
+/**
+ * @file communication_can.h
+ * @~english
+ * @brief communication_can unit header
+ */
+
+#include <peripheral_service/Canif_API.h>
+
+#endif // PERIPHERALSERVICE_COMMUNICATIONCAN_H_
diff --git a/communication/client_can/libCAN_API.ver b/communication/client_can/libCAN_API.ver
new file mode 100644
index 00000000..ede5fcac
--- /dev/null
+++ b/communication/client_can/libCAN_API.ver
@@ -0,0 +1,38 @@
+/*
+ * @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.
+ */
+
+#########################
+# lib_CWORD83_ version script #
+#########################
+{
+ global:
+ ### .text section ###
+ Canif_DeliveryEntry;
+ Canif_TransmissionStart;
+ Canif_TransmissionStop;
+ Canif_Diag_CWORD29_Transmission;
+ Canif_SetMultiID_Interval;
+ Canif_CommandCtrl;
+ Canif_CommWatch;
+ Canif_TransStart;
+ Canif_TransStop;
+ Canif_Send;
+ Canif_Debug_Delete_AllDeliveryEntryList;
+ ### .data section ###
+ local:
+ *;
+};
+
diff --git a/communication/client_can/src/Canif_API.cpp b/communication/client_can/src/Canif_API.cpp
new file mode 100644
index 00000000..9adce907
--- /dev/null
+++ b/communication/client_can/src/Canif_API.cpp
@@ -0,0 +1,852 @@
+/*
+ * @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.
+ */
+
+/*******************************************************************************
+ * SYSTEM :_CWORD107_
+ * Module configuration :Canif_DeliveryEntry() CANDataDelivery registration process
+ * Canif_TransmissionStart() CANDataTransmission start processing
+ * Canif_TransmissionStop() CANDataPeriodic transmission stop processing
+ * Canif_CommWatch() CANDataCommunication interruption monitoring processing (deprecated)
+ * Canif_CommandCtrl() CAN command control processing
+ * CanifMsgHeaderGenerate() Message header creation process
+ * CanifSndMsg() Message transmission processing
+ * Canif_CommWatchExt() CANDataCommunication interruption monitoring process
+ ******************************************************************************/
+/*!-----------------------------------------------------------------------------
+ * @file Canif_API.cpp
+ * @~english
+ * @brief CAN I/F API module
+ *----------------------------------------------------------------------------*/
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <other_service/strlcpy.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <peripheral_service/Canif_API.h>
+#include "Canif_API_Local.h"
+#include "com_error_type.h"
+
+static __thread HANDLE g_hdl = NULL;
+static __thread HANDLE g_mchdl = NULL;
+
+CANIF_RET_API Canif_CWORD29_TransmissionCore(HANDLE h_app, PCSTR notify_name, const uint16_t opc,
+ uint8_t rid, uint32_t data_size, uint8_t *p_data);
+
+#define NOTIFY_NAME_MAX_SIZE 15
+/*******************************************************************************
+ * MODULE : Canif_DeliveryEntry
+ ******************************************************************************/
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief Delivery registration of CAN data
+ *
+ * @~english
+ * Delivery registration of CAN data
+ *
+ * @~english
+ * @note Details of process
+ * -# CNAID registration number check
+ * -# Delivery CAN ID check
+ * -# Creation of event
+ * -# Message sending to CAN
+ * -# Result notification event receive
+ * -# Deletion of event
+ *
+ * @~english
+ * @return Normality/Abnormality
+ * @retval <CANIF_RET_NORMAL> Normality
+ * @retval <CANIF_RET_ERROR_PARAM> Abnormality of parameter
+ * @retval <CANIF_RET_ERROR_CREATE_EVENT> Failure of event create
+ *
+ * @~english
+ * @param[in] <notifyId> Snd ID
+ * @param[in] <can_num> Number of delivery registration CAN ID
+ * @param[in] <*p_can_id> Pointer of delivery registration CAN ID array
+ *----------------------------------------------------------------------------*/
+CANIF_RET_API Canif_DeliveryEntry(HANDLE h_app, PCSTR notify_name, uint8_t can_num, CANID *p_can_id) {
+ return CanifDeliveryEntryCore(h_app, notify_name, can_num, p_can_id, CID_CANIF_DELIVERY_ENTRY);
+}
+
+CANIF_RET_API CanifDeliveryEntryCore(HANDLE h_app, PCSTR notify_name, uint8_t can_num, CANID *p_can_id, uint16_t cid) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL; /* Return value of this function */
+ CAN_DELIVERY_ENTRY pst_delivery_entry; /* CANDataDelivery registration structure */
+ int32_t i; /* Generic counters */
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ if (h_app == (HANDLE)NULL) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ if (p_can_id == reinterpret_cast<CANID *>(NULL)) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ if (notify_name == (PCSTR)NULL) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ if (NOTIFY_NAME_MAX_SIZE < strlen(notify_name)) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ /* Checking CNAID registrations*/
+ if (((uint8_t)0 == can_num) || ((uint8_t)CAN_DELIVERY_CANID_ENTRY_MAX < can_num)) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ for (i = 0; i < (int32_t)can_num; i++) {
+ if (((CANID)CAN_ID_MASK_CODE & p_can_id[i]) != 0) { /* Parameter error when the upper 3 bits are set to numeric value */
+ return CANIF_RET_ERROR_PARAM;
+ }
+ }
+
+ /* Initialization of transmission data */
+ memset(reinterpret_cast<void *>(&pst_delivery_entry), (int32_t)0x00, (size_t)sizeof(pst_delivery_entry));
+
+ /* Delivery registration information setting */
+ snprintf(pst_delivery_entry.notifyName, sizeof(pst_delivery_entry.notifyName),
+ "%s", notify_name); /* Destination thread name */
+ pst_delivery_entry.usCanNum = (uint16_t)can_num; /* CAN ID count */
+ memcpy(pst_delivery_entry.ulCanid, p_can_id, sizeof(CANID) * can_num); /* Contain the CAN ID */
+
+ if (g_hdl == NULL) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+ /* Command delivery registration */
+ e_status = FrameworkunifiedSendMsg(g_hdl, cid, sizeof(pst_delivery_entry), &pst_delivery_entry);
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+ return l_ret;
+}
+
+/*******************************************************************************
+ * MODULE : Canif_Diag_CWORD29_DeliveryEntry
+ ******************************************************************************/
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief Delivery registration of Phse5data
+ *
+ * @~english
+ * Delivery registration of _CWORD29_data
+ *
+ * @~english
+ * @note Details of process
+ * -# OPC registration number check
+ * -# Creation of event
+ * -# Message sending to CAN
+ * -# Result notification event receive
+ * -# Deletion of event
+ *
+ * @~english
+ * @return Normality/Abnormality
+ * @retval <CANIF_RET_NORMAL> Normality
+ * @retval <CANIF_RET_ERROR_PARAM> Abnormality of parameter
+ * @retval <CANIF_RET_ERROR_CREATE_EVENT> Failure of event create
+ *
+ * @~english
+ * @param[in] <PCSTR> Notification name
+ * @param[in] <can_num> Number of delivery registration OPC
+ * @param[in] <*p_can_id> Pointer of delivery registration OPC array
+ */
+CANIF_RET_API Canif_Diag_CWORD29_DeliveryEntry(const HANDLE h_app, const PCSTR notify_name,
+ const uint8_t opc_num, const uint16_t* const p_opc) {
+ if (reinterpret_cast<HANDLE>(NULL) == h_app) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ if (reinterpret_cast<uint16_t *>(NULL) == p_opc) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ if (reinterpret_cast<PCSTR>(NULL) == notify_name) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ if ((size_t)NOTIFY_NAME_MAX_SIZE < strnlen(notify_name, (size_t)NOTIFY_NAME_MAX_SIZE+(size_t)1)) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ return Canif_CWORD29_DeliveryEntryCore(h_app, notify_name, opc_num, p_opc,
+ static_cast<const uint16_t>(CID_CANIF__CWORD29__DELIVERY_ENTRY));
+}
+
+CANIF_RET_API Canif_CWORD29_DeliveryEntryCore(const HANDLE h_app, const PCSTR notify_name,
+ const uint8_t opc_num, const uint16_t* const p_opc, const uint16_t cid) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL; /* Return value of this function */
+ CAN__CWORD29__DELIVERY_ENTRY pst_delivery_entry; /* _CWORD29_ data-delivery registry structures */
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ size_t copysize;
+
+ /* OPC registration number check*/
+ if (static_cast<uint8_t>(0) == opc_num) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ copysize = sizeof(uint16_t) * static_cast<const size_t>(opc_num);
+
+ /* Initialization of transmission data */
+ memset(reinterpret_cast<void *>(&pst_delivery_entry), (int32_t)0x00,
+ static_cast<size_t>(sizeof(CAN__CWORD29__DELIVERY_ENTRY)));
+
+ /* Delivery registration information setting */
+ snprintf(reinterpret_cast<char *>(pst_delivery_entry.notifyName), (size_t)MAX_NAME_SIZE_APP,
+ "%s", reinterpret_cast<const char *>(notify_name)); /* Destination thread name */
+ pst_delivery_entry.usOpcNum = static_cast<uint16_t>(opc_num); /* Number of OPCs */
+ memcpy(reinterpret_cast<void *>(pst_delivery_entry.usOpc), reinterpret_cast<const void *>(p_opc),
+ copysize); /* Install OPC */
+
+ if (reinterpret_cast<HANDLE>(NULL) == g_hdl) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+ /* Command delivery registration */
+ e_status = FrameworkunifiedSendMsg(g_hdl, static_cast<UI_32>(cid), sizeof(CAN__CWORD29__DELIVERY_ENTRY),
+ reinterpret_cast<void *>(&pst_delivery_entry));
+ if (eFrameworkunifiedStatusOK != e_status) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+ return l_ret;
+}
+
+/*******************************************************************************
+ * MODULE : Canif_TransmissionStart
+ ******************************************************************************/
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief CAN data transmission starting
+ *
+ * @~english
+ * The transmission of the CAN data starts(Regular/One)
+ *
+ * @~english
+ * @note Details of process
+ * -# DLC check
+ * -# CAN ID check
+ * -# Creation of event
+ * -# Message sending to CAN
+ * -# Result notification event receive
+ * -# Deletion of event
+ *
+ * @~english
+ * @return Normality/Abnormality
+ * @retval <CANIF_RET_NORMAL> Normality
+ * @retval <CANIF_RET_ERROR_PARAM> Abnormality of parameter
+ * @retval <CANIF_RET_ERROR_CREATE_EVENT> Failure of event create
+ *
+ * @~english
+ * @param[in] <notifyId>Snd ID
+ * @param[in] <rid> Resource ID for CAN data transmission result notification
+ * @param[in] <freq> Cycle of regular transmission
+ * @param[in] <*p_data> Pointer of transmission data
+ *----------------------------------------------------------------------------*/
+CANIF_RET_API Canif_TransmissionStart(HANDLE h_app, PCSTR notify_name, uint8_t rid, uint16_t freq, CAN_DATA *p_data) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL; /* Return value of this function */
+ CAN_TRANSMISSION_START_MSG_DAT pst_transmission_start; /* CANDataSending structure */
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ if (h_app == (HANDLE)NULL) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ if (p_data == reinterpret_cast<CAN_DATA *>(NULL)) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ if (rid != (uint8_t)0xff) {
+ if (notify_name == (PCSTR)NULL) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ if (NOTIFY_NAME_MAX_SIZE < strlen(notify_name)) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ }
+
+ /* DLC check*/
+ if ((uint8_t)CAN_TXDATA_SIZE < (p_data->dlc)) { /* Is the DLC over the transmission data size? */
+ return CANIF_RET_ERROR_PARAM;
+ }
+ /* CAN ID checking */
+ if (((CANID)CAN_ID_MASK_CODE & p_data->can_id) != 0) { /* Parameter error when the upper 3 bits are set to numeric value */
+ return CANIF_RET_ERROR_PARAM;
+ }
+
+ /* CANDataInitialization of transmission start information */
+ memset(reinterpret_cast<void *>(&pst_transmission_start), (int32_t)0x00, (size_t)sizeof(pst_transmission_start));
+
+ /* CANDataTransmission start information setting */
+ if (rid != (uint8_t)0xff) {
+ snprintf(pst_transmission_start.notifyName, sizeof(pst_transmission_start.notifyName),
+ "%s", notify_name); /* Destination thread name */
+ } else {
+ snprintf(pst_transmission_start.notifyName, sizeof(pst_transmission_start.notifyName), "%s", "");
+ }
+
+ pst_transmission_start.ucRid = rid; /* Resources ID */
+ pst_transmission_start.usFreq = freq; /* Periodic transmission cycle */
+ memcpy(reinterpret_cast<void *>(&pst_transmission_start.stCandata),
+ reinterpret_cast<int8_t *>(p_data), (size_t)sizeof(CAN_DATA)); /* CANData */
+
+ if (g_hdl == NULL) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+
+ /* CAN data transmission start */
+ e_status = FrameworkunifiedSendMsg(g_hdl, CID_CANIF_TX_START, sizeof(pst_transmission_start), &pst_transmission_start);
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+ return l_ret;
+}
+
+/*******************************************************************************
+ * MODULE : Canif_TransmissionStop
+ ******************************************************************************/
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief CAN data regular transmission stop
+ *
+ * @~english
+ * CAN data regular transmission stop
+ *
+ * @~english
+ * @note Details of process
+ * -# Creation of event
+ * -# Message sending to CAN
+ * -# Result notification event receive
+ * -# Deletion of event
+ *
+ * @~english
+ * @return Normality/Abnormality
+ * @retval <CANIF_RET_NORMAL> Normality
+ * @retval <CANIF_RET_ERROR_CREATE_EVENT> Failure of event create
+ * @retval <CANIF_RET_ERROR_CREATE_EVENT> Event generation failure
+ *
+ * @~english
+ * @param[in] <notifyId>Snd ID
+ * @param[in] <can_id> CAN ID
+ *----------------------------------------------------------------------------*/
+CANIF_RET_API Canif_TransmissionStop(HANDLE h_app, PCSTR notify_name, CANID can_id) {
+ return CanifTransmissionStopCore(h_app, notify_name, can_id, CID_CANIF_TX_STOP);
+}
+
+CANIF_RET_API CanifTransmissionStopCore(HANDLE h_app, PCSTR notify_name, CANID can_id, uint16_t cid) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL; /* Return value of this function */
+ CAN_FREQ_TRANS_STOP_MSG_DAT pst_freq_trans_stop; /* CANDataPeriodic transmission stop structure */
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ if (h_app == (HANDLE)NULL) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ /* CAN ID checking */
+ if (((CANID)CAN_ID_MASK_CODE & can_id) != 0) {
+ /* Parameter error when the upper 3 bits are set to numeric value */
+ return CANIF_RET_ERROR_PARAM;
+ }
+
+ if (notify_name == (PCSTR)NULL) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ if (NOTIFY_NAME_MAX_SIZE < strlen(notify_name)) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ /* CANDataInitialization of periodic transmission stop information */
+ memset(reinterpret_cast<void *>(&pst_freq_trans_stop), (int32_t)0x00, (size_t)sizeof(pst_freq_trans_stop));
+
+ /* CANDataPeriodic transmission stop information setting */
+ snprintf(pst_freq_trans_stop.notifyName, sizeof(pst_freq_trans_stop.notifyName),
+ "%s", notify_name); /* Destination thread name */
+ pst_freq_trans_stop.ulCanid = can_id; /* CAN ID */
+
+ if (g_hdl == NULL) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+ /* CAN data transmission start */
+ e_status = FrameworkunifiedSendMsg(g_hdl, cid, sizeof(pst_freq_trans_stop), &pst_freq_trans_stop);
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+ return l_ret;
+}
+
+/*******************************************************************************
+ * MODULE : Canif_CommWatch
+ ******************************************************************************/
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief CAN data regular transmission stop
+ *
+ * @~english
+ * CAN data regular transmission stop
+ *
+ * @~english
+ * @note Details of process
+ * -# Parameter check
+ * -# Creation of event
+ * -# Message sending to CAN
+ * -# Result notification event receive
+ * -# Deletion of event
+ *
+ * @~english
+ * @return Normality/Abnormality
+ * @retval <CANIF_RET_NORMAL> Normality
+ * @retval <CANIF_RET_ERROR_PARAM> Abnormality of parameter
+ * @retval <CANIF_RET_ERROR_CREATE_EVENT> Failure of event create
+ *
+ * @~english
+ * @param[in] <pid> Thread ID
+ * @param[in] <can_id> CAN ID
+ * @param[in] <did> Data ID
+ * @param[in] <watch_time> Communication watch suspension time(Unit of 100ms)
+ *----------------------------------------------------------------------------*/
+CANIF_RET_API Canif_CommWatch(HANDLE h_app, PCSTR notify_name, CANID can_id, DID did, uint16_t watch_time) {
+ return CanifCommWatchCore(h_app, notify_name, can_id, did, CAN_IG_COOPERATION_OFF, watch_time, CID_CANIF_COMM_WATCH);
+}
+
+/*******************************************************************************
+ * MODULE : Canif_CommandCtrl
+ ******************************************************************************/
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief CAN command control
+ *
+ * @~english
+ * Transmission control of CAN command
+ *
+ * @~english
+ * @note Details of process
+ * -# Parameter check
+ * -# Creation of event
+ * -# Message sending to CAN
+ * -# Result notification event receive
+ * -# Deletion of event
+ *
+ * @~english
+ * @return Normality/Abnormality
+ * @retval <CANIF_RET_NORMAL> Normality
+ * @retval <CANIF_RET_ERROR_PARAM> Abnormality of parameter
+ * @retval <CANIF_RET_ERROR_CREATE_EVENT> Failure of event create
+ *
+ * @~english
+ * @param[in] <notifyId> Snd ID
+ * @param[in] <rid> Resource ID
+ * @param[in] <cmd_id> CAN command ID(32bit)
+ *----------------------------------------------------------------------------*/
+CANIF_RET_API Canif_CommandCtrl(HANDLE h_app, PCSTR notify_name, uint8_t rid, uint32_t cmd_id) {
+ /* Parameter anomaly check */
+ if (((uint8_t)CAN_CMDID_FUELCALC_RST_REQ_DELIVERY != (uint8_t)cmd_id) && /* Request for delivery of request for flame reset in CAN section */
+ ((uint8_t)CAN_CMDID_STARTUP_FIN_REQ_TX != (uint8_t)cmd_id) && /* CAN start completion notification request transmission */
+ ((uint8_t)CAN_CMDID_MRST_INFO_REQ_TX != (uint8_t)cmd_id) && /* CAN master reset information notification request transmission */
+ ((uint8_t)CAN_CMDID_VERSION_REQ_TX != (uint8_t)cmd_id) && /* CAN Version Request Send */
+ ((uint8_t)CAN_CMDID_CONNECTION_NODE_REQ_TX != (uint8_t)cmd_id) && /* CAN connection node notification request transmission */
+ ((uint8_t)CAN_CMDID_FUELCALC_REQ_TX != (uint8_t)cmd_id)) { /* CAN section flame reset response transmission */
+ return CANIF_RET_ERROR_PARAM; /* CAN Thread-> When it is not a CAN command to be sent to the SYS microcomputer */
+ }
+
+ return CanifCommandCtrlCore(h_app, notify_name, rid, cmd_id, CID_CANIF_CMD_CTRL);
+}
+
+CANIF_RET_API CanifCommandCtrlCore(HANDLE h_app, PCSTR notify_name, uint8_t rid, uint32_t cmd_id, uint16_t cid) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL; /* Return value of this function */
+ CAN_CMD_CTRL_MSG_DAT pst_cmd_ctrl_msg; /* CAN command control message data structure */
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ /* Initialization of CAN command control information */
+ memset(reinterpret_cast<void *>(&pst_cmd_ctrl_msg), (int32_t)0x00, (size_t)sizeof(pst_cmd_ctrl_msg));
+
+ if (h_app == (HANDLE)NULL) {
+ /* Parameter error */
+ return CANIF_RET_ERROR_PARAM;
+ }
+ if (rid != 0xFF) {
+ if (notify_name == (PCSTR)NULL) {
+ /* Parameter error */
+ return CANIF_RET_ERROR_PARAM;
+ }
+ if (NOTIFY_NAME_MAX_SIZE < strlen(notify_name)) {
+ /* Parameter error */
+ return CANIF_RET_ERROR_PARAM;
+ }
+ }
+
+ /* Setting CAN command control information */
+ snprintf(pst_cmd_ctrl_msg.notifyName, sizeof(pst_cmd_ctrl_msg.notifyName),
+ "%s", notify_name); /* Destination thread name */
+ pst_cmd_ctrl_msg.ucRid = rid; /* Resources ID */
+ pst_cmd_ctrl_msg.ucCmdid = (uint8_t)cmd_id; /* CAN command ID */
+
+ if (g_hdl == NULL) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+
+ /* CAN data transmission start */
+ e_status = FrameworkunifiedSendMsg(g_hdl, cid, sizeof(pst_cmd_ctrl_msg), &pst_cmd_ctrl_msg);
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+
+ return l_ret;
+}
+
+CANIF_RET_API CanifCommWatchCore(HANDLE h_app, PCSTR notify_name, CANID can_id, DID did,
+ uint8_t ig_cooperation, uint16_t watch_time, uint16_t cid) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL; /* Return value of this function */
+ CAN_COMM_WATCHEXT_MSG_DAT pst_comm_watch_msg; /* CANDataCommunication disruption registration structure */
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ if (h_app == (HANDLE)NULL) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ if (notify_name == (PCSTR)NULL) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+ if (NOTIFY_NAME_MAX_SIZE < strlen(notify_name)) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ /* Parameter anomaly check */
+ if (((CANID)CAN_ID_MASK_CODE & can_id) != 0) { /* Parameter error when the upper 3 bits are set to numeric value */
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ /* CANDataInitialization of communication disruption monitoring information */
+ memset(reinterpret_cast<void *>(&pst_comm_watch_msg), (int32_t)0x00, (size_t)sizeof(pst_comm_watch_msg));
+
+ /* CANDataSetting of communication interruption monitoring information */
+ strlcpy(pst_comm_watch_msg.notifyName, notify_name, sizeof(pst_comm_watch_msg.notifyName)); /* Destination thread name */
+ pst_comm_watch_msg.ulCanid = can_id; /* CAN ID */
+ pst_comm_watch_msg.ulDid = did; /* Data ID */
+ pst_comm_watch_msg.ucIg = ig_cooperation; /* IG linkage */
+ pst_comm_watch_msg.usWatchTime = watch_time; /* Communication interruption monitoring time (in units of 100ms) */
+
+ if (g_hdl == NULL) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+ /* CANDataCommunication disruption monitoring */
+ e_status = FrameworkunifiedSendMsg(g_hdl, cid, sizeof(pst_comm_watch_msg), &pst_comm_watch_msg);
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+
+ return l_ret;
+}
+
+/*******************************************************************************
+ * MODULE : Canif_Diag_CWORD29_Transmission
+ ******************************************************************************/
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief Transmission of CAN data (_CWORD29_) transmission notification
+ *
+ * @~english
+ * Transmission of CAN data (_CWORD29_) transmission notification
+ *
+ * @~english
+ * @note Details of process
+ * -# Maximum check
+ * -# CAN ID check
+ * -# Creation of event
+ * -# Message sending to CAN
+ * -# Result notification event receive
+ * -# Deletion of event
+ *
+ * @~english
+ * @return Normality/Abnormality
+ * @retval <CANIF_RET_NORMAL> Normality
+ * @retval <CANIF_RET_ERROR_PARAM> Abnormality of parameter
+ * @retval <CANIF_RET_ERROR_BUFFULL> Buffer fully
+ * @retval <CANIF_RET_ERROR_CREATE_EVENT> Failure of event create
+ *
+ * @~english
+ * @param[in] <notifyId> Snd ID
+ * @param[in] <opc> OPC
+ * @param[in] <rid> Resource ID
+ * @param[in] <data_size> Data size
+ * @param[in] <*p_data> Pointer of transmission data
+ */
+CANIF_RET_API Canif_Diag_CWORD29_Transmission(HANDLE h_app, PCSTR notify_name, const uint16_t opc,
+ uint8_t rid, uint32_t data_size, uint8_t *p_data) {
+ return Canif_CWORD29_TransmissionCore(h_app, notify_name, opc, rid, data_size, p_data);
+}
+
+CANIF_RET_API Canif_CWORD29_TransmissionCore(HANDLE h_app, PCSTR notify_name, const uint16_t opc,
+ uint8_t rid, uint32_t data_size, uint8_t *p_data) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL; /* Return value of this function */
+ CAN__CWORD29__TRANS_MSG pst__CWORD29__trans; /* CANDataPointer to the send structure */
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ if (h_app == (HANDLE)NULL) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ if (rid != 0xFF) {
+ if (notify_name == (PCSTR)NULL) {
+ return CANIF_RET_ERROR_PARAM;
+ }
+
+ if (strlen(const_cast<char *>(notify_name)) > NOTIFY_NAME_MAX_SIZE) {
+ return CANIF_RET_ERROR_PARAM;
+ }
+ }
+
+ if (p_data == reinterpret_cast<uint8_t *>(NULL)) {
+ return CANIF_RET_ERROR_PARAM; /* Parameter error */
+ }
+
+ /* Maximum Size Check */
+ if (CAN__CWORD29__MEM_SZ < data_size) {
+ return CANIF_RET_ERROR_PARAM;
+ }
+
+ /* CANDataInitialization of transmission start information */
+ memset(reinterpret_cast<void *>(&pst__CWORD29__trans), (int32_t)0x00, (size_t)sizeof(pst__CWORD29__trans));
+
+ /* CANDataTransmission start information setting */
+ if (rid != (uint8_t)0xff) {
+ snprintf(pst__CWORD29__trans.notifyName, sizeof(pst__CWORD29__trans.notifyName), "%s", notify_name);
+ } else {
+ snprintf(pst__CWORD29__trans.notifyName, sizeof(pst__CWORD29__trans.notifyName), "%s", "");
+ }
+
+ pst__CWORD29__trans.ucRid = rid; /* Resources ID */
+ pst__CWORD29__trans.ulDataSize = data_size;
+ pst__CWORD29__trans.opc = opc;
+ memcpy(reinterpret_cast<void *>(&pst__CWORD29__trans.data), reinterpret_cast<int8_t *>(p_data), data_size);
+
+ if (g_hdl == NULL) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+
+ /* CAN data transmission start */
+ e_status = FrameworkunifiedSendMsg(g_hdl, CID_CANIF__CWORD29__TX_START, sizeof(pst__CWORD29__trans), &pst__CWORD29__trans);
+ if (e_status != eFrameworkunifiedStatusOK) {
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+ return l_ret;
+}
+
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief Transmission CAN Command
+ *
+ * @~english
+ * Start Transmission CAN Command API
+ *
+ * @~english
+ * @return Return value
+ * @retval <CANIF_RET_NORMAL> OK
+ * @retval <CANIF_RET_ERROR_CANCEL> Abnormal termination
+ * @retval <CANIF_RET_ERROR_PARAM> Parameter Error
+ *
+ * @~english
+ * @param[in] <h_app> Application handle
+ * @param[in] <can_id> CAN ID
+ * @param[in] <mask> Mask Data
+ * @param[in] <dat> Transmission Data
+ * @param[in] <freq> Transmission Cycle
+ *----------------------------------------------------------------------------*/
+CANIF_RET_API Canif_TransStart(HANDLE h_app, CANID can_id, CAN_DATA_MASK *mask, CAN_DATA_BIT *dat, uint32_t freq) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL;
+ CAN_TRANS_START_MSG_DAT pst_trans_start;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ /* Check parameter */
+ if (h_app == (HANDLE)NULL || can_id == (CANID)NULL || mask == reinterpret_cast<CAN_DATA_MASK *>(NULL) ||
+ dat == reinterpret_cast<CAN_DATA_BIT *>(NULL) || (uint32_t)0xFFFF < freq) {
+ return CANIF_RET_ERROR_PARAM;
+ }
+ if (((CANID)CAN_ID_MASK_CODE & can_id) != 0) { /* Parameter error when the upper 3 bits are set to numeric value */
+ return CANIF_RET_ERROR_PARAM;
+ }
+
+ memset(reinterpret_cast<void *>(&pst_trans_start), (int32_t)0x00, (size_t)sizeof(pst_trans_start));
+
+ /* Create Transmission Data */
+ pst_trans_start.id = can_id; /* CAN ID */
+ pst_trans_start.freq = freq; /* Transmission Interval */
+ memcpy(&pst_trans_start.mask.dat, mask->dat, sizeof(mask->dat));
+ memcpy(&pst_trans_start.dat.dat, dat->dat, sizeof(dat->dat));
+
+ if (g_hdl == NULL) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+
+ /* Start CAN Data transmission */
+ e_status = FrameworkunifiedSendMsg(g_hdl, CID_CANIF_TX_BIT_START, sizeof(pst_trans_start), &pst_trans_start);
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+ return l_ret;
+}
+
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief Stop periodic transmission of CAN Command
+ *
+ * @~english
+ * Stop periodic Transmission of CAN Command API
+ *
+ * @~english
+ * @return Return value
+ * @retval <CANIF_RET_NORMAL> OK
+ * @retval <CANIF_RET_ERROR_CANCEL> Abnormal termination
+ * @retval <CANIF_RET_ERROR_PARAM> Parameter Error
+ *
+ * @~english
+ * @param[in] <h_app> Application handle
+ * @param[in] <can_id> CAN ID
+ *----------------------------------------------------------------------------*/
+CANIF_RET_API Canif_TransStop(HANDLE h_app, CANID can_id) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ /* Check parameter */
+ if (h_app == (HANDLE)NULL || can_id == (CANID)NULL) {
+ return CANIF_RET_ERROR_PARAM;
+ }
+ if (((CANID)CAN_ID_MASK_CODE & can_id) != 0) { /* Parameter error when the upper 3 bits are set to numeric value */
+ return CANIF_RET_ERROR_PARAM;
+ }
+
+ if (g_hdl == NULL) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+ /* Start CAN ID transmission */
+ e_status = FrameworkunifiedSendMsg(g_hdl, CID_CANIF_TX_BIT_STOP, sizeof(CANID), &can_id);
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+ return l_ret;
+}
+
+/*!-----------------------------------------------------------------------------
+ * @~english
+ * @brief Transmission CAN Command(for OpeningMovie)
+ *
+ * @~english
+ * CAN Command Send API
+ *
+ * @~english
+ * @return Return value
+ * @retval <CANIF_RET_NORMAL> OK
+ * @retval <CANIF_RET_ERROR_CANCEL> Abnormal termination
+ * @retval <CANIF_RET_ERROR_PARAM> Parameter Error
+ *
+ * @~english
+ * @param[in] <can_id> CAN ID
+ * @param[in] <mask> Mask Data
+ * @param[in] <dat> Transmission Data
+ *----------------------------------------------------------------------------*/
+CANIF_RET_API Canif_Send(CANID can_id, CAN_DATA_MASK *mask, CAN_DATA_BIT *dat) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL;
+ CAN_TRANS_START_MSG_DAT pst_trans_start;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+
+ /* Check parameter */
+ if (can_id == (CANID)NULL || mask == NULL || dat == NULL) {
+ return CANIF_RET_ERROR_PARAM;
+ }
+ if (((CANID)CAN_ID_MASK_CODE & can_id) != 0) { /* Parameter error when the upper 3 bits are set to numeric value */
+ return CANIF_RET_ERROR_PARAM;
+ }
+
+ memset(reinterpret_cast<void *>(&pst_trans_start), (int32_t)0x00, (size_t)sizeof(pst_trans_start));
+
+ /* Create Transmission Data */
+ pst_trans_start.id = can_id; /* CAN ID */
+ pst_trans_start.freq = 0; /* Transmission Interval */
+ memcpy(&pst_trans_start.mask.dat, mask->dat, sizeof(mask->dat));
+ memcpy(&pst_trans_start.dat.dat, dat->dat, sizeof(dat->dat));
+
+ if (g_mchdl == NULL) {
+ g_mchdl = McOpenSender(LAN_SERVICE_CAN);
+ }
+
+ /* Start CAN Data transmission */
+ e_status = McSend(g_mchdl, "ViewerApp", CID_CANIF_TX_BIT_START, sizeof(pst_trans_start), &pst_trans_start);
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ // LCOV_EXCL_START 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ret = CANIF_RET_ERROR_CANCEL;
+ // LCOV_EXCL_STOP 4: NSFW error case.
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+ return l_ret;
+}
+
+#ifdef CAN_DEBUG
+CANIF_RET_API Canif_Debug_Delete_AllDeliveryEntryList(HANDLE h_app) {
+ CANIF_RET_API l_ret = CANIF_RET_NORMAL;
+ EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK;
+ UI_32 len = 0;
+
+ /* Check parameter */
+ if (h_app == (HANDLE)NULL) {
+ return CANIF_RET_ERROR_PARAM;
+ }
+
+ if (g_hdl == NULL) {
+ g_hdl = FrameworkunifiedMcOpenSender(h_app, LAN_SERVICE_CAN);
+ }
+ /* Start CAN ID transmission */
+ e_status = FrameworkunifiedInvokeSync(g_hdl, CID_CANIF_DELETE_DELIVERY_ENTRY, 0, NULL, 0, NULL, &len);
+ if (e_status != eFrameworkunifiedStatusOK) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ l_ret = CANIF_RET_ERROR_CANCEL; // LCOV_EXCL_LINE 4: NSFW error case.
+ } else {
+ l_ret = CANIF_RET_NORMAL;
+ }
+ return l_ret;
+}
+#endif
+// LCOV_EXCL_BR_LINE 10:THE_END_LINE_OF_THE_FILE