123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- #ifndef BLE_BPS_H__
- #define BLE_BPS_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include "ble.h"
- #include "ble_srv_common.h"
- #include "ble_date_time.h"
- #include "nrf_sdh_ble.h"
- #include "nrf_ble_gq.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define BLE_BPS_DEF(_name) \
- static ble_bps_t _name; \
- NRF_SDH_BLE_OBSERVER(_name ## _obs, \
- BLE_BPS_BLE_OBSERVER_PRIO, \
- ble_bps_on_ble_evt, &_name)
- #define BLE_BPS_FEATURE_BODY_MOVEMENT_BIT (0x01 << 0)
- #define BLE_BPS_FEATURE_CUFF_FIT_BIT (0x01 << 1)
- #define BLE_BPS_FEATURE_IRREGULAR_PULSE_BIT (0x01 << 2)
- #define BLE_BPS_FEATURE_PULSE_RATE_RANGE_BIT (0x01 << 3)
- #define BLE_BPS_FEATURE_MEASUREMENT_POSITION_BIT (0x01 << 4)
- #define BLE_BPS_FEATURE_MULTIPLE_BOND_BIT (0x01 << 5)
- typedef enum
- {
- BLE_BPS_EVT_INDICATION_ENABLED,
- BLE_BPS_EVT_INDICATION_DISABLED,
- BLE_BPS_EVT_INDICATION_CONFIRMED
- } ble_bps_evt_type_t;
- typedef struct
- {
- ble_bps_evt_type_t evt_type;
- } ble_bps_evt_t;
- typedef struct ble_bps_s ble_bps_t;
- typedef void (*ble_bps_evt_handler_t) (ble_bps_t * p_bps, ble_bps_evt_t * p_evt);
- typedef struct
- {
- int8_t exponent;
- int16_t mantissa;
- } ieee_float16_t;
- typedef struct
- {
- ble_bps_evt_handler_t evt_handler;
- ble_srv_error_handler_t error_handler;
- security_req_t bp_cccd_wr_sec;
- security_req_t bp_feature_rd_sec;
- uint16_t feature;
- nrf_ble_gq_t * p_gatt_queue;
- } ble_bps_init_t;
- struct ble_bps_s
- {
- ble_bps_evt_handler_t evt_handler;
- ble_srv_error_handler_t error_handler;
- uint16_t service_handle;
- ble_gatts_char_handles_t meas_handles;
- ble_gatts_char_handles_t feature_handles;
- uint16_t conn_handle;
- uint16_t feature;
- nrf_ble_gq_t * p_gatt_queue;
- };
- typedef struct ble_bps_meas_s
- {
- bool blood_pressure_units_in_kpa;
- bool time_stamp_present;
- bool pulse_rate_present;
- bool user_id_present;
- bool measurement_status_present;
- ieee_float16_t blood_pressure_systolic;
- ieee_float16_t blood_pressure_diastolic;
- ieee_float16_t mean_arterial_pressure;
- ble_date_time_t time_stamp;
- ieee_float16_t pulse_rate;
- uint8_t user_id;
- uint16_t measurement_status;
- } ble_bps_meas_t;
- uint32_t ble_bps_init(ble_bps_t * p_bps, ble_bps_init_t const * p_bps_init);
- void ble_bps_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context);
- uint32_t ble_bps_measurement_send(ble_bps_t * p_bps, ble_bps_meas_t * p_bps_meas);
- uint32_t ble_bps_is_indication_enabled(ble_bps_t * p_bps, bool * p_indication_enabled);
- #ifdef __cplusplus
- }
- #endif
- #endif
|