diff --git a/examples/tv-casting-app/APIs.md b/examples/tv-casting-app/APIs.md index 8719b0ff62b133..1bbb189e7179d7 100644 --- a/examples/tv-casting-app/APIs.md +++ b/examples/tv-casting-app/APIs.md @@ -688,7 +688,7 @@ func startDiscovery() { } ``` -Note: You will need to connect with a Casting Player as described below to see +Note: You will need to connect with a Casting Player as described below to se the list of Endpoints that they support. Refer to the [Connection](#connect-to-a-casting-player) section for details on how to discover available endpoints supported by a Casting Player. @@ -864,7 +864,7 @@ On Android, it can select an `Endpoint` as shown below. ```java private static final Integer SAMPLE_ENDPOINT_VID = 65521; -private Endpoint selectEndpoint() +private Endpoint selectFirstEndpointByVID() { Endpoint endpoint = null; if(selectedCastingPlayer != null) diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/GlobalCastingConstants.java b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/GlobalCastingConstants.java index 754d3bbe5ff4fd..483f1efedb1b46 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/GlobalCastingConstants.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/GlobalCastingConstants.java @@ -6,5 +6,6 @@ public class GlobalCastingConstants { public static final int SetupPasscode = 20202021; public static final int Discriminator = 0xF00; public static final boolean ChipCastingSimplified = - true; // set this flag to true to demo simplified casting APIs + true; // set to true, to demo the simplified casting APIs. Otherwise, the older deprecated + // APIs are invoked } diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java index 9c0dc304c72efb..878c18019f4d09 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java @@ -68,7 +68,8 @@ public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.readButtonClickListener = v -> { - Endpoint endpoint = EndpointSelectorExample.selectEndpointByVID(selectedCastingPlayer); + Endpoint endpoint = + EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); if (endpoint == null) { Log.e(TAG, "No Endpoint with sample vendorID found on CastingPlayer"); return; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java index 062d530e9bcd83..ddf41b349d6890 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java @@ -68,7 +68,8 @@ public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.launchUrlButtonClickListener = v -> { - Endpoint endpoint = EndpointSelectorExample.selectEndpointByVID(selectedCastingPlayer); + Endpoint endpoint = + EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); if (endpoint == null) { Log.e(TAG, "No Endpoint with sample vendorID found on CastingPlayer"); return; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java index 6b5c604ac5ef52..c2932c59117c64 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java @@ -10,7 +10,11 @@ public class EndpointSelectorExample { private static final String TAG = EndpointSelectorExample.class.getSimpleName(); private static final Integer SAMPLE_ENDPOINT_VID = 65521; - public static Endpoint selectEndpointByVID(CastingPlayer selectedCastingPlayer) { + /** + * Returns the first Endpoint in the list of Endpoints associated with the selectedCastingPlayer + * whose VendorID matches the EndpointSelectorExample.SAMPLE_ENDPOINT_VID + */ + public static Endpoint selectFirstEndpointByVID(CastingPlayer selectedCastingPlayer) { Endpoint endpoint = null; if (selectedCastingPlayer != null) { List endpoints = selectedCastingPlayer.getEndpoints(); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java index eac4a58608af6b..77f5129b6b9e4d 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java @@ -70,7 +70,7 @@ public void onCreate(Bundle savedInstanceState) { @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - Endpoint endpoint = EndpointSelectorExample.selectEndpointByVID(selectedCastingPlayer); + Endpoint endpoint = EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); if (endpoint == null) { Log.e(TAG, "No Endpoint with sample vendorID found on CastingPlayer"); return inflater.inflate( diff --git a/examples/tv-casting-app/android/README.md b/examples/tv-casting-app/android/README.md index c2a7622036bc8a..b620c1ac5cbdf4 100644 --- a/examples/tv-casting-app/android/README.md +++ b/examples/tv-casting-app/android/README.md @@ -70,6 +70,18 @@ Complete the following steps to prepare the Matter build: source scripts/bootstrap.sh ``` +3. The build will produce libraries: AndroidPlatform.jar, CHIPAppServer.jar, + CHIPInteractionModel.jar and TVCastingApp.jar in [App/app/libs](App/app/libs) + and libTvCastingApp.so and libc++\_shared.so in + [App/app/libs/jniLibs/](App/app/libs/jniLibs/) consumed by any casting app to + leverage the [casting APIs](../APIs.md), like the sample android + tv-casting-app. If building for your own casting app, make sure your client's + specific values are set for `CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID` and + `CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID` in the + [CHIPProjectAppConfig.h](tv-casting-common/include/CHIPProjectAppConfig.h) + file, before the build. Other values like the + `CHIP_DEVICE_CONFIG_DEVICE_NAME` may be optionally updated as well. + ## Building & Installing the app This is the simplest option. In the command line, run the following command from