This is an mbed side application meant to demonstrate how to create a custom GATT service/characteristic with Evothings.

Dependencies:   BLE_API mbed nRF51822

Intro

This code is meant to be run on an mbed enabled BLE board and paired with the mbed-evothings-customGATT smartphone application.

Details

This code is a demonstration of how to create a custom service (UUID=0xA0000) with two characteristics, a read only characteristic (UUID=0xA001) and a write characteristic (UUID=0xA002). What is written to the write characteristic will be copied across to the read characteristic and broadcast out. If a single byte is written it will be used to toggle the on board LED, if more than 1 byte is written the data will be written out to the terminal. The default max size is 10bytes.

Viewing Data

You can use either the LightBlue app on iOS or the nRF Master Control Panel application on Android to view the advertising data. Alternatively you can use a custom Evothings App to view the data.

Evothings?

Evothings is a rapid prototyping environment that uses cordova to enable you to rapidly develop smartphone applications in Javascript. Please download the Evothings workbench to your computer and the Evothings client to your smartphone. Then grab the code from the github page, drag and drop the index.htm file into Evothings workbench and run it on the Evothings client.

Reference

Files at this revision

API Documentation at this revision

Comitter:
mbedAustin
Date:
Thu Apr 02 20:27:35 2015 +0000
Parent:
16:feee85aefb34
Commit message:
hotfix for API change

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r feee85aefb34 -r dfe796bba97c main.cpp
--- a/main.cpp	Thu Apr 02 17:23:10 2015 +0000
+++ b/main.cpp	Thu Apr 02 20:27:35 2015 +0000
@@ -71,7 +71,7 @@
     ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); // advertising type
     ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); // add name
     ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); // UUID's broadcast in advertising packet
-    ble.setAdvertisingInterval(0.1); // 100ms. 
+    ble.setAdvertisingInterval(100); // 100ms. 
 
     // add our custom service
     ble.addService(customService);