Skip to content

allow calling poll() with BLE event data #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/BLECentral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ void BLECentral::poll() {
this->_peripheral->poll();
}

void BLECentral::poll(void* eventData, uint16_t length) {
this->_peripheral->poll(eventData, length);
}

void BLECentral::disconnect() {
if (this->connected()) {
this->_peripheral->disconnect();
Expand Down
1 change: 1 addition & 0 deletions src/BLECentral.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class BLECentral
bool connected();
const char* address() const;
void poll();
void poll(void* eventData, uint16_t length);

void disconnect();

Expand Down
1 change: 1 addition & 0 deletions src/BLEDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class BLEDevice
unsigned char /*numRemoteAttributes*/) { }

virtual void poll() { }
virtual void poll(void* eventData, uint16_t length) { }

virtual void end() { }

Expand Down
10 changes: 10 additions & 0 deletions src/BLEPeripheral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ void BLEPeripheral::poll() {
this->_device->poll();
}

void BLEPeripheral::poll(void* eventData, uint16_t length) {
this->_device->poll(eventData, length);
}

void BLEPeripheral::end() {
this->_device->end();
}
Expand Down Expand Up @@ -251,6 +255,12 @@ BLECentral BLEPeripheral::central() {
return this->_central;
}

BLECentral BLEPeripheral::central(void* eventData, uint16_t length) {
this->poll(eventData, length);

return this->_central;
}

bool BLEPeripheral::connected() {
this->poll();

Expand Down
2 changes: 2 additions & 0 deletions src/BLEPeripheral.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class BLEPeripheral : public BLEDeviceEventListener,

void begin();
void poll();
void poll(void* eventData, uint16_t length);
void end();

void setAdvertisedServiceUuid(const char* advertisedServiceUuid);
Expand All @@ -86,6 +87,7 @@ class BLEPeripheral : public BLEDeviceEventListener,
void disconnect();

BLECentral central();
BLECentral central(void* eventData, uint16_t length);
bool connected();

void setEventHandler(BLEPeripheralEvent event, BLEPeripheralEventHandler eventHandler);
Expand Down
Loading