0

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;
abdullah cinar
  • 543
  • 1
  • 6
  • 20

1 Answers1

1

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.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • I couldn't think of adding it just with same as the domain part, you are actually right! Even though I couldn't run it with adding those parts and changing the ADV packet length; I guess the problem is about the other settings for my BLE module. Your advice is totally true, thanks :) I will take care of the problem which causes not to be able to change the advData. – abdullah cinar Mar 16 '16 at 12:23
  • I realized that I only changed advDatalen but I didn't update the service data Length. I have been able to observe the change in Eddystone-URL after I changed the service data length. I also realized that `0x00` corresponds to `.com/`, not `.com`. I had to change it to `0x07`. Maybe this helps someone out. – abdullah cinar Mar 16 '16 at 13:56