grundid / nfctools

nfctools library for Java

Home Page:http://www.grundid.de/nfc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Smart Poster Record Problem

heydre opened this issue · comments

Hi,

there is a problem with the smart poster record type. My phone receives the following bytes, when sending an example smart poster record:

-- Smart Poster Record
D102275370
-- Text Record
D1010B540564652D44455469746C65
-- Uri Record
D1010D550177696E6675747572652E6465
-- Action Record
D1030161637400

As you can see, the problem is that most records have the wrong header. The header is always D1 which means that MB: 1 and ME: 1.

To clarify, here in this case, there are a total of four NDEF Messages with each containing one NDEF record. But there have to be only two NDEF Messages. The first message with the smart poster header and the second message ("inner message") with the remaining records.

In conclusion the MB-bit has to be set to 1 at the first "inner record". All other inner records 0. The last inner record should have ME-bit set to 1. All other inner records to 0. More infos at the specification.

Sorry for my poor english but i hope you can understand me. :-)

Best regards,
Björn

You might be right. Can you create a Smart Poster record and post it in the correct encoding as hex?

There is an example in the official NFC-Forum Smart Poster Record Type Specification (pages 10-11).

To take the example above the correct hex-values should be (but not tested):
-- Smart Poster
D1 - 11010001 - Record Header: MB:1 ME:1 CF:0 SR:1 IL:0 TNF:001
02 - 00000010 - Type Length: 2
27 - 00100111 - Payload Length: 39
5370 - Sp

-- Text Record (Title Record)
91 - 10010001 - Record Header: MB:1 ME:0 CF:0 SR:1 IL:0 TNF:001
01 - 00000001 - Type Length: 1
0B - 00001011 - Payload Length: 11
54 - T
05 - 00000101 - UTF 8 | Language Code Length: 5
64652D4445 - de-DE
5469746C65 - Title

-- Uri Record
11 - 00010001 - Record Header: MB:0 ME:0 CF:0 SR:1 IL:0 TNF:001
01 - 00000001 - Type Length: 1
0D - 00001101 - Payload Length: 13
55 - U
01 - Prefix: http://www.
77696E6675747572652E6465 - winfuture.de

-- Action Record
51 - 01010001 - Record Header: MB:0 ME:1 CF:0 SR:1 IL:0 TNF:001
03 - 00000011 - Type Length: 3
01 - 00000001 - Payload Length: 1
616374 - act
00 - Default Action

THX. I used your data in the SmartPosterDecoderTest and the SmartPosterRecordEncoderTest and now the correct data is being encoded.

The update is in the master branch.

Nice. I tested it right now and it works. Thank you. :-)