public class Device
Represents a remote OCast device.
Modifier and Type | Method and Description |
---|---|
void |
connect(SSLConfiguration sslConfiguration,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError)
Connects to the device.
|
void |
disconnect(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError)
Disconnects from the device.
|
java.lang.String |
getApplicationName()
Returns the name of the web application to use.
|
CallbackWrapper |
getCallbackWrapper()
Returns the callback wrapper.
|
void |
getDeviceID(Consumer<java.lang.String> onSuccess,
Consumer<org.ocast.sdk.core.models.OCastDeviceSettingsError> onError)
Retrieves the device identifier.
|
protected DeviceListener |
getDeviceListener()
Returns the device listener.
|
protected java.net.URL |
getDialURL()
Returns the URL of the DIAL service.
|
protected EventListener |
getEventListener()
Returns the event listener.
|
java.lang.String |
getFriendlyName()
Returns the friendly name of the device.
|
java.lang.String |
getHost()
Returns the device host.
|
java.lang.String |
getManufacturer()
Returns the manufacturer of the device.
|
void |
getMediaMetadata(Consumer<org.ocast.sdk.core.models.MediaMetadata> onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Retrieves the metadata of the current media.
|
void |
getMediaPlaybackStatus(Consumer<org.ocast.sdk.core.models.MediaPlaybackStatus> onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Retrieves the playback status of the current media.
|
java.lang.String |
getModelName()
Returns the model name of the device.
|
java.lang.String |
getSearchTarget()
Returns the SSDP search target.
|
Device.State |
getState()
Returns the current state of the device.
|
void |
getUpdateStatus(Consumer<org.ocast.sdk.core.models.UpdateStatus> onSuccess,
Consumer<org.ocast.sdk.core.models.OCastDeviceSettingsError> onError)
Retrieves the firmware update status of the device.
|
java.lang.String |
getUpnpID()
Returns the UPnP identifier of the device.
|
void |
muteMedia(boolean mute,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Mutes or unmutes the current media.
|
void |
pauseMedia(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Pauses the current media.
|
void |
playMedia(double position,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Plays a media at the specified position.
|
void |
prepareMedia(PrepareMediaCommandParams params,
org.json.JSONObject options,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Prepares a media to be played.
|
void |
resumeMedia(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Resumes the current media.
|
void |
seekMedia(double position,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Seeks the current media to the specified position.
|
<T> void |
send(OCastApplicationLayer<T> message,
OCastDomain domain,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError)
Sends a message which does not expect any reply data to the specified OCast domain.
|
<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)
Sends a message which expects a reply data to the specified OCast domain.
|
void |
sendGamepadEvent(SendGamepadEventCommandParams params,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError)
Sends a gamepad event.
|
void |
sendKeyEvent(SendKeyEventCommandParams params,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError)
Sends a keyboard event.
|
void |
sendMouseEvent(SendMouseEventCommandParams params,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError)
Sends a mouse event.
|
void |
setApplicationName(java.lang.String applicationName)
Changes the name of the web application to use.
|
void |
setCallbackWrapper(CallbackWrapper callbackWrapper)
Changes the callback wrapper.
|
protected void |
setDeviceListener(DeviceListener deviceListener)
Changes the device listener.
|
protected void |
setEventListener(EventListener eventListener)
Changes the event listener.
|
void |
setMediaTrack(SetMediaTrackCommandParams params,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Changes the current track of the current media.
|
void |
setMediaVolume(double volume,
java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Changes the media volume.
|
protected void |
setState(Device.State state)
Changes the current state of the device.
|
void |
startApplication(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError)
Starts the application identified by the return value of `getApplicationName()`.
|
void |
stopApplication(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastError> onError)
Stops the application identified by the return value of `getApplicationName()`.
|
void |
stopMedia(java.lang.Runnable onSuccess,
Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Stops the current media.
|
@NotNull public java.lang.String getUpnpID()
Returns the UPnP identifier of the device.
@NotNull protected java.net.URL getDialURL()
Returns the URL of the DIAL service.
This URL is used to start or stop web applications on the device.
@NotNull public java.lang.String getHost()
Returns the device host.
@NotNull public java.lang.String getFriendlyName()
Returns the friendly name of the device.
@NotNull public java.lang.String getModelName()
Returns the model name of the device.
@NotNull public Device.State getState()
Returns the current state of the device.
protected void setState(@NotNull Device.State state)
Changes the current state of the device.
state
- org.jetbrains.dokka.NodeRenderContent@4b937daa: The new state.@Nullable public java.lang.String getApplicationName()
Returns the name of the web application to use.
public void setApplicationName(@Nullable java.lang.String applicationName)
Changes the name of the web application to use.
You MUST set the application name before calling `startApplication(@NotNull Runnable onSuccess, @NotNull Consumer
applicationName
- org.jetbrains.dokka.NodeRenderContent@42e6fe24: The new application name.@Nullable protected DeviceListener getDeviceListener()
Returns the device listener.
protected void setDeviceListener(@Nullable DeviceListener deviceListener)
Changes the device listener.
deviceListener
- org.jetbrains.dokka.NodeRenderContent@691bba0f: The new device listener.@Nullable protected EventListener getEventListener()
Returns the event listener.
protected void setEventListener(@Nullable EventListener eventListener)
Changes the event listener.
eventListener
- org.jetbrains.dokka.NodeRenderContent@736ffc82: The new event listener.@NotNull public CallbackWrapper getCallbackWrapper()
Returns the callback wrapper.
public void setCallbackWrapper(@NotNull CallbackWrapper callbackWrapper)
Changes the callback wrapper.
callbackWrapper
- org.jetbrains.dokka.NodeRenderContent@5146b9b5: The new callback wrapper.@NotNull public java.lang.String getSearchTarget()
Returns the SSDP search target.
@NotNull public java.lang.String getManufacturer()
Returns the manufacturer of the device.
public void connect(@Nullable SSLConfiguration sslConfiguration, @NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastError> onError)
Connects to the device.
sslConfiguration
- org.jetbrains.dokka.NodeRenderContent@1af983bc: The SSL configuration of the web socket used to connect to the device if it is secure, or `null` if the web socket is not secure.onSuccess
- org.jetbrains.dokka.NodeRenderContent@7e961a47: The operation executed if the connection succeeded.onError
- org.jetbrains.dokka.NodeRenderContent@f9c486a: The operation executed if the connection failed.public void disconnect(@NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastError> onError)
Disconnects from the device.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@49a38ec1: The operation executed if the disconnection succeeded.onError
- org.jetbrains.dokka.NodeRenderContent@1f91002a: The operation executed if the disconnection failed.public void startApplication(@NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastError> onError)
Starts the application identified by the return value of `getApplicationName()`.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@519b75bd: The operation executed if the application started successfully.onError
- org.jetbrains.dokka.NodeRenderContent@3ca9a8fc: The operation executed if there was an error while starting the application.public void stopApplication(@NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastError> onError)
Stops the application identified by the return value of `getApplicationName()`.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@6929fc2e: The operation executed if the application stopped successfully.onError
- org.jetbrains.dokka.NodeRenderContent@7eae3171: The operation executed if there was an error while stopping the application.public void playMedia(double position, @NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Plays a media at the specified position.
position
- org.jetbrains.dokka.NodeRenderContent@74929584: The position to play the media at, in seconds.onSuccess
- org.jetbrains.dokka.NodeRenderContent@50d3da2: The operation executed if the media played successfully.onError
- org.jetbrains.dokka.NodeRenderContent@23e379a1: The operation executed if there was an error while playing the media.public void stopMedia(@NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Stops the current media.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@2cc9e115: The operation executed if the media stopped successfully.onError
- org.jetbrains.dokka.NodeRenderContent@4c176fbd: The operation executed if there was an error while stopping the media.public void pauseMedia(@NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Pauses the current media.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@209bbbb0: The operation executed if the media paused successfully.onError
- org.jetbrains.dokka.NodeRenderContent@188df073: The operation executed if there was an error while pausing the media.public void resumeMedia(@NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Resumes the current media.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@7b2f6b3e: The operation executed if the media resumed successfully.onError
- org.jetbrains.dokka.NodeRenderContent@c329961: The operation executed if there was an error while resuming the media.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)
Prepares a media to be played.
params
- org.jetbrains.dokka.NodeRenderContent@7109f56c: The parameters of the `prepare` command.options
- org.jetbrains.dokka.NodeRenderContent@6f08d56: The options of the `prepare` command.onSuccess
- org.jetbrains.dokka.NodeRenderContent@606602d: The operation executed if the media was prepared successfully.onError
- org.jetbrains.dokka.NodeRenderContent@1ee7181d: The operation executed if there was an error while preparing the media.public void setMediaVolume(double volume, @NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Changes the media volume.
volume
- org.jetbrains.dokka.NodeRenderContent@20fb3c38: The volume, ranging from 0.0 to 1.0.onSuccess
- org.jetbrains.dokka.NodeRenderContent@22e39f4c: The operation executed if the volume was changed successfully.onError
- org.jetbrains.dokka.NodeRenderContent@17518435: The operation executed if there was an error while changing the volume.public void setMediaTrack(@NotNull SetMediaTrackCommandParams params, @NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Changes the current track of the current media.
params
- org.jetbrains.dokka.NodeRenderContent@31d05132: The parameters of the `setMediaTrack` command.onSuccess
- org.jetbrains.dokka.NodeRenderContent@4833a1cc: The operation executed if the track was changed successfully.onError
- org.jetbrains.dokka.NodeRenderContent@76944e79: The operation executed if there was an error while changing the track.public void seekMedia(double position, @NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Seeks the current media to the specified position.
position
- org.jetbrains.dokka.NodeRenderContent@6d7f0cb2: The position to seek the media to, in seconds.onSuccess
- org.jetbrains.dokka.NodeRenderContent@5e1599ee: The operation executed if the media position was changed successfully.onError
- org.jetbrains.dokka.NodeRenderContent@bfd6e21: The operation executed if there was an error while seeking the media to the specified position.public void muteMedia(boolean mute, @NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Mutes or unmutes the current media.
mute
- org.jetbrains.dokka.NodeRenderContent@5f4e1ea1: Indicates if the media should be muted or not.onSuccess
- org.jetbrains.dokka.NodeRenderContent@4ac18366: The operation executed if the media was muted or unmuted successfully.onError
- org.jetbrains.dokka.NodeRenderContent@38e9b939: The operation executed if there was an error while muting or unmuting the media.public void getMediaPlaybackStatus(@NotNull Consumer<org.ocast.sdk.core.models.MediaPlaybackStatus> onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Retrieves the playback status of the current media.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@58054463: The operation executed if the playback status was retrieved successfully.onError
- org.jetbrains.dokka.NodeRenderContent@7711f2d4: The operation executed if there was an error while retrieving the playback status.public void getMediaMetadata(@NotNull Consumer<org.ocast.sdk.core.models.MediaMetadata> onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastMediaError> onError)
Retrieves the metadata of the current media.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@318d95e3: The operation executed if the metadata was retrieved successfully.onError
- org.jetbrains.dokka.NodeRenderContent@4458c29a: The operation executed if there was an error while retrieving the metadata.public void getUpdateStatus(@NotNull Consumer<org.ocast.sdk.core.models.UpdateStatus> onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastDeviceSettingsError> onError)
Retrieves the firmware update status of the device.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@368ca02e: The operation executed if the update status was retrieved successfully.onError
- org.jetbrains.dokka.NodeRenderContent@4ef37379: The operation executed if there was an error while retrieving the update status.public void getDeviceID(@NotNull Consumer<java.lang.String> onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastDeviceSettingsError> onError)
Retrieves the device identifier.
onSuccess
- org.jetbrains.dokka.NodeRenderContent@138cc5c9: The operation executed if the device identifier was retrieved successfully.onError
- org.jetbrains.dokka.NodeRenderContent@11c28930: The operation executed if there was an error while retrieving the device identifier.public void sendKeyEvent(@NotNull SendKeyEventCommandParams params, @NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError)
Sends a keyboard event.
params
- org.jetbrains.dokka.NodeRenderContent@421cc6f6: The parameters of the `sendKeyEvent` command.onSuccess
- org.jetbrains.dokka.NodeRenderContent@17210d77: The operation executed if the keyboard event was sent successfully.onError
- org.jetbrains.dokka.NodeRenderContent@627630d7: The operation executed if there was an error while sending the keyboard event.public void sendMouseEvent(@NotNull SendMouseEventCommandParams params, @NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError)
Sends a mouse event.
params
- org.jetbrains.dokka.NodeRenderContent@6778bea0: The parameters of the `sendMouseEvent` command.onSuccess
- org.jetbrains.dokka.NodeRenderContent@4377ffcf: The operation executed if the mouse event was sent successfully.onError
- org.jetbrains.dokka.NodeRenderContent@5ca21863: The operation executed if there was an error while sending the mouse event.public void sendGamepadEvent(@NotNull SendGamepadEventCommandParams params, @NotNull java.lang.Runnable onSuccess, @NotNull Consumer<org.ocast.sdk.core.models.OCastInputSettingsError> onError)
Sends a gamepad event.
params
- org.jetbrains.dokka.NodeRenderContent@f816ba8: The parameters of the `sendGamepadEvent` command.onSuccess
- org.jetbrains.dokka.NodeRenderContent@2d2e4946: The operation executed if the gamepad event was sent successfully.onError
- org.jetbrains.dokka.NodeRenderContent@51db52ab: The operation executed if there was an error while sending the gamepad event.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)
Sends a message which does not expect any reply data to the specified OCast domain.
message
- org.jetbrains.dokka.NodeRenderContent@1df629f3: The message to send.domain
- org.jetbrains.dokka.NodeRenderContent@19aecdce: The OCast domain to send the message to.onSuccess
- org.jetbrains.dokka.NodeRenderContent@4615d3c4: The operation executed if the message was sent successfully.onError
- org.jetbrains.dokka.NodeRenderContent@4d508fa7: The operation executed if there was an error while sending the message.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)
Sends a message which expects a reply data to the specified OCast domain.
message
- org.jetbrains.dokka.NodeRenderContent@61c59e4f: The message to send.domain
- org.jetbrains.dokka.NodeRenderContent@e6aff04: The OCast domain to send the message to.replyClass
- org.jetbrains.dokka.NodeRenderContent@668996fe: The class of the reply data.onSuccess
- org.jetbrains.dokka.NodeRenderContent@2fed103f: The operation executed if the message was sent successfully.onError
- org.jetbrains.dokka.NodeRenderContent@6217d46b: The operation executed if there was an error while sending the message.