Skip to content

Commit 2027efa

Browse files
committed
Renamed a forgotten instance of launch() to launchApplication() and added launchDefaultMediaReceiver()
1 parent 0002688 commit 2027efa

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

src/main/java/org/digitalmediaserver/cast/CastDevice.java

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,49 @@ public boolean isApplicationRunning(String applicationId) throws IOException {
720720
return application == null ? false : applicationId.equals(application.getAppId());
721721
}
722722

723+
/**
724+
* Asks the cast device to launch the default media receiver application,
725+
* using {@link #DEFAULT_MEDIA_RECEIVER_APP_ID} as the application ID and
726+
* {@link Channel#DEFAULT_RESPONSE_TIMEOUT} as the timeout value.
727+
*
728+
* @param synchronous {@code true} to make this call block until a response
729+
* is received or times out, {@code false} to make it return
730+
* immediately always returning {@code null}.
731+
* @return The resulting {@link ReceiverStatus} or {@code null} if
732+
* {@code synchronous} is {@code false}.
733+
* @throws SocketException If the {@link Channel} is closed and
734+
* {@code autoReconnect} is {@code false}.
735+
* @throws IOException If the response times out or an error occurs during
736+
* the operation.
737+
*
738+
* @apiNote This operation is blocking if {@code synchronous} is
739+
* {@code true}, otherwise non-blocking.
740+
*/
741+
@Nullable
742+
public ReceiverStatus launchDefaultMediaReceiver(boolean synchronous) throws IOException {
743+
return channel().launch(DEFAULT_MEDIA_RECEIVER_APP_ID, synchronous);
744+
}
745+
746+
/**
747+
* Asks the cast device to launch the default media receiver application,
748+
* using {@link #DEFAULT_MEDIA_RECEIVER_APP_ID} as the application ID.
749+
*
750+
* @param responseTimeout the response timeout in milliseconds. If zero or
751+
* negative, {@link Channel#DEFAULT_RESPONSE_TIMEOUT} will be
752+
* used.
753+
* @return The resulting {@link ReceiverStatus}.
754+
* @throws SocketException If the {@link Channel} is closed and
755+
* {@code autoReconnect} is {@code false}.
756+
* @throws IOException If the response times out or an error occurs during
757+
* the operation.
758+
*
759+
* @apiNote This operation is blocking.
760+
*/
761+
@Nonnull
762+
public ReceiverStatus launchDefaultMediaReceiver(long responseTimeout) throws IOException {
763+
return channel().launch(DEFAULT_MEDIA_RECEIVER_APP_ID, responseTimeout);
764+
}
765+
723766
/**
724767
* Asks the cast device to launch the application represented by the
725768
* specified application ID, using {@link Channel#DEFAULT_RESPONSE_TIMEOUT}
@@ -761,7 +804,7 @@ public ReceiverStatus launchApplication(String applicationId, boolean synchronou
761804
* @apiNote This operation is blocking.
762805
*/
763806
@Nonnull
764-
public ReceiverStatus launch(String applicationId, long responseTimeout) throws IOException {
807+
public ReceiverStatus launchApplication(String applicationId, long responseTimeout) throws IOException {
765808
return channel().launch(applicationId, responseTimeout);
766809
}
767810

0 commit comments

Comments
 (0)