llcp-dep p2p discovery and connections

旧城冷巷雨未停 提交于 2019-12-08 07:02:38

问题


I am working on a school project to connect the pn532 with a nfc phone. I am using the seeedstudio nfc controller and the library they have, with some code that I am adding. My questions are related to the connection and discovery stage of the protocol.

Question 1: What to respond when the initiator sends a CONNECT command to the DSAP = 1 "discovery service". Bellow I explain the results of the protocol.

Phones used to test were(gs4, note 2):

Situation 1:

  • the phone sends me 05 20 06 this is a CONNECT command to SAP =1 in the receiver device, then I respond with the CC command 81 84 2 2 0 78.
  • then they send me an IPDU with the URI of the application in the foreground, I keep sending command as per the llcp-snep protocol in the nfc forum and everything finish cool. *The problem is that I don't want the URI of the application in the foreground, I want the NDEF message data of that application instead.*

Situation 2:

  • the phones send to the pn532 11 20 , this is a CONNECT command to SAP =4 in the receiver device, then I respond with the command CC 81 84 2 2 0 78.
  • After this the phone send me the NDEF data as is suppose to be.

    Now my questions are:

Why some times the phone send me the CONNECT command to the SAP =1 and some times to SAP=4?

What command I have to response for the 05 20 06 ?


回答1:


When a CONNECT command is send to SAP 1 it means that the sender wants to perform service discovery and connection setup in one step. In this situation, a required information in the CONNECT command is the service name. If that service exists and is connectable the response would be a CC (Connection Complete) PDU to the SAP from which CONNECT was received and from the SAP that the named service is bound to. If a service with the requested name does not exist the answer would have to be a Disconnected Mode (DM) PDU with the appropriate reason code.

Unfortunately you have not provided full information about the CONNECT command received on SAP 1, at lest the service name length byte and the name itself are missing. As written, the CONNECT PDU is just invalid and should not be acknowledged.




回答2:


As expected the whole problem was solved. After the request for connection of the undesired service I sent the DM with reason 02 command and everything went normal. It took me some time to get the library to work with all phones together but finally I fixed it. Thanks for all the feedback



来源:https://stackoverflow.com/questions/21174628/llcp-dep-p2p-discovery-and-connections

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!