Class ConnectionManager


  • public class ConnectionManager
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ConnectionManager​(android.hardware.usb.UsbManager usbManager, android.hardware.usb.UsbDevice usbDevice)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends com.yubico.yubikit.core.YubiKeyConnection>
      T
      openConnection​(java.lang.Class<T> connectionType)
      TODO: fixme Checks if a connection type is supported by the device, attempts to acquire the connection lock, and returns a connection.
      static <T extends com.yubico.yubikit.core.YubiKeyConnection>
      void
      registerConnectionHandler​(java.lang.Class<T> connectionClass, ConnectionHandler<? extends T> handler)
      Registers a new ConnectionHandler for creating YubiKeyConnections.
      boolean supportsConnection​(java.lang.Class<? extends com.yubico.yubikit.core.YubiKeyConnection> connectionType)
      Checks to see if a given connection type is supported
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConnectionManager

        public ConnectionManager​(android.hardware.usb.UsbManager usbManager,
                                 android.hardware.usb.UsbDevice usbDevice)
    • Method Detail

      • registerConnectionHandler

        public static <T extends com.yubico.yubikit.core.YubiKeyConnection> void registerConnectionHandler​(java.lang.Class<T> connectionClass,
                                                                                                           ConnectionHandler<? extends T> handler)
        Registers a new ConnectionHandler for creating YubiKeyConnections.
        Type Parameters:
        T - the type of connection created by the handler
        Parameters:
        connectionClass - the type of connection created by the handler
        handler - the handler responsible for creating connections
      • supportsConnection

        public boolean supportsConnection​(java.lang.Class<? extends com.yubico.yubikit.core.YubiKeyConnection> connectionType)
        Checks to see if a given connection type is supported
        Parameters:
        connectionType - the type of connection to check support for
        Returns:
        true if the connection type is supported
      • openConnection

        @WorkerThread
        public <T extends com.yubico.yubikit.core.YubiKeyConnection> T openConnection​(java.lang.Class<T> connectionType)
                                                                               throws java.io.IOException
        TODO: fixme Checks if a connection type is supported by the device, attempts to acquire the connection lock, and returns a connection.
        Type Parameters:
        T - the type of connection to open
        Parameters:
        connectionType - the type of connection to open
        Throws:
        java.io.IOException