Class ConnectionMethod
- java.lang.Object
-
- com.android.identity.ConnectionMethod
-
- Direct Known Subclasses:
ConnectionMethodBle
,ConnectionMethodHttp
,ConnectionMethodNfc
,ConnectionMethodWifiAware
public abstract class ConnectionMethod extends java.lang.Object
A class representing the ConnectionMethod structure exchanged between mdoc and mdoc reader.This is an abstract class - applications are expected to interact with concrete implementations, for example
ConnectionMethodBle
orConnectionMethodNfc
.
-
-
Constructor Summary
Constructors Constructor Description ConnectionMethod()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.util.List<ConnectionMethod>
combine(java.util.List<ConnectionMethod> connectionMethods)
Combines connection methods.abstract DataTransport
createDataTransport(android.content.Context context, int role, DataTransportOptions options)
Creates a newDataTransport
-derived instance for the given type ofConnectionMethod
.static java.util.List<ConnectionMethod>
disambiguate(java.util.List<ConnectionMethod> connectionMethods)
Disambiguates a list of connection methods.
-
-
-
Method Detail
-
combine
@NonNull public static java.util.List<ConnectionMethod> combine(@NonNull java.util.List<ConnectionMethod> connectionMethods)
Combines connection methods.Given a list of connection methods, produce a list where similar methods are combined into a single one. This is currently only applicable for BLE and one requirement is that all method instances share the same UUID. If this is not the case,
IllegalArgumentException
is thrown.This is the reverse of
disambiguate(List)
.- Parameters:
connectionMethods
- a list of connection methods.- Returns:
- the given list of connection methods where similar methods are combined into one.
- Throws:
java.lang.IllegalArgumentException
- if some methods couldn't be combined
-
disambiguate
@NonNull public static java.util.List<ConnectionMethod> disambiguate(@NonNull java.util.List<ConnectionMethod> connectionMethods)
Disambiguates a list of connection methods.Given a list of connection methods, produce a list where each method represents exactly one connectable endpoint. For example, for BLE if both central client mode and peripheral server mode is set, replaces this with two connection methods so it's clear which one is which.
This is the reverse of
combine(List)
.- Parameters:
connectionMethods
- a list of connection methods.- Returns:
- the given list of connection methods where each instance is unambiguously refers to one and only one connectable endpoint.
-
createDataTransport
@NonNull public abstract DataTransport createDataTransport(@NonNull android.content.Context context, int role, @NonNull DataTransportOptions options)
Creates a newDataTransport
-derived instance for the given type ofConnectionMethod
.- Parameters:
context
- application context.role
- whether the transport will be used by the mdoc or mdoc reader.options
- options for configuring the created instance.- Returns:
- A
DataTransport
-derived instance configured with the given options. - Throws:
java.lang.IllegalArgumentException
- if the connection-method has invalid options specified.
-
-