minor service clean up

This commit is contained in:
hathach committed 2019-02-27 20:09:13 +07:00
1 parent fc34c0223c
commit a4487a22f7
6 files changed
+16 -8

No files matched your search

@@ -600,11 +600,6 @@ uint32_t BLECharacteristic::read32(void)
return read(&num, sizeof(num)) ? num : 0;
}
uint16_t BLECharacteristic::getCccd(void)
{
return this->getCccd(Bluefruit.connHandle());
}
uint16_t BLECharacteristic::getCccd(uint16_t conn_hdl)
{
VERIFY( Bluefruit.connected(conn_hdl) && (_handles.cccd_handle != BLE_GATT_HANDLE_INVALID), 0 );
@@ -134,7 +134,6 @@ class BLECharacteristic
uint32_t read32(void);
/*------------- Notify -------------*/
uint16_t getCccd(void);
uint16_t getCccd(uint16_t conn_hdl);
bool notifyEnabled(void);
@@ -47,7 +47,7 @@ err_t BLEBas::begin(void)
// Invoke base class begin()
VERIFY_STATUS( BLEService::begin() );
_battery.setProperties(CHR_PROPS_READ | CHR_PROPS_NOTIFY); // could support notify
_battery.setProperties(CHR_PROPS_READ | CHR_PROPS_NOTIFY);
_battery.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS);
_battery.setFixedLen(1);
VERIFY_STATUS( _battery.begin() );
@@ -64,3 +64,8 @@ bool BLEBas::notify(uint8_t level)
{
return _battery.notify8(level);
}
bool BLEBas::notify(uint8_t level, uint16_t conn_hdl)
{
return _battery.notify8(level, conn_hdl);
}
@@ -52,7 +52,9 @@ class BLEBas : public BLEService
virtual err_t begin(void);
bool write (uint8_t level);
bool notify(uint8_t level);
bool notify(uint8_t level, uint16_t conn_hdl);
};
@@ -123,6 +123,11 @@ bool BLEMidi::notifyEnabled(void)
return _io.notifyEnabled();
}
bool BLEMidi::notifyEnabled(uint16_t conn_hdl)
{
return _io.notifyEnabled(conn_hdl);
}
void BLEMidi::setWriteCallback(midi_write_cb_t fp)
{
_write_cb = fp;
@@ -58,7 +58,9 @@ class BLEMidi: public BLEService, public Stream
virtual err_t begin(void);
void begin(int baudrate); // MidiInterface
bool notifyEnabled(void);
bool notifyEnabled(void);
bool notifyEnabled(uint16_t conn_hdl);
bool send(uint8_t data[], uint8_t len);
bool sendSplit(uint8_t data[], uint8_t len);