org.opennfc.p2p
Interface P2PLink


public interface P2PLink

This interface exposes the methods to retrieves the parameters values of the P2P protocol negotiated during the link establishment.

These functions can be used only when a P2P link is established.

Since:
Open NFC 4.1

Method Summary
 void close()
          Closes a pending link.
 byte getAgreeLlcpVersion()
          Retrieves the version of the LLC Protocol agreed between both devices.
 int getBaudeRate()
          Retrieves the link speed, in bits per seconds.
 byte getRemoteLlcpVersion()
          Retrieves the remote LLC Protocol version.
 int getRemoteLto()
          Retrieves the remote link timeout, expressed in ms.
 int getRemoteMiu()
          Retrieves the remote Maximum Information Unit : maximum information field size that the peer is able to receive.
 int getRemoteWks()
          Retrieves the remote Well-Known service list.
 boolean isInitiator()
          Informs if the device is P2P initiator.
 byte UriLookup(String serviceUri)
          Retrieves on which SAP the specified serviceUri is running on the peer device.
 

Method Detail

getAgreeLlcpVersion

byte getAgreeLlcpVersion()
                         throws IOException
Retrieves the version of the LLC Protocol agreed between both devices.

Returns:
The version of the LLC Protocol.
Throws:
IOException - if the link is broken.
Since:
Open NFC 4.1

getRemoteLlcpVersion

byte getRemoteLlcpVersion()
                          throws IOException
Retrieves the remote LLC Protocol version.

Returns:
The remote LLC Protocol version.
Throws:
IOException - if the link is broken.
Since:
Open NFC 4.1

getRemoteMiu

int getRemoteMiu()
                 throws IOException
Retrieves the remote Maximum Information Unit : maximum information field size that the peer is able to receive. This value is truncated to the maximum information field size we are able to send.

Returns:
The remote Maximum Information Unit.
Throws:
IOException - if the link is broken.
Since:
Open NFC 4.1

getRemoteLto

int getRemoteLto()
                 throws IOException
Retrieves the remote link timeout, expressed in ms.

Returns:
The remote link timeout.
Throws:
IOException - if the link is broken.
Since:
Open NFC 4.1

getRemoteWks

int getRemoteWks()
                 throws IOException
Retrieves the remote Well-Known service list. Each bit set to 1 indicates the corresponding Well-Known service is available on the peer device.

Returns:
The remote Well-Known service list.
Throws:
IOException - if the link is broken.
Since:
Open NFC 4.1

getBaudeRate

int getBaudeRate()
                 throws IOException
Retrieves the link speed, in bits per seconds.

Returns:
The link speed.
Throws:
IOException - if the link is broken.
Since:
Open NFC 4.1

isInitiator

boolean isInitiator()
                    throws IOException
Informs if the device is P2P initiator.

Returns:
True, if the device is the P2P initiator.
Throws:
IOException - if the link is broken.
Since:
Open NFC 4.1

UriLookup

byte UriLookup(String serviceUri)
               throws IOException,
                      NfcException
Retrieves on which SAP the specified serviceUri is running on the peer device. The SAP is only valid during the duration of establishment of the P2P link. If the P2P link is broken, the association is no longer valid and a new URI lookup must be done.

This method block until the peer device respond, or an exception is thrown.

Parameters:
serviceUri - The service URI. This value shall not be null and should contain a well-formed URI.
Returns:
The Destination SAP value associated to the URI. If no SAP is found a zero value is returned.
Throws:
IllegalArgumentException - if serviceUri is null.
IllegalStateException - if other lookup operation is already in progress.
IOException - if the link is broken.
NfcException - if a NFC error occurred.
Since:
Open NFC 4.1

close

void close()
           throws IOException
Closes a pending link.

Throws:
IOException - if the link is broken.
Since:
Open NFC 4.1

Copyright © 2010-2011 Inside Secure
Except as noted, this content is licensed under Apache 2.0 License.