Adjusted to my instruments

Files at this revision

API Documentation at this revision

Comitter:
JunkoNakajima
Date:
Tue Nov 27 06:42:50 2018 +0000
Parent:
39:65d3756866f3
Commit message:
copy to my code

Changed in this revision

source/main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/main.cpp	Thu Jul 27 14:54:24 2017 +0200
+++ b/source/main.cpp	Tue Nov 27 06:42:50 2018 +0000
@@ -24,8 +24,7 @@
 static DiscoveredCharacteristic ledCharacteristic;
 static bool triggerLedCharacteristic;
 static const char PEER_NAME[] = "LED";
-
-static EventQueue eventQueue(/* event count */ 16 * EVENTS_EVENT_SIZE);
+static EventQueue eventQueue(/* event count */ 128 * EVENTS_EVENT_SIZE);
 
 void periodicCallback(void) {
     alivenessLED = !alivenessLED; /* Do blinky on LED1 while we're waiting for BLE events */
@@ -106,6 +105,7 @@
 }
 
 void triggerToggledWrite(const GattReadCallbackParams *response) {
+
     if (response->handle == ledCharacteristic.getValueHandle()) {
         printf("triggerToggledWrite: handle %u, offset %u, len %u\r\n", response->handle, response->offset, response->len);
         for (unsigned index = 0; index < response->len; index++) {
@@ -133,6 +133,7 @@
 void onBleInitError(BLE &ble, ble_error_t error)
 {
    /* Initialization error handling should go here */
+   printf("Initialization error\r\n");
 }
 
 void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
@@ -153,10 +154,8 @@
 
     ble.gap().onDisconnection(disconnectionCallback);
     ble.gap().onConnection(connectionCallback);
-
     ble.gattClient().onDataRead(triggerToggledWrite);
     ble.gattClient().onDataWrite(triggerRead);
-
     // scan interval: 400ms and scan window: 400ms.
     // Every 400ms the device will scan for 400ms
     // This means that the device will scan continuously.
@@ -169,16 +168,14 @@
     eventQueue.call(Callback<void()>(&ble, &BLE::processEvents));
 }
 
+
 int main()
 {
     triggerLedCharacteristic = false;
-    eventQueue.call_every(500, periodicCallback);
-
+    eventQueue.call_every(5000, periodicCallback);
     BLE &ble = BLE::Instance();
     ble.onEventsToProcess(scheduleBleEventsProcessing);
     ble.init(bleInitComplete);
-
     eventQueue.dispatch_forever();
-
     return 0;
 }