Skip to content

Commit

Permalink
initial Bluepad32 BLE service
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoquesada committed Dec 25, 2023
1 parent 951ab27 commit 160d28c
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 39 deletions.
122 changes: 120 additions & 2 deletions src/components/bluepad32/bt/uni_bt_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,130 @@

#include "bt/uni_bt_service.h"

#include <inttypes.h>

#include <btstack.h>

#include "bt/uni_bt_service.gatt.h"
#include "uni_common.h"
#include "uni_log.h"

static int att_write_callback(hci_con_handle_t con_handle,
uint16_t att_handle,
uint16_t transaction_mode,
uint16_t offset,
uint8_t* buffer,
uint16_t buffer_size);
static uint16_t att_read_callback(hci_con_handle_t connection_handle,
uint16_t att_handle,
uint16_t offset,
uint8_t* buffer,
uint16_t buffer_size);
static void streamer(void);

// Flags general discoverable, BR/EDR supported (== not supported flag not set) when ENABLE_GATT_OVER_CLASSIC is enabled
#ifdef ENABLE_GATT_OVER_CLASSIC
#define APP_AD_FLAGS 0x02
#else
#define APP_AD_FLAGS 0x06
#endif

// clang-format off
// Not const since the local name will be overwritten with the local address
static uint8_t adv_data[] = {
// Flags general discoverable
0x02, BLUETOOTH_DATA_TYPE_FLAGS, APP_AD_FLAGS,
// Name
21, BLUETOOTH_DATA_TYPE_COMPLETE_LOCAL_NAME, 'B', 'l','u','e','p','a','d','3','2','-','X','X','X','X','X','X','X','X','X','X',
// Incomplete List of 16-bit Service Class UUIDs -- AC00 - only valid for testing!
3, BLUETOOTH_DATA_TYPE_INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS, 0x00, 0xac,
};
static const uint8_t adv_data_len = sizeof(adv_data);
// clang-format on

static bool service_enabled = true;

/* @section Main Application Setup
*
* @text Listing MainConfiguration shows main application code.
* It initializes L2CAP, the Security Manager, and configures the ATT Server with the pre-compiled
* ATT Database generated from $le_streamer.gatt$. Finally, it configures the advertisements
* and boots the Bluetooth stack.
*/
static void le_streamer_setup(void) {
// setup ATT server
att_server_init(profile_data, att_read_callback, att_write_callback);

// setup advertisements
uint16_t adv_int_min = 0x0030;
uint16_t adv_int_max = 0x0030;
uint8_t adv_type = 0;
bd_addr_t null_addr;
memset(null_addr, 0, 6);
gap_advertisements_set_params(adv_int_min, adv_int_max, adv_type, 0, null_addr, 0x07, 0x00);
gap_advertisements_set_data(adv_data_len, (uint8_t*)adv_data);
gap_advertisements_enable(true);
}

/*
* @section ATT Write
*
* @text The only valid ATT write in this example is to the Client Characteristic Configuration, which configures
* notification and indication. If the ATT handle matches the client configuration handle, the new configuration value
* is stored. If notifications get enabled, an ATT_EVENT_CAN_SEND_NOW is requested. See Listing attWrite.
*/
static int att_write_callback(hci_con_handle_t con_handle,
uint16_t att_handle,
uint16_t transaction_mode,
uint16_t offset,
uint8_t* buffer,
uint16_t buffer_size) {
ARG_UNUSED(offset);

switch (att_handle) {
case ATT_CHARACTERISTIC_4627C4A4_AC01_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
logi("Value handle: %04x, mode=%#x, offset=%d, buffer=%p, buffer_size=%d\n", att_handle, transaction_mode,
offset, buffer, buffer_size);
break;
default:
logi("Default Write to 0x%04x, len %u\n", att_handle, buffer_size);
break;
}
return 0;
}

