Skip to content

Commit cf5f79c

Browse files
committed
Make handleNotify and handleInd return written bytes per peer
1 parent 7a039d7 commit cf5f79c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/utility/ATT.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ BLEDevice ATTClass::central()
582582
return BLEDevice();
583583
}
584584

585-
bool ATTClass::handleNotify(uint16_t handle, const uint8_t* value, int length)
585+
int ATTClass::handleNotify(uint16_t handle, const uint8_t* value, int length)
586586
{
587587
int numNotifications = 0;
588588

@@ -610,10 +610,10 @@ bool ATTClass::handleNotify(uint16_t handle, const uint8_t* value, int length)
610610
numNotifications++;
611611
}
612612

613-
return (numNotifications > 0);
613+
return (numNotifications > 0) ? length : 0;
614614
}
615615

616-
bool ATTClass::handleInd(uint16_t handle, const uint8_t* value, int length)
616+
int ATTClass::handleInd(uint16_t handle, const uint8_t* value, int length)
617617
{
618618
int numIndications = 0;
619619

@@ -650,7 +650,7 @@ bool ATTClass::handleInd(uint16_t handle, const uint8_t* value, int length)
650650
numIndications++;
651651
}
652652

653-
return (numIndications > 0);
653+
return (numIndications > 0) ? length : 0;
654654
}
655655

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

src/utility/ATT.h

Lines changed: 2 additions & 2 deletions
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)