bps.h
Go to the documentation of this file.
1
70 #ifndef __BPS_H__
71 #define __BPS_H__
72
73 #include "gr55xx_sys.h"
74 #include "ble_prf_utils.h"
75 #include "custom_config.h"
76 #include <stdint.h>
77 #include <stdbool.h>
78
83 #define BPS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
84 10 : CFG_MAX_CONNECTIONS)
85 #define BPS_BP_MEAS_MAX_LEN 20
92 #define BPS_CHAR_MANDATORY 0x018F
93 #define BPS_CHAR_INTM_CUFF_PRESS_SUP 0x0070
94 #define BPS_CHAR_FULL 0x01ff
103 typedef enum
104 {
105 BPS_EVT_INVALID,
106 BPS_EVT_BP_MEAS_INDICATION_ENABLED,
107 BPS_EVT_BP_MEAS_INDICATION_DISABLED,
108 BPS_EVT_INTM_CUFF_PRESS_NTF_ENABLED,
109 BPS_EVT_INTM_CUFF_PRESS_NTF_DISABLED,
110 BPS_EVT_READ_BL_PRESSURE_FEATURE,
111 } bps_evt_type_t;
112
114 enum bp_feature_bit
115 {
116 BP_FEATURE_BODY_MOVEMENT_BIT = (0x01 << 0),
117 BP_FEATURE_CUFF_FIT_BIT = (0x01 << 1),
118 BP_FEATURE_IRREGULAR_PULSE_BIT = (0x01 << 2),
119 BP_FEATURE_PULSE_RATE_RANGE_BIT = (0x01 << 3),
120 BP_FEATURE_MEASUREMENT_POSITION_BIT = (0x01 << 4),
121 BP_FEATURE_MULTIPLE_BOND_BIT = (0x01 << 5),
122 };
130 typedef void (*bps_evt_handler_t)(uint8_t conn_idx, bps_evt_type_t event);
138 typedef struct
139 {
140 int8_t exponent;
141 int16_t mantissa;
142 } ieee_float16_t;
143
145 typedef struct
146 {
147 uint8_t bl_unit_in_kpa;
148 uint8_t time_stamp_present;
149 uint8_t pulse_rate_present;
150 uint8_t user_id_present;
151 uint8_t meas_status_present;
152 ieee_float16_t systolic;
153 ieee_float16_t diastolic;
154 ieee_float16_t mean_arterial_pr;
155 prf_date_time_t time_stamp;
156 ieee_float16_t pulse_rate;
157 uint8_t user_id;
158 uint16_t meas_status;
159 } bps_meas_t;
160
162 typedef struct
163 {
164 bps_evt_handler_t evt_handler;
165 uint16_t char_mask;
166 uint16_t bp_feature;
167 } bps_init_t;
183 sdk_err_t bps_service_init(bps_init_t *p_bps_init);
184
195 sdk_err_t bps_measurement_send(uint8_t conn_idx, bps_meas_t *p_meas);
198 #endif
199
bps_init_t::bp_feature
uint16_t bp_feature
Definition: bps.h:166
bps_meas_t::pulse_rate_present
uint8_t pulse_rate_present
Definition: bps.h:149
bps_meas_t::pulse_rate
ieee_float16_t pulse_rate
Definition: bps.h:156
bps_init_t::evt_handler
bps_evt_handler_t evt_handler
Definition: bps.h:164
BP_FEATURE_MULTIPLE_BOND_BIT
@ BP_FEATURE_MULTIPLE_BOND_BIT
Definition: bps.h:121
bps_evt_type_t
bps_evt_type_t
Blood Pressure Service event type.
Definition: bps.h:104
bps_meas_t::bl_unit_in_kpa
uint8_t bl_unit_in_kpa
Definition: bps.h:147
bp_feature_bit
bp_feature_bit
Blood Pressure Feature bits.
Definition: bps.h:115
gr55xx_sys.h
GR55XX System API.
bps_evt_handler_t
void(* bps_evt_handler_t)(uint8_t conn_idx, bps_evt_type_t event)
Blood Pressure Service event handler type.
Definition: bps.h:130
bps_meas_t::time_stamp
prf_date_time_t time_stamp
Definition: bps.h:155
bps_meas_t::time_stamp_present
uint8_t time_stamp_present
Definition: bps.h:148
BPS_EVT_READ_BL_PRESSURE_FEATURE
@ BPS_EVT_READ_BL_PRESSURE_FEATURE
Definition: bps.h:110
ieee_float16_t::mantissa
int16_t mantissa
Definition: bps.h:141
bps_meas_t::mean_arterial_pr
ieee_float16_t mean_arterial_pr
Definition: bps.h:154
bps_meas_t::diastolic
ieee_float16_t diastolic
Definition: bps.h:153
BPS_EVT_INVALID
@ BPS_EVT_INVALID
Definition: bps.h:105
ieee_float16_t::exponent
int8_t exponent
Definition: bps.h:140
bps_meas_t
Blood Pressure measurement structure.
Definition: bps.h:146
BP_FEATURE_PULSE_RATE_RANGE_BIT
@ BP_FEATURE_PULSE_RATE_RANGE_BIT
Definition: bps.h:119
bps_init_t::char_mask
uint16_t char_mask
Definition: bps.h:165
BP_FEATURE_BODY_MOVEMENT_BIT
@ BP_FEATURE_BODY_MOVEMENT_BIT
Definition: bps.h:116
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
bps_meas_t::systolic
ieee_float16_t systolic
Definition: bps.h:152
prf_date_time_t
The date and time structure. The packed size is 7 bytes.
Definition: ble_prf_types.h:101
bps_service_init
sdk_err_t bps_service_init(bps_init_t *p_bps_init)
Initialize a Blood Pressure Service instance and add in the DB.
BPS_EVT_BP_MEAS_INDICATION_ENABLED
@ BPS_EVT_BP_MEAS_INDICATION_ENABLED
Definition: bps.h:106
BPS_EVT_INTM_CUFF_PRESS_NTF_ENABLED
@ BPS_EVT_INTM_CUFF_PRESS_NTF_ENABLED
Definition: bps.h:108
BPS_EVT_INTM_CUFF_PRESS_NTF_DISABLED
@ BPS_EVT_INTM_CUFF_PRESS_NTF_DISABLED
Definition: bps.h:109
BPS_EVT_BP_MEAS_INDICATION_DISABLED
@ BPS_EVT_BP_MEAS_INDICATION_DISABLED
Definition: bps.h:107
ble_prf_utils.h
Profile/Service Utilities API.
BP_FEATURE_CUFF_FIT_BIT
@ BP_FEATURE_CUFF_FIT_BIT
Definition: bps.h:117
bps_meas_t::user_id
uint8_t user_id
Definition: bps.h:157
ieee_float16_t
SFLOAT format (IEEE-11073 16-bit FLOAT, defined as a 16-bit value with 12-bit mantissa and 4-bit expo...
Definition: bps.h:139
bps_init_t
Blood Pressure Service init stucture. This contains all option and data needed for initialization of ...
Definition: bps.h:163
bps_measurement_send
sdk_err_t bps_measurement_send(uint8_t conn_idx, bps_meas_t *p_meas)
Send Blood Pressure Measurement indication.
bps_meas_t::meas_status_present
uint8_t meas_status_present
Definition: bps.h:151
BP_FEATURE_IRREGULAR_PULSE_BIT
@ BP_FEATURE_IRREGULAR_PULSE_BIT
Definition: bps.h:118
bps_meas_t::meas_status
uint16_t meas_status
Definition: bps.h:158
bps_meas_t::user_id_present
uint8_t user_id_present
Definition: bps.h:150
BP_FEATURE_MEASUREMENT_POSITION_BIT
@ BP_FEATURE_MEASUREMENT_POSITION_BIT
Definition: bps.h:120