54 lines
1.4 KiB
C
54 lines
1.4 KiB
C
#include "BLE.h"
|
|
#include "BLE_UUID.h"
|
|
|
|
#include "host/ble_gatt.h"
|
|
#include "host/ble_uuid.h"
|
|
|
|
int gatt_char_access_placeholder(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg){
|
|
int rc = 0;
|
|
|
|
switch(ctxt->op){
|
|
case BLE_GATT_ACCESS_OP_READ_CHR:
|
|
;
|
|
break;
|
|
case BLE_GATT_ACCESS_OP_READ_DSC:
|
|
;
|
|
break;
|
|
}
|
|
|
|
return rc ? BLE_ATT_ERR_INSUFFICIENT_RES : 0;
|
|
}
|
|
|
|
struct ble_gatt_svc_def gatt_svcs[] = {
|
|
[RAW_VALUES_SVC_ID] = {
|
|
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
|
.uuid = BLE_UUID16_DECLARE(METROLOGY_SERVICE),
|
|
},
|
|
[CALC_VALUES_SVC_ID] = {
|
|
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
|
.uuid = BLE_UUID16_DECLARE(METROLOGY_SERVICE),
|
|
},
|
|
[CONFIGURATION_SVC_ID] = {
|
|
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
|
.uuid = BLE_UUID16_DECLARE(CONFIGURATION_SERVICE),
|
|
.characteristics = (struct ble_gatt_chr_def[]){
|
|
[0] = {
|
|
.uuid = BLE_UUID16_DECLARE(SWITCHING_FREQUENCY_CHAR),
|
|
.access_cb = gatt_char_access_placeholder,
|
|
.flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_WRITE,
|
|
.min_key_size = 0,
|
|
.arg = NULL,
|
|
.descriptors = (struct ble_gatt_dsc_def[]){
|
|
[0] = {
|
|
.uuid = BLE_UUID16_DECLARE(CHAR_PRES_FORMAT),
|
|
.att_flags = BLE_GATT_CHR_F_READ,
|
|
.access_cb = gatt_char_access_placeholder,
|
|
},
|
|
{ 0 },
|
|
},
|
|
},
|
|
{ 0 },
|
|
},
|
|
},
|
|
{ 0 },
|
|
}; |