
Getting Started with EZ-BT WICED Modules
Document Number: 002-23400 Rev. **
29
// Use WICED_ROUTE_DEBUG_TO_WICED_UART to send formatted debug strings over the WICED
// HCI debug interface to be parsed by ClientControl/BtSpy.
// Note: WICED HCI must be configured to use this - see wiced_trasnport_init(), must
// be called with wiced_transport_cfg_t.wiced_tranport_data_handler_t callback present
// wiced_set_debug_uart(WICED_ROUTE_DEBUG_TO_WICED_UART);
#endif
WICED_BT_TRACE(
"APP Start\n"
);
/* Initialize Stack and Register Management Callback */
// Register call back and configuration with stack
wiced_bt_stack_init(app_management_callback, &wiced_bt_cfg_settings, wiced_bt_cfg_buf_pools);
}
The
APPLICATION_START()
function does the following
▪
Transport method is initialized by calling
wiced_transport_init()
; in this case UART
▪
Bluetooth stack is initialized by calling
wiced_bt_stack_init
.
▪
As part of the
wiced_bt_stack_init
function, Bluetooth configuration settings wiced_bt_cfg_settings are passed
to the stack and
app_management_callback
function is registered to receive both BLE and Bluetooth BR/EDR
stack events.
Note that this function already exists and does not need to be added to your project source file. The
wiced_bt_stack_init
function is declared in the
wiced_bt_stack.h
standard SDK library include file, actual
implementation of this function is in ROM.
Either PUART (WICED_ROUTE_DEBUG_TO_PUART) or HCI UART (WICED_ROUTE_DEBUG_TO_HCI_UART)
can be configured to receive debug traces based on the application requirement. PUART is enabled by default in this
example application.
The
spp.c, hello_sensor.c/h
, and
wiced_bt_cfg.c
source files contain the following key functions for BR/EDR and BLE:
Table 5. Key BR/EDR and BLE Functions Used in My First EZ-BT WICED Module Design
Common functions for Bluetooth BR/EDR and BLE (spp_custom.c)
application_init
app_management_callback
Bluetooth BR/EDR functions (spp_custom.c)
BLE functions
app_write_eir
hello_sensor_application_init
app_timeout
hello_sensor_set_advertisement_data
spp_connection_up_callback
hello_sensor_advertisement_stopped
spp_connection_down_callback
hello_sensor_timeout
spp_rx_data_callback
hello_sensor_fine_timeout
bt_write_nvram
hello_sensor_smp_bond_result
bt_read_nvram
hello_sensor_encryption_changed
app_send_data
hello_sensor_conn_idle_timeout
app_interrupt_handler
hello_sensor_send_message
app_tx_ack_timeout
hello_sensor_gatts_conn_status_cb
app_trace_callback
hello_sensor_gatts_req_cb
hello_sensor_gatts_callback
In addition to the API shown in
, the
spp.c
,
hello_sensor.c
/h, and
wiced_bt_cfg.c
source files contain the
following databases:
▪
app_sdp_db[] defines SDP data base for SPP profile of Bluetooth BR/EDR
▪
hello_sensor_gatt_database[] defines GATT database for a custom profile of BLE