/*
* @section ATT Read
*
* @text The ATT Server handles all reads to constant data. For dynamic data like the custom characteristic, the
* registered att_read_callback is called. To handle long characteristics and long reads, the att_read_callback is first
* called with buffer == NULL, to request the total value length. Then it will be called again requesting a chunk of the
* value. See Listing attRead.
*/
static uint16_t att_read_callback(hci_con_handle_t connection_handle,
uint16_t att_handle,
uint16_t offset,
uint8_t* buffer,
uint16_t buffer_size) {
ARG_UNUSED(connection_handle);

logi("att_read_callback\n");

static bool service_enabled;
if (att_handle == ATT_CHARACTERISTIC_4627C4A4_AC01_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE) {
logi("conn handle: %#x, att handle: %#x, offset: %d, buffer: %p, buffer size: %d\n", connection_handle,
att_handle, offset, buffer, buffer_size);
}
return 0;
}

void uni_bt_service_init(void) {}
void uni_bt_service_init(void) {
logi("**** SERVER INIT ****\n");
le_streamer_setup();
}

bool uni_bt_service_is_enabled() {
return service_enabled;
}
void uni_bt_service_set_enabled(bool enabled) {
service_enabled = enabled;
}
19 changes: 12 additions & 7 deletions src/components/bluepad32/bt/uni_bt_service.gatt
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
PRIMARY_SERVICE, GAP_SERVICE
CHARACTERISTIC, GAP_DEVICE_NAME, READ, "LE Streamer"
CHARACTERISTIC, GAP_DEVICE_NAME, READ, "Bluepad32"

PRIMARY_SERVICE, GATT_SERVICE
CHARACTERISTIC, GATT_DATABASE_HASH, READ,

// Test Service
PRIMARY_SERVICE, 0000FF10-0000-1000-8000-00805F9B34FB
// Test Characteristic A, write_without_response as well as notify
CHARACTERISTIC, 0000FF11-0000-1000-8000-00805F9B34FB, WRITE_WITHOUT_RESPONSE | NOTIFY | DYNAMIC,
// Test Characteristic B, write_without_response as well as notify
CHARACTERISTIC, 0000FF12-0000-1000-8000-00805F9B34FB, WRITE_WITHOUT_RESPONSE | NOTIFY | DYNAMIC,
// Bluepad32 Service
PRIMARY_SERVICE, 4627C4A4-AC00-46B9-B688-AFC5C1BF7F63
// Delete stored bonded keys
CHARACTERISTIC, 4627C4A4-AC01-46B9-B688-AFC5C1BF7F63, READ | WRITE | DYNAMIC

// add Battery Service
#import <battery_service.gatt>

// add Device ID Service
#import <device_information_service.gatt>

// add HID Service
// #import <hids.gatt>
9 changes: 8 additions & 1 deletion src/components/bluepad32/bt/uni_bt_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "bt/uni_bt_defines.h"
#include "bt/uni_bt_hci_cmd.h"
#include "bt/uni_bt_le.h"
#include "bt/uni_bt_service.h"
#include "platform/uni_platform.h"
#include "uni_common.h"
#include "uni_config.h"
Expand All @@ -39,7 +40,7 @@ static setup_state_t setup_state = SETUP_STATE_BTSTACK_IN_PROGRESS;
static btstack_packet_callback_registration_t hci_event_callback_registration;

// SDP
//#define MAX_ATTRIBUTE_VALUE_SIZE 300
// #define MAX_ATTRIBUTE_VALUE_SIZE 300
// static uint8_t hid_descriptor_storage[MAX_ATTRIBUTE_VALUE_SIZE];

