IOTC Platform  Ver: 4.3.6.2-0-ge1f616e
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
NebulaLANAPIs.h File Reference
#include "NebulaWiFiConfig.h"
#include "NebulaAPIs.h"
#include "NebulaError.h"

Data Structures

struct  _st_UDIDInfo
 

Macros

#define NEBULA_LAN_API   __declspec(dllimport)
 
#define NEBULA_LAN_API_DEPRECATED
 
#define MAX_DEVICE_NAME_LENGTH   128
 
#define PWD_MAX_LENGTH   64
 

Typedefs

typedef struct _st_UDIDInfo st_UDIDInfo
 

Enumerations

enum  LanSearchRole { DEVICE, CLIENT }
 

Functions

NEBULA_LAN_API int Nebula_WiFi_Setup_Start_On_LAN (LanSearchRole role, int searchable)
 Start to lan search without UID for WiFi setup.
 
NEBULA_LAN_API int Nebula_Device_Listen_On_LAN (const char *udid, const char *pwd, const char *device_name, uint16_t timeout_ms)
 Device can listen for tcp request on lan or response to lan search with search id.
 
NEBULA_LAN_API int Nebula_App_Search_UDID_On_LAN (st_UDIDInfo *udid_array, uint16_t array_cnt, uint16_t timeout_ms)
 Used by client for searching devices's UDID on LAN.
 
NEBULA_LAN_API int Nebula_App_Request_TCP_Connect_On_LAN (const char *udid, const char *pwd, uint16_t timeout_ms)
 Used by client for connect to devices with UDID on LAN.
 
NEBULA_LAN_API void Nebula_WiFi_Setup_Stop_On_LAN ()
 Stop to lan search for WiFi setup.
 
NEBULA_LAN_API int Nebula_Send_IOCtrl_On_LAN (NebulaIOCtrlType type, const char *ioctrl_buf, uint16_t ioctrl_len)
 Send WiFi setup IO control.
 
NEBULA_LAN_API int Nebula_Recv_IOCtrl_From_LAN (NebulaIOCtrlType *type, char *result_buf, uint16_t buf_size, uint16_t timeout_ms)
 Receive WiFi setup IO control.
 

Detailed Description

This file describes all the APIs of the IOTC module in IOTC platform. IOTC module is a kind of data communication modules to provide basic data transfer among devices and clients.

Revision Table

Version Name Date Description
4.0.0.0 Terry Liu 2019-08-07 + Add Nebula_WiFi_Setup_Start_On_LAN, Nebula_Device_Listen_On_LAN
4.0.0.0 Terry Liu 2019-08-07 + Add Nebula_App_Search_UDID_On_LAN, Nebula_App_Request_TCP_Connect_On_LAN
4.0.0.0 Terry Liu 2019-08-07 + Add Nebula_WiFi_Setup_Stop_On_LAN, Nebula_Send_IOCtrl_On_LAN
4.0.0.0 Terry Liu 2019-08-07 + Add Nebula_Recv_IOCtrl_From_LAN

Macro Definition Documentation

#define MAX_DEVICE_NAME_LENGTH   128
#define NEBULA_LAN_API   __declspec(dllimport)
#define NEBULA_LAN_API_DEPRECATED
#define PWD_MAX_LENGTH   64

Typedef Documentation

typedef struct _st_UDIDInfo st_UDIDInfo

Enumeration Type Documentation

Enumerator:
DEVICE 
CLIENT 

Function Documentation

NEBULA_LAN_API int Nebula_App_Request_TCP_Connect_On_LAN ( const char *  udid,
const char *  pwd,
uint16_t  timeout_ms 
)

Used by client for connect to devices with UDID on LAN.

When clients and devices are stay in a LAN environment, client can call this function to connect to device with TCP.

Parameters
udid[in] The udid of Device.
pwd[in] The pwd of Device, max length is 64. This param could be null, if device not support.
timeout_ms[in] The timeout in miliseconds before discovery process end.
Returns
0 if tcp connection create successfully.
Error code if return value < 0
NEBULA_LAN_API int Nebula_App_Search_UDID_On_LAN ( st_UDIDInfo udid_array,
uint16_t  array_cnt,
uint16_t  timeout_ms 
)

Used by client for searching devices's UDID on LAN.

When clients and devices are stay in a LAN environment, client can call this function to discovery devices.

Parameters
udid_array[in] The array of udid to store search result.The value of udid_array could not be null.
array_cnt[in] The size of the udid array, it could not be zero.
timeout_ms[in] The timeout in miliseconds before discovery process end and could not be zero.
Returns
The number of devices found.
Error code if return value < 0
NEBULA_LAN_API int Nebula_Device_Listen_On_LAN ( const char *  udid,
const char *  pwd,
const char *  device_name,
uint16_t  timeout_ms 
)

Device can listen for tcp request on lan or response to lan search with search id.

Devcie will start listen for tcp request and create connection on LAN after calling this api.

Parameters
udid[in] The udid of Device.
pwd[in] The pwd of Device, max length is 64. This param could be null, if device don't want to use.
device_name[in] The name of Device, max length is 128. This param could be null, if device don't want to use.
timeout_ms[in] timeout in miliseconds for this api.
Returns
0 if tcp connection create successfully.
Error code if return value < 0
NEBULA_LAN_API int Nebula_Recv_IOCtrl_From_LAN ( NebulaIOCtrlType type,
char *  result_buf,
uint16_t  buf_size,
uint16_t  timeout_ms 
)

Receive WiFi setup IO control.

This function is used by devices or clients to receive a WiFi setup io control.

Parameters
type[out] The type of IO control.
result_buf[in] The buffer of received IO control data.
buf_size[in] The max length of buffer of received IO control data.
timeout_ms[out] The timeout_ms for this function in unit of million-second, give 0 means return immediately.
Returns
If result_buf is NULL this is the required buffer size. If result_buf is non-NULL this is the data size in result_buf.
Error code if return value < 0
NEBULA_LAN_API int Nebula_Send_IOCtrl_On_LAN ( NebulaIOCtrlType  type,
const char *  ioctrl_buf,
uint16_t  ioctrl_len 
)

Send WiFi setup IO control.

This function is used by devices or clients to send a WiFi setup IO control.

Parameters
type[in] The type of IO control.
ioctrl_buf[in] The buffer of IO control data
ioctrl_len[in] The length of IO control data
Returns
AV_ER_NoERROR if sending successfully
Error code if return value < 0
NEBULA_LAN_API int Nebula_WiFi_Setup_Start_On_LAN ( LanSearchRole  role,
int  searchable 
)

Start to lan search without UID for WiFi setup.

Start to lan search for WiFi setup. After calling this api, user can listen or request tcp connect to create tcp connection.

Parameters
role[in] role of lan search.
searchable[in] This device could be searched with empty search name or not.
Returns
0 if start lan search successfully.
Error code if return value < 0
NEBULA_LAN_API void Nebula_WiFi_Setup_Stop_On_LAN ( )

Stop to lan search for WiFi setup.

Stop to lan search for WiFi setup. This api must be called, if NEBULA_WiFi_Setup_Start_On_LAN has been called. This api will close tcp connection and free memory.