ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_interface_communication_ble_gatt.h File Reference

Go to the source code of this file.

Macros

#define RI_GATT_CONN_SUP_TIMEOUT_MS   (6000U)
 
#define RI_GATT_SLAVE_LATENCY_TURBO   (0U)
 
#define RI_GATT_SLAVE_LATENCY_STANDARD   (1U)
 
#define RI_GATT_SLAVE_LATENCY_LOW_POWER   (0U)
 
#define RI_GATT_MIN_INTERVAL_TURBO_MS   (15U)
 
#define RI_GATT_MAX_INTERVAL_TURBO_MS   (30U)
 
#define RI_GATT_MIN_INTERVAL_STANDARD_MS   (480U)
 
#define RI_GATT_MAX_INTERVAL_STANDARD_MS   (510U)
 
#define RI_GATT_MIN_INTERVAL_LOW_POWER_MS   (1950U)
 
#define RI_GATT_MAX_INTERVAL_LOW_POWER_MS   (1980U)
 

Functions

rd_status_t ri_gatt_init (void)
 Initializes GATT stack. Uses default values from sdk_config.h, these can be overridden in nrf5_sdk15_application_config.h. More...
 
rd_status_t ri_gatt_uninit (void)
 Uninitializes GATT stack. More...
 
rd_status_t ri_gatt_nus_init (ri_comm_channel_t *const channel)
 Initialize Nordic UART Service as a communication channel. ri_communication_radio_init(RI_COMMUNICATION_RADIO_GATT) must be called before initializing service. More...
 
rd_status_t ri_gatt_nus_uninit (ri_comm_channel_t *const _channel)
 Uninitialize Nordic UART Service as a communication channel. More...
 
rd_status_t ri_gatt_dfu_init (void)
 Initialize BLE4 Device firmware update service. More...
 
rd_status_t ri_gatt_dis_init (const ri_comm_dis_init_t *const dis)
 Initialize BLE4 Device Information service. More...
 
rd_status_t ri_gatt_params_request (const ri_gatt_params_t params, const uint16_t delay_ms)
 Request connection parameter update for current connection. More...
 

Macro Definition Documentation

◆ RI_GATT_CONN_SUP_TIMEOUT_MS

#define RI_GATT_CONN_SUP_TIMEOUT_MS   (6000U)

Ruuvi BLE GATT profile

License: BSD-3 Author: Otso Jousimaa otso@.nosp@m.ojou.nosp@m.sima..nosp@m.net

Definition at line 19 of file ruuvi_interface_communication_ble_gatt.h.

◆ RI_GATT_MAX_INTERVAL_LOW_POWER_MS

#define RI_GATT_MAX_INTERVAL_LOW_POWER_MS   (1980U)

Definition at line 33 of file ruuvi_interface_communication_ble_gatt.h.

◆ RI_GATT_MAX_INTERVAL_STANDARD_MS

#define RI_GATT_MAX_INTERVAL_STANDARD_MS   (510U)

Definition at line 31 of file ruuvi_interface_communication_ble_gatt.h.

◆ RI_GATT_MAX_INTERVAL_TURBO_MS

#define RI_GATT_MAX_INTERVAL_TURBO_MS   (30U)

Definition at line 29 of file ruuvi_interface_communication_ble_gatt.h.

◆ RI_GATT_MIN_INTERVAL_LOW_POWER_MS

#define RI_GATT_MIN_INTERVAL_LOW_POWER_MS   (1950U)

Definition at line 32 of file ruuvi_interface_communication_ble_gatt.h.

◆ RI_GATT_MIN_INTERVAL_STANDARD_MS

#define RI_GATT_MIN_INTERVAL_STANDARD_MS   (480U)

Definition at line 30 of file ruuvi_interface_communication_ble_gatt.h.

◆ RI_GATT_MIN_INTERVAL_TURBO_MS

#define RI_GATT_MIN_INTERVAL_TURBO_MS   (15U)

Definition at line 28 of file ruuvi_interface_communication_ble_gatt.h.

◆ RI_GATT_SLAVE_LATENCY_LOW_POWER

#define RI_GATT_SLAVE_LATENCY_LOW_POWER   (0U)

Definition at line 25 of file ruuvi_interface_communication_ble_gatt.h.

◆ RI_GATT_SLAVE_LATENCY_STANDARD

#define RI_GATT_SLAVE_LATENCY_STANDARD   (1U)

Definition at line 24 of file ruuvi_interface_communication_ble_gatt.h.

◆ RI_GATT_SLAVE_LATENCY_TURBO

#define RI_GATT_SLAVE_LATENCY_TURBO   (0U)

Definition at line 23 of file ruuvi_interface_communication_ble_gatt.h.

Function Documentation

◆ ri_gatt_dfu_init()

rd_status_t ri_gatt_dfu_init ( void  )

Initialize BLE4 Device firmware update service.

Returns
RD_SUCCESS on success
error code from stack in case there is error.

◆ ri_gatt_dis_init()

rd_status_t ri_gatt_dis_init ( const ri_comm_dis_init_t *const  dis)

Initialize BLE4 Device Information service.

Parameters
[in]dispointer to data which should be presented over DIS. Memory will be deep-copied
Returns
RD_SUCCESS on success
error code from stack in case there is error.

◆ ri_gatt_init()

rd_status_t ri_gatt_init ( void  )

Initializes GATT stack. Uses default values from sdk_config.h, these can be overridden in nrf5_sdk15_application_config.h.

Returns
RD_SUCCESS on success
RD_ERROR_INVALID_STATE if radio module is not initialized with handle RI_COMMUNICATION_RADIO_GATT

◆ ri_gatt_nus_init()

rd_status_t ri_gatt_nus_init ( ri_comm_channel_t *const  channel)

Initialize Nordic UART Service as a communication channel. ri_communication_radio_init(RI_COMMUNICATION_RADIO_GATT) must be called before initializing service.

Parameters
[in]channelPointer to communication interface which will be populated. Pointer will be copied, the structure must be retained. Adding any event handler to structure after initialization will take effect immediately
Returns
RD_SUCCESS on success.
error code from stack in case there is other error.

◆ ri_gatt_nus_uninit()

rd_status_t ri_gatt_nus_uninit ( ri_comm_channel_t *const  _channel)

Uninitialize Nordic UART Service as a communication channel.

Parameters
[in]_channelPointer to communication interface which will be depopulated.
Returns
RD_SUCCESS on success
error code from stack in case there is other error.

◆ ri_gatt_params_request()

rd_status_t ri_gatt_params_request ( const ri_gatt_params_t  params,
const uint16_t  delay_ms 
)

Request connection parameter update for current connection.

This function will automatically retry connection parameter update up to 2 times and disconnects connection on failure. Takes no effect if there is no current connection.

Parameters
[in]paramsOne of preset defaults: RI_GATT_TURBO, RI_GATT_STANDARD, RI_GATT_LOW_POWER.
[in]delay_msDelay before trying to update for first time. 0 For immediate update, at least 100 ms otherwise.
Return values
RD_SUCCESSParameter update was requested
RD_ERROR_INVALID_PARAMparams was not one of supported defaults
RD_ERROR_INVALID_STATEif there is no ongoing GATT connection
Errorcode from BLE Stack if applicable

◆ ri_gatt_uninit()

rd_status_t ri_gatt_uninit ( void  )

Uninitializes GATT stack.

Returns
RD_SUCCESS on success
RD_ERROR_INVALID_STATE if radio module is not initialized with handle RI_COMMUNICATION_RADIO_GATT