#include "NebulaCommon.h"
Data Structures | |
struct | NebulaClientCtx |
struct | NebulaClientInfo |
Typedefs | |
typedef struct NebulaClientCtx | NebulaClientCtx |
typedef struct NebulaClientInfo | NebulaClientInfo |
typedef void(__stdcall * | NebulaClientConnectStateFn )(NebulaClientCtx *client, NebulaClientLoginState state) |
The prototype of client connect state callback function. | |
Enumerations | |
enum | NebulaClientLoginState { NEBULA_CLILOGIN_ST_CONNECTED = 1 << 0, NEBULA_CLILOGIN_ST_DISCONNECTED = 1 << 1, NEBULA_CLILOGIN_ST_RETRYLOGIN = 1 << 2 } |
Functions | |
NEBULA_API int | Nebula_Client_New (const char *public_udid, NebulaClientCtx **ctx) |
Generat client context for Nebula module at first time. | |
NEBULA_API int | Nebula_Client_New_From_Struct (NebulaClientInfo *client_info, NebulaClientCtx **ctx) |
Generate client context with device's information for Nebula module. | |
NEBULA_API int | Nebula_Client_New_From_String (const char *public_udid, const char *string_data, NebulaClientCtx **ctx) |
Generate client context with device's information for Nebula module. | |
NEBULA_API char * | Nebula_Client_To_String (NebulaClientCtx *ctx) |
Generating device's information for client which used to create client's context. | |
NEBULA_API int | Nebula_Client_Bind (NebulaClientCtx *ctx, const char *pin_code, TUTKJsonObject **bind_response, unsigned int timeout_msec, unsigned int *abort_flag) |
Pairing Nebula Client and Device. | |
NEBULA_API int | Nebula_Client_Free_Bind_Response (TUTKJsonObject *bind_response) |
Release response data of Nebula_Client_Bind. | |
NEBULA_API int | Nebula_Client_Connect (NebulaClientCtx *ctx, NebulaClientConnectStateFn connect_state_handler, unsigned int timeout_msec, unsigned int *abort_flag) |
Client connect to Bridge server. | |
NEBULA_API int | Nebula_Client_Send_Command (NebulaClientCtx *ctx, const char *request, TUTKJsonObject **response, unsigned int timeout_msec, unsigned int *abort_flag) |
Send Nubula command message to Device. | |
NEBULA_API int | Nebula_Client_Free_Send_Command_Response (TUTKJsonObject *response) |
Release response data of Nebula_Client_Send_Command. | |
NEBULA_API int | Nebula_Client_Wakeup_Device (NebulaClientCtx *ctx, unsigned int timeout_msec, unsigned int *abort_flag) |
Wake up sleep device. | |
NEBULA_API int | Nebula_Client_Check_Device_Online (NebulaClientCtx *client, unsigned int timeout_msec, unsigned int *abort_flag) |
Check device online. | |
NEBULA_API int | Nebula_Client_Delete (NebulaClientCtx *ctx) |
Release client context. | |
This file describes Nebula module APIs for client.
typedef void(__stdcall * NebulaClientConnectStateFn)(NebulaClientCtx *client, NebulaClientLoginState state) |
The prototype of client connect state callback function.
This callback function is called when client connect state changed.
client | [in] client's context generate by Nebula_Client_New() |
state | [in] the connect state of Nebula client |
typedef struct NebulaClientCtx NebulaClientCtx |
typedef struct NebulaClientInfo NebulaClientInfo |
NEBULA_API int Nebula_Client_Bind | ( | NebulaClientCtx * | ctx, |
const char * | pin_code, | ||
TUTKJsonObject ** | bind_response, | ||
unsigned int | timeout_msec, | ||
unsigned int * | abort_flag | ||
) |
Pairing Nebula Client and Device.
This function is used when Nebula client want to bind a Nebula device. Device and client need to use same pin code when doing binding process, after bind success, client will get infomations that is needed for establish a connection to device.
client_ctx | [in] Nebula context of client, it's from Nebula_Client_New() or Nebula_Client_New_From_String() |
pin_code | [in] Same PIN code of Nebula_Device_Bind() |
bind_response | [out] The bind response json object,this object has identity, avToken and authKey |
timeout_msec | [in] The timeout for this function in unit of millisecond, give 0 means block forever |
abort_flag | [in] set *abort_flag to 1 if you need to abort this function |
NEBULA_API int Nebula_Client_Check_Device_Online | ( | NebulaClientCtx * | client, |
unsigned int | timeout_msec, | ||
unsigned int * | abort_flag | ||
) |
Check device online.
This function will check if device login to bridge server
ctx | [in] Nebula context of client, it's from Nebula_Client_New() or Nebula_Client_New_From_String() |
timeout_msec | [in] The timeout for this function in unit of millisecond, give 0 means block forever |
abort_flag | [in] set *abort_flag to 1 if you need to abort this function |
NEBULA_API int Nebula_Client_Connect | ( | NebulaClientCtx * | ctx, |
NebulaClientConnectStateFn | connect_state_handler, | ||
unsigned int | timeout_msec, | ||
unsigned int * | abort_flag | ||
) |
Client connect to Bridge server.
This function is used by client to connect to bridge server. Client will create persistent connection with bridge server for reduce delay of send command This function is unnecessary before Nebula_Client_Send_Command()
ctx[in] | client's context generate by Nebula_Client_New() |
connect_state_handler[in] | this function will be call when connect status change |
timeout_msec | [in] The timeout for this function in unit of millisecond, give 0 means block forever |
abort_flag | [in] set *abort_flag to 1 if you need to abort this function |
NEBULA_API int Nebula_Client_Delete | ( | NebulaClientCtx * | ctx | ) |
Release client context.
This function will free client context that created by Nebula_Client_New()
client_ctx | [in] Nebula context of client, it's from Nebula_Client_New() or Nebula_Client_New_From_String() |
NEBULA_API int Nebula_Client_Free_Bind_Response | ( | TUTKJsonObject * | bind_response | ) |
Release response data of Nebula_Client_Bind.
This function is used to release json response data from Nebula_Client_Bind, you must call it after you got the json response data from Nebula_Client_Bind
bind_response | [in] This json response data pointer |
NEBULA_API int Nebula_Client_Free_Send_Command_Response | ( | TUTKJsonObject * | response | ) |
Release response data of Nebula_Client_Send_Command.
This function is used to release json response data from Nebula_Client_Send_Command, you must call it after you got the json response data from Nebula_Client_Send_Command
response | [in] This json response data pointer |
NEBULA_API int Nebula_Client_New | ( | const char * | public_udid, |
NebulaClientCtx ** | ctx | ||
) |
Generat client context for Nebula module at first time.
This function will generate client context for Nebula module. Client API for Nebula module need this context to work. Client need to call this api if never bind to device before. User can call Nebula_Client_New_From_String replace this api if user already bind to device.
public_udid | [in] device's public_udid for Nebula module |
ctx[out] | client's context generate by Nebula_Client_New or Nebula_Client_New_From_String; |
NEBULA_API int Nebula_Client_New_From_String | ( | const char * | public_udid, |
const char * | string_data, | ||
NebulaClientCtx ** | ctx | ||
) |
Generate client context with device's information for Nebula module.
This function will generate client context for Nebula module. Client API for Nebula module need this context to work. Client call this api if have bind to device and get device'information before.
public_udid | [in] device's public_udid for Nebula module |
string_data | [in] client's information that return by Nebula_Client_To_String. |
ctx[out] | client's context generate by Nebula_Client_New or Nebula_Client_New_From_String; |
NEBULA_API int Nebula_Client_New_From_Struct | ( | NebulaClientInfo * | client_info, |
NebulaClientCtx ** | ctx | ||
) |
Generate client context with device's information for Nebula module.
This function will generate client context for Nebula module. Client API for Nebula module need this context to work. Client call this api if have bind to device and get device'information before.
NebulaClientInfo | [in] the necessary informations from Nebula device |
ctx[out] | client's context generate by Nebula_Client_New or Nebula_Client_New_From_String; |
NEBULA_API int Nebula_Client_Send_Command | ( | NebulaClientCtx * | ctx, |
const char * | request, | ||
TUTKJsonObject ** | response, | ||
unsigned int | timeout_msec, | ||
unsigned int * | abort_flag | ||
) |
Send Nubula command message to Device.
This function is used by Nebula client to send a command in json format. User can get response from Nebula device through the output response buffer. This function is not support for Nebula device currently.
client_ctx | [in] Nebula context of client, it's from Nebula_Client_New() or Nebula_Client_New_From_String() |
request | [in] JSON string of Nebula request |
response | [out] The bind response json object |
timeout_msec | [in] The timeout for this function in unit of millisecond, give 0 means block forever |
abort_flag | [in] set *abort_flag to 1 if you need to abort this function |
NEBULA_API char* Nebula_Client_To_String | ( | NebulaClientCtx * | ctx | ) |
Generating device's information for client which used to create client's context.
This function will generate device's information in json string after bind to device successfully. This api must be used after calling Nebula_Client_Bind.
ctx[in] | client's context generate by Nebula_Client_New or Nebula_Client_New_From_String; |
NEBULA_API int Nebula_Client_Wakeup_Device | ( | NebulaClientCtx * | ctx, |
unsigned int | timeout_msec, | ||
unsigned int * | abort_flag | ||
) |
Wake up sleep device.
This function will wakeup sleeping device by sending wakeup pattern in Nebula_Device_Get_Sleep_Packet()
ctx | [in] Nebula context of client, it's from Nebula_Client_New() or Nebula_Client_New_From_String() |
timeout_msec | [in] The timeout for this function in unit of millisecond, give 0 means block forever |
abort_flag | [in] set *abort_flag to 1 if you need to abort this function |