add _disconnect_cb() and _connect_cb() to BLEService

integrate BLEService.addToGatt() to begin()
This commit is contained in:
hathach committed 2017-07-26 11:07:53 +07:00
1 parent ca2d6f3dce
commit 5259a71ebb
9 files changed
+44 -19

No files matched your search

@@ -44,7 +44,8 @@ BLEBas::BLEBas(void) :
err_t BLEBas::begin(void)
{
VERIFY_STATUS( this->addToGatt() );
// Invoke base class begin()
VERIFY_STATUS( BLEService::begin() );
_battery.setProperties(CHR_PROPS_READ | CHR_PROPS_NOTIFY); // could support notify
_battery.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS);
@@ -171,7 +171,8 @@ BLEDfu::BLEDfu(void) : BLEService(UUID128_SVC_DFU_OTA), _chr_control(UUID128_CHR
err_t BLEDfu::begin(void)
{
VERIFY_STATUS( this->addToGatt() );
// Invoke base class begin()
VERIFY_STATUS( BLEService::begin() );
// No need to keep packet & revision characteristics
BLECharacteristic chr_packet(UUID128_CHR_DFU_PACKET);
@@ -70,7 +70,8 @@ void BLEDis::setManufacturer(const char* manufacturer)
err_t BLEDis::begin(void)
{
VERIFY_STATUS( this->addToGatt() );
// Invoke base class begin()
VERIFY_STATUS( BLEService::begin() );
_serial = getMcuUniqueID();
_firmware_rev = getFirmwareVersion();
@@ -133,7 +133,8 @@ err_t BLEHidGeneric::begin(void)
{
VERIFY ( (_report_map != NULL) && _report_map_len, NRF_ERROR_INVALID_PARAM);
VERIFY_STATUS( this->addToGatt() );
// Invoke base class begin()
VERIFY_STATUS( BLEService::begin() );
// Protocol Mode
if ( _boot_keyboard || _boot_mouse )
@@ -140,7 +140,8 @@ void BLEMidi::begin(int baudrate)
err_t BLEMidi::begin(void)
{
VERIFY_STATUS( this->addToGatt() );
// Invoke base class begin()
VERIFY_STATUS( BLEService::begin() );
// IO characteristic
_io.setProperties(CHR_PROPS_READ | CHR_PROPS_WRITE | CHR_PROPS_WRITE_WO_RESP | CHR_PROPS_NOTIFY);