Package com.castlabs.sdk.claws
Class ClawsServiceConnection
java.lang.Object
com.castlabs.sdk.claws.ClawsServiceConnection
- All Implemented Interfaces:
ServiceConnection
Manages the connection to the ClawsService.
This class handles binding and unbinding to the service,
as well as communication with the service once connected.
-
Constructor Summary
ConstructorsConstructorDescriptionClawsServiceConnection(ClawsServiceListener listener) Constructs a new ClawsServiceConnection. -
Method Summary
Modifier and TypeMethodDescriptionvoidConnects to the Claws remote service.voidconnectService(Context context) Connects to the ClawsService.voidDisconnects from the ClawsService.voidemitTransferAccepted(long assetId, Device sourceDevice) Emits a transfer accepted event.voidemitTransferCanceled(long assetId, Device sourceDevice) Emits a transfer canceled event.Returns the ClawsServiceBinder.voidonServiceConnected(ComponentName name, IBinder service) voidMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface android.content.ServiceConnection
onBindingDied, onNullBinding
-
Constructor Details
-
ClawsServiceConnection
Constructs a new ClawsServiceConnection.- Parameters:
listener- The listener to be notified of service events.
-
-
Method Details
-
onServiceConnected
- Specified by:
onServiceConnectedin interfaceServiceConnection
-
onServiceDisconnected
- Specified by:
onServiceDisconnectedin interfaceServiceConnection
-
connectClaws
public void connectClaws()Connects to the Claws remote service. This method attempts to establish a connection with the Claws remote service using the default URL and credentials. -
connectService
Connects to the ClawsService. This method binds to the ClawsService, establishing a connection.- Parameters:
context- The context used to bind to the service.
-
disconnectService
public void disconnectService()Disconnects from the ClawsService. This method unbinds from the ClawsService, closing the connection. -
getBinder
Returns the ClawsServiceBinder.- Returns:
- The ClawsServiceBinder, or null if not connected.
-
emitTransferCanceled
Emits a transfer canceled event. This method notifies the ClawsService that a transfer has been canceled.- Parameters:
assetId- The ID of the asset being transferred.sourceDevice- The device from which the transfer originated.
-
emitTransferAccepted
Emits a transfer accepted event. This method notifies the ClawsService that a transfer has been accepted.- Parameters:
assetId- The ID of the asset being transferred.sourceDevice- The device from which the transfer originated.
-