@@ -34,15 +34,11 @@ samples so you can see the experience end to end.
34
34
35
35
A Casting Client (e.g. a mobile phone app) is expected to be a Matter
36
36
Commissionable Node and a ` CastingPlayer ` (i.e. a TV) is expected to be a Matter
37
- Commissioner. In the context of the
38
- [ Matter Video Player architecture] ( https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/app_clusters/media/VideoPlayerArchitecture.adoc ) ,
39
- a ` CastingPlayer ` would map to
40
- [ Casting "Video" Player] ( https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/app_clusters/media/VideoPlayerArchitecture.adoc#1-introduction ) .
41
- The ` CastingPlayer ` is expected to be hosting one or more ` Endpoints ` (some of
42
- which can represent
43
- [ Content Apps] ( https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/app_clusters/media/VideoPlayerArchitecture.adoc#1-introduction )
44
- in the Matter Video Player architecture) that support one or more Matter Media
45
- ` Clusters ` .
37
+ Commissioner. In the context of the Matter Video Player architecture, a
38
+ ` CastingPlayer ` would map to Casting "Video" Player. The ` CastingPlayer ` is
39
+ expected to be hosting one or more ` Endpoints ` (some of which can represent
40
+ Content Apps) in the Matter Video Player architecture) that support one or more
41
+ Matter Media ` Clusters ` .
46
42
47
43
The steps to start a casting session are:
48
44
@@ -91,10 +87,10 @@ A Casting Client must first initialize the Matter SDK and define the following
91
87
` DataProvider ` objects for the the Matter Casting library to use throughout the
92
88
client's lifecycle:
93
89
94
- 1 . ** Rotating Device Identifier** - Refer to the Matter specification for
95
- details on how to generate the
96
- [ Rotating Device Identifier ] ( https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/rendezvous/DeviceDiscovery.adoc#245-rotating-device-identifier ) ).
97
- Then, instantiate a ` DataProvider ` object as described below .
90
+ 1 . ** Rotating Device Identifier** - This unique per-device identifier SHALL
91
+ consist of a randomly-generated 128-bit or longer octet string. Refer to the
92
+ Matter specification for more details. Instantiate a ` DataProvider ` object
93
+ as described below to provide this identifier .
98
94
99
95
On Linux, define a ` RotatingDeviceIdUniqueIdProvider ` to provide the Casting
100
96
Client's ` RotatingDeviceIdUniqueId ` , by implementing a
@@ -152,10 +148,13 @@ client's lifecycle:
152
148
```
153
149
154
150
2 . ** Commissioning Data** - This object contains the passcode, discriminator,
155
- etc which identify the app and are provided to the ` CastingPlayer ` during
156
- the commissioning process. Refer to the Matter specification's
157
- [ Onboarding Payload] ( https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/qr_code/OnboardingPayload.adoc#ref_OnboardingPayload )
158
- section for details on commissioning data.
151
+ etc. which identify the app and are provided to the ` CastingPlayer ` during
152
+ the commissioning process. A Passcode SHALL be included as a 27-bit unsigned
153
+ integer, which serves as proof of possession during commissioning. A
154
+ Discriminator SHALL be included as a 12-bit unsigned integer, which SHALL
155
+ match the value which a device advertises during commissioning. Refer to the
156
+ Matter specification's "Onboarding Payload" section for more details on
157
+ commissioning data.
159
158
160
159
On Linux, define a function ` InitCommissionableDataProvider ` to initialize
161
160
initialize a ` LinuxCommissionableDataProvider ` that can provide the required
@@ -217,9 +216,8 @@ client's lifecycle:
217
216
3 . ** Device Attestation Credentials** - This object contains the
218
217
` DeviceAttestationCertificate ` , ` ProductAttestationIntermediateCertificate ` ,
219
218
etc. and implements a way to sign messages when called upon by the Matter TV
220
- Casting Library as part of the
221
- [ Device Attestation process] ( https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/device_attestation/Device_Attestation_Specification.adoc )
222
- during commissioning.
219
+ Casting Library as part of the Matter Device Attestation process during
220
+ commissioning.
223
221
224
222
On Linux, implement a define a ` dacProvider ` to provide the Casting Client's
225
223
Device Attestation Credentials, by implementing a
@@ -487,8 +485,8 @@ potentially skipping the longer commissioning process and instead, simply
487
485
re- establishing the CASE session. This cache can be cleared by calling the
488
486
`ClearCache ` API on the `CastingApp `, say when the user signs out of the app.
489
487
See API and its documentation for [Linux ](tv- casting- common/ core/ CastingApp . h),
490
- Android and
491
- [iOS](darwin/ MatterTvCastingBridge / MatterTvCastingBridge / MCCastingApp . h).
488
+ [ Android ](android / App / app / src / main / jni / com / matter / casting / core / CastingApp . java)
489
+ and [iOS](darwin/ MatterTvCastingBridge / MatterTvCastingBridge / MCCastingApp . h).
492
490
493
491
### Discover Casting Players
494
492
@@ -702,10 +700,9 @@ Each `CastingPlayer` object created during
702
700
[Discovery ](#discover- casting- players) contains information such as
703
701
`deviceName`, `vendorId`, `productId`, etc. which can help the user pick the
704
702
right `CastingPlayer `. A Casting Client can attempt to connect to the
705
- `selectedCastingPlayer` using
706
- [Matter User Directed Commissioning (UDC )](https: // github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/rendezvous/UserDirectedCommissioning.adoc).
707
- The Matter TV Casting library locally caches information required to reconnect
708
- to a `CastingPlayer `, once the Casting client has been commissioned by it. After
703
+ `selectedCastingPlayer` using Matter User Directed Commissioning (UDC ). The
704
+ Matter TV Casting library locally caches information required to reconnect to a
705
+ `CastingPlayer `, once the Casting client has been commissioned by it. After
709
706
that, the Casting client is able to skip the full UDC process by establishing
710
707
CASE with the `CastingPlayer ` directly. Once connected, the `CastingPlayer `
711
708
object will contain the list of available Endpoints on that `CastingPlayer `.
@@ -743,6 +740,60 @@ targetCastingPlayer->VerifyOrEstablishConnection(ConnectionHandler,
743
740
...
744
741
```
745
742
743
+ On Android, the Casting Client may call `verifyOrEstablishConnection` on the
744
+ `CastingPlayer` object it wants to connect to.
745
+
746
+ ```java
747
+ private static final long MIN_CONNECTION_TIMEOUT_SEC = 3 * 60;
748
+
749
+ EndpointFilter desiredEndpointFilter = new EndpointFilter();
750
+ desiredEndpointFilter.vendorId = DESIRED_ENDPOINT_VENDOR_ID;
751
+
752
+ MatterError err = targetCastingPlayer.verifyOrEstablishConnection(
753
+ MIN_CONNECTION_TIMEOUT_SEC,
754
+ desiredEndpointFilter,
755
+ new MatterCallback<Void>() {
756
+ @Override
757
+ public void handle(Void v) {
758
+ Log.i(
759
+ TAG,
760
+ "Connected to CastingPlayer with deviceId: "
761
+ + targetCastingPlayer.getDeviceId());
762
+ getActivity()
763
+ .runOnUiThread(
764
+ () -> {
765
+ connectionFragmentStatusTextView.setText(
766
+ "Connected to Casting Player with device name: "
767
+ + targetCastingPlayer.getDeviceName()
768
+ + "\n\n ");
769
+ connectionFragmentNextButton.setEnabled(true);
770
+ });
771
+ }
772
+ },
773
+ new MatterCallback<MatterError>() {
774
+ @Override
775
+ public void handle(MatterError err) {
776
+ Log.e(TAG, "CastingPLayer connection failed: " + err);
777
+ getActivity()
778
+ .runOnUiThread(
779
+ () -> {
780
+ connectionFragmentStatusTextView.setText(
781
+ "Casting Player connection failed due to: " + err + "\n\n ");
782
+ });
783
+ }
784
+ });
785
+
786
+ if (err.hasError())
787
+ {
788
+ getActivity()
789
+ .runOnUiThread(
790
+ () -> {
791
+ connectionFragmentStatusTextView.setText(
792
+ "Casting Player connection failed due to: " + err + "\n\n ");
793
+ });
794
+ }
795
+ ```
796
+
746
797
On iOS, the Casting Client may call `verifyOrEstablishConnection` on the
747
798
`MCCastingPlayer` object it wants to connect to and handle any `NSErrors` that
748
799
may happen in the process.
@@ -777,6 +828,8 @@ func connect(selectedCastingPlayer: MCCastingPlayer?) {
777
828
### Select an Endpoint on the Casting Player
778
829
779
830
_{Complete Endpoint selection examples: [Linux](linux/simple-app-helper.cpp) |
831
+ [Android](android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java)
832
+ |
780
833
[iOS](darwin/TvCasting/TvCasting/MCContentLauncherLaunchURLExampleViewModel.swift)}_
781
834
782
835
On a successful connection with a `CastingPlayer`, a Casting Client may select
@@ -803,6 +856,34 @@ if (it != endpoints.end())
803
856
}
804
857
```
805
858
859
+ On Android, it can select an `Endpoint` as shown below.
860
+
861
+ ```java
862
+ private static final Integer SAMPLE_ENDPOINT_VID = 65521;
863
+
864
+ private Endpoint selectEndpoint()
865
+ {
866
+ Endpoint endpoint = null;
867
+ if(selectedCastingPlayer != null)
868
+ {
869
+ List<Endpoint> endpoints = selectedCastingPlayer.getEndpoints();
870
+ if (endpoints == null)
871
+ {
872
+ Log.e(TAG, "No Endpoints found on CastingPlayer");
873
+ }
874
+ else
875
+ {
876
+ endpoint = endpoints
877
+ .stream()
878
+ .filter(e -> SAMPLE_ENDPOINT_VID.equals(e.getVendorId()))
879
+ .findFirst()
880
+ .get();
881
+ }
882
+ }
883
+ return endpoint;
884
+ }
885
+ ```
886
+
806
887
On iOS, it can select an `MCEndpoint` similarly and as shown below.
807
888
808
889
```swift
@@ -1045,11 +1126,8 @@ vendorIDAttribute!.read(nil) { context, before, after, err in
1045
1126
1046
1127
### Subscriptions
1047
1128
1048
- _{Complete Attribute subscription examples:
1049
- [Linux](linux/simple-app-helper.cpp)}_
1050
-
1051
- _{Complete Attribute Read examples: [Linux](linux/simple-app-helper.cpp) |
1052
- [iOS](darwin/TvCasting/TvCasting/MCMediaPlaybackSubscribeToCurrentStateExampleViewModel.swift)}_
1129
+ _{Complete Attribute subscription examples: [Linux](linux/simple-app-helper.cpp)
1130
+ |[iOS](darwin/TvCasting/TvCasting/MCMediaPlaybackSubscribeToCurrentStateExampleViewModel.swift)}_
1053
1131
1054
1132
A Casting Client may subscribe to an attribute on an `Endpoint` of the
1055
1133
`CastingPlayer` to get data reports when the attributes change.
0 commit comments