#include "IOTCCommon.h"
Data Structures | |
struct | DeviceLoginInput |
For IOTC_Device_LoginEx. More... | |
Typedefs | |
typedef struct DeviceLoginInput | DeviceLoginInput |
For IOTC_Device_LoginEx. | |
typedef void(__stdcall * | loginInfoCB )(uint32_t nLoginInfo) |
Enumerations | |
enum | IOTCDeviceAdaptionMode { IOTC_DEVICE_ADAPTION_MODE_NONE = 0, IOTC_DEVICE_ADAPTION_MODE_CHOOSE_BEST_UDP_SERVER_OR_SWITCH_TO_TCP } |
Functions | |
P2PAPI_API_DEPRECATED int32_t | IOTC_Device_Login (const char *cszUID, const char *cszDeviceName, const char *cszDevicePWD) |
Used by a device to login to IOTC servers. | |
int32_t | IOTC_Device_LoginEx (const char *cszUID, const DeviceLoginInput *optionalInput) |
Used by a device to login to IOTC servers. | |
int32_t | IOTC_Get_Login_Info (uint32_t *pnLoginInfo) |
Used by a device to get the login information. | |
void | IOTC_Get_Login_Info_ByCallBackFn (loginInfoCB pfxLoginInfoFn) |
Used by a device to get the login information. | |
int32_t | IOTC_Listen (uint32_t nTimeout) |
Used by a device to listen connections from clients. | |
void | IOTC_Listen_Exit (void) |
Used by a device to exit listen process. | |
void | IOTC_Set_Device_Name (const char *cszDeviceName) |
Set device name. | |
int32_t | IOTC_Device_Update_Authkey (const char *new_authkey) |
Change IOTC authentication key. | |
int32_t | IOTC_Device_Setup_Network_Adaption (IOTCDeviceAdaptionMode mode) |
Adapt the relay and login mode for the device under some special network environment. | |
This file describes IOTC module APIs of device.
typedef struct DeviceLoginInput DeviceLoginInput |
For IOTC_Device_LoginEx.
typedef void(__stdcall * loginInfoCB)(uint32_t nLoginInfo) |
The prototype of getting login info function, used by a device to be notified if it is still kept login with IOTC servers or is disconnected with IOTC servers.
nLoginInfo | [out] The login info with meanings of following bits
|
P2PAPI_API_DEPRECATED int32_t IOTC_Device_Login | ( | const char * | cszUID, |
const char * | cszDeviceName, | ||
const char * | cszDevicePWD | ||
) |
Used by a device to login to IOTC servers.
This function will let a device login to IOTC servers. UID is required when login to IOTC servers. The device name and password are applicable only in LAN mode when the device cannot login to IOTC servers due to network issue.
cszUID | [in] The UID of that device login to IOTC servers |
cszDeviceName | [in] The name of that device, used in LAN mode for clients to connect |
cszDevicePWD | [in] This parameter is no longer used |
int32_t IOTC_Device_LoginEx | ( | const char * | cszUID, |
const DeviceLoginInput * | optionalInput | ||
) |
Used by a device to login to IOTC servers.
This function will let a device login to IOTC servers with authentication. UID and key is required when login to IOTC servers.
cszUID | [in] The UID of that device login to IOTC servers |
optionalInput | [in] A pointer that points to a memory which the login information is saved to. |
int32_t IOTC_Device_Setup_Network_Adaption | ( | IOTCDeviceAdaptionMode | mode | ) |
Adapt the relay and login mode for the device under some special network environment.
choose
mode | [in] Choose the mode of the network adaption |
int32_t IOTC_Device_Update_Authkey | ( | const char * | new_authkey | ) |
Change IOTC authentication key.
custom can change the authentication key after calling this API
new_authkey | [in] Pass the new authentication key |
int32_t IOTC_Get_Login_Info | ( | uint32_t * | pnLoginInfo | ) |
Used by a device to get the login information.
This function gets the login information of a device to IOTC servers.
pnLoginInfo | [out] The login info with meanings of following bits
|
void IOTC_Get_Login_Info_ByCallBackFn | ( | loginInfoCB | pfxLoginInfoFn | ) |
Used by a device to get the login information.
This function gets the login information of a device to IOTC servers.
The difference of this function and IOTC_Get_Login_Info() is this function will set callback function inside IOTC module and that callback function will be invoked whenever the login status of that device is updated from IOTC servers, for example, IOTC servers response login message to that device or the connection between IOTC servers and that device has been lost.
pfxLoginInfoFn | [in] The function pointer to getting login info function |
int32_t IOTC_Listen | ( | uint32_t | nTimeout | ) |
Used by a device to listen connections from clients.
This function is for a device to listen any connection from clients. 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.
nTimeout | [in] The timeout for this function in unit of millisecond, give 0 means block forever |
void IOTC_Listen_Exit | ( | void | ) |
Used by a device to exit listen process.
Since listen process is a block process and that means a device will wait for following two conditions happens before executing sequential instructions (1) any connection from clients is established (2) timeout expires. In some cases, users may want the device to exit listen immediately by this function in another thread before the two conditions above happens.Please note that the device still can accept incoming connection even IOTC_Listen_Exit has been called.
void IOTC_Set_Device_Name | ( | const char * | cszDeviceName | ) |
Set device name.
Device can let client know its name when client call IOTC_Lan_Search2(). The maximum size of device name is 131 Byte. We filled in 0 at the 132th Byte.
cszDeviceName | [in] This is user-defined device name. Clients will get it by calling IOTC_Lan_Search2(). |