Handling BT related activity for provision AP.
Copyright (c) 2018-2020 Atmel Corporation. All rights reserved.
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "malloc.h"
#include "btstack_chipset_atwilc3000.h"
#include "btstack_debug.h"
#include "btstack_memory.h"
#include "btstack_run_loop.h"
#include "btstack_run_loop_freertos.h"
#include "classic/btstack_link_key_db.h"
#include "hci.h"
#include "hci_dump.h"
#include "ble_prov.h"
#include "ble_prov_db.h"
#include "btstack.h"
#include "wifi_prov.h"
Functions | |
static uint16_t | att_read_callback (hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) |
This function is called by BT stack during attribute read. More... | |
static int | att_write_callback (hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) |
This function is called by BT stack during attribute write. More... | |
static void | bt_app_init (int status) |
This function is used for initializing the BT application. More... | |
void | bt_task (void *arg) |
This function is called during creation of BT task. More... | |
int | btstack_main (void) |
This function is called after initialization of HCI transport. More... | |
void | le_prov_adv_start (void) |
This function is called to configure and start the advertisement. More... | |
void | le_prov_app_setup (void) |
This function is called for application setup. More... | |
static void | packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) |
This function is called for handling HCI Event. More... | |
Variables | |
TaskHandle_t | btstack_run_loop_task |
static btstack_packet_callback_registration_t | hci_event_callback_registration |
const uint8_t | le_prov_adv_data [] |
const uint8_t | le_prov_adv_data_len = sizeof(le_prov_adv_data) |
static uint16_t | le_prov_conn_handle = 0 |
const uint8_t | le_prov_scanrsp_data [] |
const uint8_t | le_prov_scanrsp_data_len = sizeof(le_prov_scanrsp_data) |
uint8_t | payload_data |
static bt_state_t | state = BT_IDLE |
static hci_transport_config_uart_t | transport_config |
static btstack_uart_config_t | uart_config |
static const btstack_uart_block_t * | uart_driver |
|
static |
This function is called by BT stack during attribute read.
References wifi_scan_ap_info::ap_count, wifi_scan_ap_info::ap_val, wifi_ap_detail::rssi_value, RSSI_VALUE_INDEX, RSSI_VALUE_SIZE, scan_ap, wifi_scan_ap_info::scan_mode, SECURITY_BYTE_INDEX, SECURITY_BYTE_SIZE, wifi_ap_detail::security_type, wifi_ap_detail::ssid_len, SSID_LEN_INDEX, SSID_LEN_SIZE, wifi_ap_detail::ssid_val, SSID_VAL_INDEX, SSID_VAL_SIZE, UNUSED, WIFI_AP_10_HANDLE, WIFI_AP_10_INDEX, WIFI_AP_11_HANDLE, WIFI_AP_11_INDEX, WIFI_AP_12_HANDLE, WIFI_AP_12_INDEX, WIFI_AP_13_HANDLE, WIFI_AP_13_INDEX, WIFI_AP_14_HANDLE, WIFI_AP_14_INDEX, WIFI_AP_15_HANDLE, WIFI_AP_15_INDEX, WIFI_AP_1_HANDLE, WIFI_AP_1_INDEX, WIFI_AP_2_HANDLE, WIFI_AP_2_INDEX, WIFI_AP_3_HANDLE, WIFI_AP_3_INDEX, WIFI_AP_4_HANDLE, WIFI_AP_4_INDEX, WIFI_AP_5_HANDLE, WIFI_AP_5_INDEX, WIFI_AP_6_HANDLE, WIFI_AP_6_INDEX, WIFI_AP_7_HANDLE, WIFI_AP_7_INDEX, WIFI_AP_8_HANDLE, WIFI_AP_8_INDEX, WIFI_AP_9_HANDLE, WIFI_AP_9_INDEX, WIFI_AP_LIST_END_HANDLE, WIFI_AP_LIST_START_HANDLE, WIFI_AP_SCAN_HANDLE, WIFI_CONN_STATE_HANDLE, and WIFI_SCAN_MODE_HANDLE.
Referenced by le_prov_app_setup().
|
static |
This function is called by BT stack during attribute write.
References att_server_request_can_send_now_event(), ATT_TRANSACTION_MODE_EXECUTE, BT_AP_CONN_STATE, BT_AP_SCANNING, conn_ap, wifi_conn_ap_info::conn_param, wifi_conn_ap_info::conn_param_offset, CONN_PARAM_SIZE, wifi_conn_ap_info::conn_state, wifi_conn_ap_info::conn_state_descriptor, le_prov_conn_handle, scan_ap, wifi_scan_ap_info::scan_mode, SCANLIST_SCANNING, state, UNUSED, WIFI_AP_PARAM_HANDLE, WIFI_CONN_STATE_CCD_HANDLE, WIFI_CONNECT_INPROGRESS, and WIFI_SCAN_MODE_HANDLE.
Referenced by le_prov_app_setup().
|
static |
This function is used for initializing the BT application.
References btstack_chipset_atwilc3000_instance(), btstack_link_key_db_memory_instance(), btstack_main(), hci_init(), hci_set_chipset(), hci_set_link_key_db(), and hci_transport_h4_instance().
Referenced by bt_task().
void bt_task | ( | void * | arg | ) |
This function is called during creation of BT task.
References btstack_uart_config_t::baudrate, hci_transport_config_uart_t::baudrate_init, bt_app_init(), bt_task_handle, btstack_chipset_atwilc3000_download_firmware(), btstack_memory_init(), btstack_run_loop_execute(), btstack_run_loop_freertos_get_instance(), btstack_run_loop_init(), btstack_run_loop_task, btstack_uart_block_freertos_instance(), btstack_uart_config_t::device_name, hci_transport_config_uart_t::device_name, btstack_uart_config_t::flowcontrol, hci_transport_config_uart_t::flowcontrol, HCI_DEFAULT_BAUDRATE, wifi_bt_if_msg_t::id, btstack_uart_block_t::init, NULL, pdFALSE, vTaskDelay(), wifi_bt_if_queue, wifi_bt_if_sem, WIFI_BT_INIT, xQueueReceive, xSemaphoreGive, and xSemaphoreTake.
int btstack_main | ( | void | ) |
This function is called after initialization of HCI transport.
References hci_power_control(), HCI_POWER_ON, and le_prov_app_setup().
void le_prov_adv_start | ( | void | ) |
This function is called to configure and start the advertisement.
References gap_advertisements_enable(), gap_advertisements_set_data(), gap_advertisements_set_params(), gap_scan_response_set_data(), le_prov_adv_data, le_prov_adv_data_len, le_prov_scanrsp_data, and le_prov_scanrsp_data_len.
Referenced by le_prov_app_setup().
void le_prov_app_setup | ( | void | ) |
This function is called for application setup.
References att_read_callback(), att_server_init(), att_server_register_packet_handler(), att_write_callback(), btstack_packet_callback_registration_t::callback, hci_add_event_handler(), l2cap_init(), le_device_db_init(), le_prov_adv_start(), packet_handler(), profile_data, and sm_init().
Referenced by btstack_main().
|
static |
This function is called for handling HCI Event.
References wifi_scan_ap_info::ap_count, ATT_EVENT_CAN_SEND_NOW, att_server_notify(), att_server_request_can_send_now_event(), BT_AP_CONN_STATE, BT_AP_CONN_STATE_UPDATED, BT_AP_LIST_UPDATED, BT_AP_SCANNING, BT_IDLE, BT_WIFI_CONNECT, BT_WIFI_SCAN, conn_ap, wifi_conn_ap_info::conn_param_offset, wifi_conn_ap_info::conn_state, wifi_conn_ap_info::conn_state_descriptor, HCI_EVENT_DISCONNECTION_COMPLETE, HCI_EVENT_LE_META, hci_event_le_meta_get_subevent_code(), HCI_EVENT_PACKET, hci_event_packet_get_type(), HCI_SUBEVENT_LE_CONNECTION_COMPLETE, hci_subevent_le_connection_complete_get_connection_handle(), wifi_bt_if_msg_t::id, le_prov_conn_handle, payload_data, RES_SUCCESS, scan_ap, wifi_scan_ap_info::scan_mode, SCANLIST_STOP, SCANLIST_UPDATED, state, UNUSED, wifi_bt_conn_if_sem, wifi_bt_if_queue, wifi_bt_if_sem, WIFI_CONN_STATE_HANDLE, WIFI_CONNECT_FAIL, WIFI_SCAN_MODE_HANDLE, xQueueSend, xSemaphoreGive, and xSemaphoreTake.
Referenced by le_prov_app_setup().
TaskHandle_t btstack_run_loop_task |
|
static |
const uint8_t le_prov_adv_data[] |
Referenced by le_prov_adv_start().
const uint8_t le_prov_adv_data_len = sizeof(le_prov_adv_data) |
Referenced by le_prov_adv_start().
|
static |
Referenced by att_write_callback(), and packet_handler().
const uint8_t le_prov_scanrsp_data[] |
Referenced by le_prov_adv_start().
const uint8_t le_prov_scanrsp_data_len = sizeof(le_prov_scanrsp_data) |
Referenced by le_prov_adv_start().
uint8_t payload_data |
Referenced by packet_handler(), and tss_server_return_credit().
|
static |
Referenced by att_write_callback(), packet_handler(), process_data(), and tss_server_return_credit().
|
static |
|
static |
|
static |