High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
Rohit Grover
Date:
Thu May 22 15:02:40 2014 +0100
Parent:
39:a57137537521
Child:
41:7ae5c71cd44c
Commit message:
adding use of consts for GAP related apis

Changed in this revision

GapAdvertisingData.cpp Show annotated file Show diff for this revision Revisions of this file
GapAdvertisingData.h Show annotated file Show diff for this revision Revisions of this file
GapAdvertisingParams.cpp Show annotated file Show diff for this revision Revisions of this file
GapAdvertisingParams.h Show annotated file Show diff for this revision Revisions of this file
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
--- a/GapAdvertisingData.cpp	Thu May 22 14:51:06 2014 +0100
+++ b/GapAdvertisingData.cpp	Thu May 22 15:02:40 2014 +0100
@@ -213,7 +213,7 @@
     \returns    A pointer to the payload
 */
 /**************************************************************************/
-uint8_t *GapAdvertisingData::getPayload(void)
+const uint8_t *GapAdvertisingData::getPayload(void) const
 {
     return (_payloadLen > 0) ? _payload : NULL;
 }
@@ -225,7 +225,7 @@
     \returns    The payload length in bytes
 */
 /**************************************************************************/
-uint8_t GapAdvertisingData::getPayloadLen(void)
+uint8_t GapAdvertisingData::getPayloadLen(void) const
 {
     return _payloadLen;
 }
@@ -237,7 +237,7 @@
     \returns    The 16-bit appearance value
 */
 /**************************************************************************/
-uint16_t GapAdvertisingData::getAppearance(void)
+uint16_t GapAdvertisingData::getAppearance(void) const
 {
     return (uint16_t)_appearance;
 }
--- a/GapAdvertisingData.h	Thu May 22 14:51:06 2014 +0100
+++ b/GapAdvertisingData.h	Thu May 22 15:02:40 2014 +0100
@@ -355,9 +355,9 @@
     ble_error_t addFlags(Flags flag = LE_GENERAL_DISCOVERABLE);
     ble_error_t addTxPower(int8_t txPower);
     void        clear(void);
-    uint8_t *getPayload(void);
-    uint8_t     getPayloadLen(void);
-    uint16_t    getAppearance(void);
+    const uint8_t *getPayload(void) const;
+    uint8_t     getPayloadLen(void) const;
+    uint16_t    getAppearance(void) const;
 
 private:
     uint8_t  _payload[GAP_ADVERTISING_DATA_MAX_PAYLOAD];
--- a/GapAdvertisingParams.cpp	Thu May 22 14:51:06 2014 +0100
+++ b/GapAdvertisingParams.cpp	Thu May 22 15:02:40 2014 +0100
@@ -133,7 +133,7 @@
     \brief returns the current Advertising Type value
 */
 /**************************************************************************/
-GapAdvertisingParams::AdvertisingType GapAdvertisingParams::getAdvertisingType(void)
+GapAdvertisingParams::AdvertisingType GapAdvertisingParams::getAdvertisingType(void) const
 {
     return _advType;
 }
@@ -143,7 +143,7 @@
     \brief returns the current Advertising Delay (in units of 0.625ms)
 */
 /**************************************************************************/
-uint16_t GapAdvertisingParams::getInterval(void)
+uint16_t GapAdvertisingParams::getInterval(void) const
 {
     return _interval;
 }
@@ -153,7 +153,7 @@
     \brief returns the current Advertising Timeout (in seconds)
 */
 /**************************************************************************/
-uint16_t GapAdvertisingParams::getTimeout(void)
+uint16_t GapAdvertisingParams::getTimeout(void) const
 {
     return _timeout;
 }
--- a/GapAdvertisingParams.h	Thu May 22 14:51:06 2014 +0100
+++ b/GapAdvertisingParams.h	Thu May 22 15:02:40 2014 +0100
@@ -84,9 +84,9 @@
         uint16_t                  timeout = 0);
     virtual ~GapAdvertisingParams(void);
 
-    virtual AdvertisingType getAdvertisingType(void);
-    virtual uint16_t        getInterval(void);
-    virtual uint16_t        getTimeout(void);
+    virtual AdvertisingType getAdvertisingType(void) const;
+    virtual uint16_t        getInterval(void) const;
+    virtual uint16_t        getTimeout(void) const;
 
 private:
     AdvertisingType _advType;
--- a/hw/BLEDevice.h	Thu May 22 14:51:06 2014 +0100
+++ b/hw/BLEDevice.h	Thu May 22 15:02:40 2014 +0100
@@ -43,9 +43,9 @@
      */
     ble_error_t setAddress(Gap::addr_type_t type, const uint8_t address[6]);
 
-    ble_error_t setAdvertisingData(GapAdvertisingData &ADStructures,
-                                   GapAdvertisingData &scanResponse);
-    ble_error_t setAdvertisingData(GapAdvertisingData &ADStructures);
+    ble_error_t setAdvertisingData(const GapAdvertisingData &ADStructures,
+                                   const GapAdvertisingData &scanResponse);
+    ble_error_t setAdvertisingData(const GapAdvertisingData &ADStructures);
     ble_error_t startAdvertising(GapAdvertisingParams &advParams);
     ble_error_t stopAdvertising(void);
     ble_error_t disconnect(void);
@@ -61,13 +61,13 @@
 }
 
 inline ble_error_t
-BLEDevice::setAdvertisingData(GapAdvertisingData &ADStructures,
-                              GapAdvertisingData &scanResponse) {
+BLEDevice::setAdvertisingData(const GapAdvertisingData &ADStructures,
+                              const GapAdvertisingData &scanResponse) {
     return getGap().setAdvertisingData(ADStructures, scanResponse);
 }
 
 inline ble_error_t
-BLEDevice::setAdvertisingData(GapAdvertisingData &ADStructures) {
+BLEDevice::setAdvertisingData(const GapAdvertisingData &ADStructures) {
     GapAdvertisingData scanResponse;
     return getGap().setAdvertisingData(ADStructures, scanResponse);
 }
--- a/hw/Gap.h	Thu May 22 14:51:06 2014 +0100
+++ b/hw/Gap.h	Thu May 22 15:02:40 2014 +0100
@@ -45,9 +45,9 @@
 
     /* These functions must be defined in the sub-class */
     virtual ble_error_t setAddress(addr_type_t type, const uint8_t address[6]) = 0;
-    virtual ble_error_t setAdvertisingData(GapAdvertisingData &,
-                                           GapAdvertisingData &) = 0;
-    virtual ble_error_t startAdvertising(GapAdvertisingParams &) = 0;
+    virtual ble_error_t setAdvertisingData(const GapAdvertisingData &,
+                                           const GapAdvertisingData &) = 0;
+    virtual ble_error_t startAdvertising(const GapAdvertisingParams &) = 0;
     virtual ble_error_t stopAdvertising(void)                    = 0;
     virtual ble_error_t disconnect(void)                         = 0;