Devchannel Team / X_NUCLEO_IDB0XA1

Dependents:   Hello_BLE F446RE-BLE

Fork of X_NUCLEO_IDB0XA1 by ST

Revision:
47:45b79f89b739
Parent:
46:01f97cfcc109
Child:
50:898acb5227fc
--- a/BlueNRGGattServer.cpp	Fri Sep 05 08:42:35 2014 +0000
+++ b/BlueNRGGattServer.cpp	Fri Sep 05 09:20:09 2014 +0000
@@ -398,7 +398,6 @@
     for other appearances BLE Scanner android app is not behaving properly 
     */
     //char deviceAppearance[2];   
-    uint8_t deviceAppearance[2];
     STORE_LE_16(deviceAppearance, appearance);                 
     DEBUG("input: incoming = %d deviceAppearance= 0x%x 0x%x\n\r", appearance, deviceAppearance[1], deviceAppearance[0]);
     
@@ -428,6 +427,11 @@
 /**************************************************************************/
 ble_error_t BlueNRGGattServer::getAppearance(uint16_t *appearanceP)
 {
+    uint16_t devP;
+    if(!appearanceP) return BLE_ERROR_PARAM_OUT_OF_RANGE;
+    devP = ((uint16_t)(0x0000|deviceAppearance[0])) | (((uint16_t)(0x0000|deviceAppearance[1]))<<8);
+    strcpy((char*)appearanceP, (const char*)&devP);
+    
     return BLE_ERROR_NONE;    
 }