BLE_API_Tiny_BLE

Dependents:   CSSE4011_BLE_IMU

Fork of BLE_API by Bluetooth Low Energy

Revision:
31:2c94f0501807
Parent:
27:4a83843f04b0
Child:
34:da2ea8cd6216
diff -r 9614522cf932 -r 2c94f0501807 GapAdvertisingData.cpp
--- a/GapAdvertisingData.cpp	Fri Jan 17 14:25:29 2014 +0000
+++ b/GapAdvertisingData.cpp	Tue Apr 01 11:04:56 2014 +0100
@@ -34,6 +34,7 @@
 {
     memset(_payload, 0, GAP_ADVERTISING_DATA_MAX_PAYLOAD);
     _payloadLen = 0;
+    _appearance = GENERIC_TAG;
 }
 
 /**************************************************************************/
@@ -119,6 +120,7 @@
 /**************************************************************************/
 ble_error_t GapAdvertisingData::addAppearance(Appearance appearance)
 {
+    _appearance = appearance;
     return addData(GapAdvertisingData::APPEARANCE, (uint8_t*)&appearance, 2);
 }
 
@@ -210,7 +212,7 @@
 /**************************************************************************/
 uint8_t * GapAdvertisingData::getPayload(void)
 {
-    return _payload;
+    return (_payloadLen > 0) ? _payload : NULL;
 }
 
 /**************************************************************************/
@@ -224,3 +226,15 @@
 {
     return _payloadLen;
 }
+
+/**************************************************************************/
+/*!
+    \brief Returns the 16-bit appearance value for this device
+    
+    \returns    The 16-bit appearance value
+*/
+/**************************************************************************/
+uint16_t GapAdvertisingData::getAppearance(void)
+{
+    return (uint16_t)_appearance;
+}