IOTC Platform  Ver: 4.3.6.2-0-ge1f616e
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
IOTCWakeUp.h File Reference
#include <stdint.h>

Data Structures

struct  _IOTC_WakeUpData
 
struct  _IOTC_WakeUpDataEx
 

Macros

#define P2PAPI_API   __declspec(dllimport)
 
#define P2PAPI_API_DEPRECATED
 

Typedefs

typedef struct _IOTC_WakeUpData IOTC_WakeUpData
 
typedef struct _IOTC_WakeUpDataEx IOTC_WakeUpDataEx
 
typedef void(* IOTC_WakeUp_SleepPacketCB )(IOTC_WakeUpData *pData, uint32_t nDataCnt, int32_t nErrCode)
 the callback funciton for IOTC_WakeUp_Get_SleepPacket
 
typedef void(* IOTC_WakeUp_SleepPacketExCB )(IOTC_WakeUpDataEx *pData, uint32_t nDataCnt, int32_t nErrCode)
 the callback funciton for IOTC_WakeUp_Get_SleepPacketEx
 

Functions

void IOTC_WakeUp_Init ()
 Initial IOTC WakeUp feature.
 
P2PAPI_API_DEPRECATED void IOTC_WakeUp_DeInit (IOTC_WakeUpData *pData)
 DeInitial IOTC WakeUp feature.
 
void IOTC_WakeUp_DeInitEx (IOTC_WakeUpDataEx *pData)
 DeInitial IOTC WakeUp feature.
 
int32_t IOTC_WakeUp_WakeDevice (const char *pcszUID)
 Send IOTC WakeUp request to wake device up.
 
P2PAPI_API_DEPRECATED int32_t IOTC_WakeUp_Get_SleepPacket (IOTC_WakeUp_SleepPacketCB fptrReadyForSleepingCB, int32_t nTimeoutMs)
 notify P2P servers that device is going to sleep.
 
P2PAPI_API_DEPRECATED int32_t IOTC_WakeUp_Get_SleepPacket2 (IOTC_WakeUp_SleepPacketCB fptrReadyForSleepingCB, int32_t nTimeoutMs)
 notify P2P servers that device is going to sleep with Wake Up 3.0 protocol.
 
int32_t IOTC_WakeUp_Get_SleepPacketEx (IOTC_WakeUp_SleepPacketExCB fptrReadyForSleepingCB, int32_t nTimeoutMs)
 notify P2P servers that device is going to sleep and wake up with Wake Up 3.0 protocol.
 
void IOTC_WakeUp_Setup_Auto_WakeUp (int32_t nEnableAutoWakeUp)
 enable that IOTC_Connect_ByUID and IOTC_Connect_ByUID_Parallel will auto wake up device. Use this function before calling IOTC_Connect_ByUID and IOTC_Connect_ByUID_Parallel. Default value is disable. This Setup will reset to disable in IOTC_DeInitialize.
 

Detailed Description

Due to power consumption concern, device will enter sleep mode and all. IOTC module will be disconnected. It needs a way to keep login and wake IOTC up.

Revision Table

Version Name Date Description
3.1.5.0 Ferando 2017-03-03 Add new API IOTC_WakeUp_Setup_Auto_WakeUp, IOTC_WakeUp_Get_SleepPacket, IOTC_WakeUp_SleepPacketCB is a function callback for IOTC_WakeUp_Get_SleepPacket

====*====*====*====*====*====*====*====*====*====*====*====*====*====*====

Macro Definition Documentation

#define P2PAPI_API   __declspec(dllimport)
#define P2PAPI_API_DEPRECATED

Typedef Documentation

typedef void(* IOTC_WakeUp_SleepPacketCB)(IOTC_WakeUpData *pData, uint32_t nDataCnt, int32_t nErrCode)

the callback funciton for IOTC_WakeUp_Get_SleepPacket

