Bluetooth Low Energy for Smart Plug

Dependencies:   BLE_API mbed nRF51822

Fork of SmartPlugBLE by Pavit Noinongyao

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "SmartPlugBLE.h"
00003 #include "BLECommunication.h"
00004 #include "BLE.h"
00005 BLE ble;
00006 
00007 void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
00008 {
00009     printf("reason = x%08x\r\n",reason);
00010     ble.gap().startAdvertising();
00011 }
00012 
00013 int main(void)
00014 {
00015     ble.gap().onDisconnection(disconnectionCallback);
00016     Ticker ticker;
00017     SmartPlugBLE smartPlugBLE;
00018     BLECommunication bleComm(smartPlugBLE,ble);
00019 }