MT2523 API Reference  LinkIt SDK v4

The Bluetooth notification service is a Bluetooth service that parses the information from a remote device. More...

Overview

The Bluetooth notification service is a Bluetooth service that parses the information from a remote device.

The information could be a common notification, message, missed call or a customized content.

Terms and Acronyms

Terms Details
SPP Serial Port Profile. For more information, please refer to Wikipedia.
SDP Service Discovery Protocol. For more information, please refer to Wikipedia.
DOGP Data Over GATT Profile. It is a GATT based profile defined by MediaTek. It is used to transmit (send and receive) data through a GATT server.
EXCD Extend Command. It is used to send and receive customized data.

How to use this module

Functions

bt_notify_result_t bt_notify_register_callback (const bt_bd_addr_t *bt_addr, char *sender, bt_notify_callback_t cb_ptr)
 This function registers a callback function to the Bluetooth notification service. More...
 
bt_notify_result_t bt_notify_deregister_callback (const bt_bd_addr_t *bt_addr, bt_notify_callback_t cb_ptr)
 This function unregisters the callback function that has already been registered. More...
 
int32_t bt_notify_send_data (bt_bd_addr_t *bt_addr, const char *data, uint16_t data_len, bool is_new)
 Call this function to send data. More...
 
void bt_notify_init (uint8_t sdp_id)
 This function initializes the Bluetooth notification service. More...
 
bt_notify_data_source_t bt_notify_get_data_source (bt_bd_addr_t *bt_addr)
 Call this function to get the data transfer mode. More...
 

Modules

 Define
 This section defines the macros for the Bluetooth notification service.
 
 Struct
 This section defines the structures for the Bluetooth notification service.
 

Function Documentation

bt_notify_result_t bt_notify_deregister_callback ( const bt_bd_addr_t bt_addr,
bt_notify_callback_t  cb_ptr 
)

This function unregisters the callback function that has already been registered.

Parameters
[in]bt_addris the Bluetooth address of a remote device. It cannot be NULL.
[in]cb_ptris the callback function to unregister.
Returns
The result of the registration, as defined in bt_notify_result_t.
bt_notify_data_source_t bt_notify_get_data_source ( bt_bd_addr_t bt_addr)

Call this function to get the data transfer mode.

Parameters
[in]bt_addris the Bluetooth address of a remote device. It cannot be NULL.
Returns
The data transfer mode, SPP or DOGP mode.
void bt_notify_init ( uint8_t  sdp_id)

This function initializes the Bluetooth notification service.

It should be called either in application initialization or in system initialization.

Parameters
[in]sdp_idis the record ID of the SDP.
bt_notify_result_t bt_notify_register_callback ( const bt_bd_addr_t bt_addr,
char *  sender,
bt_notify_callback_t  cb_ptr 
)

This function registers a callback function to the Bluetooth notification service.

Parameters
[in]bt_addris the Bluetooth address of a remote device. It can be NULL.
[in]senderis a character string to identify the entity the callback is registered for.
[in]cb_ptris the callback function.
Returns
The result of the registration, as defined in bt_notify_result_t.
int32_t bt_notify_send_data ( bt_bd_addr_t bt_addr,
const char *  data,
uint16_t  data_len,
bool  is_new 
)

Call this function to send data.

Wait for the BT_NOTIFY_EVENT_SEND_IND event to send more data.

Parameters
[in]bt_addris the Bluetooth address of the remote device to send data to. It cannot be NULL.
[in]datais the data to be sent.
[in]data_lenis the data length.
[in]is_newis the flag indicating if the data is new.
Returns
The length of the send data.