Package com.android.identity
Class DataTransportNfc
- java.lang.Object
-
- com.android.identity.DataTransport
-
- com.android.identity.DataTransportNfc
-
public class DataTransportNfc extends DataTransport
NFC data transport
-
-
Field Summary
-
Fields inherited from class com.android.identity.DataTransport
mContext, mOptions, mRole, ROLE_MDOC, ROLE_MDOC_READER
-
-
Constructor Summary
Constructors Constructor Description DataTransportNfc(android.content.Context context, int role, ConnectionMethodNfc connectionMethod, DataTransportOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
connect()
ConnectionMethod
getConnectionMethod()
Returns aConnectionMethod
instance that can be used to connect to this transport.static void
onDeactivated(int reason)
static byte[]
processCommandApdu(android.nfc.cardemulation.HostApduService hostApduService, byte[] apdu)
void
sendMessage(byte[] data)
void
sendTransportSpecificTerminationMessage()
void
setEDeviceKeyBytes(byte[] encodedEDeviceKeyBytes)
void
setIsoDep(android.nfc.tech.IsoDep isoDep)
Called by reader when finding theIsoDep
tag.boolean
supportsTransportSpecificTerminationMessage()
-
Methods inherited from class com.android.identity.DataTransport
getMessage, inhibitCallbacks, reportConnected, reportConnecting, reportConnectionMethodReady, reportDisconnected, reportError, reportMessageProgress, reportMessageReceived, reportTransportSpecificSessionTermination
-
-
-
-
Constructor Detail
-
DataTransportNfc
public DataTransportNfc(@NonNull android.content.Context context, int role, @NonNull ConnectionMethodNfc connectionMethod, @NonNull DataTransportOptions options)
-
-
Method Detail
-
setEDeviceKeyBytes
public void setEDeviceKeyBytes(@NonNull byte[] encodedEDeviceKeyBytes)
-
setIsoDep
public void setIsoDep(@NonNull android.nfc.tech.IsoDep isoDep)
Called by reader when finding theIsoDep
tag.- Parameters:
isoDep
- the tag withIsoDep
technology.
-
processCommandApdu
@Nullable public static byte[] processCommandApdu(@NonNull android.nfc.cardemulation.HostApduService hostApduService, @NonNull byte[] apdu)
-
onDeactivated
public static void onDeactivated(int reason)
-
connect
public void connect()
-
close
public void close()
-
sendMessage
public void sendMessage(@NonNull byte[] data)
-
sendTransportSpecificTerminationMessage
public void sendTransportSpecificTerminationMessage()
-
supportsTransportSpecificTerminationMessage
public boolean supportsTransportSpecificTerminationMessage()
-
getConnectionMethod
@NonNull public ConnectionMethod getConnectionMethod()
Description copied from class:DataTransport
Returns aConnectionMethod
instance that can be used to connect to this transport.This is used for listening transports where the address to listen on is not known until the connection has been set up for example if dynamic TCP port assignments are used or cloud relays.
For most data transports this will return the same
ConnectionMethod
instance that was passed at construction time. However for some transports where the address to listen on is not known until the connection have been set up (for example dynamic TCP listening port assignments or when a cloud relay is in use) it will differ.This cannot be called until the
DataTransport.Listener.onConnectionMethodReady()
callback has been fired.- Specified by:
getConnectionMethod
in classDataTransport
- Returns:
- A
ConnectionMethod
-derived instance.
-
-