AIROC™ BTSDK v4.9 - Documentation | ||||
Bluetooth LE GATT Profiles functions. More...
Typedefs | |
struct { | |
UINT16 fine_timer_interval | |
UINT8 default_adv | |
UINT8 button_adv_toggle | |
UINT16 high_undirect_adv_interval | |
UINT16 low_undirect_adv_interval | |
UINT16 high_undirect_adv_duration | |
UINT16 low_undirect_adv_duration | |
UINT16 high_direct_adv_interval | |
UINT16 low_direct_adv_interval | |
UINT16 high_direct_adv_duration | |
UINT16 low_direct_adv_duration | |
char local_name [LOCAL_NAME_LEN_MAX] | |
char cod [COD_LEN] | |
char ver [VERSION_LEN] | |
UINT8 encr_required | |
UINT8 disc_required | |
UINT8 test_enable | |
UINT8 tx_power_level | |
UINT8 con_idle_timeout | |
UINT8 powersave_timeout | |
UINT16 hdl [HANDLE_NUM_MAX] | |
UINT16 serv [HANDLE_NUM_MAX] | |
UINT16 cha [HANDLE_NUM_MAX] | |
UINT8 findme_locator_enable | |
UINT8 findme_alert_level | |
UINT8 client_grouptype_enable | |
UINT8 linkloss_button_enable | |
UINT8 pathloss_check_interval | |
UINT8 alert_interval | |
UINT8 high_alert_num | |
UINT8 mild_alert_num | |
UINT8 status_led_enable | |
UINT8 status_led_interval | |
UINT8 status_led_con_blink | |
UINT8 status_led_dir_adv_blink | |
UINT8 status_led_un_adv_blink | |
UINT16 led_on_ms | |
UINT16 led_off_ms | |
UINT16 buz_on_ms | |
UINT8 button_power_timeout | |
UINT8 button_client_timeout | |
UINT8 button_discover_timeout | |
UINT8 button_filter_timeout | |
} | BLE_PROFILE_CFG |
Bluetooth LE Profile Configuration. More... | |
struct { | |
UINT32 baudrate | |
UINT8 txpin | |
UINT8 rxpin | |
} | BLE_PROFILE_PUART_CFG |
UART Configuration. More... | |
struct { | |
INT8 gpio_pin [GPIO_NUM_MAX] | |
UINT16 gpio_flag [GPIO_NUM_MAX] | |
} | BLE_PROFILE_GPIO_CFG |
GPIO Configuration. More... | |
Functions | |
void | bleprofile_GenerateADVData (BLE_ADV_FIELD *p_adv, UINT8 number) |
Generate Advertisement data. More... | |
void | bleprofile_GenerateScanRspData (BLE_ADV_FIELD *p_adv, UINT8 number) |
Generate Scan Response data. More... | |
void | bleprofile_CFGRegister (BLE_PROFILE_CFG *p_cfg) |
Register Configuration. More... | |
void | bleprofile_PUARTRegister (BLE_PROFILE_PUART_CFG *p_puart_cfg) |
Register Peripheral UART Configuration. More... | |
void | bleprofile_GPIORegister (BLE_PROFILE_GPIO_CFG *p_gpio_cfg) |
Register GPIO Configuration. More... | |
void | bleprofile_Init (BLE_PROFILE_CFG *p_cfg) |
Initialize Blueooth LE profile. More... | |
void | bleprofile_GPIOInit (BLE_PROFILE_GPIO_CFG *p_gpio_cfg) |
Initialize GPIO. More... | |
UINT8 | bleprofile_ReadNVRAM (UINT8 vsID, UINT8 itemLength, UINT8 *payload) |
Read NVRAM. More... | |
UINT8 | bleprofile_WriteNVRAM (UINT8 vsID, UINT8 itemLength, UINT8 *payload) |
Write NVRAM. More... | |
BOOL32 | bleprofile_DeleteNVRAM (UINT8 vsID) |
Delete NVRAM. More... | |
void | bleprofile_WPEnable (UINT8 wp_enable) |
Sets NVRAM Write Protection. More... | |
void | bleprofile_ReadUART (char *data) |
Read UART. More... | |
INT32 | bleprofile_ReadHandle (UINT16 hdl, BLEPROFILE_DB_PDU *p_pdu) |
Read local GATT database by handle. More... | |
INT32 | bleprofile_WriteHandle (UINT16 hdl, BLEPROFILE_DB_PDU *p_pdu) |
Write data to GATT database by handle. More... | |
void | bleprofile_sendWriteReq (UINT16 attrHandle, UINT8 *attr, INT32 len) |
Send Write Request. More... | |
void | bleprofile_sendWriteCmd (UINT16 attrHandle, UINT8 *data, INT32 len) |
Send Write Command. More... | |
void | bleprofile_sendReadReq (UINT16 Handle) |
Send Read Request. More... | |
void | bleprofile_sendReadByTypeReq (UINT16 startHandle, UINT16 endHandle, UINT16 uuid16) |
Send Read by Type Request. More... | |
void | bleprofile_sendReadByGroupTypeReq (UINT16 startHandle, UINT16 endHandle, UINT16 uuid16) |
Send Read by Group Type Request. More... | |
void | bleprofile_sendHandleValueConf (void) |
Send Handle Value Confirmation. More... | |
void | bleprofile_sendIndication (UINT16 attrHandle, UINT8 *attr, INT32 len, LEATT_NO_PARAM_CB cb) |
Send Indication. More... | |
void | bleprofile_sendNotification (UINT16 attrHandle, UINT8 *attr, INT32 len) |
Send Notification. More... | |
void | bleprofile_LEDOn (void) |
Turn LED On. More... | |
void | bleprofile_LEDOff (void) |
Turn LED Off. More... | |
void | bleprofile_LEDBlink (UINT16 on_ms, UINT16 off_ms, UINT8 num) |
Perform LED blinking. More... | |
void | bleprofile_BUZOn (void) |
Turn Buzzer On. More... | |
void | bleprofile_BUZOff (void) |
Turn Buzzer Off. More... | |
void | bleprofile_BUZBeep (UINT16 duration_ms) |
Play a Buzzer beep. More... | |
void | bleprofile_PWMBUZFreq (UINT8 preset, UINT16 init_value, UINT16 toggle_val) |
Change Buzzer beeping frequency. More... | |
void | bleprofile_BatOn (void) |
Turn Battery monitoring on. More... | |
void | bleprofile_BatOff (void) |
Turn Battery monitoring off. More... | |
void | bleprofile_UARTOn (void) |
Turn UART on. More... | |
void | bleprofile_UARTOff (void) |
Turn UART off. More... | |
void | bleprofile_PUARTTxOn (void) |
Turn on Peripheral UART TX. More... | |
void | bleprofile_PUARTTxOff (void) |
Turn off Peripheral UART TX. More... | |
void | bleprofile_PUARTRxOn (void) |
Turn on Peripheral UART RX. More... | |
void | bleprofile_PUARTRxOff (void) |
Turn off Peripheral UART RX. More... | |
INT8 | bleprofile_ReadBut (void) |
Read button. More... | |
INT8 | bleprofile_ReadBut1 (void) |
Read button 1. More... | |
INT8 | bleprofile_ReadBut2 (void) |
Read button 2. More... | |
INT8 | bleprofile_ReadBut3 (void) |
Read button 3. More... | |
SFLOAT | bleprofile_UINT16toSFLOAT (UINT16 uin) |
Convert UINT16 to SFLOAT. More... | |
UINT16 | bleprofile_SFLOATtoUINT16 (SFLOAT sfl) |
Convert SFLOAT to UINT16. More... | |
SFLOAT | bleprofile_UINT8_UINT8toSFLOAT (UINT8 minus, UINT8 uin, UINT8 bdp) |
Creates SFLOAT value. More... | |
FLOAT32 | bleprofile_UINT32toFLOAT32 (UINT32 uin) |
Convert UINT32 to FLOAT32. More... | |
UINT32 | bleprofile_FLOAT32toUINT32 (FLOAT32 fl) |
Convert FLOAT32 to UINT32. More... | |
FLOAT32 | bleprofile_UINT16_UINT16toFLOAT32 (UINT8 minus, UINT16 uin, UINT16 bdp) |
Creates FLOAT32 value. More... | |
UINT8 | bleprofile_GetDiscoverable (void) |
Get Discoverable State. More... | |
void | bleprofile_Discoverable (UINT8 Discoverable, BD_ADDR paired_addr) |
Set Discoverable. More... | |
void | bleprofile_regHandleUARTCb (BLEPROFILE_DOUBLE_PARAM_CB cb) |
Register callback to receive UART data. More... | |
void | bleprofile_regIntCb (BLEPROFILE_SINGLE_PARAM_CB callback) |
Register receive GPIO Interrupt. More... | |
void | bleprofile_regButtonFunctionCb (BLEPROFILE_SINGLE_PARAM_CB cb) |
Register receive polling button callback. More... | |
void | bleprofile_ReadButton (void) |
Callback function for polling button functionality. More... | |
void | bleprofile_regTimerCb (BLEAPP_TIMER_CB fine_cb, BLEAPP_TIMER_CB normal_cb) |
Register receive timer callbacks. More... | |
void | bleprofile_StartTimer (void) |
Start timers. More... | |
void | bleprofile_KillTimer (void) |
Stop timers. More... | |
void | bleprofile_regAppEvtHandler (BLECM_APP_EVT_ENUM idx, BLECM_NO_PARAM_FUNC func) |
Register application event handler. More... | |
void | bleprofile_InitPowersave (void) |
Init Powersave. More... | |
UINT8 | bleprofile_pollPowersave (void) |
Poll Powersave. More... | |
void | bleprofile_StartPowersave (void) |
Start Powersave. More... | |
void | bleprofile_StopPowersave (void) |
Stop Powersave. More... | |
void | bleprofile_PreparePowersave (void) |
Prepare Powersave. More... | |
void | bleprofile_setupTargetAdrInScanRsp (void) |
Setup Scan Response. More... | |
void | bleprofile_appTimerCb (UINT32 arg) |
Application Timer Callback. More... | |
void | bleprofile_setidletimer_withNotification (void) |
Configure Idle timer depending on the notification state. More... | |
void | bleprofile_StartConnIdleTimer (UINT8 timeout, BLEAPP_TIMER_CB cb) |
Start Connection Idle Timer. More... | |
void | bleprofile_StopConnIdleTimer (void) |
Stop Connection Idle Timer. More... | |
void | bleprofile_SendConnParamUpdateReq (UINT16 minInterval, UINT16 maxInterval, UINT16 peripheralLatency, UINT16 timeout) |
Send Connection Parameters Update Request. More... | |
Bluetooth LE GATT Profiles functions.
typedef { ... } BLE_PROFILE_CFG |
Bluetooth LE Profile Configuration.
BLE_PROFILE_CFG is used for setting application timer interval, ADV related parameters, local device information, connection/encryption related parameters, GATT DB handle, alert/led/buzzer related parameters, button related parameters.
typedef { ... } BLE_PROFILE_GPIO_CFG |
GPIO Configuration.
BLE_PROFILE_GPIO_CFG defines up to GPIO_NUM_MAX (currently 16) GPIO settings. Gpio_pin denotes GPIO pin number and gpio_flag defines GPIO setting (Input/Output, Interrupt, polarity) and the purpose (LED, Buzzer, Button, EEPROM Write Protect, etc). When GPIO purpose flag is set, profile common library functions can be usable. Without using GPIO purpose flag, GPIOs still can be usable with GPIO driver.
typedef { ... } BLE_PROFILE_PUART_CFG |
UART Configuration.
BLE_PROFILE_PUART_CFG defines baudrate, txpin, and rxpin of Periperal UART.
void bleprofile_appTimerCb | ( | UINT32 | arg | ) |
Application Timer Callback.
This function is called when ADV, Connection related events happen. ADV related event can change ADV setting (eg. High undirected ADV -> Low undirected ADV). Connection Idle timeout event can disconnect the Bluetooth LE connection.
arg | Type of events
|
void bleprofile_BatOff | ( | void | ) |
Turn Battery monitoring off.
This function turns off battery monitor (ADC) GPIO by using input disable mode.
void bleprofile_BatOn | ( | void | ) |
Turn Battery monitoring on.
This function turns on battery monitor (ADC) GPIO.
void bleprofile_BUZBeep | ( | UINT16 | duration_ms | ) |
Play a Buzzer beep.
This function plays a beep tone over Buzzer that is defined in BLE_PROFILE_GPIO_CFG. When PWM supporting GPIO (26-29) is used for buzzer, PWM is used to generate constant frequency. When other GPIO is used for buzzer, FW will control beeping sound and frequency may be changed.
duration_ms | : beeping duration (multiple of 12.5ms, MIN: 25ms, MAX: 1sec) |
void bleprofile_BUZOff | ( | void | ) |
Turn Buzzer Off.
This function turns off Buzzer that is defined in BLE_PROFILE_GPIO_CFG.
void bleprofile_BUZOn | ( | void | ) |
Turn Buzzer On.
This function turns on Buzzer that is defined in BLE_PROFILE_GPIO_CFG. When PWM supporting GPIO (26-29) is used for buzzer, PWM is used to generate constant frequency. When other GPIO is used for buzzer, FW will control beeping sound and frequency may be changed.
void bleprofile_CFGRegister | ( | BLE_PROFILE_CFG * | p_cfg | ) |
Register Configuration.
Application can call this function to overwrite default configuration.
p_cfg | Pointer to the BLE_PROFILE_CFG configuration structure. |
BOOL32 bleprofile_DeleteNVRAM | ( | UINT8 | vsID | ) |
Delete NVRAM.
This function releases the NVRAM previously allocated by the bleprofile_WriteNVRAM
call.
vsID | ID number of NVRAM. Valid values are 0x10 to 0x6F. |
void bleprofile_Discoverable | ( | UINT8 | Discoverable, |
BD_ADDR | paired_addr | ||
) |
Set Discoverable.
This function sets ADV state
state |
|
bda | Bluetooth address of the peer for directed advertisements, not use for undirected advertisements |
UINT32 bleprofile_FLOAT32toUINT32 | ( | FLOAT32 | fl | ) |
Convert FLOAT32 to UINT32.
A helper function to convert FLOAT32 a 4 byte float type used in some medical profiles into UINT32.
sfl | FLOAT32 value |
sfl
. void bleprofile_GenerateADVData | ( | BLE_ADV_FIELD * | p_adv, |
UINT8 | number | ||
) |
Generate Advertisement data.
This function generates ADV data to be used in the LE advertisement packets. When p_adv
is NULL, default fields (Flags, Local Name, Class of Device, Service UUID) are included. If p_adv
and number
are not zeroes, ADV data is set based on the user defined values.
If application does not call this function default values will be used.
p_adv | Pointer to the first advertisement field or NULL if defaults need to be used. |
number | Number of fields. |
void bleprofile_GenerateScanRspData | ( | BLE_ADV_FIELD * | p_adv, |
UINT8 | number | ||
) |
Generate Scan Response data.
This function generates data to be used in the LE Scan Response packets. When p_adv
is NULL, default data (Tx Power) is included. If p_adv
and number
are none zeroes, ADV data is set based on the user defined values.
If application does not call this function default values will be used.
p_adv | Pointer to the first advertisement field or NULL if defaults need to be used. |
number | Number of fields. |
UINT8 bleprofile_GetDiscoverable | ( | void | ) |
Get Discoverable State.
returns current discoverable state
void bleprofile_GPIOInit | ( | BLE_PROFILE_GPIO_CFG * | p_gpio_cfg | ) |
Initialize GPIO.
This function initializes GPIO pins defined in p_cfg
p_cfg | Pointer to the BLE_PROFILE_GPIO_CFG GPIO configuration structure. |
void bleprofile_GPIORegister | ( | BLE_PROFILE_GPIO_CFG * | p_gpio_cfg | ) |
Register GPIO Configuration.
This function registers GPIO configuration. bleapp_Init function calls this function using arguments that passed by bleapp_set_cfg function.
p_uart_cfg | Pointer to the BLE_PROFILE_GPIO_CFG config structure |
void bleprofile_Init | ( | BLE_PROFILE_CFG * | p_cfg | ) |
Initialize Blueooth LE profile.
This function is the main profile common library initialization. Application must call this function during blexxxx_Create. The function registers profile with the stack, initializes power saving, enables interrupts, and generates default advertisement and scan response data.
p_cfg | Pointer to the BLE_PROFILE_CFG configuration structure. |
void bleprofile_InitPowersave | ( | void | ) |
Init Powersave.
bleprofile_Init function calls this function during profile initialization when powersave_timeout of BLE_PROFILE_CFG is set.
void bleprofile_KillTimer | ( | void | ) |
Stop timers.
This function stops fine and normal timers.
void bleprofile_LEDBlink | ( | UINT16 | on_ms, |
UINT16 | off_ms, | ||
UINT8 | num | ||
) |
Perform LED blinking.
This function blinks LED that is defined in BLE_PROFILE_GPIO_CFG.
on_ms | LED on time (multiple of 12.5ms, MIN: 25ms, MAX: 1sec). |
off_ms | LED off time (multiple of 12.5ms, MIN: 25ms, MAX: 1sec). |
num | : number of times to blink. |
void bleprofile_LEDOff | ( | void | ) |
Turn LED Off.
This function turns on LED that is defined in BLE_PROFILE_GPIO_CFG.
void bleprofile_LEDOn | ( | void | ) |
Turn LED On.
This function turns on LED that is defined in BLE_PROFILE_GPIO_CFG.
UINT8 bleprofile_pollPowersave | ( | void | ) |
Poll Powersave.
This function is called to check idle timeout powersaving condition is met or not. This function is usually called by timer timeout function.
void bleprofile_PreparePowersave | ( | void | ) |
Prepare Powersave.
This function initiates idle mode to prepare powersave mode.
void bleprofile_PUARTRegister | ( | BLE_PROFILE_PUART_CFG * | p_puart_cfg | ) |
Register Peripheral UART Configuration.
This function registers peripheral UART configuration. bleapp_Init function calls this function using arguments that passed by bleapp_set_cfg function.
p_uart_cfg | Pointer to the BLE_PROFILE_PUART_CFG config structure |
void bleprofile_PUARTRxOff | ( | void | ) |
Turn off Peripheral UART RX.
This function turns off Peripheral UART RX pins.
void bleprofile_PUARTRxOn | ( | void | ) |
Turn on Peripheral UART RX.
This function turns on Peripheral UART RX pin.
void bleprofile_PUARTTxOff | ( | void | ) |
Turn off Peripheral UART TX.
This function turns off Peripheral UART TX pins.
void bleprofile_PUARTTxOn | ( | void | ) |
Turn on Peripheral UART TX.
This function turns on Peripheral UART TX pin.
void bleprofile_PWMBUZFreq | ( | UINT8 | preset, |
UINT16 | init_value, | ||
UINT16 | toggle_val | ||
) |
Change Buzzer beeping frequency.
This function changes frequency of beeping sound when PWM enabled GPIO is used. GPIO is configured in BLE_PROFILE_GPIO_CFG.
preset | Preset number. Following values can be usable.
|
init_value | Initial value of PWM. only meaningful when PWMBUZ_FREQ_MANUAL |
toggle_val | Toggle value of PWM. only meaningful when preset PWMBUZ_FREQ_MANUAL |
INT8 bleprofile_ReadBut | ( | void | ) |
Read button.
This function reads the state of the default (first) button.
button_state |
|
INT8 bleprofile_ReadBut1 | ( | void | ) |
Read button 1.
This function reads the state of the button 1.
button_state |
|
INT8 bleprofile_ReadBut2 | ( | void | ) |
Read button 2.
This function reads the state of the button 2.
button_state |
|
INT8 bleprofile_ReadBut3 | ( | void | ) |
Read button 3.
This function reads the state of the button 3.
button_state |
|
void bleprofile_ReadButton | ( | void | ) |
Callback function for polling button functionality.
This function can handle powersave, discover, client, filter timeout related functions that are defined in button_power_timeout, button_client_timeout, button_discover_timeout, button_filter_timeout of BLE_PROFILE_CFG config item. When button is pressed for timeout (sec) of powersave, discover, client, filter function, such function (powersaving, undirected ADV for pairing, client function (find me, time, etc), toggle HCI mode) will be initiated.
This function will call user defined callback function that is registered by bleprofile_regButtonFunctionCb function.
INT32 bleprofile_ReadHandle | ( | UINT16 | hdl, |
BLEPROFILE_DB_PDU * | p_pdu | ||
) |
Read local GATT database by handle.
This function provides a way for the application to read local GATT database using specific handle. GATT database can modified internally or when peer writes data over the air.
handle | Handle in the GATT database. |
p_pdu | Pointer to the BLEPROFILE_DB_PDU to retrieve the data to |
0
if the function succeeds. error_code
returned from the read operation. UINT8 bleprofile_ReadNVRAM | ( | UINT8 | vsID, |
UINT8 | itemLength, | ||
UINT8 * | payload | ||
) |
Read NVRAM.
This function reads bytes from the NVRAM(EEPROM). Application should use the same vsID
that was used during call.
vsID | ID number of NVRAM. Valid values are 0x10 to 0x6F. |
itemLength | Number of bytes to read. |
payload | Address of the itemLength bytes where the bytes from NVRAM are copied to. |
void bleprofile_ReadUART | ( | char * | data | ) |
Read UART.
Application can call this function to read the content of the UART received buffer. Application needs to provide at least READ_UART_LEN
byte buffer.
data | Pointer to the buffer to read UART to. |
void bleprofile_regAppEvtHandler | ( | BLECM_APP_EVT_ENUM | idx, |
BLECM_NO_PARAM_FUNC | func | ||
) |
Register application event handler.
Register a callback to receive certain event. Although registering for the notifications is optional and default processing is assumed, in most cases application will want to be notified and process the events.
idx | Event for the registration. Following events are defined.
|
func | Pointer to the function to be called when event occurs |
void bleprofile_regButtonFunctionCb | ( | BLEPROFILE_SINGLE_PARAM_CB | cb | ) |
Register receive polling button callback.
Application can register a callback function to be notified on the polling button push. Whenever the polling button is pressed for timeout values that defined in BLE_PROFILE_CFG, registered callback function will be called for additional user level action.
callback | Pointer to the application defined callback function that can handle polling. |
void bleprofile_regHandleUARTCb | ( | BLEPROFILE_DOUBLE_PARAM_CB | cb | ) |
Register callback to receive UART data.
Application can register a callback function to be notified when data is received over UART.
data | Pointer to the function to be called when data in the UART is available. |
void bleprofile_regIntCb | ( | BLEPROFILE_SINGLE_PARAM_CB | callback | ) |
Register receive GPIO Interrupt.
Application can register a callback function to be notified on the interrupt button. Whenever buttons (1-3) are pressed, registered callback function will be called.
callback | Pointer to the application defined callback function that can handle interrupt. |
void bleprofile_regTimerCb | ( | BLEAPP_TIMER_CB | fine_cb, |
BLEAPP_TIMER_CB | normal_cb | ||
) |
Register receive timer callbacks.
This function registers fine timer and normal timer callback function. Normal timer expires every second and fine resolution timer is called every 12.5ms, configurable in BLE_PROFILE_CFG.
fine_cb | Pointer to the callback function for fine resolution timer timeout. |
normal_cb | Pointer to the callback function for normal timer timeout. |
void bleprofile_SendConnParamUpdateReq | ( | UINT16 | minInterval, |
UINT16 | maxInterval, | ||
UINT16 | peripheralLatency, | ||
UINT16 | timeout | ||
) |
Send Connection Parameters Update Request.
The Connection Parameter Update Request allows the application to request a set of new connection parameters. During connection establishment and initial data exchange central typically sets parameters requiring very fast polling which is typically not needed during normal connection.
minInterval | Defines minimum value for the connection event interval in 1.25ms shall be less or equal to maximum |
maxInterval | Defines maximum value for the connection event interval in 1.25ms. |
peripheralLatency | Defines the peripheral latency parameter (as number of LL connection events). |
timeout | Defines connection timeout parameter. Timeout * 10ms is Connection supervision timeout |
void bleprofile_sendHandleValueConf | ( | void | ) |
Send Handle Value Confirmation.
Client side application should call this function when it receives indication from the server to acknowledge the receipt.
void bleprofile_sendIndication | ( | UINT16 | attrHandle, |
UINT8 * | attr, | ||
INT32 | len, | ||
LEATT_NO_PARAM_CB | cb | ||
) |
Send Indication.
Server side application can call this function to send an Indication packet to the client. To receive indication the client needs to register with the server by writing to Client Characteristic Configuration descriptor. The handle
is the GATT handle of the characteristic value. When client receives indication it sends back confirmation packet, and application receives it through the cb
callback. Application should not send next indication until previous one has been confirmed.
handle | Handle of the attribute in the GATT database. |
data | Pointer to the data chunk to be sent. |
len | Length of the data chunk to send. |
cb | Callback function to be called when peer acks the indication. |
void bleprofile_sendNotification | ( | UINT16 | attrHandle, |
UINT8 * | attr, | ||
INT32 | len | ||
) |
Send Notification.
Server side application can call this function to send a Notification packet to the client. To receive a Notification the client needs to register with the server by writing to Client Characteristic Configuration descriptor. The handle
is the GATT handle of the characteristic value.
handle | Handle of the attribute in the GATT database. |
data | Pointer to the data chunk to be sent. |
len | Length of the data chunk to send. |
void bleprofile_sendReadByGroupTypeReq | ( | UINT16 | startHandle, |
UINT16 | endHandle, | ||
UINT16 | uuid16 | ||
) |
Send Read by Group Type Request.
Client side application can call this function to send a Read by Group Type Request to the server. Before calling this function application will typically register to receive notification with a read results using leatt_regReadByGroupTypeRspCb
function. Application must specified range of the handles and UUID of the item to search for. This function usually is called by the client during GATT discovery.
start_handle | Start handle in the GATT database. |
end_handle | End handle in the GATT database. |
uuid | 16 bit UUID to search for |
void bleprofile_sendReadByTypeReq | ( | UINT16 | startHandle, |
UINT16 | endHandle, | ||
UINT16 | uuid16 | ||
) |
Send Read by Type Request.
Client side application can call this function to send a Read by Type Request to the server. Before calling this function application will typically register to receive notification with a read results using leatt_regReadByTypeRspCb
function. Application must specified range of the handles and UUID of the item to search for. This function usually is called by the client during GATT discovery.
start_handle | Start handle in the GATT database. |
end_handle | End handle in the GATT database. |
uuid | 16 bit UUID to search for |
void bleprofile_sendReadReq | ( | UINT16 | Handle | ) |
Send Read Request.
Client side application can call this function to send a Read Request to the server. Before calling this function application will typically register to receive notification with a read results using leatt_regReadRspCb
function.
handle | Handle of the attribute in the GATT database. |
data | Pointer to the data chunk to be sent. |
len | Length of the data chunk to send. |
void bleprofile_sendWriteCmd | ( | UINT16 | attrHandle, |
UINT8 * | data, | ||
INT32 | len | ||
) |
Send Write Command.
Client side application can call this function to send a write command to the server. The handle
can be GATT handle of the characteristic value, or a descriptor.
attrHandle | Handle of the attribute in the GATT database. |
data | Pointer to the data chunk to be sent |
len | Length of the data chunk to send |
void bleprofile_sendWriteReq | ( | UINT16 | attrHandle, |
UINT8 * | attr, | ||
INT32 | len | ||
) |
Send Write Request.
Client side application can call this function to send a write request to the server. The handle
can be GATT handle of the characteristic value, or a descriptor. Before calling this function application can register to receive notification with a result of write operation using leatt_regWriteRspCb
function.
attrHandle | Handle of the attribute in the GATT database. |
data | Pointer to the data chunk to be sent |
len | Length of the data chunk to send |
void bleprofile_setidletimer_withNotification | ( | void | ) |
Configure Idle timer depending on the notification state.
This function turns idle timer off if there is a characteristic with the client configuration descriptor set for notifications or indications. If there are no characteristics currently set to send indication or notification, idle timer is stopped.
void bleprofile_setupTargetAdrInScanRsp | ( | void | ) |
Setup Scan Response.
This function sets up the target address in the scan response payload if there are bonded keys.
UINT16 bleprofile_SFLOATtoUINT16 | ( | SFLOAT | sfl | ) |
Convert SFLOAT to UINT16.
A helper function to convert SFLOAT (2 byte float type used in some medical profiles into UINT16.
sfl | SFLOAT value |
sfl
. void bleprofile_StartConnIdleTimer | ( | UINT8 | timeout, |
BLEAPP_TIMER_CB | cb | ||
) |
Start Connection Idle Timer.
Starts connection idle timer.
Timeout | value in seconds. |
Callback | function to be called when timer expires. |
void bleprofile_StartPowersave | ( | void | ) |
Start Powersave.
This function starts powersafe mode
void bleprofile_StartTimer | ( | void | ) |
Start timers.
This function starts fine and normal timers. Timers are configurable in BLE_PROFILE_CFG.
void bleprofile_StopConnIdleTimer | ( | void | ) |
Stop Connection Idle Timer.
Stops connection idle timer
void bleprofile_StopPowersave | ( | void | ) |
Stop Powersave.
This function is called during wake up from Sleep powersave mode. Wake from HID off mode does not call this function.
void bleprofile_UARTOff | ( | void | ) |
Turn UART off.
This function turns off UART pins.
void bleprofile_UARTOn | ( | void | ) |
Turn UART on.
This function turns on UART pins.
FLOAT32 bleprofile_UINT16_UINT16toFLOAT32 | ( | UINT8 | minus, |
UINT16 | uin, | ||
UINT16 | bdp | ||
) |
Creates FLOAT32 value.
A helper function to create a FLOAT32 value a 4 byte float type used in some medical profiles from sign, integer, and below decimal point. For example -1.5 can be inputted as minus = 1, uin = 1, bdp 5.
minus | When 0, result should be a positive number, if 1 the negative number. |
uin | 16 bit unsigned interger above the decimal point. |
bdp | 16 bit unsigned interger below the decimal point. |
minus
, uin
and bdp
. SFLOAT bleprofile_UINT16toSFLOAT | ( | UINT16 | uin | ) |
Convert UINT16 to SFLOAT.
A helper function to convert UINT16 into SFLOAT (2 byte float type used in some medical profiles).
uin | 16 bit unsigned interger |
uin
. FLOAT32 bleprofile_UINT32toFLOAT32 | ( | UINT32 | uin | ) |
Convert UINT32 to FLOAT32.
A helper function to convert 32 bit unsigned integer value into FLOAT32 a 4 byte float type used in some medical profiles.
uin | 32 bit unsigned interger |
uin
. SFLOAT bleprofile_UINT8_UINT8toSFLOAT | ( | UINT8 | minus, |
UINT8 | uin, | ||
UINT8 | bdp | ||
) |
Creates SFLOAT value.
A helper function to create an SFLOAT value (2 byte float type used in some medical profiles) from sign, integer, and below decimal point. For example -1.5 can be inputted as minus = 1, uin = 1, bdp 5.
minus | When 0, result should be a positive number, if 1 the negative number. |
uin | 8 bit unsigned interger above the decimal point. |
bdp | 8 bit unsigned interger below the decimal point. |
minus
, uin
and bdp
. void bleprofile_WPEnable | ( | UINT8 | wp_enable | ) |
Sets NVRAM Write Protection.
This function enables or disables NVRAM (EEPROM) write protection.
wp_enable | If 0, write protect is off (EEPROM is writable). If 1, write protect is on (EEPROM is not writable). |
INT32 bleprofile_WriteHandle | ( | UINT16 | hdl, |
BLEPROFILE_DB_PDU * | p_pdu | ||
) |
Write data to GATT database by handle.
This function provides a way for the application to write data to GATT database using specific handle.
handle | Handle in the GATT database. |
p_pdu | Pointer to the BLEPROFILE_DB_PDU to write |
0
if the function succeeds. error_code
returned from the write operation. UINT8 bleprofile_WriteNVRAM | ( | UINT8 | vsID, |
UINT8 | itemLength, | ||
UINT8 * | payload | ||
) |
Write NVRAM.
This function writes bytes to the NVRAM(EEPROM). Application can specify any vsID
between 0x10 and 0x6F. Stack allocates memory and copies contents of the payload provided. The same payload can be retrieved later on using the same @ vsID by calling bleprofile_ReadNVRAM
.
vsID | ID number of NVRAM. Valid values are 0x10 to 0x6F. |
itemLength | Number of bytes to write. Valid values are 1 to 255. |
payload | Address of the itemLength bytes to be stored in the NVRAM. |