FreeRTOS: BLE
BLE
Return to main page ↑
iot_ble_wifi_provisioning.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS BLE V2.2.0
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
31 #ifndef IOT_BLE_WIFI_PROVISIONING_H_
32 #define IOT_BLE_WIFI_PROVISIONING_H_
33 
34 #include "iot_ble.h"
35 #include "iot_wifi.h"
36 
41 typedef enum
42 {
50 
56 typedef struct
57 {
58  int16_t scanSize;
59  int16_t scanTimeoutMS;
61 
70 typedef struct
71 {
72  union
73  {
74  WIFINetworkProfile_t network;
75  int16_t index;
76  } info;
77  bool isProvisioned : 1;
78  bool shouldConnect : 1;
80 
87 typedef struct
88 {
90  int16_t newPriorityIndex;
92 
99 typedef struct
100 {
101  int16_t priorityIndex;
103 
108 typedef struct
109 {
110  union
111  {
112  WIFIScanResult_t * pScannedNetwork;
113  WIFINetworkProfile_t * pSavedNetwork;
114  } info;
115  uint16_t index;
116  bool isSavedNetwork : 1;
117  bool isConnected : 1;
118  bool isHidden : 1;
120 
125 typedef struct IotBleWifiProvResponse
126 {
127  IotBleWiFiProvRequest_t requestType;
128  WIFIReturnCode_t status;
130  bool statusOnly : 1;
132 
137 typedef enum
138 {
144 
145 
146 typedef struct
147 {
148  bool ( * getRequestType )( const uint8_t * pMessage,
149  size_t length,
150  IotBleWiFiProvRequest_t * pRequeustType );
151 
152  bool ( * deserializeListNetworkRequest )( const uint8_t * pData,
153  size_t length,
154  IotBleWifiProvListNetworksRequest_t * pListNetworksRequest );
155 
156  bool ( * deserializeAddNetworkRequest )( const uint8_t * pData,
157  size_t length,
158  IotBleWifiProvAddNetworkRequest_t * pAddNetworkRequest );
159 
160  bool ( * deserializeEditNetworkRequest )( const uint8_t * pData,
161  size_t length,
162  IotBleWifiProvEditNetworkRequest_t * pEditNetworkRequest );
163 
164  bool ( * deserializeDeleteNetworkRequest )( const uint8_t * pData,
165  size_t length,
166  IotBleWifiProvDeleteNetworkRequest_t * pDeleteNetworkRequest );
167 
168  bool ( * getSerializedSizeForResponse )( const IotBleWifiProvResponse_t * pResponse,
169  size_t * length );
170 
171  bool ( * serializeResponse )( const IotBleWifiProvResponse_t * pResponse,
172  uint8_t * pBuffer,
173  size_t length );
175 
222 /* @[declare_iotblewifiprov_init] */
223 bool IotBleWifiProv_Init( void );
224 /* @[declare_iotblewifiprov_init] */
225 
235 /* @[declare_iotblewifiprov_init] */
236 bool IotBleWifiProv_RunProcessLoop( void );
237 
244 /* @[declare_iotblewifiprov_getnumnetworks] */
245 uint32_t IotBleWifiProv_GetNumNetworks( void );
246 /* @[declare_iotblewifiprov_getnumnetworks] */
247 
273 /* @[declare_iotblewifiprov_connect] */
274 bool IotBleWifiProv_Connect( uint32_t networkIndex );
275 /* @[declare_iotblewifiprov_connect] */
276 
283 /* @[declare_iotblewifiprov_stop] */
284 bool IotBleWifiProv_Stop( void );
285 
291 /* @[declare_iotblewifiprov_eraseallnetworks] */
293 /* @[declare_iotblewifiprov_eraseallnetworks] */
294 
299 /* @[declare_iotblewifiprov_delete] */
300 void IotBleWifiProv_Deinit( void );
301 /* @[declare_iotblewifiprov_delete] */
302 
310 /* @[declare_iotblewifiprov_getserializer] */
312 /* @[declare_iotblewifiprov_getserializer] */
313 
314 #endif /* _AWS_BLE_WIFI_PROVISIONING_H_ */
int16_t currentPriorityIndex
Definition: iot_ble_wifi_provisioning.h:89
bool IotBleWifiProv_Stop(void)
Stop the WiFi provisionig process loop function. This enqueues a command to stop the WiFi provisionin...
int16_t index
Definition: iot_ble_wifi_provisioning.h:75
Definition: iot_ble_wifi_provisioning.h:146
Definition: iot_ble_wifi_provisioning.h:44
Defines add wifi network request message structure sent from the provisioining app to the device...
Definition: iot_ble_wifi_provisioning.h:70
bool shouldConnect
Definition: iot_ble_wifi_provisioning.h:78
uint16_t index
Definition: iot_ble_wifi_provisioning.h:115
Definition: iot_ble_wifi_provisioning.h:142
bool IotBleWifiProv_Connect(uint32_t networkIndex)
Connects to one of the saved networks in priority order.
bool isProvisioned
Definition: iot_ble_wifi_provisioning.h:77
Defines the structure used to hold a scanned or saved network information.
Definition: iot_ble_wifi_provisioning.h:108
IotBleWifiProvEvent_t
Events Used by the WIFI provisioning service.
Definition: iot_ble_wifi_provisioning.h:137
Defines delete access point request message structure sent from provisioning app to the device...
Definition: iot_ble_wifi_provisioning.h:99
WIFIScanResult_t * pScannedNetwork
Definition: iot_ble_wifi_provisioning.h:112
Definition: iot_ble_wifi_provisioning.h:140
Definition: iot_ble_wifi_provisioning.h:141
bool IotBleWifiProv_RunProcessLoop(void)
Function which runs the process loop for Wifi provisioning. Process loop can be run within a task...
IotBleWifiProvNetworkInfo_t networkInfo
Definition: iot_ble_wifi_provisioning.h:129
IotBleWiFiProvRequest_t
This enumeration defines the different types of request processed by the WiFi provisioning library...
Definition: iot_ble_wifi_provisioning.h:41
Defines the structure used to hold the wifi provisioning response.
Definition: iot_ble_wifi_provisioning.h:125
bool statusOnly
Definition: iot_ble_wifi_provisioning.h:130
bool isHidden
Definition: iot_ble_wifi_provisioning.h:118
WIFIReturnCode_t status
Definition: iot_ble_wifi_provisioning.h:128
Defines the list wifi networks request message structure sent from the provisioining app to the devic...
Definition: iot_ble_wifi_provisioning.h:56
WIFINetworkProfile_t network
Definition: iot_ble_wifi_provisioning.h:74
int16_t newPriorityIndex
Definition: iot_ble_wifi_provisioning.h:90
Definition: iot_ble_wifi_provisioning.h:45
bool isConnected
Definition: iot_ble_wifi_provisioning.h:117
Definition: iot_ble_wifi_provisioning.h:48
Definition: iot_ble_wifi_provisioning.h:47
bool IotBleWifiProv_Init(void)
Initialize wifi provisioning over BLE service.
uint32_t IotBleWifiProv_GetNumNetworks(void)
Gets the total number of provisioned networks.
Definition: iot_ble_wifi_provisioning.h:46
int16_t scanTimeoutMS
Definition: iot_ble_wifi_provisioning.h:59
IotBleWifiProvSerializer_t * IotBleWifiProv_GetSerializer(void)
Gets the serializer interface used to serialize/deserialize packets over BLE. By default it uses the ...
BLE GAP and GATT API.
bool IotBleWifiProv_EraseAllNetworks(void)
Erase all wifi networks.
WIFINetworkProfile_t * pSavedNetwork
Definition: iot_ble_wifi_provisioning.h:113
Definition: iot_ble_wifi_provisioning.h:139
bool isSavedNetwork
Definition: iot_ble_wifi_provisioning.h:116
void IotBleWifiProv_Deinit(void)
Tear down WIFI provisioning service.
int16_t scanSize
Definition: iot_ble_wifi_provisioning.h:58
Defines edit wifi network request message structure sent from provisioning app to the device...
Definition: iot_ble_wifi_provisioning.h:87
Definition: iot_ble_wifi_provisioning.h:43
int16_t priorityIndex
Definition: iot_ble_wifi_provisioning.h:101