SDK Interconnection
This is the header file for "psdk_mop_channel.c", defining the structure and (exported) function prototypes.
NOTE The payload which developed on the Linux support developer use SDK Interconnection.
Define and Enum
Mop Channel Handle
typedef void *T_PsdkMopChannelHandle;
typedef enum E_PsdkMopChannelTransType
Mop channel transmission type.
typedef enum {
PSDK_MOP_CHANNEL_TRANS_RELIABLE = 0, Reliable transmission
PSDK_MOP_CHANNEL_TRANS_UNRELIABLE, Unreliable transmission
} E_PsdkMopChannelTransType;
Function
function PsdkMopChannel_Init
Function:Initialize | product:all |
Initialize the mop channel for operation about mop channel handle later.
NOTE This interface needs to be called before calling other mop channel interfaces. Please make sure the network port is connected properly before calling this interface. Mop channel feature currently only supports linux platform.
T_PsdkReturnCode PsdkMopChannel_Init(void);
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkMopChannel_Create
Function:Specified transmission type | product:all |
Create the mop channel handle by specified transmission type.
NOTE
- When mop channel handle created successfully, you need bind channel id to this created mop channel handle and accept other client device connections, such as MSDK or OSDK device;
- When mop channel accept successfully, you can use send or receive data interface to write or read data by accepted output channel handle;
- When the mop channel handle do not used, you can use close or destroy interface to release the resource.
T_PsdkReturnCode PsdkMopChannel_Create(T_PsdkMopChannelHandle *channelHandle, E_PsdkMopChannelTransType transType);
channelHandle:pointer to the created mop channel.
transType:the transmission type for mop channel ::E_PsdkMopChannelTransType.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkMopChannel_Destroy
Function:Destroy the created channel | product:all |
Destroy the created mop channel and release the resource that referenced by the channel handle.
NOTE After calling this interface, we can not do any operation about this channel handle expect create channel handle.
T_PsdkReturnCode PsdkMopChannel_Destroy(T_PsdkMopChannelHandle channelHandle);
channelHandle:pointer to the created mop channel.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkMopChannel_Bind
Function:Bind the channel id | product:all |
Bind the channel id to the created mop channel handle.
NOTE When mop channel handle created successfully, you can bind channel id to this created mop handle and calling interface ::PsdkMopChannel_Accept, then other client device can use this binded channel id to connect created mop handle.
T_PsdkReturnCode PsdkMopChannel_Bind(T_PsdkMopChannelHandle channelHandle,
uint16_t channelId);
channelHandle:pointer to the created mop channel handle.
channelId:the channel id of mop handle for accepting client device connection.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkMopChannel_Accept
Function:Accept the MOP connection | product:all |
Accept the connection by binded channel id for created mop channel.
NOTE The mop accept channel extracts the connection request on the queue of pennding connections for listening channel handle ::channelHandle. Create a new connected channel handle and return to user ::outChannelHandle by referrng to a new connection. Payload can be a server that allow multiple client connections by binded channel id.
T_PsdkReturnCode PsdkMopChannel_Accept(T_PsdkMopChannelHandle channelHandle,
T_PsdkMopChannelHandle *outChannelHandle);
channelHandle:pointer to the created mop channel.
outChannelHandle:pointer to the accepted output mop channel.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkMopChannel_Close
Function:Close the created mop channel | product:all |
Close the created mop channel.
NOTE After calling this interface, we can not do any operation about this channel handle expect destroy channel handle.
T_PsdkReturnCode PsdkMopChannel_Close(T_PsdkMopChannelHandle channelHandle);
channelHandle:pointer to the created mop channel.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkMopChannel_SendData
Function:Send data | product:all |
NOTE This interface should be called after successfully calling the interface ::PsdkMopChannel_Accept. It is recommended to send more bytes of data at a time to improve read and write efficiency. Need to determine whether the send is successful according to the return code and the actual sent data length.
T_PsdkReturnCode PsdkMopChannel_SendData(T_PsdkMopChannelHandle channelHandle,
uint8_t *data,
uint32_t len,
uint32_t *realLen);
channelHandle:pointer to accepted output mop handle outChannelHandle by calling interface PsdkMopChannel_Accept.
data:pointer to data to be sent.
len:length of data to be sent via accepted output mop handle, unit: byte.
realLen:pointer to real length of data that already sent. Retuen The details for the return code please refer to:PsdkErrorCode
function PsdkMopChannel_RecvData
Function:Receive data | product:all |
Receive data from the accepted output mop channel.
NOTE This interface should be called after successfully calling the interface ::PsdkMopChannel_Accept. It is recommended to receive more bytes of data at a time to improve read and write efficiency. Need to determine whether the receive is successful according to the return code and the actual received data length.
T_PsdkReturnCode PsdkMopChannel_RecvData(T_PsdkMopChannelHandle channelHandle,
uint8_t *data,
uint32_t len,
uint32_t *realLen);
channelHandle:pointer to accepted output mop handle outChannelHandle by calling interface PsdkMopChannel_Accept.
data:pointer to data to store the received data.
len:length of data to be received via accepted output mop handle, unit: byte.
realLen:pointer to real length of data that already received.
Return
The details for the return code please refer to:PsdkErrorCode