FreeRTOS: BLE
BLE
Return to main page ↑
iot_ble_wifi_provisioning.h File Reference

WiFi provisioning Gatt service. More...

#include "iot_ble.h"
#include "iot_ble_data_transfer.h"
#include "iot_wifi.h"
#include "platform/iot_threads.h"

Go to the source code of this file.

Data Structures

struct  IotBleListNetworkRequest_t
 List Network request sent by the GATT client to list saved and scanned networks. More...
 
struct  IotBleAddNetworkRequest_t
 Sent by the GATT client to provision a new WiFi network. More...
 
struct  IotBleEditNetworkRequest_t
 Sent by the GATT client to change the saved WiFi networks priority order. More...
 
struct  IotBleDeleteNetworkRequest_t
 Sent by the GATT client to delete a saved WIFI network from flash. More...
 
struct  IotBleWifiNetworkInfo_t
 Response type used to send a WIFI network. More...
 
struct  IotBleWifiProvService_t
 Structure used for WiFi provisioning service. More...
 

Enumerations

enum  IotBleWifiProvEvent_t { IOT_BLE_WIFI_PROV_CONNECT = 0x01, IOT_BLE_WIFI_PROV_CONNECTED = 0x02, IOT_BLE_WIFI_PROV_DELETED = 0x4, IOT_BLE_WIFI_PROV_FAILED = 0x8 }
 Events Used by the WIFI provisioning service. More...
 

Functions

bool IotBleWifiProv_Init (void)
 Initialize wifi provisioning over BLE service. More...
 
uint32_t IotBleWifiProv_GetNumNetworks (void)
 Gets the total number of provisioned networks. More...
 
bool IotBleWifiProv_Connect (uint32_t networkIndex)
 Connects to one of the saved networks in priority order. More...
 
bool IotBleWifiProv_EraseAllNetworks (void)
 Erase all wifi networks. More...
 
void IotBleWifiProv_Deinit (void)
 Tear down WIFI provisioning service.
 

Detailed Description

WiFi provisioning Gatt service.

Function Documentation

◆ IotBleWifiProv_Init()

bool IotBleWifiProv_Init ( void  )

Initialize wifi provisioning over BLE service.

Creates necessary data structures for the service. Opens ble data transfer channel and listens for incoming messages from the channel.

Returns
true if the initialization succeeded. false if the initialization failed.

◆ IotBleWifiProv_GetNumNetworks()

uint32_t IotBleWifiProv_GetNumNetworks ( void  )

Gets the total number of provisioned networks.

Returns
Number of provisioned networks

◆ IotBleWifiProv_Connect()

bool IotBleWifiProv_Connect ( uint32_t  networkIndex)

Connects to one of the saved networks in priority order.

Example usage of this API to connect to provisioned networks in priority order:

uint32_t numNetworks =  IotBleWifiProv_GetNumNetworks(); //Gets the number of provisioned networks
uint16_t priority;
TickType_t  xNetworkConnectionDelay = pdMS_TO_TICKS( 1000 ); //1 Second delay
for( priority = 0; priority < numNetworks; priority++ ) //Priority is always in descending order/0 being highest priority.
{
     bool ret = IotBleWifiProv_Connect( priority );
     if( ret == true )
     {
         break;
     }
     vTaskDelay( xNetworkConnectionDelay );
}
Returns
Returns the connected network index in the flash.

◆ IotBleWifiProv_EraseAllNetworks()

bool IotBleWifiProv_EraseAllNetworks ( void  )

Erase all wifi networks.

Returns
true if success, false otherwise.