Created
November 26, 2011 03:56
-
-
Save astjohn/1394963 to your computer and use it in GitHub Desktop.
Experiments with libndef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// More complicated SP | |
NDEFRecord text = NDEFRecord::createTextRecord("Could be an ID here...", "en-US"); | |
// USING THIS ACTION RECORD RESULTED IN TRUNCATED truncated OUTPUT | |
// NDEFRecord action = NDEFRecord::createSpActionRecord(NDEFRecord::Do); // should have value of zero | |
NDEFRecord type = NDEFRecord::createSpTypeRecord("application/json"); // not necessary | |
QList<NDEFRecord> records; | |
records.append(text); | |
// records.append(action); | |
records.append(type); | |
NDEFRecord sp = NDEFRecord::createSmartPosterRecord("http://www.th.com/mobile_welcome", records); | |
msg.appendRecord(sp); | |
// Now let's shove it in a TLV for the tag | |
Tlv tlv = Tlv::createNDEFMessageTlv(msg); | |
const char *data = output.constData(); | |
while (*data) { | |
printf ("%x = %u = %c", *data, *data, *data); | |
cout << endl; | |
++data; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 = 3 = = TLV BLOCK - byte1 - 3 means it contains an NDEF message | |
53 = 83 = S = TLV BLOCK - byte2 - Length Field - single byte format = value field is 83 bytes long | |
ffffffd1 = 4294967249 = = ???? IS THIS THE MB/ME/CF/SR/IL/TNT ????, Yes NDEF HEADER | |
1111 1111 1111 1111 1111 1111 1101 0001 - last octet could be it... why all the padding in front? | |
MB=1 | |
ME=1 | |
CF=0 | |
SR=1 | |
IL=0 | |
TNT=0x01 = NFC Forum well-known type | |
2 = 2 = = TYPE LENGTH = 2 bytes | |
4e = 78 = N = PAYLOAD LENGTH = 78 bytes | |
53 = 83 = S = TYPE Byte 1. i.e. S of "Sp" | |
70 = 112 = p = TYPE Byte 2. i.e. p of "Sp" | |
ffffff91 = 4294967185 = = ???? IS THIS THE MB/ME/CF/SR/IL/TNT ????, Yes NDEF HEADER | |
111111111111111111111111 1001 0001 | |
MB=1 | |
ME=0 | |
CF=0 | |
SR=1 | |
IL=0 | |
TNT=0x01 = NFC Forum well-known type | |
1 = 1 = = TYPE LENGTH = 1 byte | |
1c = 28 = = PAYLOAD LENGTH = 26 bytes | |
54 = 84 = T = TYPE = T = Text | |
5 = 5 = = STATUS BYTE = 5 = Length of language code in bytes | |
65 = 101 = e = Language code Byte 1 | |
6e = 110 = n = Language code Byte 2 | |
2d = 45 = - = Language code Byte 3 | |
55 = 85 = U = Language code Byte 4 | |
53 = 83 = S = Language code Byte 5 | |
43 = 67 = C = Data | |
6f = 111 = o = Data | |
75 = 117 = u = Data | |
6c = 108 = l = Data | |
64 = 100 = d = Data | |
20 = 32 = = Data | |
62 = 98 = b = Data | |
65 = 101 = e = Data | |
20 = 32 = = Data | |
61 = 97 = a = Data | |
6e = 110 = n = Data | |
20 = 32 = = Data | |
49 = 73 = I = Data | |
44 = 68 = D = Data | |
20 = 32 = = Data | |
68 = 104 = h = Data | |
65 = 101 = e = Data | |
72 = 114 = r = Data | |
65 = 101 = e = Data | |
2e = 46 = . = Data | |
2e = 46 = . = Data | |
2e = 46 = . = Data | |
11 = 17 = = ???????????? | |
1 = 1 = = Type Length = 1 byte | |
10 = 16 = = PAYLOAD LENGTH = 16 bytes | |
74 = 116 = t = TYPE = t = "Type Record" (describes MIME Types) | |
61 = 97 = a = Data | |
70 = 112 = p = Data | |
70 = 112 = p = Data | |
6c = 108 = l = Data | |
69 = 105 = i = Data | |
63 = 99 = c = Data | |
61 = 97 = a = Data | |
74 = 116 = t = Data | |
69 = 105 = i = Data | |
6f = 111 = o = Data | |
6e = 110 = n = Data | |
2f = 47 = / = Data | |
6a = 106 = j = Data | |
73 = 115 = s = Data | |
6f = 111 = o = Data | |
6e = 110 = n = Data | |
51 = 81 = Q = ???????????? | |
1 = 1 = = Type Length = 1 byte | |
16 = 22 = = PAYLOAD LENGTH = 16 bytes | |
55 = 85 = U = TYPE = U = URI | |
1 = 1 = = SHORT FORM - 01 = http://www. | |
74 = 116 = t = Data | |
68 = 104 = h = Data | |
2e = 46 = . = Data | |
63 = 99 = c = Data | |
6f = 111 = o = Data | |
6d = 109 = m = Data | |
2f = 47 = / = Data | |
6d = 109 = m = Data | |
6f = 111 = o = Data | |
62 = 98 = b = Data | |
69 = 105 = i = Data | |
6c = 108 = l = Data | |
65 = 101 = e = Data | |
5f = 95 = _ = Data | |
77 = 119 = w = Data | |
65 = 101 = e = Data | |
6c = 108 = l = Data | |
63 = 99 = c = Data | |
6f = 111 = o = Data | |
6d = 109 = m = Data | |
65 = 101 = e = Data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issues experienced were due to the way I was printing out the lines.... whoops!
Here's a better way: