123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- #ifndef BLE_LBS_H__
- #define BLE_LBS_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include "ble.h"
- #include "ble_srv_common.h"
- #include "nrf_sdh_ble.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define BLE_LBS_DEF(_name) \
- static ble_lbs_t _name; \
- NRF_SDH_BLE_OBSERVER(_name ## _obs, \
- BLE_LBS_BLE_OBSERVER_PRIO, \
- ble_lbs_on_ble_evt, &_name)
- #define LBS_UUID_BASE {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, \
- 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00}
- #define LBS_UUID_SERVICE 0x1523
- #define LBS_UUID_BUTTON_CHAR 0x1524
- #define LBS_UUID_LED_CHAR 0x1525
- typedef struct ble_lbs_s ble_lbs_t;
- typedef void (*ble_lbs_led_write_handler_t) (uint16_t conn_handle, ble_lbs_t * p_lbs, uint8_t new_state);
- typedef struct
- {
- ble_lbs_led_write_handler_t led_write_handler;
- } ble_lbs_init_t;
- struct ble_lbs_s
- {
- uint16_t service_handle;
- ble_gatts_char_handles_t led_char_handles;
- ble_gatts_char_handles_t button_char_handles;
- uint8_t uuid_type;
- ble_lbs_led_write_handler_t led_write_handler;
- };
- uint32_t ble_lbs_init(ble_lbs_t * p_lbs, const ble_lbs_init_t * p_lbs_init);
- void ble_lbs_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context);
- uint32_t ble_lbs_on_button_change(uint16_t conn_handle, ble_lbs_t * p_lbs, uint8_t button_state);
- #ifdef __cplusplus
- }
- #endif
- #endif
|