public class ReferenceDevice extends Device implements WebSocket.Listener
The reference OCast device.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ReferenceDevice.Companion
The companion object.
|
| Modifier and Type | Field and Description |
|---|---|
static ReferenceDevice.Companion |
Companion
Deprecated.
|
static java.lang.String |
REFERENCE_WEB_SOCKET_ID
The identifier of the web socket of the reference device.
|
| Constructor and Description |
|---|
ReferenceDevice(UpnpDevice upnpDevice)
Creates an instance of
class ReferenceDevice from an class UpnpDevice. |
| Modifier and Type | Method and Description |
|---|---|
void |
connect(SSLConfiguration sslConfiguration,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError) |
void |
disconnect(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError) |
protected long |
generateSequenceID()
Generates a message identifier.
|
protected java.lang.String |
getClientUuid()
An identifier which uniquely identifies the device when sending OCast messages.
|
protected RunnableCallback |
getConnectCallback()
The callback executed when the device connect process is complete.
|
void |
getDeviceID(Consumer<java.lang.String> onSuccess,
Consumer<org.ocast.sdk.core.models.OCastDeviceSettingsError> onError) |
protected RunnableCallback |
getDisconnectCallback()
The callback executed when the device disconnect process is complete.
|
java.lang.String |
getManufacturer() |
void |
getMediaMetadata(Consumer<org.ocast.sdk.core.models.MediaMetadata> onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
void |
getMediaPlaybackStatus(Consumer<org.ocast.sdk.core.models.MediaPlaybackStatus> onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
protected java.util.Map<java.lang.Long,org.ocast.sdk.core.models.ReplyCallback> |
getReplyCallbacksBySequenceID()
A map of callbacks that will be executed when receiving reply messages, indexed by the identifier of their associated command message.
|
java.lang.String |
getSearchTarget() |
void |
getUpdateStatus(Consumer<org.ocast.sdk.core.models.UpdateStatus> onSuccess,
Consumer<org.ocast.sdk.core.models.OCastDeviceSettingsError> onError) |
protected java.util.concurrent.atomic.AtomicBoolean |
isApplicationRunning()
A boolean which indicates if the web application specified by
applicationName is currently running or not. |
void |
muteMedia(boolean mute,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
void |
onConnected(WebSocket webSocket)
Tells the listener that the socket is connected to the device.
|
protected void |
onCreateWebSockets(SSLConfiguration sslConfiguration,
Consumer<java.util.HashMap> onComplete)
Creates all the web sockets.
|
void |
onDataReceived(WebSocket webSocket,
java.lang.String data)
Tells the listener that the socket has received a message.
|
void |
onDisconnected(WebSocket webSocket,
java.lang.Throwable error)
Tells the listener that the socket has been disconnected from the device.
|
void |
pauseMedia(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
void |
playMedia(double position,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
void |
prepareMedia(PrepareMediaCommandParams params,
org.json.JSONObject options,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
void |
resumeMedia(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
void |
seekMedia(double position,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
<T> void |
send(OCastApplicationLayer<T> message,
OCastDomain domain,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError) |
<T,S> void |
send(OCastApplicationLayer<T> message,
OCastDomain domain,
java.lang.Class<S> replyClass,
Consumer<S> onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError) |
void |
sendGamepadEvent(SendGamepadEventCommandParams params,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError) |
void |
sendKeyEvent(SendKeyEventCommandParams params,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError) |
void |
sendMouseEvent(SendMouseEventCommandParams params,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError) |
protected void |
sendToWebSocket(long id,
java.lang.String message,
boolean startApplicationIfNeeded,
Consumer<org.ocast.sdk.core.models.OCastError> onError)
Sends a message on the web socket.
|
void |
setApplicationName(java.lang.String applicationName) |
protected void |
setApplicationRunning(java.util.concurrent.atomic.AtomicBoolean p)
A boolean which indicates if the web application specified by
applicationName is currently running or not. |
protected void |
setClientUuid(java.lang.String p)
An identifier which uniquely identifies the device when sending OCast messages.
|
protected void |
setConnectCallback(RunnableCallback p)
The callback executed when the device connect process is complete.
|
protected void |
setDisconnectCallback(RunnableCallback p)
The callback executed when the device disconnect process is complete.
|
void |
setMediaTrack(SetMediaTrackCommandParams params,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
void |
setMediaVolume(double volume,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
protected void |
setState(Device.State state) |
void |
startApplication(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError) |
void |
stopApplication(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError) |
void |
stopMedia(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError) |
connect, disconnect, getApplicationName, getCallbackWrapper, getDeviceID, getDeviceListener, getDialURL, getEventListener, getFriendlyName, getHost, getManufacturer, getMediaMetadata, getMediaPlaybackStatus, getModelName, getSearchTarget, getState, getUpdateStatus, getUpnpID, muteMedia, pauseMedia, playMedia, prepareMedia, resumeMedia, seekMedia, send, send, sendGamepadEvent, sendKeyEvent, sendMouseEvent, setApplicationName, setCallbackWrapper, setDeviceListener, setEventListener, setMediaTrack, setMediaVolume, setState, startApplication, stopApplication, stopMediaonConnected, onDataReceived, onDisconnected@NotNull public static java.lang.String REFERENCE_WEB_SOCKET_ID
The identifier of the web socket of the reference device.
This web socket sends commands and receives replies and events.
public static ReferenceDevice.Companion Companion
The companion object.
public ReferenceDevice(@NotNull
UpnpDevice upnpDevice)
Creates an instance of class ReferenceDevice from an class UpnpDevice.
upnpDevice - The UPnP device to create the reference device from.class ReferenceDevice,
class UpnpDevice@NotNull public java.lang.String getSearchTarget()
@NotNull public java.lang.String getManufacturer()
public void setApplicationName(@Nullable
java.lang.String applicationName)
protected void setState(@NotNull
Device.State state)
@NotNull protected java.lang.String getClientUuid()
An identifier which uniquely identifies the device when sending OCast messages.
protected void setClientUuid(@NotNull
java.lang.String p)
An identifier which uniquely identifies the device when sending OCast messages.
@Nullable protected RunnableCallback getConnectCallback()
The callback executed when the device connect process is complete.
protected void setConnectCallback(@Nullable
RunnableCallback p)
The callback executed when the device connect process is complete.
@Nullable protected RunnableCallback getDisconnectCallback()
The callback executed when the device disconnect process is complete.
protected void setDisconnectCallback(@Nullable
RunnableCallback p)
The callback executed when the device disconnect process is complete.
@NotNull protected java.util.Map<java.lang.Long,org.ocast.sdk.core.models.ReplyCallback> getReplyCallbacksBySequenceID()
A map of callbacks that will be executed when receiving reply messages, indexed by the identifier of their associated command message.
@NotNull protected java.util.concurrent.atomic.AtomicBoolean isApplicationRunning()
A boolean which indicates if the web application specified by applicationName is currently running or not.
protected void setApplicationRunning(@NotNull
java.util.concurrent.atomic.AtomicBoolean p)
A boolean which indicates if the web application specified by applicationName is currently running or not.
public void startApplication(@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastError> onError)
public void stopApplication(@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastError> onError)
public void connect(@Nullable
SSLConfiguration sslConfiguration,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastError> onError)
public void disconnect(@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastError> onError)
protected void onCreateWebSockets(@Nullable
SSLConfiguration sslConfiguration,
@NotNull
Consumer<java.util.HashMap> onComplete)
Creates all the web sockets.
Default behaviour creates only one web socket for the reference device.
If you need to override this method to manages multiple web sockets,
then you MUST call onComplete with a hash map of the created web sockets indexed by their identifier.
sslConfiguration - The SSL configuration if the web sockets to create are secure, or null if they are not secure.onComplete - The operation called when the web sockets are created.public void onDisconnected(@NotNull
WebSocket webSocket,
@Nullable
java.lang.Throwable error)
Tells the listener that the socket has been disconnected from the device.
webSocket - The web socket which informs the listener.error - The disconnection error, or null if the disconnection was initiated by the user.public void onConnected(@NotNull
WebSocket webSocket)
Tells the listener that the socket is connected to the device.
webSocket - The web socket which informs the listener.public void onDataReceived(@NotNull
WebSocket webSocket,
@NotNull
java.lang.String data)
Tells the listener that the socket has received a message.
webSocket - The web socket which informs the listener.data - : The message received.public void playMedia(double position,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void stopMedia(@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void pauseMedia(@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void resumeMedia(@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void prepareMedia(@NotNull
PrepareMediaCommandParams params,
@Nullable
org.json.JSONObject options,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void setMediaVolume(double volume,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void setMediaTrack(@NotNull
SetMediaTrackCommandParams params,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void seekMedia(double position,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void muteMedia(boolean mute,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void getMediaPlaybackStatus(@NotNull
Consumer<org.ocast.sdk.core.models.MediaPlaybackStatus> onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void getMediaMetadata(@NotNull
Consumer<org.ocast.sdk.core.models.MediaMetadata> onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
public void getUpdateStatus(@NotNull
Consumer<org.ocast.sdk.core.models.UpdateStatus> onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastDeviceSettingsError> onError)
public void getDeviceID(@NotNull
Consumer<java.lang.String> onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastDeviceSettingsError> onError)
public void sendKeyEvent(@NotNull
SendKeyEventCommandParams params,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError)
public void sendMouseEvent(@NotNull
SendMouseEventCommandParams params,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError)
public void sendGamepadEvent(@NotNull
SendGamepadEventCommandParams params,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError)
public <T> void send(@NotNull
OCastApplicationLayer<T> message,
@NotNull
OCastDomain domain,
@NotNull
java.lang.Runnable onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastError> onError)
public <T,S> void send(@NotNull
OCastApplicationLayer<T> message,
@NotNull
OCastDomain domain,
@NotNull
java.lang.Class<S> replyClass,
@NotNull
Consumer<S> onSuccess,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastError> onError)
protected void sendToWebSocket(long id,
@NotNull
java.lang.String message,
boolean startApplicationIfNeeded,
@NotNull
Consumer<org.ocast.sdk.core.models.OCastError> onError)
Sends a message on the web socket.
id - The identifier of the message to send.message - The message to send.startApplicationIfNeeded - Indicates if the web application should be started before sending the message.onError - The operation executed if there was an error while sending the message.protected long generateSequenceID()
Generates a message identifier.