Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

Branch:
axis_normal
Revision:
16:482d8f81d6f3
Parent:
15:c0c01188a29b
Child:
26:6101bb09f70d
--- a/aconno_ble/aconno_ble.cpp	Wed Aug 29 14:48:43 2018 +0000
+++ b/aconno_ble/aconno_ble.cpp	Wed Aug 29 17:08:08 2018 +0000
@@ -21,7 +21,7 @@
 };
 LizzyService *lizzy_service;
 
-
+static bool clientConected = false;
 static EventQueue eventQueue( BLE_EVENT_COUNT * EVENTS_EVENT_SIZE );
 
 
@@ -36,13 +36,19 @@
     return &eventQueue;
 }
 
+bool bleIsClientConnected(void)
+{
+    return clientConected;
+}
+
 void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
 {
+    clientConected = false;
     (lizzy_service->get_ble())->gap().startAdvertising();
 }
 
 void onConnectionCallback(const Gap::ConnectionCallbackParams_t *params){   
-    
+    clientConected = true;
 }
 
 void onDataWrittenCallback(const GattWriteCallbackParams *params) 
@@ -104,7 +110,7 @@
     
     lizzy_service = new LizzyService(ble, &init_lizzy);
     ble.gap().onDisconnection(disconnectionCallback);
-    //ble.gap().onConnection(onConnectionCallback);         
+    ble.gap().onConnection(onConnectionCallback);         
     ble.gattServer().onDataWritten(onDataWrittenCallback);
     
     // Setup event handling. This is needed only with services.
@@ -126,7 +132,7 @@
     ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
     ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t *)&advertisementPacket, sizeof(uint8_t)*11);
     ble.gap().setAdvertisingInterval(ADV_INTERVAL_MS);
-    ble.gap().startAdvertising();
+    //ble.gap().startAdvertising();
 }
 
 void updatePayload(BLE *ble, advertising_packet *advertisementPacket)