Package com.castlabs.sdk.claws

# Class ClawsServiceBinder

java.lang.Object
android.os.Binder
com.castlabs.sdk.claws.ClawsServiceBinder

All Implemented Interfaces:
  `IBinder`

public class ClawsServiceBinder extends Binder
Binder for the ClawsService.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface android.os.IBinder

  `IBinder.DeathRecipient`

- ## Field Summary

  ### Fields inherited from interface android.os.IBinder

  `DUMP_TRANSACTION, FIRST_CALL_TRANSACTION, FLAG_ONEWAY, INTERFACE_TRANSACTION, LAST_CALL_TRANSACTION, LIKE_TRANSACTION, PING_TRANSACTION, TWEET_TRANSACTION`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClawsServiceBinder(ClawsService clawsService)`
  Creates a new ClawsServiceBinder.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addListener(ClawsServiceListener listener)`
  Adds a listener for CLAWS service events.
  `void`
  `connect(String url, String userId, String deviceName)`
  Connects to the CLAWS server.
  `void`
  `disconnect()`
  Disconnects from the CLAWS server.
  `void`
  `emitTransferAccepted(long assetId, Device sourceDevice)`
  Emits a transfer accepted event.
  `void`
  `emitTransferCanceled(long assetId, Device sourceDevice)`
  Emits a transfer canceled event.
  `List<Device>`
  `getConnectedDevices()`
  Gets the list of connected devices.
  `void`
  `removeListener(ClawsServiceListener listener)`
  Removes a listener for CLAWS service events.
  `void`
  `transfer(String assetId, long positionMs, Device targetDevice, ClawsService.TransferCallback callback)`
  Transfers an asset to a target device.

  ### Methods inherited from class android.os.Binder

  `attachInterface, clearCallingIdentity, clearCallingWorkSource, dump, dumpAsync, flushPendingCommands, getCallingPid, getCallingUid, getCallingUidOrThrow, getCallingUserHandle, getCallingWorkSourceUid, getInterfaceDescriptor, isBinderAlive, joinThreadPool, linkToDeath, pingBinder, queryLocalInterface, restoreCallingIdentity, restoreCallingWorkSource, setCallingWorkSourceUid, transact, unlinkToDeath`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ClawsServiceBinder

    public ClawsServiceBinder(@NonNull ClawsService clawsService)
    Creates a new ClawsServiceBinder.
    Parameters:
      `clawsService` - The ClawsService instance.

- ## Method Details

  - ### connect

    public void connect(String url, String userId, String deviceName) throws Exception
    Connects to the CLAWS server.
    Parameters:
      `url` - The URL of the CLAWS server.
      `userId` - The user ID.
      `deviceName` - The device name.
    Throws:
      `Exception` - If an error occurs while connecting.

  - ### getConnectedDevices

    @NonNull public List<Device> getConnectedDevices()
    Gets the list of connected devices.
    Returns:
      The list of connected devices.

  - ### transfer

    public void transfer(String assetId, long positionMs, Device targetDevice, ClawsService.TransferCallback callback)
    Transfers an asset to a target device.
    Parameters:
      `assetId` - The ID of the asset to transfer.
      `positionMs` - The position in milliseconds to start the transfer from.
      `targetDevice` - The target device.
      `callback` - The callback to be invoked when the transfer is complete or an error occurs.

  - ### disconnect

    public void disconnect()
    Disconnects from the CLAWS server.

  - ### addListener

    public void addListener(ClawsServiceListener listener)
    Adds a listener for CLAWS service events.
    Parameters:
      `listener` - The listener to add.

  - ### removeListener

    public void removeListener(ClawsServiceListener listener)
    Removes a listener for CLAWS service events.
    Parameters:
      `listener` - The listener to remove.

  - ### emitTransferCanceled

    public void emitTransferCanceled(long assetId, Device sourceDevice)
    Emits a transfer canceled event.
    Parameters:
      `assetId` - The ID of the asset for which the transfer was canceled.
      `sourceDevice` - The source device.

  - ### emitTransferAccepted

    public void emitTransferAccepted(long assetId, Device sourceDevice)
    Emits a transfer accepted event.
    Parameters:
      `assetId` - The ID of the asset for which the transfer was accepted.
      `sourceDevice` - The source device.