#include "IOTCCommon.h"
Data Structures | |
struct | st_ConnectOption |
struct | IOTCCheckDeviceInput |
struct | IOTCCheckDeviceOutput |
Typedefs | |
typedef struct st_ConnectOption | st_ConnectOption_t |
typedef struct IOTCCheckDeviceInput | IOTCCheckDeviceInput |
typedef struct IOTCCheckDeviceOutput | IOTCCheckDeviceOutput |
Functions | |
int32_t | IOTC_Check_Device_OnlineEx (const char *UID, IOTCCheckDeviceInput *input, IOTCCheckDeviceOutput *output, uint32_t timeout_ms, int32_t *abort) |
Checking device online or not. | |
P2PAPI_API_DEPRECATED int32_t | IOTC_Connect_ByUID (const char *cszUID) |
Used by a client to connect a device. | |
int32_t | IOTC_Connect_ByUIDEx (const char *cszUID, int32_t SID, IOTCConnectInput *connectInput) |
Used by a client to connect a device. | |
int32_t | IOTC_Connect_ByUID_Parallel (const char *cszUID, int32_t SID) |
Used by a client to connect a device and bind to a specified session ID. | |
void | IOTC_Connect_Stop (void) |
Used by a client to stop connecting a device. | |
int32_t | IOTC_Connect_Stop_BySID (int32_t SID) |
Used by a client to stop a specific session connecting a device. | |
P2PAPI_API_DEPRECATED int32_t | IOTC_Lan_Search (struct st_LanSearchInfo *psLanSearchInfo, int32_t nArrayLen, int32_t nWaitTimeMs) |
Used for searching devices in LAN. | |
P2PAPI_API_DEPRECATED int32_t | IOTC_Lan_Search2 (struct st_LanSearchInfo2 *psLanSearchInfo2, int32_t nArrayLen, int32_t nWaitTimeMs) |
Used for searching devices in LAN. | |
P2PAPI_API_DEPRECATED int32_t | IOTC_Lan_Search2_Ex (struct st_LanSearchInfo2 *psLanSearchInfo2, int32_t nArrayLen, int32_t nWaitTimeMs, int32_t nSendIntervalMs) |
Used for searching devices in LAN. | |
int32_t | IOTC_Search_Device_Start (int32_t nWaitTimeMs, int32_t nSendIntervalMs) |
Start to search devices in LAN. | |
int32_t | IOTC_Search_Device_Result (struct st_SearchDeviceInfo *psSearchDeviceInfo, int32_t nArrayLen, int32_t nGetAll) |
Poll the results of searched device in LAN. | |
int32_t | IOTC_Search_Device_Stop () |
Stop to search devices in LAN. | |
int32_t | IOTC_Set_Connection_Option (struct st_ConnectOption *S_ConnectOption) |
Setup connect option when client connects to device. | |
void | IOTC_Setup_LANConnection_Timeout (uint32_t nTimeout) |
Setup LAN search and LAN connection timeout. | |
void | IOTC_Setup_P2PConnection_Timeout (uint32_t nTimeout) |
Setup P2P connection timeout. | |
This file describes IOTC module APIs for client.
typedef struct IOTCCheckDeviceInput IOTCCheckDeviceInput |
typedef struct IOTCCheckDeviceOutput IOTCCheckDeviceOutput |
typedef struct st_ConnectOption st_ConnectOption_t |
Connect Option, containing all options of connection setup when client connects to device by P2P or relay mode.
int32_t IOTC_Check_Device_OnlineEx | ( | const char * | UID, |
IOTCCheckDeviceInput * | input, | ||
IOTCCheckDeviceOutput * | output, | ||
uint32_t | timeout_ms, | ||
int32_t * | abort | ||
) |
Checking device online or not.
UID | [in] A device UID which is used to check the state. |
input | [in] Additional info of auth key, NULL if device does not use auth key |
output | [out] Device status, See IOTCCheckDeviceOutput |
timeout_ms | [in] The time out value of checking device information in millisecond. |
abort | [in] Assign abort other than 0 to abort. |
P2PAPI_API_DEPRECATED int32_t IOTC_Connect_ByUID | ( | const char * | cszUID | ) |
Used by a client to connect a device.
This function is for a client to connect a device by specifying the UID of that device. If connection is established with the help of IOTC servers, the IOTC session ID will be returned in this function and then device and client can communicate for the other later by using this IOTC session ID.
cszUID | [in] The UID of a device that client wants to connect |
int32_t IOTC_Connect_ByUID_Parallel | ( | const char * | cszUID, |
int32_t | SID | ||
) |
Used by a client to connect a device and bind to a specified session ID.
This function is for a client to connect a device by specifying the UID of that device, and bind to a tutk_platform_free session ID from IOTC_Get_SessionID(). If connection is established with the help of IOTC servers, the IOTC_ER_NoERROR will be returned in this function and then device and client can communicate for the other later by using this IOTC session ID. If this function is called by multiple threads, the connections will be processed concurrently.
cszUID | [in] The UID of a device that client wants to connect |
SID | [in] The Session ID got from IOTC_Get_SessionID() the connection should bind to. |
int32_t IOTC_Connect_ByUIDEx | ( | const char * | cszUID, |
int32_t | SID, | ||
IOTCConnectInput * | connectInput | ||
) |
Used by a client to connect a device.
This function is for a client to connect a device by specifying the UID and password of that device. If connection is established with the help of IOTC servers, the IOTC session ID will be returned in this function and then device and client can communicate for the other later by using this IOTC session ID.This function will wake up device if it's sleeping.
cszUID | [in] The UID of a device that client wants to connect |
SID | [in] The Session ID got from IOTC_Get_SessionID() the connection should bind to. |
connectInput | [in] A pointer that points to a memory which the login information is saved to. |
void IOTC_Connect_Stop | ( | void | ) |
Used by a client to stop connecting a device.
This function is for a client to stop connecting a device. Since IOTC_Connect_ByUID(), IOTC_Connect_ByUID2() are all block processes, that means the client will have to wait for the return of these functions before executing sequential instructions. In some cases, users may want the client to stop connecting immediately by this function in another thread before the return of connection process.
int32_t IOTC_Connect_Stop_BySID | ( | int32_t | SID | ) |
Used by a client to stop a specific session connecting a device.
This function is for a client to stop connecting a device. Since IOTC_Connect_ByUID_Parallel() is a block processes, that means the client will have to wait for the return of these functions before executing sequential instructions. In some cases, users may want the client to stop connecting immediately by this function in another thread before the return of connection process.
SID | [in] The Session ID of a connection which will be stop. |
P2PAPI_API_DEPRECATED int32_t IOTC_Lan_Search | ( | struct st_LanSearchInfo * | psLanSearchInfo, |
int32_t | nArrayLen, | ||
int32_t | nWaitTimeMs | ||
) |
Used for searching devices in LAN.
When client and devices are in LAN, client can search devices by calling this function.
psLanSearchInfo | [out] The array of struct st_LanSearchInfo to store search result |
nArrayLen | [in] The size of the psLanSearchInfo array |
nWaitTimeMs | [in] Period (or timeout) of searching LAN. (in milliseconds) |
P2PAPI_API_DEPRECATED int32_t IOTC_Lan_Search2 | ( | struct st_LanSearchInfo2 * | psLanSearchInfo2, |
int32_t | nArrayLen, | ||
int32_t | nWaitTimeMs | ||
) |
Used for searching devices in LAN.
When client and devices are in LAN, client can search devices and their name by calling this function.
psLanSearchInfo2 | [out] The array of struct st_LanSearchInfo2 store the search result and Device name. |
nArrayLen | [in] The size of psLanSearchInfo2 array |
nWaitTimeMs | [in] Period (or timeout) of searching LAN. (milliseconds) |
P2PAPI_API_DEPRECATED int32_t IOTC_Lan_Search2_Ex | ( | struct st_LanSearchInfo2 * | psLanSearchInfo2, |
int32_t | nArrayLen, | ||
int32_t | nWaitTimeMs, | ||
int32_t | nSendIntervalMs | ||
) |
Used for searching devices in LAN.
When client and devices are in LAN, client can search devices and their name by calling this function.
psLanSearchInfo2 | [out] The array of struct st_LanSearchInfo2 store the search result and Device name. |
nArrayLen | [in] The size of psLanSearchInfo2 array |
nWaitTimeMs | [in] Period (or timeout) of searching LAN. (milliseconds) |
nSendIntervalMs | [in] Interval of sending broadcast for searching device in LAN. (milliseconds) |
int32_t IOTC_Search_Device_Result | ( | struct st_SearchDeviceInfo * | psSearchDeviceInfo, |
int32_t | nArrayLen, | ||
int32_t | nGetAll | ||
) |
Poll the results of searched device in LAN.
Use the function to poll the result of device search in LAN, the IOTC_Search_Device_Start should be called before use the function
st_SearchDeviceInfo | [out] The array of struct st_SearchDeviceInfo store the search result and Device name. |
nArrayLen | [in] The length of array |
nGetAll | [in] 0: get new queried device 1: get all queried devices |
int32_t IOTC_Search_Device_Start | ( | int32_t | nWaitTimeMs, |
int32_t | nSendIntervalMs | ||
) |
Start to search devices in LAN.
When client and devices are in LAN, client can search devices and their name and the result can be polled by function IOTC_Search_Device_Result
nWaitTimeMs | [in] Period (or timeout) of searching LAN. (milliseconds) |
nSendIntervalMs | [in] Interval of sending broadcast for searching device in LAN. (milliseconds) |
int32_t IOTC_Search_Device_Stop | ( | ) |
Stop to search devices in LAN.
Stop to do device search in LAN, the IOTC_Search_Device_Start should be called before use the function
int32_t IOTC_Set_Connection_Option | ( | struct st_ConnectOption * | S_ConnectOption | ) |
Setup connect option when client connects to device.
Client uses this function to set the Option of Connection.
S_ConnectOption | [in] the connect option that contained the option to be set. |
void IOTC_Setup_LANConnection_Timeout | ( | uint32_t | nTimeout | ) |
Setup LAN search and LAN connection timeout.
Only client can call this, it can determine how many time to try LAN search and LAN connection. Once it called the timeout value is effective forever until IOTC_DeInitialize() be called.
nTimeout | [in] The timeout for this function in unit of millisecond, give 0 means skip LAN flow |
void IOTC_Setup_P2PConnection_Timeout | ( | uint32_t | nTimeout | ) |
Setup P2P connection timeout.
Only client can call this, it can determine how many time to try P2P connection. Once it called the timeout value is effective forever until IOTC_DeInitialize() be called.
nTimeout | [in] The timeout for this function in unit of millisecond, give 0 means skip P2P flow |