Parameters
pDatapointer to IOTC_WakeUpData structure
nDataCntthe length of pData
nErrCodeerror code. 0 for success.
typedef void(* IOTC_WakeUp_SleepPacketExCB)(IOTC_WakeUpDataEx *pData, uint32_t nDataCnt, int32_t nErrCode)

the callback funciton for IOTC_WakeUp_Get_SleepPacketEx

Parameters
pDatapointer to IOTC_WakeUpDataEx structure
nDataCntthe length of pData
nErrCodeerror code. 0 for success.

Function Documentation

P2PAPI_API_DEPRECATED void IOTC_WakeUp_DeInit ( IOTC_WakeUpData pData)

DeInitial IOTC WakeUp feature.

Parameters
pData[in]pointer to IOTC_WakeUpData structure
Returns
None
Attention
"Only" Device needs to use this API. DeInit wake up feature and free all memory allocated by IOTC. It will cause memory leak if doesn't use this function at the end of wake up feature.
void IOTC_WakeUp_DeInitEx ( IOTC_WakeUpDataEx pData)

DeInitial IOTC WakeUp feature.

Parameters
pData[in]pointer to IOTC_WakeUpDataEx structure
Returns
None
Attention
"Only" Device needs to use this API. DeInit wake up feature and free all memory allocated by IOTC. It will cause memory leak if doesn't use this function at the end of wake up feature.
P2PAPI_API_DEPRECATED int32_t IOTC_WakeUp_Get_SleepPacket ( IOTC_WakeUp_SleepPacketCB  fptrReadyForSleepingCB,
int32_t  nTimeoutMs 
)

notify P2P servers that device is going to sleep.

Parameters
fptrReadyForSleepingCB[in]fptrReadyForSleepingCB will be called when all servers reponse or reach timeout.
nTimeout[in]set the timeout of waiting ack from servers. default 6 sec if given 0.
Attention
"Only" Device needs to use this API.
P2PAPI_API_DEPRECATED int32_t IOTC_WakeUp_Get_SleepPacket2 ( IOTC_WakeUp_SleepPacketCB  fptrReadyForSleepingCB,
int32_t  nTimeoutMs 
)

notify P2P servers that device is going to sleep with Wake Up 3.0 protocol.

Parameters
fptrReadyForSleepingCB[in]fptrReadyForSleepingCB will be called when all servers reponse or reach timeout.
nTimeout[in]set the timeout of waiting ack from servers. default 6 sec if given 0.
Attention
"Only" Device needs to use this API.
int32_t IOTC_WakeUp_Get_SleepPacketEx ( IOTC_WakeUp_SleepPacketExCB  fptrReadyForSleepingCB,
int32_t  nTimeoutMs 
)

notify P2P servers that device is going to sleep and wake up with Wake Up 3.0 protocol.

Parameters
fptrReadyForSleepingCB[in]fptrReadyForSleepingCB will be called when all servers reponse or reach timeout.
nTimeout[in]set the timeout of waiting ack from servers. default 6 sec if given 0.
Attention
"Only" Device needs to use this API.
void IOTC_WakeUp_Init ( )

Initial IOTC WakeUp feature.

Parameters
None
Returns
None
Attention
"Only" Device needs to use this API. Must invoke this API before using IOTC_WakeUp_Get_SleepPacket() API
void IOTC_WakeUp_Setup_Auto_WakeUp ( int32_t  nEnableAutoWakeUp)

enable that IOTC_Connect_ByUID and IOTC_Connect_ByUID_Parallel will auto wake up device. Use this function before calling IOTC_Connect_ByUID and IOTC_Connect_ByUID_Parallel. Default value is disable. This Setup will reset to disable in IOTC_DeInitialize.

Parameters
nEnableAutoWakeUp[in]0:disable, 1:enable.
int32_t IOTC_WakeUp_WakeDevice ( const char *  pcszUID)

Send IOTC WakeUp request to wake device up.

Parameters
pcszUID[in]The UID of a device that client wants to connect
Returns
Error code if return value < 0
Attention
"Only" Client needs to use this API.