Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Diff: main.cpp
- Revision:
- 5:7635f81a8e09
- Parent:
- 3:46de446e82ed
- Child:
- 6:425638944835
diff -r 50a31ff5f974 -r 7635f81a8e09 main.cpp
--- a/main.cpp Thu Dec 12 02:20:54 2013 +0000
+++ b/main.cpp Thu Dec 12 02:43:22 2013 +0000
@@ -29,12 +29,31 @@
GattCharacteristic thermInterval ( 0x2A21, 2, 2, BLE_GATT_CHAR_PROPERTIES_READ );
/* Notify = device (server) sends data when it changes */
-/* Indicate = device (server) sends data when it changes and client confirms reception */
-
+/* Indicate = device (server) sends data when it changes and client confirms reception */
+
+/* GAP Advertising Example (iBeacon) */
+GapAdvertisingParams advParams ( GapAdvertisingParams::NON_CONNECTABLE );
+GapAdvertisingData advData;
+
+uint8_t iBeaconPayload[25] = { 0x4C, 0x00, 0x02, 0x15, 0xE2, 0x0A, 0x39, 0xF4, 0x73, 0xF5, 0x4B, 0xC4, 0xA1, 0x2F, 0x17, 0xD1, 0xAD, 0x07, 0xA9, 0x61, 0x00, 0x00, 0x00, 0x00, 0xC8 };
+
+void startBeacon(void)
+{
+ /* iBeacon includes the FLAG and MSD fields */
+ advData.addFlags(GapAdvertisingData::BREDR_NOT_SUPPORTED);
+ advData.addData(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, iBeaconPayload, 25);
+
+ wait(2);
+ radio.reset();
+ radio.setAdvertising(advParams, advData);
+ radio.start();
+}
+
int main()
{
wait(2);
- radio.test();
+ // radio.test();
+ startBeacon();
while(1);
/* Add the battery level characteristic to the battery service */
