Bluetooth Low Energy template with prewritten functions and callbacks for BLE events.

source/main.cpp

Committer:
jurica238814
Date:
2018-06-22
Revision:
0:dbe0ce913311

File content as of revision 0:dbe0ce913311:

/*
 * 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)
	{}
}