Thursday, December 28, 2017

Eddystone URL Encoding : A Beginner's Guide

For beginners who need to know how to convert url into UINT8_T, This can be a very helpful information:

To begin with, beginners need to know exactly what the URL frame contains and here is the details:

The first 9 bytes of the frame are just prefix. To check the content of the prefix value, see the picture below:


The 10th and 11th byte is constant having the value "AAFE". And starting on the 12th byte is the actual eddystone frame which is broken down into the following:

Frame Specification

Byte offsetFieldDescription
0Frame TypeValue = 0x10
1TX PowerCalibrated Tx power at 0 m
2URL SchemeEncoded Scheme Prefix
3+Encoded URLLength 1-17

The URL prefix have constant designated values:

URL Scheme Prefix

The URL Scheme Prefix byte defines the identifier scheme, an optional prefix and how the remainder of the URL is encoded.
DecimalHexExpansion
00x00http://www.
10x01https://www.
20x02http://
30x03https://

The URL Expansion also have constant values:
DecimalHexExpansion
00x00.com/
10x01.org/
20x02.edu/
30x03.net/
40x04.info/
50x05.biz/
60x06.gov/
70x07.com
80x08.org
90x09.edu
100x0a.net
110x0b.info
120x0c.biz
130x0d.gov
14..320x0e..0x20Reserved for Future Use
127..2550x7F..0xFFReserved for Future Use

And the remaining strings in url are converted to hex ascii codes. The URL is 17 bytes including the expansion value.

Here is the raw data from nRF Connect App:



And here is the actual raw data:



To Interpret the data
Byte offsetFieldValue
0Frame Type0x10 
1TX Power0x04 
2URL Scheme0x00 = "http://www."
3+Encoded URL0x06D696E65777465636807
The last 2 digits "07" is the URL extension for ".com"
0x06D696E657774656368 when converted to string is "minewtech". I used the foloowing website for the conversion:

http://www.unit-conversion.info/texttools/hexadecimal/#data

Combining the decoded data that we will get "http://www.minewtech.com"

No comments:

Post a Comment