Compatible with Keewi v1

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
Rohit Grover
Date:
Mon Jun 09 08:34:47 2014 +0100
Parent:
76:103fac6e36d1
Child:
78:5d356ef94347
Commit message:
slowly switching to astyle code formatting as recommended by the team

Changed in this revision

hw/BLEDevice.h Show annotated file Show diff for this revision Revisions of this file
hw/Gap.h Show annotated file Show diff for this revision Revisions of this file
hw/GapEvents.h Show annotated file Show diff for this revision Revisions of this file
hw/GattServer.h Show annotated file Show diff for this revision Revisions of this file
hw/GattServerEvents.h Show annotated file Show diff for this revision Revisions of this file
--- a/hw/BLEDevice.h	Mon Jun 09 08:29:22 2014 +0100
+++ b/hw/BLEDevice.h	Mon Jun 09 08:34:47 2014 +0100
@@ -198,60 +198,71 @@
  * transport.*/
 
 inline ble_error_t
-BLEDevice::init() {
+BLEDevice::init()
+{
     return transport->init();
 }
 
 inline ble_error_t
-BLEDevice::reset(void) {
+BLEDevice::reset(void)
+{
     return transport->reset();
 }
 
 inline ble_error_t
-BLEDevice::setAddress(Gap::addr_type_t type, const uint8_t address[6]) {
+BLEDevice::setAddress(Gap::addr_type_t type, const uint8_t address[6])
+{
     return transport->getGap().setAddress(type, address);
 }
 
 inline void
-BLEDevice::setAdvertisingType(GapAdvertisingParams::AdvertisingType advType) {
+BLEDevice::setAdvertisingType(GapAdvertisingParams::AdvertisingType advType)
+{
     advParams.setAdvertisingType(advType);
 }
 
 inline void
-BLEDevice::setAdvertisingInterval(uint16_t interval) {
+BLEDevice::setAdvertisingInterval(uint16_t interval)
+{
     advParams.setInterval(interval);
 }
 
 inline void
-BLEDevice::setAdvertisingTimeout(uint16_t timeout) {
+BLEDevice::setAdvertisingTimeout(uint16_t timeout)
+{
     advParams.setTimeout(timeout);
 }
 
 inline void
-BLEDevice::setAdvertisingParams(const GapAdvertisingParams &newAdvParams) {
+BLEDevice::setAdvertisingParams(const GapAdvertisingParams &newAdvParams)
+{
     advParams = newAdvParams;
 }
 
 inline void
-BLEDevice::clearAdvertisingPayload(void) {
+BLEDevice::clearAdvertisingPayload(void)
+{
     needToUpdateAdvData = true;
     advPayload.clear();
 }
 
 inline ble_error_t
-BLEDevice::accumulateAdvertisingPayload(GapAdvertisingData::Flags flags) {
+BLEDevice::accumulateAdvertisingPayload(GapAdvertisingData::Flags flags)
+{
     needToUpdateAdvData = true;
     return advPayload.addFlags(flags);
 }
 
 inline ble_error_t
-BLEDevice::accumulateAdvertisingPayload(GapAdvertisingData::Appearance app) {
+BLEDevice::accumulateAdvertisingPayload(GapAdvertisingData::Appearance app)
+{
     needToUpdateAdvData = true;
     return advPayload.addAppearance(app);
 }
 
 inline ble_error_t
-BLEDevice::accumulateAdvertisingPayloadTxPower(int8_t txPower) {
+BLEDevice::accumulateAdvertisingPayloadTxPower(int8_t txPower)
+{
     needToUpdateAdvData = true;
     return advPayload.addTxPower(txPower);
 }
@@ -259,13 +270,15 @@
 inline ble_error_t
 BLEDevice::accumulateAdvertisingPayload(GapAdvertisingData::DataType  type,
                                         const uint8_t                *data,
-                                        uint8_t                       len) {
+                                        uint8_t                       len)
+{
     needToUpdateAdvData = true;
     return advPayload.addData(type, data, len);
 }
 
 inline ble_error_t
-BLEDevice::startAdvertising(void) {
+BLEDevice::startAdvertising(void)
+{
     if (needToUpdateAdvData) {
         setAdvertisingDataForTransport();
         needToUpdateAdvData = false;
@@ -275,72 +288,86 @@
 }
 
 inline ble_error_t
-BLEDevice::stopAdvertising(void) {
+BLEDevice::stopAdvertising(void)
+{
     return transport->getGap().stopAdvertising();
 }
 
 inline ble_error_t
-BLEDevice::disconnect(void) {
+BLEDevice::disconnect(void)
+{
     return transport->getGap().disconnect();
 }
 
 inline ble_error_t
-BLEDevice::setAdvertisingDataForTransport(void) {
+BLEDevice::setAdvertisingDataForTransport(void)
+{
     return transport->getGap().setAdvertisingData(advPayload, scanResponse);
 }
 
 inline void
-BLEDevice::onTimeout(Gap::EventCallback_t timeoutCallback) {
+BLEDevice::onTimeout(Gap::EventCallback_t timeoutCallback)
+{
     transport->getGap().setOnTimeout(timeoutCallback);
 }
 
 inline void
-BLEDevice::onConnection(Gap::EventCallback_t connectionCallback) {
+BLEDevice::onConnection(Gap::EventCallback_t connectionCallback)
+{
     transport->getGap().setOnConnection(connectionCallback);
 }
 
 inline void
-BLEDevice::onDisconnection(Gap::EventCallback_t disconnectionCallback) {
+BLEDevice::onDisconnection(Gap::EventCallback_t disconnectionCallback)
+{
     transport->getGap().setOnDisconnection(disconnectionCallback);
 }
 
 inline void
-BLEDevice::onDataSent(GattServer::EventCallback_t callback) {
+BLEDevice::onDataSent(GattServer::EventCallback_t callback)
+{
     transport->getGattServer().setOnDataSent(callback);
 }
 
 inline void
-BLEDevice::onDataWritten(GattServer::EventCallback_t callback) {
+BLEDevice::onDataWritten(GattServer::EventCallback_t callback)
+{
     transport->getGattServer().setOnDataWritten(callback);
 }
 
 inline void
-BLEDevice::onUpdatesEnabled(GattServer::EventCallback_t callback) {
+BLEDevice::onUpdatesEnabled(GattServer::EventCallback_t callback)
+{
     transport->getGattServer().setOnUpdatesEnabled(callback);
 }
 
 inline void
-BLEDevice::onUpdatesDisabled(GattServer::EventCallback_t callback) {
+BLEDevice::onUpdatesDisabled(GattServer::EventCallback_t callback)
+{
     transport->getGattServer().setOnUpdatesDisabled(callback);
 }
 
 inline void
-BLEDevice::onConfirmationReceived(GattServer::EventCallback_t callback) {
+BLEDevice::onConfirmationReceived(GattServer::EventCallback_t callback)
+{
     transport->getGattServer().setOnConfirmationReceived(callback);
 }
 
 inline ble_error_t
-BLEDevice::addService(GattService &service) {
+BLEDevice::addService(GattService &service)
+{
     return transport->getGattServer().addService(service);
 }
 
 inline Gap::GapState_t
-BLEDevice::getGapState(void) const {
+BLEDevice::getGapState(void) const
+{
     return transport->getGap().getState();
 }
 
 inline ble_error_t
-BLEDevice::updateCharacteristicValue(uint16_t handle, const uint8_t* value, uint16_t size, bool localOnly) {
+BLEDevice::updateCharacteristicValue(uint16_t handle, const uint8_t* value, uint16_t size, bool localOnly)
+{
     return transport->getGattServer().updateValue(handle, const_cast<uint8_t *>(value), size, localOnly);
 }
 
@@ -350,18 +377,21 @@
 
 inline ble_error_t
 BLEDevice::setAdvertisingData(const GapAdvertisingData &ADStructures,
-                              const GapAdvertisingData &scanResponse) {
+                              const GapAdvertisingData &scanResponse)
+{
     return transport->getGap().setAdvertisingData(ADStructures, scanResponse);
 }
 
 inline ble_error_t
-BLEDevice::setAdvertisingData(const GapAdvertisingData &ADStructures) {
+BLEDevice::setAdvertisingData(const GapAdvertisingData &ADStructures)
+{
     GapAdvertisingData scanResponse;
     return transport->getGap().setAdvertisingData(ADStructures, scanResponse);
 }
 
 inline ble_error_t
-BLEDevice::startAdvertising(const GapAdvertisingParams &_advParams) {
+BLEDevice::startAdvertising(const GapAdvertisingParams &_advParams)
+{
     return transport->getGap().startAdvertising(_advParams);
 }
 
--- a/hw/Gap.h	Mon Jun 09 08:29:22 2014 +0100
+++ b/hw/Gap.h	Mon Jun 09 08:34:47 2014 +0100
@@ -68,24 +68,24 @@
 
     void handleEvent(GapEvents::gapEvent_e type) {
         switch (type) {
-        case GapEvents::GAP_EVENT_TIMEOUT:
-            state.advertising = 0;
-            if (onTimeout) {
-                onTimeout();
-            }
-            break;
-        case GapEvents::GAP_EVENT_CONNECTED:
-            state.connected = 1;
-            if (onConnection) {
-                onConnection();
-            }
-            break;
-        case GapEvents::GAP_EVENT_DISCONNECTED:
-            state.connected = 0;
-            if (onDisconnection) {
-                onDisconnection();
-            }
-            break;
+            case GapEvents::GAP_EVENT_TIMEOUT:
+                state.advertising = 0;
+                if (onTimeout) {
+                    onTimeout();
+                }
+                break;
+            case GapEvents::GAP_EVENT_CONNECTED:
+                state.connected = 1;
+                if (onConnection) {
+                    onConnection();
+                }
+                break;
+            case GapEvents::GAP_EVENT_DISCONNECTED:
+                state.connected = 0;
+                if (onDisconnection) {
+                    onDisconnection();
+                }
+                break;
         }
     }
 
--- a/hw/GapEvents.h	Mon Jun 09 08:29:22 2014 +0100
+++ b/hw/GapEvents.h	Mon Jun 09 08:34:47 2014 +0100
@@ -27,7 +27,8 @@
     triggered with the GAP.
 */
 /**************************************************************************/
-class GapEvents {
+class GapEvents
+{
 public:
     /******************************************************************/
     /*!
@@ -36,8 +37,7 @@
         callback occurs
     */
     /******************************************************************/
-    typedef enum gapEvent_e
-    {
+    typedef enum gapEvent_e {
         GAP_EVENT_TIMEOUT      = 1,                 /**< Advertising timed out
                                                      *before a connection was
                                                      *established */
--- a/hw/GattServer.h	Mon Jun 09 08:29:22 2014 +0100
+++ b/hw/GattServer.h	Mon Jun 09 08:34:47 2014 +0100
@@ -62,31 +62,31 @@
 
     void handleEvent(GattServerEvents::gattEvent_e type, uint16_t charHandle) {
         switch (type) {
-        case GattServerEvents::GATT_EVENT_DATA_SENT:
-            if (onDataSent) {
-                onDataSent(charHandle);
-            }
-            break;
-        case GattServerEvents::GATT_EVENT_DATA_WRITTEN:
-            if (onDataWritten) {
-                onDataWritten(charHandle);
-            }
-            break;
-        case GattServerEvents::GATT_EVENT_UPDATES_ENABLED:
-            if (onUpdatesEnabled) {
-                onUpdatesEnabled(charHandle);
-            }
-            break;
-        case GattServerEvents::GATT_EVENT_UPDATES_DISABLED:
-            if (onUpdatesDisabled) {
-                onUpdatesDisabled(charHandle);
-            }
-            break;
-        case GattServerEvents::GATT_EVENT_CONFIRMATION_RECEIVED:
-            if (onConfirmationReceived) {
-                onConfirmationReceived(charHandle);
-            }
-            break;
+            case GattServerEvents::GATT_EVENT_DATA_SENT:
+                if (onDataSent) {
+                    onDataSent(charHandle);
+                }
+                break;
+            case GattServerEvents::GATT_EVENT_DATA_WRITTEN:
+                if (onDataWritten) {
+                    onDataWritten(charHandle);
+                }
+                break;
+            case GattServerEvents::GATT_EVENT_UPDATES_ENABLED:
+                if (onUpdatesEnabled) {
+                    onUpdatesEnabled(charHandle);
+                }
+                break;
+            case GattServerEvents::GATT_EVENT_UPDATES_DISABLED:
+                if (onUpdatesDisabled) {
+                    onUpdatesDisabled(charHandle);
+                }
+                break;
+            case GattServerEvents::GATT_EVENT_CONFIRMATION_RECEIVED:
+                if (onConfirmationReceived) {
+                    onConfirmationReceived(charHandle);
+                }
+                break;
         }
     }
 
--- a/hw/GattServerEvents.h	Mon Jun 09 08:29:22 2014 +0100
+++ b/hw/GattServerEvents.h	Mon Jun 09 08:34:47 2014 +0100
@@ -27,7 +27,8 @@
     triggered with the GATT Server.
 */
 /**************************************************************************/
-class GattServerEvents {
+class GattServerEvents
+{
 public:
     /******************************************************************/
     /*!
@@ -36,8 +37,7 @@
         callback occurs
     */
     /******************************************************************/
-    typedef enum gattEvent_e
-    {
+    typedef enum gattEvent_e {
         GATT_EVENT_DATA_SENT             = 1,       /**< Fired when a msg was
                                                      *successfully sent out
                                                      *(notify only?) */