vo dung
/
eddystone_URL
first commit
Fork of BLE_WallbotBLE_Challenge by
Diff: main.cpp
- Revision:
- 5:984cc7e96073
- Parent:
- 4:2386637c9c7c
--- 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(); }