我可以将我的BLE设备广播为Eddystone Beacon。它正在使用“http://www.cypress.com”广播Eddystone网址。现在我想将该URL更改为特定于国家/地区的扩展,例如"---.com.tr"
Here是Eddystone协议的GitHub源。它没有提供任何关于使用特殊URL扩展的线索。你知道如何实现它吗?
此处还有我项目的代码片段:
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;
答案 0 :(得分:1)
了解.com等扩展的特殊扩展代码对于保存字节非常有用,但它们是完全可选的。你也可以简单地输入扩展名的字节:
...
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;
因此,虽然.tr没有特殊代码,但您可以简单地将ASCII字节放在广告中。