Class CloverTransport
java.lang.Object
com.clover.remote.client.transport.CloverTransport
- All Implemented Interfaces:
ICloverTransport
- Direct Known Subclasses:
DualDisplayCloverTransport,NativeCloverTransport,USBCloverTransport,WebSocketCloverTransport
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObserver(ICloverTransportObserver observer) Registers a listener to receive connect events and messages from the transportvoiddispose()Closes the connection to the underlying transportintprotected voidShould be called by subclasses (super.notifyDeviceConnected) when the device connects (but is not ready) in order to forward to all observersprotected voidShould be called by subclasses (super.notifyDeviceDisconnected) when the device disconnects in order to forward to all observersprotected voidShould be called by subclasses (super.notifyDeviceReady) when the device is ready to process messages in order to forward to all observersprotected voidShould be called by subclasses (super.onMessage) when a message is received in order to forward to all observersvoidremoveObserver(ICloverTransportObserver observer) Remove a previously added listener.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.clover.remote.client.transport.ICloverTransport
initializeConnection, sendMessage
-
Field Details
-
DEVICE_CONNECTED
- See Also:
-
DEVICE_READY
- See Also:
-
DEVICE_DISCONNECTED
- See Also:
-
-
Constructor Details
-
CloverTransport
public CloverTransport()
-
-
Method Details
-
notifyDeviceConnected
protected void notifyDeviceConnected()Should be called by subclasses (super.notifyDeviceConnected) when the device connects (but is not ready) in order to forward to all observers -
notifyDeviceReady
protected void notifyDeviceReady()Should be called by subclasses (super.notifyDeviceReady) when the device is ready to process messages in order to forward to all observers -
notifyDeviceDisconnected
protected void notifyDeviceDisconnected()Should be called by subclasses (super.notifyDeviceDisconnected) when the device disconnects in order to forward to all observers -
onMessage
Should be called by subclasses (super.onMessage) when a message is received in order to forward to all observers- Parameters:
message- message to forward
-
getRemoteMessageVersion
public int getRemoteMessageVersion() -
addObserver
Description copied from interface:ICloverTransportRegisters a listener to receive connect events and messages from the transport- Specified by:
addObserverin interfaceICloverTransport- Parameters:
observer- listener to add
-
removeObserver
Description copied from interface:ICloverTransportRemove a previously added listener. If the provided listener is not registered, this call has no effect.- Specified by:
removeObserverin interfaceICloverTransport- Parameters:
observer- listener to remove
-
dispose
public void dispose()Description copied from interface:ICloverTransportCloses the connection to the underlying transport- Specified by:
disposein interfaceICloverTransport
-