expansionbluetooth-lowenergybeaconeddystoneeddystone-url

How to set the Eddystone-URL to a country specific expansion?


I can make my BLE device broadcast as an Eddystone Beacon. It is broadcasting Eddystone URL with "http://www.cypress.com". Now I want to change that URL to a country specific expansion, e.g. "---.com.tr"

Here is the GitHub source for Eddystone protocol. It does not give any clue about using special URL expansions. Do you have any idea how can implement it?

Also here is the code snippet from my project:

cyBle_discoveryData.advData[13] = 0x00;     /* URL scheme- http://www. */
cyBle_discoveryData.advData[14] = 0x63;     /* Encoded URL - 'c' */
cyBle_discoveryData.advData[15] = 0x79;     /* Encoded URL - 'y' */
cyBle_discoveryData.advData[16] = 0x70;     /* Encoded URL - 'p' */
cyBle_discoveryData.advData[17] = 0x72;     /* Encoded URL - 'r' */
cyBle_discoveryData.advData[18] = 0x65;     /* Encoded URL - 'e' */
cyBle_discoveryData.advData[19] = 0x73;     /* Encoded URL - 's' */
cyBle_discoveryData.advData[20] = 0x73;     /* Encoded URL - 's' */
cyBle_discoveryData.advData[21] = 0x00;     /* Expansion - .com */

/* ADV packet length */
cyBle_discoveryData.advDataLen = 22;

Solution

  • Understand that the special expansion codes for extensions like .com are useful to save bytes, but are completely optional. You can also simply put in the bytes of the extension like this:

    ...
    cyBle_discoveryData.advData[20] = 0x73;     /* Encoded URL - 's' */
    cyBle_discoveryData.advData[21] = 0x00;     /* Expansion - .com */
    cyBle_discoveryData.advData[22] = 0x2e;     /* Encoded URL - '.' */
    cyBle_discoveryData.advData[23] = 0x74;     /* Encoded URL - 't' */
    cyBle_discoveryData.advData[24] = 0x72;     /* Encoded URL - 'r' */
    
    /* ADV packet length */
    cyBle_discoveryData.advDataLen = 25;
    

    So while there is no special code for .tr, you can simply put the ASCII bytes for it in the advertisement.