central enhancement

- change discoverCharacteristic() API
- add BLECentralUart Rx callback,
- add BLECentralService discovered()
- refactor BLECentralCharacteristic
This commit is contained in:
hathach committed 2017-03-29 15:02:45 +07:00
1 parent f08759ad64
commit 15ddb3ede5
8 files changed
+115 -75

No files matched your search

@@ -41,6 +41,7 @@ BLECentralService* BLECentralService::lastService = NULL;
void BLECentralService::_init(void)
{
_discovered = false;
}
BLECentralService::BLECentralService(void)
@@ -61,14 +62,24 @@ err_t BLECentralService::begin(void)
// Add UUID128 if needed
uuid.begin();
lastService = this;
return ERROR_NONE;
}
bool BLECentralService::discover(uint16_t start_handle)
{
VERIFY( Bluefruit.Central.discoverService(uuid, start_handle) );
lastService = this;
_discovered = true;
return true;
}
bool BLECentralService::discovered(void)
{
return _discovered;
}
void BLECentralService::disconnect(void)
{
// do nothing, inherited service may want to clean up its own
}