Bluetooth Low Energy template with prewritten functions and callbacks for BLE events.
Diff: source/main.cpp
- Revision:
- 0:dbe0ce913311
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/source/main.cpp Fri Jun 22 15:05:42 2018 +0200
@@ -0,0 +1,51 @@
+/*
+ * aconno.de
+ * Simple program for aconno ble template demonstration
+ *
+ * Made by Jurica Resetar @ aconno
+ * ResetarJurica@gmail.com
+ *
+ */
+
+#include "mbed.h"
+#include "aconnoBLE.h"
+#include "ble/BLE.h"
+#include "BLEData.h"
+#include "GapAdvertisingData.h"
+#include "BLEConfig.h"
+#include <list>
+
+advertisingFormat manufacturerSpecificData;
+headerFormat header;
+systemStateFormat systemState;
+timestampFormat timestamp;
+diagnoseFlagsFormat diagnoseFlags;
+
+int (*callback_)(int, int) = NULL; // pointer to a function
+
+int callbackFunction(int param1, int param2)
+{
+ // Do some job
+ return 1;
+}
+
+void primjer(int(*callback)(int, int))
+{
+ callback_(1, 2);
+}
+
+int main()
+{
+ //primjer(functionCallback);
+
+ callback_ = callbackFunction;
+ primjer(callback_);
+
+ BLE &ble = BLE::Instance();
+ ble.init(bleInitComplete);
+ ble.gap().setTxPower(TX_POWER_dB); // Set TX power to TX_POWER
+ while (ble.hasInitialized() == false) { }
+
+ while(1)
+ {}
+}