简体   繁体   中英

Android Beam and SNEP to pn532

we are trying to send a big file from an android phone to a mikroprocessor via nfc-p2p, android-beam and snep.

This is what we have so far. I can connect the pn532(target) with the phone(initiator). My android app uses setNdefPushMessage to send a NdefMessage via nfc. As soon as i tap the phone(Beam-UI) it starts to connect with SAP 4 on my pn532 and after a readcommand(tgGetData) i receive the following:

00 FF 86 7A D5 87 00 13 20 00 10 02 00 00 03 BD C1 01 00 00 03 B6 54 30 68 61 6C 6C 6F 20 64 61 73 20 69 73 74 20 65 69 6E 20 74 65 73 74 31 68 61 6C 6C 6F 20 64 61 73 20 69 73 74 20 65 69 6E 20 74 65 73 74 32 68 61 6C 6C 6F 20 64 61 73 20 69 73 74 20 65 69 6E 20 74 65 73 74 33 68 61 6C 6C 6F 20 64 61 73 20 69 73 74 20 65 69 6E 20 74 65 73 74 34 68 61 6C 6C 6F 20 64 61 73 20 69 73 74 20 65 69 6E 20 74 65 73 74

To clean it up: PN532 header: 00 FF 86 7A D5 87 00 no MI Bit set!
LLCP header: 13 20 00 I-Package from SAP 32 to 4
SNEP header: 10 02 00 00 03 BD version 10 request PUT len 0x3bd
NDEF header: C1 01 00 00 03 B6 54 c1: start+EndMessage
Message ... the rest

I made the connect complete with MUI 128.

my problem: it says the SNEP packae is 0x3BD Bytes long but i only received this short part. Nowhere in this message is any indication whether it is a split message.

where is the rest of my Data? i tried to read more packages from pn532 but there were none.

** edit: After a night of trying i finally got somewhere. What worked at least sometimes:(all from the PN532's point of view)
receive: Connect
send: Connect complete[MUI=128]
receive: SYMM
send: SYMM
receive: I first Fragmented Data(as shown above)
send: RR
receive: SYMM
send: I SNEP:response CONTINUE
receive: RR
send: I SNEP:request CONTINUE
receive: I second Fragmented Data
send: RR
receive: RR
send: I SNEP:request CONTINUE
receive: I third Data Fragment

Like I said this only works some times. most of the Time my PN532 just responds with an error Code 0x29 -> Initiator droped the Connection. So te Question is can it be a timing problem or what else causes the Connection to be dropped before sending the Rest of the Data.

SNEP is designed as a simple request/response protocol run on top of an LLCP data link connection (a pair of source and destination SAP established with CONNECT). The client requests an operation to be executed by the server and the server returns the response. With a PUT operation the client attaches data to the request. If the request then exceeds the maximum information unit size of an LLCP Information PDU, the client transmits the request in appropriate fragments. The first fragment informs the server of the number of octets it should be prepared to receive from the client. If the server is able to receive the data it answers the first fragment with a Continue response, if the data size exceeds the server's capabilities it can stop the exchange with a Reject response. After the client has received a Continue response it will send all remaining fragments without expecting intermediate responses. The server finally sends a Success response after having received all request data, as was indicated by the length value. The same principle applies to large SNEP responses, only that Continue or Reject are then request messages (because they are sent by the client).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM