Duy tran / Mbed OS HealthCare_Graduation

Dependencies:   PulseSensor GSM Thermometer KalmanFilter

Revision:
18:a9d67c51715e
Parent:
17:b7c2db3e7282
Child:
19:a4f3328e9d09
--- a/Application/main.cpp	Thu May 24 17:37:31 2018 +0000
+++ b/Application/main.cpp	Thu May 24 17:53:46 2018 +0000
@@ -60,6 +60,7 @@
 static EventQueue        eventQueue(EVENTS_EVENT_SIZE * 20);
 Serial                   serial(USBTX, USBRX);
 /* ================== FUNCTION PROTOTYPES ==================== */
+void connectionCallback(const Gap::ConnectionCallbackParams_t *);
 void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *);
 void onBleInitError(BLE &ble, ble_error_t error);
 void bleInitComplete(BLE::InitializationCompleteCallbackContext *params);
@@ -77,6 +78,11 @@
     printf("Device disconnected with mobile/table\r\n");
 }
 
+void connectionCallback(const Gap::ConnectionCallbackParams_t *) {
+    printf("Deviced connected");
+    startSendFloat = 0;
+}
+
 void updatePayload(void) {
     // Update the count in the SERVICE_DATA field of the advertising payload
     cnt++;
@@ -214,6 +220,7 @@
         return;
     }
     uint8_t initial_HRMIncreasement = 1;
+    ble.gap().onConnection(connectionCallback);
     ble.gap().onDisconnection(disconnectionCallback);
     ble.gattServer().onDataWritten(onDataWrittenCallback);