73 lines
2.2 KiB
C
73 lines
2.2 KiB
C
/**
|
|
* @file app_cls.h
|
|
* @brief CAIIC Link Service (CLS) application module: custom 128-bit UUID GATT
|
|
* service built on the SDK rdtss profile engine.
|
|
*
|
|
* Service: 0000CA10-CA11-4B11-8000-CA11CA11CA11
|
|
* Write char: 0000CA11-CA11-4B11-8000-CA11CA11CA11 (Write Without Response)
|
|
* Notify char: 0000CA12-CA11-4B11-8000-CA11CA11CA11 (Notify + CCCD)
|
|
*/
|
|
#ifndef APP_CLS_H_
|
|
#define APP_CLS_H_
|
|
|
|
#include "rwip_config.h" // SW configuration
|
|
|
|
#if (BLE_RDTSS_SERVER)
|
|
|
|
#include <stdint.h>
|
|
|
|
/* 128-bit UUIDs, LSB first (attribute table byte order, same as rdtss demo) */
|
|
#define ATT_SERVICE_CLS_128 {0x10,0xCA,0x00,0x00, 0x11,0xCA, 0x11,0x4B, 0x00,0x80, 0x11,0xCA,0x11,0xCA,0x11,0xCA} /*!< Service UUID */
|
|
#define ATT_CHAR_CLS_WRITE_128 {0x11,0xCA,0x00,0x00, 0x11,0xCA, 0x11,0x4B, 0x00,0x80, 0x11,0xCA,0x11,0xCA,0x11,0xCA} /*!< Write characteristic value UUID */
|
|
#define ATT_CHAR_CLS_NTF_128 {0x12,0xCA,0x00,0x00, 0x11,0xCA, 0x11,0x4B, 0x00,0x80, 0x11,0xCA,0x11,0xCA,0x11,0xCA} /*!< Notify characteristic value UUID */
|
|
|
|
/// CLS Service Attributes Indexes
|
|
enum
|
|
{
|
|
CLS_IDX_SVC,
|
|
|
|
CLS_IDX_WRITE_CHAR,
|
|
CLS_IDX_WRITE_VAL,
|
|
CLS_IDX_WRITE_CFG,
|
|
|
|
CLS_IDX_NTF_CHAR,
|
|
CLS_IDX_NTF_VAL,
|
|
CLS_IDX_NTF_CFG,
|
|
|
|
CLS_IDX_NB,
|
|
};
|
|
|
|
/* Downlink (phone -> device) write callback */
|
|
typedef void (*app_cls_rx_cb_t)(const uint8_t *data, uint16_t len);
|
|
|
|
/**
|
|
* @brief Register the CLS profile task and its get-itf function.
|
|
*/
|
|
void app_cls_init(void);
|
|
|
|
/**
|
|
* @brief Add a CLS service instance into the GATT database.
|
|
*/
|
|
void app_cls_add_cls(void);
|
|
|
|
/**
|
|
* @brief Send one notification packet on the notify characteristic.
|
|
* @return 0 if the packet was queued to the profile, -1 if notify is not
|
|
* enabled by the peer or a previous packet is still in flight.
|
|
*/
|
|
int app_cls_send_notify(const uint8_t *data, uint16_t length);
|
|
|
|
/**
|
|
* @brief Register the callback invoked when the peer writes the write char.
|
|
*/
|
|
void app_cls_set_rx_callback(app_cls_rx_cb_t cb);
|
|
|
|
/**
|
|
* @brief Reset the notify/busy state. Called on connection and disconnection.
|
|
*/
|
|
void app_cls_notify_state_reset(void);
|
|
|
|
#endif //BLE_RDTSS_SERVER
|
|
|
|
#endif // APP_CLS_H_
|