WiFi Provisioning Profile declarations.
Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | _scanitem |
Store the scan list and then later populate when creating the database. More... | |
struct | credentials |
struct | credentials_mschapv2 |
struct | credentials_tls |
struct | wifi_provision_scanlist |
Macros | |
#define | BLE_IS_CONNECTED (1) |
#define | BLE_IS_NOT_CONNECTED (0) |
BLE connected or otherwise. More... | |
#define | CREDENTIALS_NOT_VALID (0) |
credentials provisioning status More... | |
#define | CREDENTIALS_VALID (1) |
#define | WIFI_PROVISION_ADV_DATA_NAME_DATA ("3400-DEMO") |
#define | WIFI_PROVISION_ADV_DATA_NAME_LEN (11) |
WIFI_PROVISION_ADV_DATA_NAME_LEN the length of the device name. More... | |
#define | WIFI_PROVISION_ADV_DATA_NAME_TYPE (0x09) |
WIFI_PROVISION_ADV_DATA_NAME_TYPE the gap ad data type. More... | |
#define | WIFI_PROVISION_ADV_SCAN_RESP_LEN (31) |
advertisement or scan response length. More... | |
#define | WIFI_PROVISION_ADV_TIMEOUT (1000) |
#define | WIFI_PROVISION_FAST_ADV (100) |
WIFI_PROVISION_FAST_ADV between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s). More... | |
#define | WIFI_PROVISION_MAX_AP_NUM (15) |
maximum number of APs in scan list given to remote device More... | |
#define | WIFI_PROVISION_MAX_PASS_LENGTH (64) |
maximum pass phrase length More... | |
#define | WIFI_PROVISION_MAX_SSID_LENGTH (32) |
maximum ssid length More... | |
#define | WIFI_PROVISION_MAX_USERNAME_LENGTH (34) |
maximum username length More... | |
#define | WIFI_PROVISION_SCP_TYPE_MORE_128_BIT_UUID (0x06) |
Scan response type Incomplete List of 128-bit Service Class UUIDs. More... | |
#define | WIFI_PROVISION_STATE_FAILED (0x10) |
#define | WIFI_PROVISION_STATE_HAVE_CREDENTIAL (0x08) |
#define | WIFI_PROVISION_STATE_IDLE (0x00) |
provisioning state that the app can query More... | |
#define | WIFI_PROVISION_STATE_IN_PROGRESS (0x04) |
#define | WIFI_PROVISION_STATE_REQUESTING_SCAN (0x01) |
#define | WIFI_PROVISION_STATE_WIFI_SCANNING (0x02) |
#define | WIFI_PROVISION_TLS_CERT_LENGTH ((1024*2)-32) |
maximum TLS CERT length More... | |
#define | WIFI_PROVISION_TLS_KEY_LENGTH (1024*2) |
maximum TLS key length More... | |
Typedefs | |
typedef struct _scanitem | scanitem |
typedef at_ble_status_t(* | wifi_provision_cred_callback_t )(credentials *) |
typedef at_ble_status_t(* | wifi_provision_scanning_callback_t )(void) |
typedef void(* | wifi_provision_u8_callback_t )(uint8_t) |
Enumerations | |
enum | { WIFI_PROVISION_SCANMODE_SCANNING = 1, WIFI_PROVISION_SCANMODE_DONE } |
scanning status: can be scanning or scan done when the AP list is refreshed More... | |
enum | { WIFI_CONNECTION_STATE_NOTSTARTED, WIFI_CONNECTION_STATE_PROVISIONFAILED, WIFI_CONNECTION_STATE_CONNECTING, WIFI_CONNECTION_STATE_PROVISIONED } |
WiFi status;application can inform on this. More... | |
Functions | |
void | ble_connected (void) |
application updates ble has connected More... | |
void | ble_disconnected (void) |
application updates ble has disconnected More... | |
uint8_t | ble_is_connected (void) |
function for querying ble connect status More... | |
void | disconnect_ble (void) |
application requests ble be disconnected More... | |
void | inform_wifi_connection_state (uint8_t s) |
application updates wifi provisioning on wifi connect state More... | |
at_ble_status_t | provision_start (void) |
start or restart provision and advertise and get scan list More... | |
void | register_wifi_provision_credentials_handler (wifi_provision_cred_callback_t credentials_fn) |
application to register the credential update function callback More... | |
void | register_wifi_provision_scanning_handler (wifi_provision_scanning_callback_t scanning_fn) |
application to register the scanning function callback More... | |
void | request_scan (void) |
application requests wif scanning More... | |
uint8_t | wifi_provision_char_changed_handler (at_ble_characteristic_changed_t *char_handle) |
character changed handler More... | |
at_ble_status_t | wifi_provision_define (void) |
profile services definition to the attribute data base More... | |
void | wifi_provision_init (void *param) |
Initialize the profile, includes all initializations and start up routines of the profiles. More... | |
uint8_t | wifi_provision_processing (void) |
application periodically kicks wifi provision processing More... | |
uint8_t | wifi_provision_scanlist_receive (wifi_provision_scanlist *param) |
application updates the wifi scan list More... | |
uint8_t | wifi_provision_svc_changed_handler (uint8_t *data) |
ble stack indicate service client configuration change More... | |
#define BLE_IS_CONNECTED (1) |
Referenced by ble_connected().
#define BLE_IS_NOT_CONNECTED (0) |
BLE connected or otherwise.
Referenced by ble_disconnected(), provision_start(), and wifi_provision_init().
#define CREDENTIALS_NOT_VALID (0) |
credentials provisioning status
Referenced by retrieve_credentials().
#define CREDENTIALS_VALID (1) |
Referenced by app_ble_wifi_provisioning(), retrieve_credentials(), and wifi_provision_app_credentials_update().
#define WIFI_PROVISION_ADV_DATA_NAME_DATA ("3400-DEMO") |
Referenced by prepare_advertisement(), and start_advertise().
#define WIFI_PROVISION_ADV_DATA_NAME_LEN (11) |
WIFI_PROVISION_ADV_DATA_NAME_LEN the length of the device name.
Referenced by prepare_advertisement().
#define WIFI_PROVISION_ADV_DATA_NAME_TYPE (0x09) |
WIFI_PROVISION_ADV_DATA_NAME_TYPE the gap ad data type.
Referenced by prepare_advertisement().
#define WIFI_PROVISION_ADV_SCAN_RESP_LEN (31) |
advertisement or scan response length.
Referenced by prepare_advertisement().
#define WIFI_PROVISION_ADV_TIMEOUT (1000) |
Referenced by start_advertise().
#define WIFI_PROVISION_FAST_ADV (100) |
WIFI_PROVISION_FAST_ADV between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s).
Referenced by start_advertise().
#define WIFI_PROVISION_MAX_AP_NUM (15) |
maximum number of APs in scan list given to remote device
Referenced by send_scan_result().
#define WIFI_PROVISION_MAX_PASS_LENGTH (64) |
maximum pass phrase length
Referenced by retrieve_credentials(), wifi_provision_app_credentials_update(), and wifi_provision_char_changed_handler().
#define WIFI_PROVISION_MAX_SSID_LENGTH (32) |
maximum ssid length
Referenced by retrieve_credentials(), wifi_provision_app_credentials_update(), wifi_provision_char_changed_handler(), and wifiscan_scanlist_receive().
#define WIFI_PROVISION_MAX_USERNAME_LENGTH (34) |
maximum username length
Referenced by wifi_provision_char_changed_handler().
#define WIFI_PROVISION_SCP_TYPE_MORE_128_BIT_UUID (0x06) |
Scan response type Incomplete List of 128-bit Service Class UUIDs.
Referenced by prepare_advertisement().
#define WIFI_PROVISION_STATE_FAILED (0x10) |
#define WIFI_PROVISION_STATE_HAVE_CREDENTIAL (0x08) |
Referenced by app_ble_wifi_provisioning(), wifi_provision_char_changed_handler(), and wifi_provision_set_state().
#define WIFI_PROVISION_STATE_IDLE (0x00) |
provisioning state that the app can query
Referenced by ble_disconnected(), inform_wifi_connection_state(), provision_start(), wifi_provision_init(), and wifi_provision_set_state().
#define WIFI_PROVISION_STATE_IN_PROGRESS (0x04) |
Referenced by wifi_provision_scanlist_receive(), and wifi_provision_set_state().
#define WIFI_PROVISION_STATE_REQUESTING_SCAN (0x01) |
#define WIFI_PROVISION_STATE_WIFI_SCANNING (0x02) |
Referenced by wifi_provision_processing(), and wifi_provision_set_state().
#define WIFI_PROVISION_TLS_CERT_LENGTH ((1024*2)-32) |
maximum TLS CERT length
Referenced by wifi_provision_char_changed_handler().
#define WIFI_PROVISION_TLS_KEY_LENGTH (1024*2) |
maximum TLS key length
Referenced by wifi_provision_char_changed_handler().
typedef at_ble_status_t(* wifi_provision_cred_callback_t)(credentials *) |
typedef at_ble_status_t(* wifi_provision_scanning_callback_t)(void) |
typedef void(* wifi_provision_u8_callback_t)(uint8_t) |
anonymous enum |
anonymous enum |
void ble_connected | ( | void | ) |
application updates ble has connected
application updates ble has connected
References BLE_IS_CONNECTED, is_BLE_Connected, and PROVISION_PRINTF.
Referenced by ble_app_connected_update().
void ble_disconnected | ( | void | ) |
application updates ble has disconnected
application updates ble has disconnected
References BLE_IS_NOT_CONNECTED, is_BLE_Connected, PROVISION_PRINTF, wifi_connection_state, WIFI_CONNECTION_STATE_PROVISIONFAILED, wifi_provision_get_state(), wifi_provision_set_state(), WIFI_PROVISION_STATE_FAILED, and WIFI_PROVISION_STATE_IDLE.
Referenced by ble_app_disconnected_update().
uint8_t ble_is_connected | ( | void | ) |
function for querying ble connect status
References is_BLE_Connected.
Referenced by provision_start(), and start_provisioning_app().
void disconnect_ble | ( | void | ) |
application requests ble be disconnected
application requests ble be disconnected
References at_ble_adv_stop(), at_ble_disconnect(), and AT_BLE_TERMINATED_BY_USER.
Referenced by provision_app_ble_disconnect().
void inform_wifi_connection_state | ( | uint8_t | s | ) |
application updates wifi provisioning on wifi connect state
[in] | wifi | connect state |
References NOTIFY_STATE_PROVISIONED, NOTIFY_STATE_PROVISIONFAILED, NOTIFY_STATE_WIFICONNECTING, PROVISION_PRINTF, wifi_connection_state, WIFI_CONNECTION_STATE_CONNECTING, WIFI_CONNECTION_STATE_PROVISIONED, WIFI_CONNECTION_STATE_PROVISIONFAILED, wifi_provision_set_state(), WIFI_PROVISION_STATE_FAILED, WIFI_PROVISION_STATE_IDLE, and wificon_connect_noti().
Referenced by wifi_state_update().
at_ble_status_t provision_start | ( | void | ) |
start or restart provision and advertise and get scan list
References AT_BLE_SUCCESS, ble_is_connected(), BLE_IS_NOT_CONNECTED, prepare_advertisement(), start_advertise(), wifi_connection_state, WIFI_CONNECTION_STATE_NOTSTARTED, wifi_provision_set_state(), WIFI_PROVISION_STATE_IDLE, and WIFI_PROVISION_STATE_REQUESTING_SCAN.
Referenced by start_provisioning_app().
void register_wifi_provision_credentials_handler | ( | wifi_provision_cred_callback_t | credentials_fn | ) |
application to register the credential update function callback
[in] | application's | credential function |
References credentials_cb.
Referenced by initialise_provisioning_app().
void register_wifi_provision_scanning_handler | ( | wifi_provision_scanning_callback_t | scanning_fn | ) |
application to register the scanning function callback
[in] | application's | scanning function |
References scanning_cb.
Referenced by initialise_provisioning_app().
void request_scan | ( | void | ) |
application requests wif scanning
application requests wif scanning
References wifi_provision_set_state(), and WIFI_PROVISION_STATE_REQUESTING_SCAN.
uint8_t wifi_provision_char_changed_handler | ( | at_ble_characteristic_changed_t * | char_handle | ) |
character changed handler
[in] | at_ble_characteristic_changed_t | which includes handle,new value |
character changed handler
References APPARAM_MULTIPART_LENGTH, APPARAM_MULTIPART_PASS_POS, APPARAM_MULTIPART_PASSLEN_POS, APPARAM_MULTIPART_SECTYPE_POS, APPARAM_MULTIPART_SSID_POS, APPARAM_MULTIPART_SSIDLEN_POS, APPARAM_MULTIPART_TLSCERT_POS, APPARAM_MULTIPART_TLSCERTLEN_POS, APPARAM_MULTIPART_TLSKEY_POS, APPARAM_MULTIPART_TLSKEYLEN_POS, APPARAM_MULTIPART_USERLEN_POS, APPARAM_MULTIPART_USERNAME_POS, AT_BLE_SUCCESS, credentials_tls::certificate, credentials_tls::certificate_length, at_ble_characteristic_changed_t::char_len, at_ble_characteristic_changed_t::char_new_value, at_ble_characteristic_changed_t::char_offset, credentials_cb, FAILED_WIFICON_CHANGE_PARAM, FAILED_WIFISCAN_CHANGE_PARAM, INVALID_WIFICON_CHANGE_PARAM, credentials_tls::keydata, credentials_tls::keydata_length, multi_part, credentials::passphrase, credentials_mschapv2::passphrase, credentials::passphrase_length, credentials_mschapv2::passphrase_length, PROVISION_PRINTF, PROVISION_PRINTF_CONT, credentials::sec_type, credentials_tls::sec_type, credentials_mschapv2::sec_type, credentials::ssid, credentials_tls::ssid, credentials_mschapv2::ssid, credentials::ssid_length, credentials_tls::ssid_length, credentials_mschapv2::ssid_length, credentials_mschapv2::username, credentials_mschapv2::username_length, VALID_WIFICON_CHANGE_PARAM, VALID_WIFISCAN_CHANGE_PARAM, WIFI_PROVISION_MAX_PASS_LENGTH, WIFI_PROVISION_MAX_SSID_LENGTH, WIFI_PROVISION_MAX_USERNAME_LENGTH, WIFI_PROVISION_SCANMODE_SCANNING, wifi_provision_set_state(), WIFI_PROVISION_STATE_FAILED, WIFI_PROVISION_STATE_HAVE_CREDENTIAL, WIFI_PROVISION_STATE_REQUESTING_SCAN, WIFI_PROVISION_TLS_CERT_LENGTH, WIFI_PROVISION_TLS_KEY_LENGTH, wificon_char_change_apparam(), wificon_char_change_state_client_cfg(), and wifiscan_char_change_scanmode().
at_ble_status_t wifi_provision_define | ( | void | ) |
profile services definition to the attribute data base
[in] | void |
profile services definition to the attribute data base
References AT_BLE_SUCCESS, wificon_primary_service_define(), and wifiscan_primary_service_define().
Referenced by wifi_provision_init().
void wifi_provision_init | ( | void * | param | ) |
Initialize the profile, includes all initializations and start up routines of the profiles.
[in] | void |
Initialize the profile, includes all initializations and start up routines of the profiles.
References BLE_IS_NOT_CONNECTED, is_BLE_Connected, wifi_provision_define(), wifi_provision_service_init(), wifi_provision_set_state(), and WIFI_PROVISION_STATE_IDLE.
uint8_t wifi_provision_processing | ( | void | ) |
application periodically kicks wifi provision processing
References AT_BLE_SUCCESS, scanning_cb, wifi_provision_get_state(), WIFI_PROVISION_SCANMODE_SCANNING, wifi_provision_scanmode_update(), wifi_provision_set_state(), WIFI_PROVISION_STATE_REQUESTING_SCAN, and WIFI_PROVISION_STATE_WIFI_SCANNING.
Referenced by provisioning_app_processing().
uint8_t wifi_provision_scanlist_receive | ( | wifi_provision_scanlist * | param | ) |
application updates the wifi scan list
[in] | wifi | scanlist |
References AT_BLE_SUCCESS, PROVISION_PRINTF, WIFI_PROVISION_SCANMODE_DONE, wifi_provision_scanmode_update(), wifi_provision_set_state(), WIFI_PROVISION_STATE_IN_PROGRESS, WIFI_PROVISION_STATE_REQUESTING_SCAN, and wifiscan_scanlist_receive().
Referenced by send_scan_result().
uint8_t wifi_provision_svc_changed_handler | ( | uint8_t * | data | ) |
ble stack indicate service client configuration change
[in] | service | change data |
References at_ble_characteristic_value_set(), AT_BLE_SUCCESS, and wificon_gatt_service_handler::serv_handle.