diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 05a46e2da0395e..76d6fd74187214 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -191,6 +191,11 @@ capacitive CarbonDioxideConcentrationMeasurement CarbonMonoxideConcentrationMeasurement CaseAdminNode +castingApp +CastingApp +castingAppDidReceiveRequestForDeviceAttestationCredentials +CastingClient +CastingPlayer CatalogVendorId CBB cbd @@ -204,6 +209,7 @@ CCXML CDEEDC CDVersionNumber ced +certificationDeclaration cfg CFLAGS cgit @@ -278,6 +284,7 @@ CommissionableDataProvider commissionables commissionee CommissioningFlow +commissoning commondatastorage CONF CONFIG @@ -321,6 +328,7 @@ crypto cryptographic CSA csg +csrData csrrequest csu csv @@ -333,6 +341,7 @@ CurrentSaturation customAcl customizations cvfJ +CXE cxx CY CYW @@ -344,6 +353,7 @@ DAPLINK DataFrame datamodel DataModelRevision +DataProvider dataset datasets DataVersion @@ -369,6 +379,7 @@ DefaultOTARequestor DefaultOTARequestorDriver DefaultOTARequestorStorage DefaultSuccess +defaultTestPasscode definedValue DehumidificationControl DelayedActionTime @@ -388,6 +399,7 @@ dev devcontainer devCtrl DevelopmentCerts +deviceAttestationCert DeviceAttestationCredentialsProvider DeviceAttestationCredsExample DeviceCaCerts @@ -418,6 +430,7 @@ DHCPv dhrishi DiagnosticLogs dialout +didReceiveRequestToSignCertificateRequest diffstat diffsyms dimmable @@ -551,6 +564,7 @@ fffff Fi filepath fini +firmwareInformation FixedLabel flashdebug FlowMeasurement @@ -566,6 +580,7 @@ fstab fsync ftd fullclean +func fuzzer FW gbl @@ -587,7 +602,10 @@ GetDeviceId GetDeviceInfo GetDns GetIP +GetLongValue getManualTests +GetRandU +GetSetupPasscode getstarted getTests GH @@ -686,6 +704,7 @@ Infineon ini init InitArgs +InitCommissionableDataProvider inlined InputLoop installDebug @@ -694,6 +713,7 @@ integrations IntelliSense InteractionModelVersion Interoperable +intialize introvideos InvokeCommandRequests InvokeCommandResponse @@ -733,8 +753,10 @@ kAdminister kbd kBusy kCase +kCertificationDeclaration Kconfig kDacPublicKey +kDevelopmentDAC KeypadInput keyset kGroup @@ -745,8 +767,17 @@ kNewButton kNodeIdNotSpecified knownissues kOperate +KPAI kPAKEParameterError kPase +kQ +kRotatingDeviceIDUniqueIDLength +kSecAttrKeyClass +kSecAttrKeyClassPrivate +kSecAttrKeySizeInBits +kSecAttrKeyType +kSecAttrKeyTypeECSECPrimeRandom +kSpake kView KVS kWindowNotOpen @@ -789,6 +820,8 @@ LightingApp LightingColor LightingState LinkSoftwareAndDocumentationPack +LinuxCommissionableDataProvider +LinuxDeviceOptions LocalConfigDisabled localedef localhost @@ -866,6 +899,8 @@ microcontroller microcontrollers MicroSD middleware +MII +MIIB minApplicableSoftwareVersion Minicom MinInterval @@ -889,12 +924,15 @@ MoveWithOnOff MPSL MRP MTD +MTRDeviceAttestationCredentials MTU Multiband Multicast multilib Multiprotocol multithreaded +MutableByteSpan +MutableByteSpanDataProvider mutexes mv MX @@ -938,6 +976,8 @@ nrfconnect nrfdks nrfutil nrfxlib +NSData +NSDictionary NTAG nullable nullptr @@ -948,6 +988,7 @@ nwdiag nwk NXP objcopy +objectivec OccupancySensing OctetString OECORE @@ -1020,6 +1061,7 @@ params PartNumber PASE Passcode +passRetained PBKDF pbuf pbufs @@ -1042,6 +1084,8 @@ PID Pigweed PinCode pinrequest +pIterationCount +pIterations pkgconfig PKI plaintext @@ -1063,7 +1107,11 @@ pre preprocessor Presetup PressureMeasurement +privateKey +PrivateKey +privateKeyRef prj +productAttestationIntermediateCert ProductID ProductLabel ProductName @@ -1081,14 +1129,17 @@ ProxyValid ProxyView PRs PSA +pSalt PSCAN PSECT PSK PSoC PTR pts +PublicKey PulseWidthModulation PumpConfigurationAndControl +pVerifier pwd PWM PXXXF @@ -1109,6 +1160,7 @@ QPG QRCode qrcodetool QRCodeUrl +qrYA QSPI QueryImage QueryImageResponse @@ -1125,6 +1177,7 @@ ReadConfigValue readelf readfds README +READMEs readonly readthedocs Reag @@ -1161,6 +1214,10 @@ rmw rodata Rollershade rootfs +rotatingDeviceIdUniqueId +RotatingDeviceIdUniqueId +RotatingDeviceIdUniqueIdProvider +rotatingDeviceIdUniqueIdSpan RPC RPCs RPi @@ -1203,6 +1260,8 @@ sdkconfig SDKs SDKTARGETSYSROOT sdl +SecKey +SecKeyCreateWithData SecureCertDACProvider SED SEGGER @@ -1222,8 +1281,10 @@ setpin setpoint SetpointRaiseLower SetRequestorInstance +setupPasscode SetUpPINCode SetupQRCode +SetValue sexualized sfv SHA @@ -1240,6 +1301,7 @@ SimpleFileExFlags SimpleLink SiWx sizedb +sizeof sl SLAAC SLTB @@ -1276,9 +1338,9 @@ StatusCode stderr stdout sterm -stmicroelectronics -stm stlink +stm +stmicroelectronics storagepath str strcpy @@ -1336,6 +1398,7 @@ TestGenExample TestGroupDemoConfig TestMultiRead TestName +TestOnlyCommissionableDataProvider TESTPASSWD TestPICS TESTSSID @@ -1351,11 +1414,11 @@ textboxes TFT ThermostatUserInterfaceConfiguration ThIsIsNoTMyReAlGiThUbToKeNSoDoNoTtRy +thread ThreadNetworkDiagnostics threadOperationalDataset ThreadStackManager ThreadStackManagerImpl -thread ths Thunderboard timedInteractionTimeoutMs @@ -1426,6 +1489,7 @@ unfocus Unicast UniFlash UnitLocalization +Unmanaged unpair unprovisioned Unsecure @@ -1463,6 +1527,7 @@ venv ver Verifier Verifiers +VerifyOrDie VID vids virtualenv diff --git a/examples/tv-casting-app/APIs.md b/examples/tv-casting-app/APIs.md index 1083293294a731..4b66f932fdd4b1 100644 --- a/examples/tv-casting-app/APIs.md +++ b/examples/tv-casting-app/APIs.md @@ -16,11 +16,12 @@ Matter Casting consists of three parts: for Android builds on top of the Matter SDK to demonstrate how a TV Content app works. - **The TV platform app**: The TV platform app implements the Casting Video - Player device type and provides common capabilities around media playback - on the TV such as play/pause, keypad navigation, input and output control, - content search, and an implementation of an app platform as described in - the media chapter of the device library specification. This is generally - implemented by the TV manufacturer. The [example Matter tv-app](https://github.com/project-chip/connectedhomeip/tree/master/examples/tv-app) + Player device type and provides common capabilities around media playback on + the TV such as play/pause, keypad navigation, input and output control, + content search, and an implementation of an app platform as described in the + media chapter of the device library specification. This is generally + implemented by the TV manufacturer. The + [example Matter tv-app](https://github.com/project-chip/connectedhomeip/tree/master/examples/tv-app) for Android builds on top of the Matter SDK to demonstrate how a TV platform app works. @@ -69,28 +70,29 @@ Next, you're ready to: ## Build and Setup The Casting Client is expected to consume the Matter TV Casting library built -for its respective platform which implements the APIs described in this document. -Refer to the tv-casting-app READMEs for [Linux](linux), [Android](android) and -[iOS](darwin) to understand how to build and consume each platform's specicific -libraries. +for its respective platform which implements the APIs described in this +document. Refer to the tv-casting-app READMEs for [Linux](linux/README.md), +[Android](android/README.md) and [iOS](darwin/TvCasting/README.md) to understand +how to build and consume each platform's specific libraries. ### Initialize the Casting Client -_{Complete Initialization examples: -[Linux](linux/simple-app.cpp) | [Android](android/App/app/src/main/java/com/matter/casting/InitializationExample.java) +_{Complete Initialization examples: [Linux](linux/simple-app.cpp) | +[Android](android/App/app/src/main/java/com/matter/casting/InitializationExample.java) | [iOS](darwin/TvCasting/TvCasting/MTRInitializationExample.swift)}_ A Casting Client must first initialize the Matter SDK and define the following -"DataProvider" objects for the the Matter Casting library to use throughout the client's -lifecycle: +"DataProvider" objects for the the Matter Casting library to use throughout the +client's lifecycle: 1. **Rotating Device Identifier** - Refer to the Matter specification for details on how to generate the [Rotating Device Identifier](https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/rendezvous/DeviceDiscovery.adoc#245-rotating-device-identifier)). Then, instantiate a `DataProvider` object as described below. - On Linux, define a `RotatingDeviceIdUniqueIdProvider` to provide the - Casting Client's RotatingDeviceIdUniqueId, by implementing a `matter:casting::support::MutableByteSpanDataProvider`: + On Linux, define a `RotatingDeviceIdUniqueIdProvider` to provide the Casting + Client's RotatingDeviceIdUniqueId, by implementing a + `matter:casting::support::MutableByteSpanDataProvider`: ```c++ class RotatingDeviceIdUniqueIdProvider : public MutableByteSpanDataProvider { @@ -112,7 +114,8 @@ lifecycle: ``` On Android, define a `rotatingDeviceIdUniqueIdProvider` to provide the - Casting Client's RotatingDeviceIdUniqueId, by implementing a `com.matter.casting.support.DataSource`: + Casting Client's RotatingDeviceIdUniqueId, by implementing a + `com.matter.casting.support.DataSource`: ```java private static final DataProvider rotatingDeviceIdUniqueIdProvider = @@ -148,9 +151,10 @@ lifecycle: [Onboarding Payload](https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/qr_code/OnboardingPayload.adoc#ref_OnboardingPayload) section for details on commissioning data. - On Linux, define a function `InitCommissionableDataProvider` to initialize intialize a - `LinuxCommissionableDataProvider` that can provide the required values to the CastingApp. - + On Linux, define a function `InitCommissionableDataProvider` to initialize + intialize a `LinuxCommissionableDataProvider` that can provide the required + values to the CastingApp. + ```c++ CHIP_ERROR InitCommissionableDataProvider(LinuxCommissionableDataProvider & provider, LinuxDeviceOptions & options) { chip::Optional setupPasscode; @@ -158,7 +162,7 @@ lifecycle: if (options.payload.setUpPINCode != 0) { setupPasscode.SetValue(options.payload.setUpPINCode); } else if (!options.spake2pVerifier.HasValue()) { - // default to TestOnlyCommissionableDataProvider for demonstration + // default to TestOnlyCommissionableDataProvider for demonstration uint32_t defaultTestPasscode = 0; chip::DeviceLayer::TestOnlyCommissionableDataProvider TestOnlyCommissionableDataProvider; VerifyOrDie(TestOnlyCommissionableDataProvider.GetSetupPasscode(defaultTestPasscode) == CHIP_NO_ERROR); @@ -189,8 +193,8 @@ lifecycle: ``` On iOS, add a `func commissioningDataProvider` to the - `MTRAppParametersDataSource` class defined above, that can provide the required - values to the `MTRCastingApp`. + `MTRAppParametersDataSource` class defined above, that can provide the + required values to the `MTRCastingApp`. ```objectivec func castingAppDidReceiveRequestForCommissionableData(_ sender: Any) -> MTRCommissionableData { @@ -211,12 +215,14 @@ lifecycle: [Device Attestation process](https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/device_attestation/Device_Attestation_Specification.adoc) during commissoning. - On Linux, implement a define a `dacProvider` to provide the Casting Client's Device - Attestation Credentials, by implementing a `chip::Credentials::DeviceAttestationCredentialsProvider`. - For this example, we will use the `chip::Credentials::Examples::ExampleDACProvider` + On Linux, implement a define a `dacProvider` to provide the Casting Client's + Device Attestation Credentials, by implementing a + `chip::Credentials::DeviceAttestationCredentialsProvider`. For this example, + we will use the `chip::Credentials::Examples::ExampleDACProvider` On Android, define a `dacProvider` to provide the Casting Client's Device - Attestation Credentials, by implementing a `com.matter.casting.support.DACProvider`: + Attestation Credentials, by implementing a + `com.matter.casting.support.DACProvider`: ```java private static final DACProvider dacProvider = new DACProviderStub(); @@ -260,12 +266,14 @@ lifecycle: }; ``` - On iOS, add functions `castingAppDidReceiveRequestForDeviceAttestationCredentials` - and `didReceiveRequestToSignCertificateRequest` to the `MTRAppParametersDataSource` - class defined above, that can return MTRDeviceAttestationCredentials and sign - messages for the Casting Client, respectively. + On iOS, add functions + `castingAppDidReceiveRequestForDeviceAttestationCredentials` and + `didReceiveRequestToSignCertificateRequest` to the + `MTRAppParametersDataSource` class defined above, that can return + MTRDeviceAttestationCredentials and sign messages for the Casting Client, + respectively. - ```objectivec + ```objectivec // dummy DAC values for demonstration only let kDevelopmentDAC_Cert_FFF1_8001: Data = Data(base64Encoded: "MIIB....CXE1M=")!; let kDevelopmentDAC_PrivateKey_FFF1_8001: Data = Data(base64Encoded: "qrYAtE+/8=")!; @@ -280,21 +288,21 @@ lifecycle: deviceAttestationCert: kDevelopmentDAC_Cert_FFF1_8001, productAttestationIntermediateCert: KPAI_FFF1_8000_Cert_Array) } - + func castingApp(_ sender: Any, didReceiveRequestToSignCertificateRequest csrData: Data) -> Data { var privateKey = Data() privateKey.append(kDevelopmentDAC_PublicKey_FFF1_8001); privateKey.append(kDevelopmentDAC_PrivateKey_FFF1_8001); - + let privateKeyRef: SecKey = SecKeyCreateWithData(privateKey as NSData, [ kSecAttrKeyType: kSecAttrKeyTypeECSECPrimeRandom, kSecAttrKeyClass: kSecAttrKeyClassPrivate, kSecAttrKeySizeInBits: 256 ] as NSDictionary, nil)! - + let _:Unmanaged = Unmanaged.passRetained(privateKeyRef); - + // use SecKey above to sign csrData and return resulting value } ``` @@ -305,9 +313,9 @@ Casting client, make sure your code initializes it only once, before it starts a Matter casting session. On Linux, create an AppParameters object using the -`RotatingDeviceIdUniqueIdProvider`, `LinuxCommissionableDataProvider`, -`CommonCaseDeviceServerInitParamsProvider`, `ExampleDACProvider` and `DefaultDACVerifier`, -and call `CastingApp::GetInstance()->Initialize` with it. +`RotatingDeviceIdUniqueIdProvider`, `LinuxCommissionableDataProvider`, +`CommonCaseDeviceServerInitParamsProvider`, `ExampleDACProvider` and +`DefaultDACVerifier`, and call `CastingApp::GetInstance()->Initialize` with it. ```c++ LinuxCommissionableDataProvider gCommissionableDataProvider; @@ -342,9 +350,10 @@ int main(int argc, char * argv[]) { ... } ``` + On Android, create an AppParameters object using the -`rotatingDeviceIdUniqueIdProvider`, `commissioningDataProvider`, -`dacProvider` and `DataProvider`, and call +`rotatingDeviceIdUniqueIdProvider`, `commissioningDataProvider`, `dacProvider` +and `DataProvider`, and call `CastingApp.getInstance().initialize` with it. ```java @@ -396,14 +405,14 @@ func initialize() -> MatterError { ### Discover Casting Players -_{Complete Discovery examples: -[Linux](linux/simple-app.cpp)}_ +_{Complete Discovery examples: [Linux](linux/simple-app.cpp)}_ The Casting Client discovers `CastingPlayers` using Matter Commissioner discovery over DNS-SD by listening for CastingPlayer events as they are discovered, updated, or lost from the network. -On Linux, define a `DiscoveryDelegateImpl` that implements the `matter::casting::core::DiscoveryDelegate`. +On Linux, define a `DiscoveryDelegateImpl` that implements the +`matter::casting::core::DiscoveryDelegate`. ```c++ class DiscoveryDelegateImpl : public DiscoveryDelegate { @@ -429,10 +438,11 @@ public: Finally, register these listeners and start discovery. -On Linux, register an instance of the `DiscoveryDelegateImpl` with -`matter::casting::core::CastingPlayerDiscovery` by calling SetDelegate on its singleton -instance. Then, call `StartDiscovery` by optionally specifying the +On Linux, register an instance of the `DiscoveryDelegateImpl` with +`matter::casting::core::CastingPlayerDiscovery` by calling SetDelegate on its +singleton instance. Then, call `StartDiscovery` by optionally specifying the `kTargetPlayerDeviceType` to filter results by. + ```c++ DiscoveryDelegateImpl delegate; CastingPlayerDiscovery::GetInstance()->SetDelegate(&delegate); @@ -446,3 +456,15 @@ VerifyOrReturnValue(err == CHIP_NO_ERROR, 0, chip::DeviceLayer::PlatformMgr().RunEventLoop(); ... ``` + +### Connect to a Casting Player + +### Select an Endpoint on the Casting Player + +## Interacting with a Casting Endpoint + +### Issuing Commands + +### Read Operations + +### Subscriptions diff --git a/examples/tv-casting-app/android/App/.idea/gradle.xml b/examples/tv-casting-app/android/App/.idea/gradle.xml index a2d7c21338e98a..526b4c25c6813e 100644 --- a/examples/tv-casting-app/android/App/.idea/gradle.xml +++ b/examples/tv-casting-app/android/App/.idea/gradle.xml @@ -13,6 +13,7 @@ + diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h index ea407f2c0fca12..c523fb111b0b48 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h @@ -42,7 +42,7 @@ using DisconnectCallback = std::function; const int kPortMaxLength = 5; // port is uint16_t const int kIdMaxLength = chip::Dnssd::kHostNameMaxLength + kPortMaxLength; -class Attributes +class CastingPlayerAttributes { public: char id[kIdMaxLength] = {}; @@ -66,10 +66,10 @@ class CastingPlayer : public std::enable_shared_from_this private: // std::vector> endpoints; bool mConnected = false; - Attributes mAttributes; + CastingPlayerAttributes mAttributes; public: - CastingPlayer(Attributes playerAttributes) { mAttributes = playerAttributes; } + CastingPlayer(CastingPlayerAttributes playerAttributes) { mAttributes = playerAttributes; } const char * GetId() const { return mAttributes.id; } const char * GetDeviceName() const { return mAttributes.deviceName; } diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.cpp b/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.cpp index fe247e0d47f5d6..65a589932c1a4b 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.cpp +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.cpp @@ -78,7 +78,7 @@ void DeviceDiscoveryDelegateImpl::OnDiscoveredDevice(const chip::Dnssd::Discover ChipLogError(NotSpecified, "CastingPlayerDeviceDiscoveryDelegate, mClientDelegate is a nullptr")); // convert nodeData to CastingPlayer - Attributes attributes; + CastingPlayerAttributes attributes; strcpy(attributes.id, nodeData.resolutionData.hostName); char port[kPortMaxLength] = {};