Skip to content

Commit ab7509f

Browse files
committed
Make handleNotify and handleInd return written bytes per peer
1 parent f18b1c0 commit ab7509f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/utility/ATT.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ BLEDevice ATTClass::central()
598598
return BLEDevice();
599599
}
600600

601-
bool ATTClass::handleNotify(uint16_t handle, const uint8_t* value, int length)
601+
int ATTClass::handleNotify(uint16_t handle, const uint8_t* value, int length)
602602
{
603603
int numNotifications = 0;
604604

@@ -626,10 +626,10 @@ bool ATTClass::handleNotify(uint16_t handle, const uint8_t* value, int length)
626626
numNotifications++;
627627
}
628628

629-
return (numNotifications > 0);
629+
return (numNotifications > 0) ? length : 0;
630630
}
631631

632-
bool ATTClass::handleInd(uint16_t handle, const uint8_t* value, int length)
632+
int ATTClass::handleInd(uint16_t handle, const uint8_t* value, int length)
633633
{
634634
int numIndications = 0;
635635

@@ -666,7 +666,7 @@ bool ATTClass::handleInd(uint16_t handle, const uint8_t* value, int length)
666666
numIndications++;
667667
}
668668

669-
return (numIndications > 0);
669+
return (numIndications > 0) ? length : 0;
670670
}
671671

672672
void ATTClass::error(uint16_t connectionHandle, uint8_t dlen, uint8_t data[])

src/utility/ATT.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ class ATTClass {
8383

8484
virtual BLEDevice central();
8585

86-
virtual bool handleNotify(uint16_t handle, const uint8_t* value, int length);
87-
virtual bool handleInd(uint16_t handle, const uint8_t* value, int length);
86+
virtual int handleNotify(uint16_t handle, const uint8_t* value, int length);
87+
virtual int handleInd(uint16_t handle, const uint8_t* value, int length);
8888

8989
virtual void setEventHandler(BLEDeviceEvent event, BLEDeviceEventHandler eventHandler);
9090

0 commit comments

Comments
 (0)