llcp-dep p2p discovery and connections - nfc-p2p

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 ?

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.

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

Related

Tachograph remote authentication

I am trying to do a remote tachograph authentication by sending a RemoteCompanyCardReady cantp message to a VDO tachograph on connector C.
The reply message I get is a nack 7f 31 7f which seems to suggest there is no open session. I can't seem to find anywhere how to open the diagnostic session to the tachograph. Also the can id I am using for sending the messages is 18DAEEFB, is that correct? Can anyone give me the byte sequence on the can bus for that?
If you are receiving a response from the device (7F 31 7F in your case), then the CAN ID seems to be correct.
The service which you are trying to send (0x31) seems to be a Routine Control service. Those services usually work in the Diagnostic Session.
According to the ISO, Session Control service is 0x10. So, try to send the request (10 03) to the device. If you receive a positive response (50 01 XX..) then send your required service immediately (within 5 seconds of receiving 50 01).

IoT Foundation errors (The topic is not valid, The topic does not match an allowed rule)

I have a device connected to IBM IoT foundation. It uses a TI CC3100 Wi-Fi chip driven by an MSP430 MCU. The device used to connect perfectly to IOTF in the past. I didn't use it for a couple of months and now suddenly it does not connect. Did IBM recently change anything in the MQTT protocol for IOTF ?
I get the following messages on the device's console:
Device is configured in default state
Device started as STATION
Connection established with AP
Broker connect failed for conn no. 1
Exiting the Application
In the Watson IoT foundation dashboard I see the following messages (in the connection log):
Closed connection from 217.132.56.201. The topic does not match an allowed rule 2 times in the last 5 minutes May 29, 2016 8:36:46 AM
Closed connection from 217.132.56.201. The topic is not valid. 2 times in the last 5 minutes
Can anyone help resolving this problem ?
Thanks a lot,
Danny

Reason for group formation timeout in Wi-Fi Direct

I am using two Wi-Fi Direct enabled devices (Let be A with android ICS running and B with Android Jelly Bean )
A has intent value 3 and B has intent value 5 . GO Negotiation happens and B elected as GO. I am using Wi-Fi DirectDemo App for file transfer and able to transfer file from A to B successfully.
Next I changed the intent value of A to 15 and B has intent value 5. GO negotiation happens and A elected as GO.It moves to Provisoning phase then. But the Group Formation fails with no error message except "Group Formation timeout"
Group formation failure happens due to
1) Failed WPS provisioning
2) 15 sec timeout.
Since no error messages are thrown it is hard to debug the issue.I have two queries.
What process actually takes place in this 15 secs.?
Is there any common reason or cause for this timeout?
Expecting answers from Wi-Fi Direct experts.......
Sounds like its EAPOL handshake failure.
We need the sniffer traces to pin point the issue. If you got a sniffer, please share the capture

OBD-II iOS WiFi Connection

I am trying to write an iOS application that connects to an OBD-II Interface over WiFi (specifically the OBDLink MX WiFi Scan Tool). I have written some basic socket code taken and I am able to open a socket to 192.168.0.10:35000. I receive the NSStreamEventOpenCompleted for both input and output streams.
The first event that fires shortly after is the NSStreamEventHasBytesAvailable. I attempt to read the stream, but the length comes back 0. My question is what is the flow of execution for communicating with these devices? I have tried to issue an ATZ\r command, but nothing is happening (no stream events are firing).
How do I know if if I am connected and the OBD-II interface is ready?
The usual command terminator is ˋ\r\nˋ, so first try sending ˋATZˋ with this command. Only send, after you have received the HasSpace notification from the ˋNSOutputStreamˋ.
Another alternative to communicate with this device would be this Car Diagnostics API, access to the API can be found on
https://github.com/HellaVentures/Car-Diagnostic-API

CoreBluetooth[WARNING] Unknown error: 14 on iPhone 5

I am able to connect to a peripheral device using BLE, but shortly after reading some characteristics, the framework returns:
CoreBluetooth[WARNING] Unknown error: 14
and the peripheral is disconnected.
Looking at the BT Core_V4.0 spec, I am not sure what the error means. Is the 14 a hex value? does it mean the following error according to the spec: (Part D Section 2 - Error Codes)
2.20 REMOTE DEVICE TERMINATED CONNECTION DUE TO LOW RESOURCES (0X14)
The Remote Device Terminated Connection due to Low Resources error code indicates that the remote device terminated the connection because of low resources.
I tried changing the battery but did not have a different effect.
Also, I don't know how to catch these CB errors, I only see them logged, but when the device disconnects, it does not provide an error (it is null).
I do not directly control the source code for the peripheral but can ask for a bug fix. So any hints are appreciated it.
Thanks,
You cannot intercept these CB errors, they are just traces from lower layer BLE.
Error 13 for instance is when the length of written data is not as specified in the GATT database.
Error 14 means the connection was closed by other side (peripheral). I have seen this several times. Some times I read data too fast (You are not allowed to request next access before previous has been answered, there is only 1 "resource" in BLE per connection. Maybe this is what you also see?
As always it is best to get the TI BTLE USB Dongle with sniffer sw installed and then use the TI RF Sniffer tool in BLE mode with that dongle. You get a lot of information you can debug from in those traces. Like see if there are more than one read or write request without response.

Resources