Class AgentHandler

java.lang.Object
com.github.hypfvieh.bluetooth.wrapper.AbstractBluetoothObject
com.github.hypfvieh.bluetooth.wrapper.AgentHandler
All Implemented Interfaces:
Agent1, org.freedesktop.dbus.interfaces.DBusInterface

public final class AgentHandler extends AbstractBluetoothObject implements Agent1
  • Constructor Summary

    Constructors
    Constructor
    Description
    AgentHandler(String _dbusPath, org.freedesktop.dbus.connections.impl.DBusConnection _dbusConnection, AgentChangeListener agentChangeListener)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    AuthorizeService(org.freedesktop.dbus.DBusPath _device, String _uuid)
    From bluez documentation:

    This method gets called when the service daemon
    needs to authorize a connection/service request.

    void
    From bluez documentation:

    This method gets called to indicate that the agent
    request failed before a reply was returned.
    void
    DisplayPasskey(org.freedesktop.dbus.DBusPath _device, org.freedesktop.dbus.types.UInt32 _passkey, org.freedesktop.dbus.types.UInt16 _entered)
    From bluez documentation:

    This method gets called when the service daemon
    needs to display a passkey for an authentication.

    The entered parameter indicates the number of already
    typed keys on the remote side.

    An empty reply should be returned.
    void
    DisplayPinCode(org.freedesktop.dbus.DBusPath _device, String _pincode)
    From bluez documentation:

    This method gets called when the service daemon
    needs to display a pincode for an authentication.

    An empty reply should be returned.
    protected Class<? extends org.freedesktop.dbus.interfaces.DBusInterface>
    DBus-Interface class used in this wrapper object.
     
    boolean
     
    void
    From bluez documentation:

    This method gets called when the service daemon
    unregisters the agent.
    void
    RequestAuthorization(org.freedesktop.dbus.DBusPath _device)
    From bluez documentation:

    This method gets called to request the user to
    authorize an incoming pairing attempt which
    would in other circumstances trigger the just-works
    model, or when the user plugged in a device that
    implements cable pairing.
    void
    RequestConfirmation(org.freedesktop.dbus.DBusPath _device, org.freedesktop.dbus.types.UInt32 _passkey)
    From bluez documentation:

    This method gets called when the service daemon
    needs to confirm a passkey for an authentication.

    To confirm the value it should return an empty reply
    or an error in case the passkey is invalid.

    Note that the passkey will always be a 6-digit number,
    so the display should be zero-padded at the start if
    the value contains less than 6 digits.

    org.freedesktop.dbus.types.UInt32
    RequestPasskey(org.freedesktop.dbus.DBusPath _device)
    From bluez documentation:

    This method gets called when the service daemon
    needs to get the passkey for an authentication.

    The return value should be a numeric value
    between 0-999999.

    RequestPinCode(org.freedesktop.dbus.DBusPath _device)
    From bluez documentation:

    This method gets called when the service daemon
    needs to get the passkey for an authentication.

    The return value should be a string of 1-16 characters
    length.

    Methods inherited from class java.lang.Object

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

    • AgentHandler

      public AgentHandler(String _dbusPath, org.freedesktop.dbus.connections.impl.DBusConnection _dbusConnection, AgentChangeListener agentChangeListener)
  • Method Details

    • AuthorizeService

      public void AuthorizeService(org.freedesktop.dbus.DBusPath _device, String _uuid) throws BluezRejectedException, BluezCanceledException
      Description copied from interface: Agent1
      From bluez documentation:

      This method gets called when the service daemon
      needs to authorize a connection/service request.

      Specified by:
      AuthorizeService in interface Agent1
      Parameters:
      _device - device
      _uuid - uuid
      Throws:
      BluezRejectedException - when operation rejected
      BluezCanceledException - when operation canceled
    • Cancel

      public void Cancel()
      Description copied from interface: Agent1
      From bluez documentation:

      This method gets called to indicate that the agent
      request failed before a reply was returned.
      Specified by:
      Cancel in interface Agent1
    • DisplayPasskey

      public void DisplayPasskey(org.freedesktop.dbus.DBusPath _device, org.freedesktop.dbus.types.UInt32 _passkey, org.freedesktop.dbus.types.UInt16 _entered)
      Description copied from interface: Agent1
      From bluez documentation:

      This method gets called when the service daemon
      needs to display a passkey for an authentication.

      The entered parameter indicates the number of already
      typed keys on the remote side.

      An empty reply should be returned. When the passkey
      needs no longer to be displayed, the Cancel method
      of the agent will be called.

      During the pairing process this method might be
      called multiple times to update the entered value.

      Note that the passkey will always be a 6-digit number,
      so the display should be zero-padded at the start if
      the value contains less than 6 digits.

      Specified by:
      DisplayPasskey in interface Agent1
      Parameters:
      _device - device
      _passkey - passkey
      _entered - entered
    • DisplayPinCode

      public void DisplayPinCode(org.freedesktop.dbus.DBusPath _device, String _pincode) throws BluezRejectedException, BluezCanceledException
      Description copied from interface: Agent1
      From bluez documentation:

      This method gets called when the service daemon
      needs to display a pincode for an authentication.

      An empty reply should be returned. When the pincode
      needs no longer to be displayed, the Cancel method
      of the agent will be called.

      This is used during the pairing process of keyboards
      that don't support Bluetooth 2.1 Secure Simple Pairing,
      in contrast to DisplayPasskey which is used for those
      that do.

      This method will only ever be called once since
      older keyboards do not support typing notification.

      Note that the PIN will always be a 6-digit number,
      zero-padded to 6 digits. This is for harmony with
      the later specification.

      Specified by:
      DisplayPinCode in interface Agent1
      Parameters:
      _device - device
      _pincode - pincode
      Throws:
      BluezRejectedException - when operation rejected
      BluezCanceledException - when operation canceled
    • Release

      public void Release()
      Description copied from interface: Agent1
      From bluez documentation:

      This method gets called when the service daemon
      unregisters the agent. An agent can use it to do
      cleanup tasks. There is no need to unregister the
      agent, because when this method gets called it has
      already been unregistered.

      Specified by:
      Release in interface Agent1
    • RequestAuthorization

      public void RequestAuthorization(org.freedesktop.dbus.DBusPath _device) throws BluezRejectedException, BluezCanceledException
      Description copied from interface: Agent1
      From bluez documentation:

      This method gets called to request the user to
      authorize an incoming pairing attempt which
      would in other circumstances trigger the just-works
      model, or when the user plugged in a device that
      implements cable pairing. In the latter case, the
      device would not be connected to the adapter via
      Bluetooth yet.

      Specified by:
      RequestAuthorization in interface Agent1
      Parameters:
      _device - device
      Throws:
      BluezRejectedException - when operation rejected
      BluezCanceledException - when operation canceled
    • RequestConfirmation

      public void RequestConfirmation(org.freedesktop.dbus.DBusPath _device, org.freedesktop.dbus.types.UInt32 _passkey) throws BluezRejectedException, BluezCanceledException
      Description copied from interface: Agent1
      From bluez documentation:

      This method gets called when the service daemon
      needs to confirm a passkey for an authentication.

      To confirm the value it should return an empty reply
      or an error in case the passkey is invalid.

      Note that the passkey will always be a 6-digit number,
      so the display should be zero-padded at the start if
      the value contains less than 6 digits.

      Specified by:
      RequestConfirmation in interface Agent1
      Parameters:
      _device - device
      _passkey - passkey
      Throws:
      BluezRejectedException - when operation rejected
      BluezCanceledException - when operation canceled
    • RequestPasskey

      public org.freedesktop.dbus.types.UInt32 RequestPasskey(org.freedesktop.dbus.DBusPath _device) throws BluezRejectedException, BluezCanceledException
      Description copied from interface: Agent1
      From bluez documentation:

      This method gets called when the service daemon
      needs to get the passkey for an authentication.

      The return value should be a numeric value
      between 0-999999.

      Specified by:
      RequestPasskey in interface Agent1
      Parameters:
      _device - device
      Returns:
      UInt32 - maybe null
      Throws:
      BluezRejectedException - when operation rejected
      BluezCanceledException - when operation canceled
    • RequestPinCode

      public String RequestPinCode(org.freedesktop.dbus.DBusPath _device) throws BluezRejectedException, BluezCanceledException
      Description copied from interface: Agent1
      From bluez documentation:

      This method gets called when the service daemon
      needs to get the passkey for an authentication.

      The return value should be a string of 1-16 characters
      length. The string can be alphanumeric.

      Specified by:
      RequestPinCode in interface Agent1
      Parameters:
      _device - device
      Returns:
      String - maybe null
      Throws:
      BluezRejectedException - when operation rejected
      BluezCanceledException - when operation canceled
    • getInterfaceClass

      protected Class<? extends org.freedesktop.dbus.interfaces.DBusInterface> getInterfaceClass()
      Description copied from class: AbstractBluetoothObject
      DBus-Interface class used in this wrapper object.
      Specified by:
      getInterfaceClass in class AbstractBluetoothObject
      Returns:
      class which implements the interface
    • getObjectPath

      public String getObjectPath()
      Specified by:
      getObjectPath in interface org.freedesktop.dbus.interfaces.DBusInterface
    • isRemote

      public boolean isRemote()
      Specified by:
      isRemote in interface org.freedesktop.dbus.interfaces.DBusInterface