Interface CommandExecutionFacade

  • public interface CommandExecutionFacade
    Offers commands to be executed on Tapkey locks. Methods of this class expect a TLCP connection to a Tapkey lock and take a cancellation token for execution control.

    The example below outlines a possible usage of triggerLockAsync(TlcpConnection, CancellationToken). In the present example, the required TLCP connection is established using the BleLockCommunicator.

     // The Bluetooth Communicator establishes a connection to the Tapkey lock via Bluetooth and lets
     // the CommandExecutionFacade use this connection to execute a TriggerLock command.
     return bleLockCommunicator.executeCommandAsync(bluetoothAddress, physicalLockId, tlcpConnection -> {
         // Now, with the TlcpConnection to the lock available, the CommandExecutionFacade
         // asynchronously executes the trigger lock command.
         return commandExecutionFacade.triggerLockAsync(tlcpConnection, ct);
     }, ct).continueOnUi(commandResult -> {
         switch (commandResult.getCommandResultCode()) {
             case Ok:
                 return true;
             // Handle error results.
         return false;
     }).catchOnUi(e -> {
         Log.e(TAG, "Could not execute trigger lock command.", e);
         if (!ct.isCancellationRequested()) {
              // Handle any exceptions and let the user know, something went wrong.
         return false;