Getting Started with EZ-BT WICED Modules
Document Number: 002-23400 Rev. **
114
p_power_mgmt_notification->
status
, p_power_mgmt_notification->
hci_status
);
break
;
default
:
result =
WICED_BT_USE_DEFAULT_SECURITY
;
break
;
}
return
result;
}
/*
* Prepare extended inquiry response data. Current version publishes device name and 16bit
* SPP service.
*/
void
app_write_eir
(
void
)
{
uint8_t
*pBuf;
uint8_t
*p;
uint8_t
length;
uint16_t
eir_length;
pBuf = (
uint8_t
*)wiced_bt_get_buffer(WICED_EIR_BUF_MAX_SIZE);
WICED_BT_TRACE(
"hci_control_write_eir %x\n"
, pBuf);
if
(!pBuf)
{
WICED_BT_TRACE(
"app_write_eir %x\n"
, pBuf);
return
;
}
p = pBuf;
length = strlen((
char
*)wiced_bt_cfg_settings.
device_name
);
*p++ = 1;
*p++ = BT_EIR_COMPLETE_LOCAL_NAME_TYPE;
// EIR type full name
memcpy(p, wiced_bt_cfg_settings.
device_name
, length);
p += length;
*p++ = 2 + 1;
// Length of 16 bit services
*p++ = BT_EIR_COMPLETE_16BITS_UUID_TYPE;
// 0x03 EIR type full list of 16 bit service UUIDs
*p++ = UUID_SERVCLASS_SERIAL_PORT & 0xff;
*p++ = (UUID_SERVCLASS_SERIAL_PORT >> 8) & 0xff;
*p++ = 0;
// end of EIR Data is 0
eir_length = (
uint16_t
) (p - pBuf);
// print EIR data
wiced_bt_trace_array(
"EIR :"
, pBuf, MIN(p-pBuf, 100));
wiced_bt_dev_write_eir(pBuf, eir_length);
return
;
}
/*
* The function invoked on timeout of app seconds timer.
*/
#if
SEND_DATA_ON_TIMEOUT
void
app_timeout
(
uint32_t
count)
{
static
uint32_t
timer_count = 0;
time+;
WICED_BT_TRACE(
"app_timeout: %d\n"
, timer_count);
if
(spp_handle != 0)
{
wiced_bt_spp_send_session_data(spp_handle, (
uint8_t
*)&timer_count,
sizeof
(
uint32_t
));
}
}
#endif
/*
* SPP connection up callback
*/
void
spp_connection_up_callback
(
uint16_t
handle,
uint8_t
* bda)
{
WICED_BT_TRACE(
"%s handle:%d address:%B\n"
, __FUNCTION__, handle, bda);
spp_handle = handle;