62 #include "ble_srv_common.h" 63 #include "app_util_platform.h" 67 #define BLE_UUID_TMS_SERVICE 0x0400 68 #define BLE_TMS_MAX_DATA_LEN (BLE_GATT_ATT_MTU_DEFAULT - 3) 75 #define PACKED(TYPE) TYPE __attribute__ ((packed)) 78 typedef PACKED(
struct 83 }) ble_tms_raw_accel_t;
85 typedef PACKED(
struct 90 }) ble_tms_raw_gyro_t;
92 typedef PACKED(
struct 97 }) ble_tms_raw_compass_t;
99 typedef PACKED(
struct 101 ble_tms_raw_accel_t accel;
102 ble_tms_raw_gyro_t gyro;
103 ble_tms_raw_compass_t compass;
106 typedef PACKED(
struct 112 typedef uint8_t ble_tms_orientation_t;
114 typedef PACKED(
struct 122 typedef PACKED(
struct 129 typedef PACKED(
struct 132 }) ble_tms_rot_mat_t;
134 typedef int32_t ble_tms_heading_t;
136 typedef PACKED(
struct 141 }) ble_tms_gravity_t;
143 typedef PACKED(
struct 149 typedef PACKED(
struct 151 uint16_t pedo_interval_ms;
152 uint16_t temp_interval_ms;
153 uint16_t compass_interval_ms;
154 uint16_t motion_freq_hz;
155 uint8_t wake_on_motion;
158 #define BLE_TMS_CONFIG_PEDO_INT_MIN 100 159 #define BLE_TMS_CONFIG_PEDO_INT_MAX 5000 160 #define BLE_TMS_CONFIG_TEMP_INT_MIN 100 161 #define BLE_TMS_CONFIG_TEMP_INT_MAX 5000 162 #define BLE_TMS_CONFIG_COMP_INT_MIN 100 163 #define BLE_TMS_CONFIG_COMP_INT_MAX 1000 164 #define BLE_TMS_CONFIG_MPUF_MIN 5 165 #define BLE_TMS_CONFIG_MPUF_MAX 200 166 #define BLE_TMS_CONFIG_WOM_MIN 0 167 #define BLE_TMS_CONFIG_WOM_MAX 1 171 BLE_TMS_EVT_CONFIG_RECEIVED,
172 BLE_TMS_EVT_NOTIF_TAP,
173 BLE_TMS_EVT_NOTIF_ORIENTATION,
174 BLE_TMS_EVT_NOTIF_QUAT,
175 BLE_TMS_EVT_NOTIF_PEDOMETER,
176 BLE_TMS_EVT_NOTIF_RAW,
177 BLE_TMS_EVT_NOTIF_EULER,
178 BLE_TMS_EVT_NOTIF_ROT_MAT,
179 BLE_TMS_EVT_NOTIF_HEADING,
180 BLE_TMS_EVT_NOTIF_GRAVITY,
188 ble_tms_evt_type_t evt_type,
199 ble_tms_config_t * p_init_config;
357 #endif // BLE_TMS_H__ ble_gatts_char_handles_t quat_handles
Definition: ble_tms.h:214
void ble_tms_on_ble_evt(ble_tms_t *p_wss, ble_evt_t *p_ble_evt)
Function for handling the Motion Service's BLE events.
uint32_t ble_tms_quat_set(ble_tms_t *p_tms, ble_tms_quat_t *p_data)
Function for sending quaternion data.
ble_gatts_char_handles_t tap_handles
Definition: ble_tms.h:212
uint32_t ble_tms_init(ble_tms_t *p_wss, const ble_tms_init_t *p_tms_init)
Function for initializing the Motion Service.
bool is_tap_notif_enabled
Definition: ble_tms.h:222
void(* ble_tms_evt_handler_t)(ble_tms_t *p_tms, ble_tms_evt_type_t evt_type, uint8_t *p_data, uint16_t length)
Motion Service event handler type.
Definition: ble_tms.h:187
uint32_t ble_tms_heading_set(ble_tms_t *p_tms, ble_tms_heading_t *p_data)
Function for sending compass heading data.
uint8_t uuid_type
Definition: ble_tms.h:209
ble_gatts_char_handles_t rot_mat_handles
Definition: ble_tms.h:218
uint16_t conn_handle
Definition: ble_tms.h:221
uint32_t ble_tms_orientation_set(ble_tms_t *p_tms, ble_tms_orientation_t *p_data)
Function for sending orientation data.
bool is_pedo_notif_enabled
Definition: ble_tms.h:225
uint32_t ble_tms_euler_set(ble_tms_t *p_tms, ble_tms_euler_t *p_data)
Function for sending euler angle data.
ble_gatts_char_handles_t raw_handles
Definition: ble_tms.h:216
uint32_t ble_tms_tap_set(ble_tms_t *p_tms, ble_tms_tap_t *p_data)
Function for sending tap data.
ble_gatts_char_handles_t euler_handles
Definition: ble_tms.h:217
bool is_rot_mat_notif_enabled
Definition: ble_tms.h:228
Motion Service initialization structure.
Definition: ble_tms.h:197
ble_gatts_char_handles_t heading_handles
Definition: ble_tms.h:219
ble_gatts_char_handles_t pedo_handles
Definition: ble_tms.h:215
bool is_heading_notif_enabled
Definition: ble_tms.h:229
bool is_orientation_notif_enabled
Definition: ble_tms.h:223
ble_tms_evt_handler_t evt_handler
Definition: ble_tms.h:200
uint32_t ble_tms_gravity_set(ble_tms_t *p_tms, ble_tms_gravity_t *p_data)
Function for sending gravity vector data.
ble_gatts_char_handles_t orientation_handles
Definition: ble_tms.h:213
bool is_quat_notif_enabled
Definition: ble_tms.h:224
ble_gatts_char_handles_t gravity_handles
Definition: ble_tms.h:220
bool is_gravity_notif_enabled
Definition: ble_tms.h:230
bool is_raw_notif_enabled
Definition: ble_tms.h:226
uint32_t ble_tms_raw_set(ble_tms_t *p_tms, ble_tms_raw_t *p_data)
Function for sending raw data.
uint16_t service_handle
Definition: ble_tms.h:210
Motion Service structure.
Definition: ble_tms.h:207
bool is_euler_notif_enabled
Definition: ble_tms.h:227
ble_gatts_char_handles_t config_handles
Definition: ble_tms.h:211
ble_tms_evt_handler_t evt_handler
Definition: ble_tms.h:231
uint32_t ble_tms_rot_mat_set(ble_tms_t *p_tms, ble_tms_rot_mat_t *p_data)
Function for sending rotation matrix data.
uint32_t ble_tms_pedo_set(ble_tms_t *p_tms, ble_tms_pedo_t *p_data)
Function for sending pedometer data.