Skip to content

Commit b83536e

Browse files
committed
drv/bluetooth: add new Pybricks capabilities characteristic
This adds a new Pybricks capabilities characteristic to the Pybricks BLE service. This characteristic allows reading the hub capabilities that are defined by the application.
1 parent ed2e584 commit b83536e

15 files changed

Lines changed: 230 additions & 42 deletions

File tree

‎bricks/cityhub/pbsys_app_config.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
#define PBSYS_APP_HUB_FEATURE_FLAGS (PBIO_PYBRICKS_FEATURE_REPL | PBIO_PYBRICKS_FEATURE_USER_PROG_FORMAT_MULTI_MPY_V6)
3+
#define PBSYS_APP_USER_PROGRAM_SIZE (16 * 1024 - 512)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
#define PBSYS_APP_HUB_FEATURE_FLAGS (PBIO_PYBRICKS_FEATURE_REPL | PBIO_PYBRICKS_FEATURE_USER_PROG_FORMAT_MULTI_MPY_V6)
3+
#define PBSYS_APP_USER_PROGRAM_SIZE (255 * 1024)

‎bricks/movehub/pbsys_app_config.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
#define PBSYS_APP_HUB_FEATURE_FLAGS (PBIO_PYBRICKS_FEATURE_USER_PROG_FORMAT_MULTI_MPY_V6)
3+
#define PBSYS_APP_USER_PROGRAM_SIZE (4 * 1024 - 128)

‎bricks/primehub/pbsys_app_config.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
#define PBSYS_APP_HUB_FEATURE_FLAGS (PBIO_PYBRICKS_FEATURE_REPL | PBIO_PYBRICKS_FEATURE_USER_PROG_FORMAT_MULTI_MPY_V6)
3+
#define PBSYS_APP_USER_PROGRAM_SIZE (255 * 1024)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
#define PBSYS_APP_HUB_FEATURE_FLAGS (PBIO_PYBRICKS_FEATURE_REPL | PBIO_PYBRICKS_FEATURE_USER_PROG_FORMAT_MULTI_MPY_V6)
3+
#define PBSYS_APP_USER_PROGRAM_SIZE (16 * 1024 - 512)

‎lib/ble5stack/central/att.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ extern "C"
151151
* Refer to ble_user_config.h for the device-specific maximum MTU value.
152152
*/
153153
#define ATT_MTU_SIZE 23 //L2CAP_MTU_SIZE //!< Minimum ATT MTU size
154-
//#define ATT_MAX_MTU_SIZE (255-L2CAP_HDR_SIZE) //!< Maximum ATT MTU size
154+
#define ATT_MAX_MTU_SIZE 158 //(255-L2CAP_HDR_SIZE) //!< Maximum ATT MTU size
155+
// Pybricks: official LEGO firmware uses 158
155156
/** @} End ATT_MTU_Sizes */
156157

157158
/**

‎lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c‎

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <pbio/task.h>
2323
#include <pbio/util.h>
2424
#include <pbio/version.h>
25+
#include <pbsys/app.h>
2526

2627
#include <contiki.h>
2728
#include <lego_lwp3.h>
@@ -94,7 +95,9 @@ static uint16_t remote_handle;
9495
static uint16_t remote_lwp3_char_handle;
9596

9697
// Pybricks GATT service handles
97-
static uint16_t pybricks_service_handle, pybricks_char_handle;
98+
static uint16_t pybricks_service_handle;
99+
static uint16_t pybricks_command_event_char_handle;
100+
static uint16_t pybricks_hub_capabilities_char_handle;
98101

99102
// Nordic UART GATT service handles
100103
static uint16_t uart_service_handle, uart_rx_char_handle, uart_tx_char_handle;
@@ -339,7 +342,7 @@ static PT_THREAD(send_value_notification(struct pt *pt, pbio_task_t *task))
339342
goto done;
340343
}
341344
service_handle = pybricks_service_handle;
342-
attr_handle = pybricks_char_handle;
345+
attr_handle = pybricks_command_event_char_handle;
343346
} else if (send->connection == PBDRV_BLUETOOTH_CONNECTION_UART) {
344347
if (!uart_tx_notify_en) {
345348
goto done;
@@ -807,24 +810,47 @@ static PT_THREAD(init_pybricks_service(struct pt *pt)) {
807810
};
808811

809812
// c5f50002-8280-46da-89f4-6d8051e4aeef
810-
static const uint8_t pybricks_char_uuid[] = {
813+
static const uint8_t pybricks_command_event_char_uuid[] = {
811814
0xef, 0xae, 0xe4, 0x51, 0x80, 0x6d, 0xf4, 0x89,
812815
0xda, 0x46, 0x80, 0x82, 0x02, 0x00, 0xf5, 0xc5
813816
};
814817

818+
// c5f50003-8280-46da-89f4-6d8051e4aeef
819+
static const uint8_t pybricks_hub_capabilities_char_uuid[] = {
820+
0xef, 0xae, 0xe4, 0x51, 0x80, 0x6d, 0xf4, 0x89,
821+
0xda, 0x46, 0x80, 0x82, 0x03, 0x00, 0xf5, 0xc5
822+
};
823+
815824
PT_BEGIN(pt);
816825

817826
PT_WAIT_WHILE(pt, write_xfer_size);
818-
aci_gatt_add_serv_begin(UUID_TYPE_128, pybricks_service_uuid, PRIMARY_SERVICE, 4);
827+
aci_gatt_add_serv_begin(UUID_TYPE_128, pybricks_service_uuid, PRIMARY_SERVICE, 6);
819828
PT_WAIT_UNTIL(pt, hci_command_complete);
820829
aci_gatt_add_serv_end(&pybricks_service_handle);
821830

822831
PT_WAIT_WHILE(pt, write_xfer_size);
823-
aci_gatt_add_char_begin(pybricks_service_handle, UUID_TYPE_128, pybricks_char_uuid,
832+
aci_gatt_add_char_begin(pybricks_service_handle, UUID_TYPE_128, pybricks_command_event_char_uuid,
824833
NUS_CHAR_SIZE, CHAR_PROP_WRITE_WITHOUT_RESP | CHAR_PROP_WRITE | CHAR_PROP_NOTIFY, ATTR_PERMISSION_NONE,
825834
GATT_NOTIFY_ATTRIBUTE_WRITE, MIN_ENCRY_KEY_SIZE, CHAR_VALUE_LEN_VARIABLE);
826835
PT_WAIT_UNTIL(pt, hci_command_complete);
827-
aci_gatt_add_char_end(&pybricks_char_handle);
836+
aci_gatt_add_char_end(&pybricks_command_event_char_handle);
837+
838+
PT_WAIT_WHILE(pt, write_xfer_size);
839+
aci_gatt_add_char_begin(pybricks_service_handle, UUID_TYPE_128, pybricks_hub_capabilities_char_uuid,
840+
PBIO_PYBRICKS_HUB_CAPABILITIES_VALUE_SIZE, CHAR_PROP_READ, ATTR_PERMISSION_NONE,
841+
GATT_DONT_NOTIFY_EVENTS, MIN_ENCRY_KEY_SIZE, CHAR_VALUE_LEN_CONSTANT);
842+
PT_WAIT_UNTIL(pt, hci_command_complete);
843+
aci_gatt_add_char_end(&pybricks_hub_capabilities_char_handle);
844+
845+
PT_WAIT_WHILE(pt, write_xfer_size);
846+
{
847+
uint8_t buf[PBIO_PYBRICKS_HUB_CAPABILITIES_VALUE_SIZE];
848+
pbio_pybricks_hub_capabilities(buf, ATT_MTU - 3, PBSYS_APP_HUB_FEATURE_FLAGS, PBSYS_APP_USER_PROGRAM_SIZE);
849+
aci_gatt_update_char_value_begin(pybricks_service_handle, pybricks_hub_capabilities_char_handle,
850+
0, PBIO_PYBRICKS_HUB_CAPABILITIES_VALUE_SIZE, buf);
851+
}
852+
PT_WAIT_UNTIL(pt, hci_command_complete);
853+
aci_gatt_update_char_value_end();
828854

829855
PT_END(pt);
830856
}
@@ -886,11 +912,11 @@ static void handle_event(hci_event_pckt *event) {
886912

887913
case EVT_BLUE_GATT_ATTRIBUTE_MODIFIED: {
888914
evt_gatt_attr_modified *subevt = (evt_gatt_attr_modified *)evt->data;
889-
if (subevt->attr_handle == pybricks_char_handle + 1) {
915+
if (subevt->attr_handle == pybricks_command_event_char_handle + 1) {
890916
if (receive_handler) {
891917
receive_handler(PBDRV_BLUETOOTH_CONNECTION_PYBRICKS, subevt->att_data, subevt->data_length);
892918
}
893-
} else if (subevt->attr_handle == pybricks_char_handle + 2) {
919+
} else if (subevt->attr_handle == pybricks_command_event_char_handle + 2) {
894920
pybricks_notify_en = subevt->att_data[0];
895921
} else if (subevt->attr_handle == uart_rx_char_handle + 1) {
896922
if (receive_handler) {

‎lib/pbio/drv/bluetooth/bluetooth_stm32_cc2640.c‎

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <pbio/task.h>
2424
#include <pbio/util.h>
2525
#include <pbio/version.h>
26+
#include <pbsys/app.h>
2627

2728
#include <contiki.h>
2829
#include <lego_lwp3.h>
@@ -131,7 +132,8 @@ static uint16_t gap_service_handle, gap_service_end_handle;
131132
// Device information service handles
132133
static uint16_t dev_info_service_handle, dev_info_service_end_handle;
133134
// Pybricks service handles
134-
static uint16_t pybricks_service_handle, pybricks_service_end_handle, pybricks_char_handle;
135+
static uint16_t pybricks_service_handle, pybricks_service_end_handle;
136+
static uint16_t pybricks_command_event_char_handle, pybricks_capabilities_char_handle;
135137
// Pybricks tx notifications enabled
136138
static bool pybricks_notify_en;
137139
// Nordic UART service handles
@@ -379,7 +381,7 @@ static PT_THREAD(send_value_notification(struct pt *pt, pbio_task_t *task))
379381
task->status = PBIO_ERROR_INVALID_OP;
380382
goto done;
381383
}
382-
attr_handle = pybricks_char_handle;
384+
attr_handle = pybricks_command_event_char_handle;
383385
} else if (send->connection == PBDRV_BLUETOOTH_CONNECTION_UART) {
384386
if (!uart_tx_notify_en) {
385387
task->status = PBIO_ERROR_INVALID_OP;
@@ -808,9 +810,12 @@ static void handle_event(uint8_t *packet) {
808810

809811
switch (event_code) {
810812
case ATT_EVENT_EXCHANGE_MTU_REQ: {
813+
// uint16_t client_mtu = (data[7] << 8) | data[6];
811814
attExchangeMTURsp_t rsp;
812815

813-
rsp.serverRxMTU = 158;
816+
rsp.serverRxMTU = ATT_MAX_MTU_SIZE;
817+
// REVISIT: may need to keep a table of min(client_mtu, MAX_ATT_MTU_SIZE)
818+
// for each connection if any known clients have smaller MTU
814819
ATT_ExchangeMTURsp(connection_handle, &rsp);
815820
}
816821
break;
@@ -867,7 +872,11 @@ static void handle_event(uint8_t *packet) {
867872
} else if (start_handle <= pybricks_service_handle + 1) {
868873
read_by_type_response_uuid128(connection_handle, pybricks_service_handle + 1,
869874
GATT_PROP_WRITE_NO_RSP | GATT_PROP_WRITE | GATT_PROP_NOTIFY,
870-
pbio_pybricks_control_char_uuid);
875+
pbio_pybricks_command_event_char_uuid);
876+
} else if (start_handle <= pybricks_service_handle + 4) {
877+
read_by_type_response_uuid128(connection_handle, pybricks_service_handle + 4,
878+
GATT_PROP_READ,
879+
pbio_pybricks_hub_capabilities_char_uuid);
871880
} else if (start_handle <= uart_service_handle + 1) {
872881
read_by_type_response_uuid128(connection_handle, uart_service_handle + 1,
873882
GATT_PROP_WRITE_NO_RSP, pbio_nus_rx_char_uuid);
@@ -971,7 +980,7 @@ static void handle_event(uint8_t *packet) {
971980
rsp.len = 7;
972981
rsp.pValue = buf;
973982
ATT_ReadRsp(connection_handle, &rsp);
974-
} else if (handle == pybricks_char_handle + 1) {
983+
} else if (handle == pybricks_command_event_char_handle + 1) {
975984
attReadRsp_t rsp;
976985
uint8_t buf[ATT_MTU_SIZE - 1];
977986

@@ -980,6 +989,15 @@ static void handle_event(uint8_t *packet) {
980989
rsp.len = 2;
981990
rsp.pValue = buf;
982991
ATT_ReadRsp(connection_handle, &rsp);
992+
} else if (handle == pybricks_capabilities_char_handle + 1) {
993+
attReadRsp_t rsp;
994+
uint8_t buf[PBIO_PYBRICKS_HUB_CAPABILITIES_VALUE_SIZE];
995+
996+
// REVISIT: client MTU may be smaller, in which case we can't used fixed value for MTU
997+
pbio_pybricks_hub_capabilities(buf, ATT_MAX_MTU_SIZE - 3, PBSYS_APP_HUB_FEATURE_FLAGS, PBSYS_APP_USER_PROGRAM_SIZE);
998+
rsp.len = sizeof(buf);
999+
rsp.pValue = buf;
1000+
ATT_ReadRsp(connection_handle, &rsp);
9831001
} else if (handle == uart_tx_char_handle + 1) {
9841002
attReadRsp_t rsp;
9851003
uint8_t buf[ATT_MTU_SIZE - 1];
@@ -1089,11 +1107,11 @@ static void handle_event(uint8_t *packet) {
10891107
uint16_t char_handle = (data[9] << 8) | data[8];
10901108

10911109
DBG("w: %04X %04X %d", char_handle, uart_tx_char_handle, pdu_len - 4);
1092-
if (char_handle == pybricks_char_handle) {
1110+
if (char_handle == pybricks_command_event_char_handle) {
10931111
if (receive_handler) {
10941112
receive_handler(PBDRV_BLUETOOTH_CONNECTION_PYBRICKS, &data[10], pdu_len - 4);
10951113
}
1096-
} else if (char_handle == pybricks_char_handle + 1) {
1114+
} else if (char_handle == pybricks_command_event_char_handle + 1) {
10971115
pybricks_notify_en = data[10];
10981116
DBG("noti: %d", pybricks_notify_en);
10991117
} else if (char_handle == uart_rx_char_handle) {
@@ -1529,7 +1547,7 @@ static PT_THREAD(init_pybricks_service(struct pt *pt)) {
15291547
PT_BEGIN(pt);
15301548

15311549
PT_WAIT_WHILE(pt, write_xfer_size);
1532-
GATT_AddService(GATT_PRIMARY_SERVICE_UUID, 4, GATT_MIN_ENCRYPT_KEY_SIZE);
1550+
GATT_AddService(GATT_PRIMARY_SERVICE_UUID, 6, GATT_MIN_ENCRYPT_KEY_SIZE);
15331551
PT_WAIT_UNTIL(pt, hci_command_status);
15341552
// ignoring response data
15351553

@@ -1539,19 +1557,30 @@ static PT_THREAD(init_pybricks_service(struct pt *pt)) {
15391557
// ignoring response data
15401558

15411559
PT_WAIT_WHILE(pt, write_xfer_size);
1542-
GATT_AddAttribute2(pbio_pybricks_control_char_uuid, GATT_PERMIT_READ | GATT_PERMIT_WRITE);
1560+
GATT_AddAttribute2(pbio_pybricks_command_event_char_uuid, GATT_PERMIT_READ | GATT_PERMIT_WRITE);
15431561
PT_WAIT_UNTIL(pt, hci_command_status);
15441562
// ignoring response data
15451563

15461564
PT_WAIT_WHILE(pt, write_xfer_size);
15471565
GATT_AddAttribute(GATT_CLIENT_CHAR_CFG_UUID, GATT_PERMIT_READ | GATT_PERMIT_WRITE);
15481566
PT_WAIT_UNTIL(pt, hci_command_status);
15491567

1568+
PT_WAIT_WHILE(pt, write_xfer_size);
1569+
GATT_AddAttribute(GATT_CHARACTER_UUID, GATT_PERMIT_READ);
1570+
PT_WAIT_UNTIL(pt, hci_command_status);
1571+
// ignoring response data
1572+
1573+
PT_WAIT_WHILE(pt, write_xfer_size);
1574+
GATT_AddAttribute2(pbio_pybricks_hub_capabilities_char_uuid, GATT_PERMIT_READ | GATT_PERMIT_WRITE);
1575+
PT_WAIT_UNTIL(pt, hci_command_status);
1576+
// ignoring response data
1577+
15501578
// the response to the last GATT_AddAttribute contains the first and last handles
15511579
// that were allocated.
15521580
pybricks_service_handle = (read_buf[13] << 8) | read_buf[12];
15531581
pybricks_service_end_handle = (read_buf[15] << 8) | read_buf[14];
1554-
pybricks_char_handle = pybricks_service_handle + 2;
1582+
pybricks_command_event_char_handle = pybricks_service_handle + 2;
1583+
pybricks_capabilities_char_handle = pybricks_service_handle + 4;
15551584
DBG("pybricks: %04X", pybricks_service_handle);
15561585

15571586
PT_END(pt);

‎lib/pbio/drv/bluetooth/pybricks_service.gatt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ CHARACTERISTIC, ORG_BLUETOOTH_CHARACTERISTIC_PNP_ID, DYNAMIC | READ,
1010
// Pybricks service
1111
PRIMARY_SERVICE, C5F50001-8280-46DA-89F4-6D8051E4AEEF
1212
CHARACTERISTIC, C5F50002-8280-46DA-89F4-6D8051E4AEEF, NOTIFY | WRITE | WRITE_WITHOUT_RESPONSE | DYNAMIC,
13+
CHARACTERISTIC, C5F50003-8280-46DA-89F4-6D8051E4AEEF, READ | DYNAMIC,
1314

1415
#import <nordic_spp_service.gatt>

‎lib/pbio/drv/bluetooth/pybricks_service_server.c‎

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
#include <stdint.h>
5050
#include <string.h>
5151

52+
#include <pbsys/app.h>
53+
#include <pbio/math.h>
5254
#include <pbio/protocol.h>
5355

5456
#include "btstack_defines.h"
@@ -64,37 +66,45 @@ static att_service_handler_t pybricks_service;
6466
static pybricks_characteristic_write_callback_t client_callback;
6567
static pybricks_characteristic_configuration_callback_t client_configuration_callback;
6668

67-
static uint16_t pybricks_value_handle;
68-
static uint16_t pybricks_client_configuration_handle;
69-
static uint16_t pybricks_client_configuration_value;
69+
static uint16_t pybricks_command_event_value_handle;
70+
static uint16_t pybricks_command_event_client_configuration_handle;
71+
static uint16_t pybricks_command_event_client_configuration_value;
72+
static uint16_t pybricks_hub_capabilities_value_handle;
7073

71-
// TODO: need a way to reset pybricks_client_configuration_value on disconnect
74+
// TODO: need a way to reset pybricks_command_event_client_configuration_value on disconnect
7275

7376
static uint16_t pybricks_service_read_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) {
7477
UNUSED(con_handle);
7578
UNUSED(offset);
76-
UNUSED(buffer_size);
7779

78-
if (attribute_handle == pybricks_client_configuration_handle) {
80+
if (attribute_handle == pybricks_command_event_client_configuration_handle) {
7981
if (buffer) {
80-
little_endian_store_16(buffer, 0, pybricks_client_configuration_value);
82+
little_endian_store_16(buffer, 0, pybricks_command_event_client_configuration_value);
8183
}
8284
return 2;
8385
}
86+
87+
if (attribute_handle == pybricks_hub_capabilities_value_handle) {
88+
if (buffer && buffer_size >= PBIO_PYBRICKS_HUB_CAPABILITIES_VALUE_SIZE) {
89+
pbio_pybricks_hub_capabilities(buffer, pbio_math_min(att_server_get_mtu(con_handle) - 3, 512),
90+
PBSYS_APP_HUB_FEATURE_FLAGS, PBSYS_APP_USER_PROGRAM_SIZE);
91+
}
92+
return PBIO_PYBRICKS_HUB_CAPABILITIES_VALUE_SIZE;
93+
}
94+
8495
return 0;
8596
}
8697

8798
static int pybricks_service_write_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) {
8899
UNUSED(transaction_mode);
89100
UNUSED(offset);
90-
UNUSED(buffer_size);
91101

92-
if (attribute_handle == pybricks_value_handle) {
102+
if (attribute_handle == pybricks_command_event_value_handle) {
93103
client_callback(con_handle, &buffer[0], buffer_size);
94104
}
95-
if (attribute_handle == pybricks_client_configuration_handle) {
96-
pybricks_client_configuration_value = little_endian_read_16(buffer, 0);
97-
client_configuration_callback(con_handle, pybricks_client_configuration_value);
105+
else if (attribute_handle == pybricks_command_event_client_configuration_handle) {
106+
pybricks_command_event_client_configuration_value = little_endian_read_16(buffer, 0);
107+
client_configuration_callback(con_handle, pybricks_command_event_client_configuration_value);
98108
}
99109

100110
return 0;
@@ -117,12 +127,13 @@ void pybricks_service_server_init(
117127
btstack_assert(service_found != 0);
118128
UNUSED(service_found);
119129

120-
// get characteristic value handle and client configuration handle
121-
pybricks_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid128(start_handle, end_handle, pbio_pybricks_control_char_uuid);
122-
pybricks_client_configuration_handle = gatt_server_get_client_configuration_handle_for_characteristic_with_uuid128(start_handle, end_handle, pbio_pybricks_control_char_uuid);
130+
// get characteristic value and descriptor handles
131+
pybricks_command_event_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid128(start_handle, end_handle, pbio_pybricks_command_event_char_uuid);
132+
pybricks_command_event_client_configuration_handle = gatt_server_get_client_configuration_handle_for_characteristic_with_uuid128(start_handle, end_handle, pbio_pybricks_command_event_char_uuid);
133+
pybricks_hub_capabilities_value_handle = gatt_server_get_value_handle_for_characteristic_with_uuid128(start_handle, end_handle, pbio_pybricks_hub_capabilities_char_uuid);
123134

124-
log_info("pybricks_value_handle 0x%02x", pybricks_value_handle);
125-
log_info("pybricks_client_configuration_handle 0x%02x", pybricks_client_configuration_handle);
135+
log_info("pybricks_command_event_value_handle 0x%02x", pybricks_command_event_value_handle);
136+
log_info("pybricks_command_event_client_configuration_handle 0x%02x", pybricks_command_event_client_configuration_handle);
126137

127138
// register service with ATT Server
128139
pybricks_service.start_handle = start_handle;
@@ -148,7 +159,7 @@ void pybricks_service_server_request_can_send_now(btstack_context_callback_regis
148159
* @param size
149160
*/
150161
int pybricks_service_server_send(hci_con_handle_t con_handle, const uint8_t *data, uint16_t size) {
151-
return att_server_notify(con_handle, pybricks_value_handle, data, size);
162+
return att_server_notify(con_handle, pybricks_command_event_value_handle, data, size);
152163
}
153164

154165
#endif // PBDRV_CONFIG_BLUETOOTH_BTSTACK

0 commit comments

Comments
 (0)