From b2ae702c484b9fc665e49d3b6d9b57cb2a0588a4 Mon Sep 17 00:00:00 2001 From: Adam Greenwood-Byrne Date: Tue, 11 Aug 2020 17:48:00 +0100 Subject: [PATCH] Notifications working for ATT characteristic --- part7-bluetooth/bt.c | 8 ++++---- part7-bluetooth/bt.h | 2 +- part7-bluetooth/kernel.c | 13 +++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/part7-bluetooth/bt.c b/part7-bluetooth/bt.c index acf7547..c91c854 100644 --- a/part7-bluetooth/bt.c +++ b/part7-bluetooth/bt.c @@ -194,18 +194,18 @@ void bt_getbdaddr(unsigned char *bdaddr) { for (int c=0;c<6;c++) bdaddr[c] = bt_waitReadByte(); } -void sendACLreadreq(unsigned int handle) +void sendACLsubscribe(unsigned int handle) { bt_writeByte(HCI_ACL_PKT); bt_writeByte(lo(handle)); bt_writeByte(hi(handle)); - unsigned int length = 0x0007; + unsigned int length = 0x0009; bt_writeByte(lo(length)); bt_writeByte(hi(length)); - unsigned int data_length = 0x0003; + unsigned int data_length = 0x0005; bt_writeByte(lo(data_length)); bt_writeByte(hi(data_length)); @@ -213,7 +213,7 @@ void sendACLreadreq(unsigned int handle) bt_writeByte(lo(channel)); bt_writeByte(hi(channel)); - unsigned char params[] = { 0x0a, 0x2a, 0x00 }; + unsigned char params[] = { 0x12, 0x2b, 0x00, 0x01, 0x00 }; unsigned int c=0; while (c++