adaptation for bkap

Fork of X_NUCLEO_IDB0XA1 by ST

Revision:
215:e8fa3129410a
Parent:
212:8b5ff0f0186f
Parent:
213:781abfbf2d1c
Child:
242:058b2e731adc
diff -r 8b5ff0f0186f -r e8fa3129410a source/BlueNRGGap.cpp
--- a/source/BlueNRGGap.cpp	Thu Jan 14 11:19:43 2016 +0100
+++ b/source/BlueNRGGap.cpp	Fri Mar 18 12:10:20 2016 +0100
@@ -283,6 +283,21 @@
         //Set the SCAN_RSP Payload
         scan_response_payload = scanResponse.getPayload();
         scan_rsp_length = scanResponse.getPayloadLen();
+        
+        // Update the ADV data if we are already in ADV mode
+        if(AdvLen > 0 && state.advertising == 1) {
+ 
+            tBleStatus ret = aci_gap_update_adv_data(AdvLen, AdvData);
+            if(BLE_STATUS_SUCCESS!=ret) {
+                PRINTF("error occurred while adding adv data (ret=0x%x)\n", ret);
+                switch (ret) {
+                    case BLE_STATUS_TIMEOUT:
+                        return BLE_STACK_BUSY;
+                    default:
+                        return BLE_ERROR_UNSPECIFIED;
+                }
+            }
+        }
     }
     return BLE_ERROR_NONE;
 }