-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from soar-robotics:ble_services
Add BLE HRS support
- Loading branch information
Showing
4 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
#include <string.h> | ||
|
||
#include "esp_ble_conn_mgr.h" | ||
#include "custom_ble.h" | ||
|
||
static const esp_ble_conn_character_t nu_lookup_table[] = { | ||
{"A", BLE_CONN_UUID_TYPE_16, BLE_CONN_GATT_CHR_NOTIFY, {BLE_CURSTOM_CHR_UUID16_A}, NULL}, | ||
{"B", BLE_CONN_UUID_TYPE_16, BLE_CONN_GATT_CHR_READ, {BLE_CURSTOM_CHR_UUID16_B}, NULL}, | ||
{"C", BLE_CONN_UUID_TYPE_16, BLE_CONN_GATT_CHR_WRITE, {BLE_CURSTOM_CHR_UUID16_C}, NULL}, | ||
}; | ||
|
||
static const esp_ble_conn_svc_t svc = { | ||
.type = BLE_CONN_UUID_TYPE_16, | ||
.uuid = { | ||
.uuid16 = BLE_CURSTOM_UUID16, | ||
}, | ||
.nu_lookup_count = sizeof(nu_lookup_table) / sizeof(nu_lookup_table[0]), | ||
.nu_lookup = (esp_ble_conn_character_t *)nu_lookup_table}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
#define INTERVAL_MAX_NUM 7 | ||
|
||
/* 16 Bit Custom Service UUID */ | ||
#define BLE_CURSTOM_UUID16 0x18FF | ||
|
||
/* 16 Bit Custom Service Characteristic UUIDs */ | ||
#define BLE_CURSTOM_CHR_UUID16_A 0x2AFF | ||
#define BLE_CURSTOM_CHR_UUID16_B 0x2AFF | ||
#define BLE_CURSTOM_CHR_UUID16_C 0x2ACC | ||
|
||
typedef struct | ||
{ | ||
struct | ||
{ | ||
uint8_t supported : 1; | ||
} flags; | ||
|
||
uint16_t user_data; | ||
uint16_t interval_buf[INTERVAL_MAX_NUM]; | ||
} __attribute__((packed)) esp_ble_cust_svc_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters