diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp index d0409c6a27945c..b2597c883406d8 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp @@ -120,9 +120,8 @@ JNI_METHOD(jobject, verifyOrEstablishConnection) matter::casting::core::ConnectionCallbacks connectionCallbacks; connectionCallbacks.mOnConnectionComplete = connectCallback; - // TODO: Verify why commissioningWindowTimeoutSec is a "unsigned long long int" type. Seems too big. - castingPlayer->VerifyOrEstablishConnection(connectionCallbacks, - static_cast(commissioningWindowTimeoutSec), idOptions); + castingPlayer->VerifyOrEstablishConnection(connectionCallbacks, static_cast(commissioningWindowTimeoutSec), + idOptions); return support::convertMatterErrorFromCppToJava(CHIP_NO_ERROR); } diff --git a/examples/tv-casting-app/linux/simple-app-helper.cpp b/examples/tv-casting-app/linux/simple-app-helper.cpp index 49f006aa9cf4ab..beef624eea5ff8 100644 --- a/examples/tv-casting-app/linux/simple-app-helper.cpp +++ b/examples/tv-casting-app/linux/simple-app-helper.cpp @@ -33,6 +33,11 @@ // VendorId of the Endpoint on the CastingPlayer that the CastingApp desires to interact with after connection const uint16_t kDesiredEndpointVendorId = 65521; +// EndpointId of the Endpoint on the CastingPlayer that the CastingApp desires to interact with after connection using the +// Commissioner-Generated passcode commissioning flow +const uint8_t kDesiredEndpointId = 1; +// Indicates that the Commissioner-Generated passcode commissioning flow is in progress. +bool gCommissionerGeneratedPasscodeFlowRunning = false; DiscoveryDelegateImpl * DiscoveryDelegateImpl::_discoveryDelegateImpl = nullptr; bool gAwaitingCommissionerPasscodeInput = false; @@ -244,6 +249,16 @@ CHIP_ERROR InitCommissionableDataProvider(LinuxCommissionableDataProvider & prov options.payload.discriminator.GetLongValue()); } +void LogEndpointsDetails(const std::vector> & endpoints) +{ + ChipLogProgress(AppServer, "simple-app-helper.cpp::LogEndpointsDetails() Number of Endpoints: %d", + static_cast(endpoints.size())); + for (const auto & endpoint : endpoints) + { + endpoint->LogDetail(); + } +} + void ConnectionHandler(CHIP_ERROR err, matter::casting::core::CastingPlayer * castingPlayer) { ChipLogProgress(AppServer, "simple-app-helper.cpp::ConnectionHandler()"); @@ -256,16 +271,39 @@ void ConnectionHandler(CHIP_ERROR err, matter::casting::core::CastingPlayer * ca "simple-app-helper.cpp::ConnectionHandler(): Failed to connect to CastingPlayer (ID: %s) with err %" CHIP_ERROR_FORMAT, targetCastingPlayer->GetId(), err.Format())); - ChipLogProgress(AppServer, "simple-app-helper.cpp::ConnectionHandler(): Successfully connected to CastingPlayer (ID: %s)", - castingPlayer->GetId()); - ChipLogProgress(AppServer, - "simple-app-helper.cpp::ConnectionHandler(): Triggering demo interactions with CastingPlayer (ID: %s)", - castingPlayer->GetId()); + if (gCommissionerGeneratedPasscodeFlowRunning) + { + ChipLogProgress(AppServer, + "simple-app-helper.cpp::ConnectionHandler(): Successfully connected to CastingPlayer (ID: %s) using " + "Commissioner-Generated passcode", + castingPlayer->GetId()); + ChipLogProgress(AppServer, "simple-app-helper.cpp::ConnectionHandler(): Desired Endpoint ID for demo interactions: 1"); + } + else + { + ChipLogProgress(AppServer, "simple-app-helper.cpp::ConnectionHandler(): Successfully connected to CastingPlayer (ID: %s)", + castingPlayer->GetId()); + ChipLogProgress(AppServer, + "simple-app-helper.cpp::ConnectionHandler(): Desired Endpoint Vendor ID for demo interactions: %d", + kDesiredEndpointVendorId); + } + ChipLogProgress(AppServer, "simple-app-helper.cpp::ConnectionHandler(): Getting endpoints avaiable for demo interactions"); std::vector> endpoints = castingPlayer->GetEndpoints(); + LogEndpointsDetails(endpoints); + // Find the desired Endpoint and auto-trigger some Matter Casting demo interactions auto it = std::find_if(endpoints.begin(), endpoints.end(), [](const matter::casting::memory::Strong & endpoint) { + if (gCommissionerGeneratedPasscodeFlowRunning) + { + // For the example Commissioner-Generated passcode commissioning flow, run demo interactions with + // the Endpoint with ID 1. For this flow, we commissioned with the Target Content Application + // with Vendor ID 1111. Since this target content application does not report its Endpoint's + // Vendor IDs, we find the desired endpoint based on the Endpoint ID. See + // connectedhomeip/examples/tv-app/tv-common/include/AppTv.h. + return endpoint->GetId() == kDesiredEndpointId; + } return endpoint->GetVendorId() == kDesiredEndpointVendorId; }); if (it != endpoints.end()) @@ -273,6 +311,11 @@ void ConnectionHandler(CHIP_ERROR err, matter::casting::core::CastingPlayer * ca // The desired endpoint is endpoints[index] unsigned index = (unsigned int) std::distance(endpoints.begin(), it); + ChipLogProgress( + AppServer, + "simple-app-helper.cpp::ConnectionHandler(): Triggering demo interactions with CastingPlayer (ID: %s). Endpoint ID: %d", + castingPlayer->GetId(), endpoints[index]->GetId()); + // demonstrate invoking a command InvokeContentLauncherLaunchURL(endpoints[index]); @@ -286,8 +329,8 @@ void ConnectionHandler(CHIP_ERROR err, matter::casting::core::CastingPlayer * ca { ChipLogError( AppServer, - "simple-app-helper.cpp::ConnectionHandler():Desired Endpoint Vendor Id (%d) not found on the CastingPlayer (ID: %s)", - kDesiredEndpointVendorId, castingPlayer->GetId()); + "simple-app-helper.cpp::ConnectionHandler():Desired Endpoint Vendor ID not found on the CastingPlayer (ID: %s)", + castingPlayer->GetId()); } } @@ -350,9 +393,14 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) ChipLogError(AppServer, "Invalid casting player index provided: %lu", index)); targetCastingPlayer = castingPlayers.at(index); + gCommissionerGeneratedPasscodeFlowRunning = false; matter::casting::core::IdentificationDeclarationOptions idOptions; + chip::Protocols::UserDirectedCommissioning::TargetAppInfo targetAppInfo; + targetAppInfo.vendorId = kDesiredEndpointVendorId; + if (argc == 3) { + if (strcmp(argv[2], "commissioner-generated-passcode") == 0) { // Attempt Commissioner-Generated Passcode (commissioner-generated-passcode) commissioning flow only if the @@ -364,6 +412,14 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) "Commissioner-Generated Passcode commissioning flow", index); idOptions.mCommissionerPasscode = true; + + // For the example Commissioner-Generated passcode commissioning flow, override the default Target Content + // Application Vendor ID, which is configured on the tv-app. This Target Content Application Vendor ID (1111), + // does not implement the AccountLogin cluster, which would otherwise auto commission using the + // Commissionee-Generated passcode upon recieving the IdentificationDeclaration Message. See + // connectedhomeip/examples/tv-app/tv-common/include/AppTv.h. + targetAppInfo.vendorId = 1111; + gCommissionerGeneratedPasscodeFlowRunning = true; } else { @@ -374,9 +430,8 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) } } } - chip::Protocols::UserDirectedCommissioning::TargetAppInfo targetAppInfo; - targetAppInfo.vendorId = kDesiredEndpointVendorId; - CHIP_ERROR result = idOptions.addTargetAppInfo(targetAppInfo); + + CHIP_ERROR result = idOptions.addTargetAppInfo(targetAppInfo); if (result != CHIP_NO_ERROR) { ChipLogError(AppServer, "CommandHandler() request, failed to add targetAppInfo: %" CHIP_ERROR_FORMAT, result.Format()); @@ -430,11 +485,8 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) err.Format()); } - matter::casting::core::ConnectionCallbacks connectionCallbacks; - connectionCallbacks.mOnConnectionComplete = ConnectionHandler; - // Continue Connecting to the target CastingPlayer with the user entered Commissioner-generated Passcode. - targetCastingPlayer->ContinueConnecting(connectionCallbacks, matter::casting::core::kCommissioningWindowTimeoutSec); + targetCastingPlayer->ContinueConnecting(); } else { diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp index b3075be95304d8..ff204923da5d40 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp @@ -29,9 +29,7 @@ namespace core { CastingPlayer * CastingPlayer::mTargetCastingPlayer = nullptr; -// TODO: Verify why commissioningWindowTimeoutSec is a "unsigned long long int" type. Seems too big. -void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCallbacks, - unsigned long long int commissioningWindowTimeoutSec, +void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCallbacks, uint16_t commissioningWindowTimeoutSec, IdentificationDeclarationOptions idOptions) { ChipLogProgress(AppServer, "CastingPlayer::VerifyOrEstablishConnection() called"); @@ -72,6 +70,25 @@ void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCa "CastingPlayer::VerifyOrEstablishConnection() CommissionerDeclarationCallback not provided in ConnectionCallbacks"); } + ChipLogProgress(AppServer, "CastingPlayer::VerifyOrEstablishConnection() verifying User Directed Commissioning (UDC) state"); + mIdOptions.LogDetail(); + if (!GetSupportsCommissionerGeneratedPasscode() && mIdOptions.mCommissionerPasscode) + { + ChipLogError(AppServer, + "CastingPlayer::VerifyOrEstablishConnection() the target CastingPlayer doesn't support Commissioner-Generated " + "passcode yet IdentificationDeclarationOptions.mCommissionerPasscode is set to true"); + SuccessOrExit(err = CHIP_ERROR_INVALID_ARGUMENT); + } + if (!matter::casting::core::CommissionerDeclarationHandler::GetInstance()->HasCommissionerDeclarationCallback() && + mIdOptions.mCommissionerPasscode) + { + ChipLogError( + AppServer, + "CastingPlayer::VerifyOrEstablishConnection() the CommissionerDeclarationHandler CommissionerDeclaration message " + "callback has not been set, yet IdentificationDeclarationOptions.mCommissionerPasscode is set to true"); + SuccessOrExit(err = CHIP_ERROR_INVALID_ARGUMENT); + } + // If *this* CastingPlayer was previously connected to, its nodeId, fabricIndex and other attributes should be present // in the CastingStore cache. If that is the case, AND, the cached data contains the endpoint desired by the client, if any, // as per IdentificationDeclarationOptions.mTargetAppInfos, simply Find or Re-establish the CASE session and return early. @@ -138,28 +155,11 @@ void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCa } else { - ChipLogProgress(AppServer, - "CastingPlayer::VerifyOrEstablishConnection() verifying User Directed Commissioning (UDC) state"); - mIdOptions.LogDetail(); - SuccessOrExit(err = support::ChipDeviceEventHandler::SetUdcStatus(true)); - - if (!GetSupportsCommissionerGeneratedPasscode() && mIdOptions.mCommissionerPasscode) - { - ChipLogError( - AppServer, - "CastingPlayer::VerifyOrEstablishConnection() the target CastingPlayer doesn't support Commissioner-Generated " - "passcode yet IdentificationDeclarationOptions.mCommissionerPasscode is set to true"); - SuccessOrExit(err = CHIP_ERROR_INVALID_ARGUMENT); - } - if (!matter::casting::core::CommissionerDeclarationHandler::GetInstance()->HasCommissionerDeclarationCallback() && - mIdOptions.mCommissionerPasscode) - { - ChipLogError(AppServer, - "CastingPlayer::VerifyOrEstablishConnection() the CommissionerDeclaration message callback has not been " - "set yet IdentificationDeclarationOptions.mCommissionerPasscode is set to true"); - SuccessOrExit(err = CHIP_ERROR_INVALID_ARGUMENT); - } - + // We need to call OpenBasicCommissioningWindow() for both Commissionee-Generated passcode commissioning flow and + // Commissioner-Generated passcode commissioning flow. Per the Matter spec (UserDirectedCommissioning), even if the + // Commissionee sends an IdentificationDeclaration with CommissionerPasscode set to true, the Commissioner will first + // attempt to use AccountLogin in order to obtain Passcode using rotatingID. If no Passcode is obtained, Commissioner + // displays a Passcode. ChipLogProgress(AppServer, "CastingPlayer::VerifyOrEstablishConnection() calling OpenBasicCommissioningWindow()"); SuccessOrExit(err = chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow( chip::System::Clock::Seconds16(mCommissioningWindowTimeoutSec))); @@ -178,33 +178,19 @@ void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCa } } -void CastingPlayer::ContinueConnecting(ConnectionCallbacks connectionCallbacks, - unsigned long long int commissioningWindowTimeoutSec) +void CastingPlayer::ContinueConnecting() { ChipLogProgress(AppServer, "CastingPlayer::ContinueConnecting()"); CHIP_ERROR err = CHIP_NO_ERROR; - SuccessOrExit(err = support::ChipDeviceEventHandler::SetUdcStatus(true)); - VerifyOrExit( - connectionCallbacks.mOnConnectionComplete != nullptr, - ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() ConnectionCallbacks.mOnConnectionComplete was not provided")); - mConnectionState = CASTING_PLAYER_CONNECTING; - mOnCompleted = connectionCallbacks.mOnConnectionComplete; - mCommissioningWindowTimeoutSec = commissioningWindowTimeoutSec; - mTargetCastingPlayer = this; - - // Register the handler for Commissioner's CommissionerDeclaration messages. The CommissionerDeclaration messages provide - // information indicating the Commissioner's pre-commissioning state. - if (connectionCallbacks.mCommissionerDeclarationCallback != nullptr) - { - matter::casting::core::CommissionerDeclarationHandler::GetInstance()->SetCommissionerDeclarationCallback( - connectionCallbacks.mCommissionerDeclarationCallback); - } - else + // Verify that mOnCompleted is not nullptr. + VerifyOrExit(mOnCompleted != nullptr, ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() mOnCompleted == nullptr")); + if (!matter::casting::core::CommissionerDeclarationHandler::GetInstance()->HasCommissionerDeclarationCallback()) { - ChipLogProgress( - AppServer, - "CastingPlayer::VerifyOrEstablishConnection() CommissionerDeclarationCallback not provided in ConnectionCallbacks"); + ChipLogProgress(AppServer, + "CastingPlayer::ContinueConnecting() CommissionerDeclaration message callback has not been set."); } + mConnectionState = CASTING_PLAYER_CONNECTING; + mTargetCastingPlayer = this; ChipLogProgress(AppServer, "CastingPlayer::ContinueConnecting() calling OpenBasicCommissioningWindow()"); SuccessOrExit(err = chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow( @@ -272,6 +258,8 @@ CHIP_ERROR CastingPlayer::SendUserDirectedCommissioningRequest() chip::Protocols::UserDirectedCommissioning::IdentificationDeclaration id = mIdOptions.buildIdentificationDeclarationMessage(); + ReturnErrorOnFailure(support::ChipDeviceEventHandler::SetUdcStatus(true)); + ReturnErrorOnFailure(chip::Server::GetInstance().SendUserDirectedCommissioningRequest( chip::Transport::PeerAddress::UDP(*ipAddressToUse, mAttributes.port, mAttributes.interfaceId), id)); @@ -401,6 +389,26 @@ void CastingPlayer::LogDetail() const } } +CastingPlayer::CastingPlayer(const CastingPlayer & other) : + std::enable_shared_from_this(other), mEndpoints(other.mEndpoints), mConnectionState(other.mConnectionState), + mAttributes(other.mAttributes), mIdOptions(other.mIdOptions), + mCommissioningWindowTimeoutSec(other.mCommissioningWindowTimeoutSec), mOnCompleted(other.mOnCompleted) +{} + +CastingPlayer & CastingPlayer::operator=(const CastingPlayer & other) +{ + if (this != &other) + { + mAttributes = other.mAttributes; + mEndpoints = other.mEndpoints; + mConnectionState = other.mConnectionState; + mIdOptions = other.mIdOptions; + mCommissioningWindowTimeoutSec = other.mCommissioningWindowTimeoutSec; + mOnCompleted = other.mOnCompleted; + } + return *this; +} + ConnectionContext::ConnectionContext(void * clientContext, core::CastingPlayer * targetCastingPlayer, chip::OnDeviceConnected onDeviceConnectedFn, chip::OnDeviceConnectionFailure onDeviceConnectionFailureFn) 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 14a55e045fcb83..d5bbcd46006920 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h @@ -38,8 +38,8 @@ namespace core { const int kPortMaxLength = 5; // port is uint16_t // +1 for the : between the hostname and the port. -const int kIdMaxLength = chip::Dnssd::kHostNameMaxLength + kPortMaxLength + 1; -const unsigned long long int kCommissioningWindowTimeoutSec = 3 * 60; // 3 minutes +const int kIdMaxLength = chip::Dnssd::kHostNameMaxLength + kPortMaxLength + 1; +const uint16_t kCommissioningWindowTimeoutSec = 3 * 60; // 3 minutes /** * @brief Describes an Endpoint that the client wants to connect to @@ -111,46 +111,81 @@ class CastingPlayer : public std::enable_shared_from_this return (compareResult == 0) ? 1 : 0; } + /** + * @brief Define the copy constructor + */ + CastingPlayer(const CastingPlayer & other); + + /** + * @brief Define the assignment operator + */ + CastingPlayer & operator=(const CastingPlayer & other); + /** * @return true if this CastingPlayer is connected to the CastingApp */ bool IsConnected() const { return mConnectionState == CASTING_PLAYER_CONNECTED; } /** - * @brief Verifies that a connection exists with this CastingPlayer, or triggers a new session - * request. If the CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on disk, - * this will execute the User Directed Commissioning (UDC) process. + * @brief Verifies that a connection exists with this CastingPlayer, or triggers a new commissioning session request. If the + * CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on disk, this will execute the User Directed + * Commissioning (UDC) process by sending an IdentificationDeclaration message to the Commissioner. For certain UDC features, + * where a Commissioner reply is expected, this API needs to be followed up with the ContinueConnecting() API defiend below. See + * the Matter UDC specification or parameter class definitions for details on features not included in the description below. + * + * @param connectionCallbacks contains the ConnectCallback (Required) and CommissionerDeclarationCallback (Optional) defiend in + * ConnectCallbacks.h. + * + * ConnectCallback: The callback called when the connection process has ended, regardless of whether it was successful or not. + * + * CommissionerDeclarationCallback: The callback called when the Commissionee receives a CommissionerDeclaration message from + * the Commissioner. This callback is needed to support UDC features where a reply from the Commissioner is expected. It + * provides information indicating the Commissioner’s pre-commissioning state. + * + * For example: During Commissioner-Generated passcode commissioning, the Commissioner replies with a CommissionerDeclaration + * message with PasscodeDialogDisplayed and CommissionerPasscode set to true. Given these Commissioner state details, the client + * is expected to perform some actions, detailed in the ContinueConnecting() API below, and then call the ContinueConnecting() + * API to complete the process. * - * @param connectionCallbacks contains the ConnectCallback and CommissionerDeclarationCallback (Optional). * @param commissioningWindowTimeoutSec (Optional) time (in sec) to keep the commissioning window open, if commissioning is * required. Needs to be >= kCommissioningWindowTimeoutSec. + * * @param idOptions (Optional) Parameters in the IdentificationDeclaration message sent by the Commissionee to the Commissioner. * These parameters specify the information relating to the requested commissioning session. + * + * For example: To invoke the Commissioner-Generated passcode commissioning flow, the client would call this API with + * IdentificationDeclarationOptions containing CommissionerPasscode set to true. See IdentificationDeclarationOptions.h for a + * complete list of optional parameters. + * * Furthermore, attributes (such as VendorId) describe the TargetApp that the client wants to interact with after commissioning. * If this value is passed in, VerifyOrEstablishConnection() will force UDC, in case the desired * TargetApp is not found in the on-device CastingStore. */ void VerifyOrEstablishConnection(ConnectionCallbacks connectionCallbacks, - unsigned long long int commissioningWindowTimeoutSec = kCommissioningWindowTimeoutSec, - IdentificationDeclarationOptions idOptions = IdentificationDeclarationOptions()); + uint16_t commissioningWindowTimeoutSec = kCommissioningWindowTimeoutSec, + IdentificationDeclarationOptions idOptions = IdentificationDeclarationOptions()); /** - * @brief Continues the UDC process during the Commissioner-Generated passcode commissioning flow by sending a second - * IdentificationDeclaration to Commissioner containing CommissionerPasscode and CommissionerPasscodeReady set to true. At this - * point it is assumed that the following have occurred: - * 1. Client has handled the Commissioner's CommissionerDecelration message with PasscodeDialogDisplayed and - * CommissionerPasscode set to true. - * 2. Client prompted user to input Passcode from Commissioner. - * 3. Client has updated the commissioning session's PAKE verifier using the user input Passcode by updating the CastingApps + * @brief This is a continuation of the Commissioner-Generated passcode commissioning flow started via the + * VerifyOrEstablishConnection() API above. It continues the UDC process by sending a second IdentificationDeclaration message + * to Commissioner containing CommissionerPasscode and CommissionerPasscodeReady set to true. At this point it is assumed that + * the following have occurred: + * + * 1. Client (Commissionee) has sent the first IdentificationDeclaration message, via VerifyOrEstablishConnection(), to the + * Commissioner containing CommissionerPasscode set to true. + * 2. Commissioner generated and displayed a passcode. + * 3. The Commissioner replied with a CommissionerDecelration message with PasscodeDialogDisplayed and CommissionerPasscode set + * to true. + * 3. Client has handled the Commissioner's CommissionerDecelration message. + * 4. Client prompted user to input Passcode from Commissioner. + * 5. Client has updated the commissioning session's PAKE verifier using the user input Passcode by updating the CastingApps * CommissionableDataProvider * (matter::casting::core::CastingApp::GetInstance()->UpdateCommissionableDataProvider(CommissionableDataProvider)). * - * @param connectionCallbacks contains the ConnectCallback and CommissionerDeclarationCallback (Optional). - * @param commissioningWindowTimeoutSec (Optional) time (in sec) to keep the commissioning window open, if commissioning is - * required. Needs to be >= kCommissioningWindowTimeoutSec. + * The same connectionCallbacks and commissioningWindowTimeoutSec parameters passed into VerifyOrEstablishConnection() will be + * used. */ - void ContinueConnecting(ConnectionCallbacks connectionCallbacks, - unsigned long long int commissioningWindowTimeoutSec = kCommissioningWindowTimeoutSec); + void ContinueConnecting(); /** * @brief Sets the internal connection state of this CastingPlayer to "disconnected" @@ -220,8 +255,8 @@ class CastingPlayer : public std::enable_shared_from_this CastingPlayerAttributes mAttributes; IdentificationDeclarationOptions mIdOptions; static CastingPlayer * mTargetCastingPlayer; - unsigned long long int mCommissioningWindowTimeoutSec = kCommissioningWindowTimeoutSec; - ConnectCallback mOnCompleted = {}; + uint16_t mCommissioningWindowTimeoutSec = kCommissioningWindowTimeoutSec; + ConnectCallback mOnCompleted = {}; /** * @brief resets this CastingPlayer's state and calls mOnCompleted with the CHIP_ERROR. Also, after calling mOnCompleted, it diff --git a/examples/tv-casting-app/tv-casting-common/core/CommissionerDeclarationHandler.cpp b/examples/tv-casting-app/tv-casting-common/core/CommissionerDeclarationHandler.cpp index bb9ecc3c4c57d9..22e7d49cdb7a5d 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CommissionerDeclarationHandler.cpp +++ b/examples/tv-casting-app/tv-casting-common/core/CommissionerDeclarationHandler.cpp @@ -38,7 +38,7 @@ CommissionerDeclarationHandler * CommissionerDeclarationHandler::GetInstance() } // TODO: In the following PRs. Implement setHandler() for CommissionerDeclaration messages and expose messages to higher layers for -// Linux(DONE), Android(pending) and iOS(pending). +// Linux, Android and iOS. void CommissionerDeclarationHandler::OnCommissionerDeclarationMessage( const chip::Transport::PeerAddress & source, chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cd) { diff --git a/examples/tv-casting-app/tv-casting-common/core/Endpoint.h b/examples/tv-casting-app/tv-casting-common/core/Endpoint.h index 4da8cd56210b07..fc18267cf466be 100644 --- a/examples/tv-casting-app/tv-casting-common/core/Endpoint.h +++ b/examples/tv-casting-app/tv-casting-common/core/Endpoint.h @@ -145,6 +145,12 @@ class Endpoint : public std::enable_shared_from_this } return nullptr; } + + void LogDetail() const + { + ChipLogProgress(AppServer, "Endpoint::LogDetail() Endpoint ID: %d, Vendor ID: %d, Product ID: %d", mAttributes.mId, + mAttributes.mVendorId, mAttributes.mProductId); + } }; }; // namespace core