vo dung
/
eddystone_URL
first commit
Fork of BLE_WallbotBLE_Challenge by
Revision 5:984cc7e96073, committed 2017-12-21
- Comitter:
- tridung141196
- Date:
- Thu Dec 21 03:40:35 2017 +0000
- Parent:
- 4:2386637c9c7c
- Commit message:
- eddystone url
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Nov 23 08:46:00 2017 +0000 +++ b/main.cpp Thu Dec 21 03:40:35 2017 +0000 @@ -1,47 +1,42 @@ #include "mbed.h" + #include "BLEDevice.h" BLEDevice ble; -static const uint16_t uuid16_list[] = {0x00A0}; -const static uint8_t beaconPayload_url[] = { - 0xaa, - 0xfe, - - // URL - - 0x10, // Frame Type - 0x20, // Ranging Data - 0x02, // URL Scheme (http:// = 0x02) - - 'i', - 'o', - 't', - 'm', - 'a', - 'k', - 'e', - 'r', - '.', - 'v', - 'n', -}; -int main(void) + +void bleUploadUrl() { - ble.init(); + static const uint16_t uuid16_list[] = {0xFEAA}; + const static uint8_t beaconPayload_url[] = { + 0xaa,0xfe, + // URL + 0x10, // Frame Type + 0x20, // Ranging Data + 0x01, // URL Scheme (https:// = 0x02) + 'e','s','p','3','2','.','v','n'}; + ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED|GapAdvertisingData::LE_GENERAL_DISCOVERABLE); ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); - //ble.accumulateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA,beaconPayload_uid, sizeof(beaconPayload_uid)); ble.accumulateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA,beaconPayload_url, sizeof(beaconPayload_url)); - //ble.accumulateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA,beaconPayload_tlm, sizeof(beaconPayload_tlm)); ble.setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED); - + ble.setAdvertisingInterval(160); + ble.setTxPower(200); + ble.startAdvertising(); - + +} + +int main(void) +{ + ble.init(); + + bleUploadUrl(); + while(true) { ble.waitForEvent(); }