static uint8_t setup_set_event_filter(void) {
Expand Down Expand Up @@ -124,6 +125,7 @@ bool uni_bt_setup_is_ready() {
int uni_bt_setup(void) {
bool bredr_enabled = false;
bool ble_enabled = false;
bool ble_service_enabled = false;

// Initialize L2CAP
l2cap_init();
Expand All @@ -132,6 +134,8 @@ int uni_bt_setup(void) {
bredr_enabled = uni_bt_bredr_is_enabled();
if (IS_ENABLED(UNI_ENABLE_BLE))
ble_enabled = uni_bt_le_is_enabled();
if (IS_ENABLED(UNI_ENABLE_BLE))
ble_service_enabled = uni_bt_service_is_enabled();

logi("Max connected gamepads: %d\n", CONFIG_BLUEPAD32_MAX_DEVICES);

Expand All @@ -148,6 +152,9 @@ int uni_bt_setup(void) {
if (IS_ENABLED(UNI_ENABLE_BLE) && ble_enabled)
uni_bt_le_setup();

if (IS_ENABLED(UNI_ENABLE_BLE) && ble_service_enabled)
uni_bt_service_init();

// Initialize HID Host
// hid_host_init(hid_descriptor_storage, sizeof(hid_descriptor_storage));
// hid_host_register_packet_handler(uni_bt_packet_handler);
Expand Down
137 changes: 108 additions & 29 deletions src/components/bluepad32/include/bt/uni_bt_service.gatt.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,103 @@ const uint8_t profile_data[] =
0x0a, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x28, 0x00, 0x18,
// 0x0002 CHARACTERISTIC-GAP_DEVICE_NAME - READ
0x0d, 0x00, 0x02, 0x00, 0x02, 0x00, 0x03, 0x28, 0x02, 0x03, 0x00, 0x00, 0x2a,
// 0x0003 VALUE CHARACTERISTIC-GAP_DEVICE_NAME - READ -'LE Streamer'
// 0x0003 VALUE CHARACTERISTIC-GAP_DEVICE_NAME - READ -'Bluepad32'
// READ_ANYBODY
0x13, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00, 0x2a, 0x4c, 0x45, 0x20, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x72,
0x11, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00, 0x2a, 0x42, 0x6c, 0x75, 0x65, 0x70, 0x61, 0x64, 0x33, 0x32,
// 0x0004 PRIMARY_SERVICE-GATT_SERVICE
0x0a, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x28, 0x01, 0x18,
// 0x0005 CHARACTERISTIC-GATT_DATABASE_HASH - READ
0x0d, 0x00, 0x02, 0x00, 0x05, 0x00, 0x03, 0x28, 0x02, 0x06, 0x00, 0x2a, 0x2b,
// 0x0006 VALUE CHARACTERISTIC-GATT_DATABASE_HASH - READ -''
// READ_ANYBODY
0x18, 0x00, 0x02, 0x00, 0x06, 0x00, 0x2a, 0x2b, 0x7a, 0xc0, 0xab, 0x87, 0xb3, 0x05, 0xc3, 0xdc, 0x91, 0xb5, 0xcf, 0xee, 0x52, 0xea, 0xbc, 0xf9,
// Test Service
// 0x0007 PRIMARY_SERVICE-0000FF10-0000-1000-8000-00805F9B34FB
0x18, 0x00, 0x02, 0x00, 0x07, 0x00, 0x00, 0x28, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x10, 0xff, 0x00, 0x00,
// Test Characteristic A, write_without_response as well as notify
// 0x0008 CHARACTERISTIC-0000FF11-0000-1000-8000-00805F9B34FB - WRITE_WITHOUT_RESPONSE | NOTIFY | DYNAMIC
0x1b, 0x00, 0x02, 0x00, 0x08, 0x00, 0x03, 0x28, 0x14, 0x09, 0x00, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x11, 0xff, 0x00, 0x00,
// 0x0009 VALUE CHARACTERISTIC-0000FF11-0000-1000-8000-00805F9B34FB - WRITE_WITHOUT_RESPONSE | NOTIFY | DYNAMIC
// WRITE_ANYBODY
0x16, 0x00, 0x04, 0x03, 0x09, 0x00, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x11, 0xff, 0x00, 0x00,
// 0x000a CLIENT_CHARACTERISTIC_CONFIGURATION
0x18, 0x00, 0x02, 0x00, 0x06, 0x00, 0x2a, 0x2b, 0xdc, 0xc4, 0xd4, 0x28, 0x75, 0xf7, 0xdb, 0x13, 0xc0, 0xfc, 0xf3, 0x6e, 0xfa, 0x30, 0xc1, 0x4f,
// Bluepad32 Service
// 0x0007 PRIMARY_SERVICE-4627C4A4-AC00-46B9-B688-AFC5C1BF7F63
0x18, 0x00, 0x02, 0x00, 0x07, 0x00, 0x00, 0x28, 0x63, 0x7f, 0xbf, 0xc1, 0xc5, 0xaf, 0x88, 0xb6, 0xb9, 0x46, 0x00, 0xac, 0xa4, 0xc4, 0x27, 0x46,
// Delete stored bonded keys
// 0x0008 CHARACTERISTIC-4627C4A4-AC01-46B9-B688-AFC5C1BF7F63 - READ | WRITE | DYNAMIC
0x1b, 0x00, 0x02, 0x00, 0x08, 0x00, 0x03, 0x28, 0x0a, 0x09, 0x00, 0x63, 0x7f, 0xbf, 0xc1, 0xc5, 0xaf, 0x88, 0xb6, 0xb9, 0x46, 0x01, 0xac, 0xa4, 0xc4, 0x27, 0x46,
// 0x0009 VALUE CHARACTERISTIC-4627C4A4-AC01-46B9-B688-AFC5C1BF7F63 - READ | WRITE | DYNAMIC
// READ_ANYBODY, WRITE_ANYBODY
0x0a, 0x00, 0x0e, 0x01, 0x0a, 0x00, 0x02, 0x29, 0x00, 0x00,
// Test Characteristic B, write_without_response as well as notify
// 0x000b CHARACTERISTIC-0000FF12-0000-1000-8000-00805F9B34FB - WRITE_WITHOUT_RESPONSE | NOTIFY | DYNAMIC
0x1b, 0x00, 0x02, 0x00, 0x0b, 0x00, 0x03, 0x28, 0x14, 0x0c, 0x00, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x12, 0xff, 0x00, 0x00,
// 0x000c VALUE CHARACTERISTIC-0000FF12-0000-1000-8000-00805F9B34FB - WRITE_WITHOUT_RESPONSE | NOTIFY | DYNAMIC
// WRITE_ANYBODY
0x16, 0x00, 0x04, 0x03, 0x0c, 0x00, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x12, 0xff, 0x00, 0x00,
0x16, 0x00, 0x0a, 0x03, 0x09, 0x00, 0x63, 0x7f, 0xbf, 0xc1, 0xc5, 0xaf, 0x88, 0xb6, 0xb9, 0x46, 0x01, 0xac, 0xa4, 0xc4, 0x27, 0x46,
// add Battery Service


// #import <battery_service.gatt> -- BEGIN
// Specification Type org.bluetooth.service.battery_service
// https://www.bluetooth.com/api/gatt/xmlfile?xmlFileName=org.bluetooth.service.battery_service.xml
// Battery Service 180F
// 0x000a PRIMARY_SERVICE-ORG_BLUETOOTH_SERVICE_BATTERY_SERVICE
0x0a, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x28, 0x0f, 0x18,
// 0x000b CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_BATTERY_LEVEL - DYNAMIC | READ | NOTIFY
0x0d, 0x00, 0x02, 0x00, 0x0b, 0x00, 0x03, 0x28, 0x12, 0x0c, 0x00, 0x19, 0x2a,
// 0x000c VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_BATTERY_LEVEL - DYNAMIC | READ | NOTIFY
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x0c, 0x00, 0x19, 0x2a,
// 0x000d CLIENT_CHARACTERISTIC_CONFIGURATION
// READ_ANYBODY, WRITE_ANYBODY
0x0a, 0x00, 0x0e, 0x01, 0x0d, 0x00, 0x02, 0x29, 0x00, 0x00,
// #import <battery_service.gatt> -- END
// add Device ID Service


// #import <device_information_service.gatt> -- BEGIN
// Specification Type org.bluetooth.service.device_information
// https://www.bluetooth.com/api/gatt/xmlfile?xmlFileName=org.bluetooth.service.device_information.xml
// Device Information 180A
// 0x000e PRIMARY_SERVICE-ORG_BLUETOOTH_SERVICE_DEVICE_INFORMATION
0x0a, 0x00, 0x02, 0x00, 0x0e, 0x00, 0x00, 0x28, 0x0a, 0x18,
// 0x000f CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_MANUFACTURER_NAME_STRING - DYNAMIC | READ
0x0d, 0x00, 0x02, 0x00, 0x0f, 0x00, 0x03, 0x28, 0x02, 0x10, 0x00, 0x29, 0x2a,
// 0x0010 VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_MANUFACTURER_NAME_STRING - DYNAMIC | READ
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x10, 0x00, 0x29, 0x2a,
// 0x0011 CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_MODEL_NUMBER_STRING - DYNAMIC | READ
0x0d, 0x00, 0x02, 0x00, 0x11, 0x00, 0x03, 0x28, 0x02, 0x12, 0x00, 0x24, 0x2a,
// 0x0012 VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_MODEL_NUMBER_STRING - DYNAMIC | READ
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x12, 0x00, 0x24, 0x2a,
// 0x0013 CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_SERIAL_NUMBER_STRING - DYNAMIC | READ
0x0d, 0x00, 0x02, 0x00, 0x13, 0x00, 0x03, 0x28, 0x02, 0x14, 0x00, 0x25, 0x2a,
// 0x0014 VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_SERIAL_NUMBER_STRING - DYNAMIC | READ
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x14, 0x00, 0x25, 0x2a,
// 0x0015 CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_HARDWARE_REVISION_STRING - DYNAMIC | READ
0x0d, 0x00, 0x02, 0x00, 0x15, 0x00, 0x03, 0x28, 0x02, 0x16, 0x00, 0x27, 0x2a,
// 0x0016 VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_HARDWARE_REVISION_STRING - DYNAMIC | READ
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x16, 0x00, 0x27, 0x2a,
// 0x0017 CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_FIRMWARE_REVISION_STRING - DYNAMIC | READ
0x0d, 0x00, 0x02, 0x00, 0x17, 0x00, 0x03, 0x28, 0x02, 0x18, 0x00, 0x26, 0x2a,
// 0x0018 VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_FIRMWARE_REVISION_STRING - DYNAMIC | READ
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x18, 0x00, 0x26, 0x2a,
// 0x0019 CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_SOFTWARE_REVISION_STRING - DYNAMIC | READ
0x0d, 0x00, 0x02, 0x00, 0x19, 0x00, 0x03, 0x28, 0x02, 0x1a, 0x00, 0x28, 0x2a,
// 0x001a VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_SOFTWARE_REVISION_STRING - DYNAMIC | READ
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x1a, 0x00, 0x28, 0x2a,
// 0x001b CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_SYSTEM_ID - DYNAMIC | READ
0x0d, 0x00, 0x02, 0x00, 0x1b, 0x00, 0x03, 0x28, 0x02, 0x1c, 0x00, 0x23, 0x2a,
// 0x001c VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_SYSTEM_ID - DYNAMIC | READ
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x1c, 0x00, 0x23, 0x2a,
// 0x001d CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_IEEE_11073_20601_REGULATORY_CERTIFICATION_DATA_LIST - DYNAMIC | READ
0x0d, 0x00, 0x02, 0x00, 0x1d, 0x00, 0x03, 0x28, 0x02, 0x1e, 0x00, 0x2a, 0x2a,
// 0x001e VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_IEEE_11073_20601_REGULATORY_CERTIFICATION_DATA_LIST - DYNAMIC | READ
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x1e, 0x00, 0x2a, 0x2a,
// 0x001f CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_PNP_ID - DYNAMIC | READ
0x0d, 0x00, 0x02, 0x00, 0x1f, 0x00, 0x03, 0x28, 0x02, 0x20, 0x00, 0x50, 0x2a,
// 0x0020 VALUE CHARACTERISTIC-ORG_BLUETOOTH_CHARACTERISTIC_PNP_ID - DYNAMIC | READ
// READ_ANYBODY
0x08, 0x00, 0x02, 0x01, 0x20, 0x00, 0x50, 0x2a,
// #import <device_information_service.gatt> -- END
// add HID Service
// #import <hids.gatt>
// END
0x00, 0x00,
}; // total size 126 bytes
}; // total size 249 bytes


//
Expand All @@ -73,17 +136,33 @@ const uint8_t profile_data[] =
#define ATT_SERVICE_GATT_SERVICE_END_HANDLE 0x0006
#define ATT_SERVICE_GATT_SERVICE_01_START_HANDLE 0x0004
#define ATT_SERVICE_GATT_SERVICE_01_END_HANDLE 0x0006
#define ATT_SERVICE_0000FF10_0000_1000_8000_00805F9B34FB_START_HANDLE 0x0007
#define ATT_SERVICE_0000FF10_0000_1000_8000_00805F9B34FB_END_HANDLE 0x000d
#define ATT_SERVICE_0000FF10_0000_1000_8000_00805F9B34FB_01_START_HANDLE 0x0007
#define ATT_SERVICE_0000FF10_0000_1000_8000_00805F9B34FB_01_END_HANDLE 0x000d
#define ATT_SERVICE_4627C4A4_AC00_46B9_B688_AFC5C1BF7F63_START_HANDLE 0x0007
#define ATT_SERVICE_4627C4A4_AC00_46B9_B688_AFC5C1BF7F63_END_HANDLE 0x0009
#define ATT_SERVICE_4627C4A4_AC00_46B9_B688_AFC5C1BF7F63_01_START_HANDLE 0x0007
#define ATT_SERVICE_4627C4A4_AC00_46B9_B688_AFC5C1BF7F63_01_END_HANDLE 0x0009
#define ATT_SERVICE_ORG_BLUETOOTH_SERVICE_BATTERY_SERVICE_START_HANDLE 0x000a
#define ATT_SERVICE_ORG_BLUETOOTH_SERVICE_BATTERY_SERVICE_END_HANDLE 0x000d
#define ATT_SERVICE_ORG_BLUETOOTH_SERVICE_BATTERY_SERVICE_01_START_HANDLE 0x000a
#define ATT_SERVICE_ORG_BLUETOOTH_SERVICE_BATTERY_SERVICE_01_END_HANDLE 0x000d
#define ATT_SERVICE_ORG_BLUETOOTH_SERVICE_DEVICE_INFORMATION_START_HANDLE 0x000e
#define ATT_SERVICE_ORG_BLUETOOTH_SERVICE_DEVICE_INFORMATION_END_HANDLE 0x0020
#define ATT_SERVICE_ORG_BLUETOOTH_SERVICE_DEVICE_INFORMATION_01_START_HANDLE 0x000e
#define ATT_SERVICE_ORG_BLUETOOTH_SERVICE_DEVICE_INFORMATION_01_END_HANDLE 0x0020

//
// list mapping between characteristics and handles
//
#define ATT_CHARACTERISTIC_GAP_DEVICE_NAME_01_VALUE_HANDLE 0x0003
#define ATT_CHARACTERISTIC_GATT_DATABASE_HASH_01_VALUE_HANDLE 0x0006
#define ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_VALUE_HANDLE 0x0009
#define ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_CLIENT_CONFIGURATION_HANDLE 0x000a
#define ATT_CHARACTERISTIC_0000FF12_0000_1000_8000_00805F9B34FB_01_VALUE_HANDLE 0x000c
#define ATT_CHARACTERISTIC_0000FF12_0000_1000_8000_00805F9B34FB_01_CLIENT_CONFIGURATION_HANDLE 0x000d
#define ATT_CHARACTERISTIC_4627C4A4_AC01_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE 0x0009
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_BATTERY_LEVEL_01_VALUE_HANDLE 0x000c
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_BATTERY_LEVEL_01_CLIENT_CONFIGURATION_HANDLE 0x000d
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_MANUFACTURER_NAME_STRING_01_VALUE_HANDLE 0x0010
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_MODEL_NUMBER_STRING_01_VALUE_HANDLE 0x0012
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_SERIAL_NUMBER_STRING_01_VALUE_HANDLE 0x0014
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_HARDWARE_REVISION_STRING_01_VALUE_HANDLE 0x0016
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_FIRMWARE_REVISION_STRING_01_VALUE_HANDLE 0x0018
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_SOFTWARE_REVISION_STRING_01_VALUE_HANDLE 0x001a
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_SYSTEM_ID_01_VALUE_HANDLE 0x001c
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_IEEE_11073_20601_REGULATORY_CERTIFICATION_DATA_LIST_01_VALUE_HANDLE 0x001e
#define ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_PNP_ID_01_VALUE_HANDLE 0x0020
1 change: 1 addition & 0 deletions src/components/bluepad32/include/bt/uni_bt_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extern "C" {
#include <stdbool.h>

void uni_bt_service_init(void);
bool uni_bt_service_is_enabled();
void uni_bt_service_set_enabled(bool enabled);

#ifdef __cplusplus
Expand Down

0 comments on commit 160d28c

Please sign in to comment.