public interface DeviceListener
Device
Modifier and Type | Method and Description |
---|---|
void |
onPresenceChanged(Device inDevice,
PresenceEvent inPresenceEvent)
Called when the presence status for one or more other clients has changed.
|
void |
onStartListening(Device inDevice)
Called when the Device has started listening for incoming connections.
|
void |
onStopListening(Device inDevice)
Called when the Device has stopped listening for incoming connections.
|
void |
onStopListening(Device inDevice,
int inErrorCode,
java.lang.String inErrorMessage)
Called when the Device has stopped listening for incoming connections due to an error condition.
|
boolean |
receivePresenceEvents(Device inDevice)
Called to query whether or not the application wants to receive presence events.
|
void onStartListening(Device inDevice)
inDevice
- The Device instance that has started listeningvoid onStopListening(Device inDevice)
inDevice
- The device instance that has stopped listeningvoid onStopListening(Device inDevice, int inErrorCode, java.lang.String inErrorMessage)
inDevice
- The device instance that has stopped listeninginErrorCode
- The error code that pinpoints the errorinErrorMessage
- A string describing the error in a human-readable formboolean receivePresenceEvents(Device inDevice)
false
from it. You'll still need to implement
onPresenceChanged(Device, PresenceEvent)
, of course, but
an empty body will do, and it will never be called.inDevice
- The Device querying about presence notificationsvoid onPresenceChanged(Device inDevice, PresenceEvent inPresenceEvent)
receivePresenceEvents(Device)
returns true
.
Thereafter it is invoked as clients become available or unavailable.
A client is considered available even if another call is in progress.
When your client disconnects the onStopListening(Device)
method will be invoked, and when the device reconnects this method will be called again
for every available online client.
The PresenceEvent
object may be reused in between calls, so any
data required to persist past the invocation of this method should be copied out.inDevice
- The Device receiving the presence change notificationinPresenceEvent
- A PresenceEvent
object describing the notification