Release 0.3.2

=============

Enhancements
~~~~~~~~~~~~

* Add new API: onRadioNotification(). Radio Notification is a feature that
  enables ACTIVE and INACTIVE (nACTIVE) signals from the stack that notify the
  application when the radio is in use. The ACTIVE signal is sent before the
  Radio Event starts. The nACTIVE signal is sent at the end of the Radio
  Event. These signals can be used by the application programmer to
  synchronize application logic with radio activity. For example, the ACTIVE
  signal can be used to shut off external devices to manage peak current drawn
  during periods when the radio is on, or to trigger sensor data collection
  for transmission in the Radio Event.

* merge contents of several .cpp files under common/* into .h files under public/*.
  e.g. GattService, GapAdvertisingData, UUID.

* Add a note to the documentation for setAdvertisingInterval() to warn users
  about the new units for 'interval'.

* get rid of a few deprecated APIs: setAdvertisingData() and startAdvertising().

Bugfixes
~~~~~~~~

none.
This commit is contained in:
Rohit Grover 2015-04-09 13:46:17 +01:00
parent 20649946f5
commit 8b631fc0c2
2 changed files with 34 additions and 1 deletions

View file

@ -300,6 +300,24 @@ public:
void onUpdatesDisabled(GattServer::EventCallback_t callback);
void onConfirmationReceived(GattServer::EventCallback_t callback);
/**
* Radio Notification is a feature that enables ACTIVE and INACTIVE
* (nACTIVE) signals from the stack that notify the application when the
* radio is in use. The signal is sent using software interrupt.
*
* The ACTIVE signal is sent before the Radio Event starts. The nACTIVE
* signal is sent at the end of the Radio Event. These signals can be used
* by the application programmer to synchronize application logic with radio
* activity. For example, the ACTIVE signal can be used to shut off external
* devices to manage peak current drawn during periods when the radio is on,
* or to trigger sensor data collection for transmission in the Radio Event.
*
* @param callback
* The application handler to be invoked in response to a radio
* ACTIVE/INACTIVE event.
*/
void onRadioNotification(Gap::RadioNotificationEventCallback_t callback);
/**
* Add a service declaration to the local server ATT table. Also add the
* characteristics contained within.
@ -650,6 +668,12 @@ BLEDevice::onConfirmationReceived(GattServer::EventCallback_t callback)
transport->getGattServer().setOnConfirmationReceived(callback);
}
inline void
BLEDevice::onRadioNotification(Gap::RadioNotificationEventCallback_t callback)
{
transport->getGap().setOnRadioNotification(callback);
}
inline ble_error_t
BLEDevice::addService(GattService &service)
{

View file

@ -79,6 +79,7 @@ public:
typedef void (*EventCallback_t)(void);
typedef void (*ConnectionEventCallback_t)(Handle_t, addr_type_t peerAddrType, const address_t peerAddr, const ConnectionParams_t *);
typedef void (*DisconnectionEventCallback_t)(Handle_t, DisconnectionReason_t);
typedef void (*RadioNotificationEventCallback_t) (bool radio_active); /* gets passed true for ACTIVE; false for INACTIVE. */
friend class BLEDevice;
private:
@ -113,6 +114,13 @@ protected:
*/
void setOnDisconnection(DisconnectionEventCallback_t callback) {onDisconnection = callback;}
/**
* Set the application callback for radio-notification events.
* @param callback
* Handler to be executed in resonse to a radio notification event.
*/
virtual void setOnRadioNotification(RadioNotificationEventCallback_t callback) {onRadioNotification = callback;}
/**
* Append to a chain of callbacks to be invoked upon disconnection; these
* callbacks receive no context and are therefore different from the
@ -135,7 +143,7 @@ private:
protected:
/* Default constructor. */
Gap() : state(), onTimeout(NULL), onConnection(NULL), onDisconnection(NULL), disconnectionCallChain() {
Gap() : state(), onTimeout(NULL), onConnection(NULL), onDisconnection(NULL), onRadioNotification(), disconnectionCallChain() {
/* empty */
}
@ -175,6 +183,7 @@ protected:
EventCallback_t onTimeout;
ConnectionEventCallback_t onConnection;
DisconnectionEventCallback_t onDisconnection;
RadioNotificationEventCallback_t onRadioNotification;
CallChain disconnectionCallChain;
private: