@@ -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
@@ -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,59 @@ 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(null, DESIRED_ENDPOINT_VENDOR_ID, new ArrayList<>());
750
+
751
+ MatterError err = targetCastingPlayer.verifyOrEstablishConnection(
752
+ MIN_CONNECTION_TIMEOUT_SEC,
753
+ desiredEndpointFilter,
754
+ new MatterCallback<Void>() {
755
+ @Override
756
+ public void handle(Void v) {
757
+ Log.i(
758
+ TAG,
759
+ "Connected to CastingPlayer with deviceId: "
760
+ + targetCastingPlayer.getDeviceId());
761
+ getActivity()
762
+ .runOnUiThread(
763
+ () -> {
764
+ connectionFragmentStatusTextView.setText(
765
+ "Connected to Casting Player with device name: "
766
+ + targetCastingPlayer.getDeviceName()
767
+ + "\n\n ");
768
+ connectionFragmentNextButton.setEnabled(true);
769
+ });
770
+ }
771
+ },
772
+ new MatterCallback<MatterError>() {
773
+ @Override
774
+ public void handle(MatterError err) {
775
+ Log.e(TAG, "CastingPLayer connection failed: " + err);
776
+ getActivity()
777
+ .runOnUiThread(
778
+ () -> {
779
+ connectionFragmentStatusTextView.setText(
780
+ "Casting Player connection failed due to: " + err + "\n\n ");
781
+ });
782
+ }
783
+ });
784
+
785
+ if (err.hasError())
786
+ {
787
+ getActivity()
788
+ .runOnUiThread(
789
+ () -> {
790
+ connectionFragmentStatusTextView.setText(
791
+ "Casting Player connection failed due to: " + err + "\n\n ");
792
+ });
793
+ }
794
+ ```
795
+
746
796
On iOS, the Casting Client may call `verifyOrEstablishConnection` on the
747
797
`MCCastingPlayer` object it wants to connect to and handle any `NSErrors` that
748
798
may happen in the process.
@@ -777,6 +827,8 @@ func connect(selectedCastingPlayer: MCCastingPlayer?) {
777
827
### Select an Endpoint on the Casting Player
778
828
779
829
_{Complete Endpoint selection examples: [Linux](linux/simple-app-helper.cpp) |
830
+ [Android](android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java)
831
+ |
780
832
[iOS](darwin/TvCasting/TvCasting/MCContentLauncherLaunchURLExampleViewModel.swift)}_
781
833
782
834
On a successful connection with a `CastingPlayer`, a Casting Client may select
@@ -803,6 +855,34 @@ if (it != endpoints.end())
803
855
}
804
856
```
805
857
858
+ On Android, it can select an `Endpoint` as shown below.
859
+
860
+ ```java
861
+ private static final Integer SAMPLE_ENDPOINT_VID = 65521;
862
+
863
+ private Endpoint selectEndpoint()
864
+ {
865
+ Endpoint endpoint = null;
866
+ if(selectedCastingPlayer != null)
867
+ {
868
+ List<Endpoint> endpoints = selectedCastingPlayer.getEndpoints();
869
+ if (endpoints == null)
870
+ {
871
+ Log.e(TAG, "No Endpoints found on CastingPlayer");
872
+ }
873
+ else
874
+ {
875
+ endpoint = endpoints
876
+ .stream()
877
+ .filter(e -> SAMPLE_ENDPOINT_VID.equals(e.getVendorId()))
878
+ .findFirst()
879
+ .get();
880
+ }
881
+ }
882
+ return endpoint;
883
+ }
884
+ ```
885
+
806
886
On iOS, it can select an `MCEndpoint` similarly and as shown below.
807
887
808
888
```swift
@@ -1045,11 +1125,8 @@ vendorIDAttribute!.read(nil) { context, before, after, err in
1045
1125
1046
1126
### Subscriptions
1047
1127
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)}_
1128
+ _{Complete Attribute subscription examples: [Linux](linux/simple-app-helper.cpp)
1129
+ |[iOS](darwin/TvCasting/TvCasting/MCMediaPlaybackSubscribeToCurrentStateExampleViewModel.swift)}_
1053
1130
1054
1131
A Casting Client may subscribe to an attribute on an `Endpoint` of the
1055
1132
`CastingPlayer` to get data reports when the attributes change.
0 commit comments