-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[E2E][JF] Implemented JCM mDNS advertisement and OJCW #38994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vijs
wants to merge
1
commit into
project-chip:master
Choose a base branch
from
vijs:feature/38544
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+605
−50
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
examples/jf-control-app/commands/pairing/OpenJointCommissioningWindowCommand.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2025 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#include "OpenJointCommissioningWindowCommand.h" | ||
|
||
#include <system/SystemClock.h> | ||
|
||
using namespace ::chip; | ||
|
||
CHIP_ERROR OpenJointCommissioningWindowCommand::RunCommand() | ||
{ | ||
mWindowOpener = Platform::MakeUnique<Controller::CommissioningWindowOpener>(&CurrentCommissioner()); | ||
|
||
SetupPayload ignored; | ||
return mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() | ||
.SetNodeId(mNodeId) | ||
.SetTimeout(mCommissioningWindowTimeout) | ||
.SetIteration(mIteration) | ||
.SetDiscriminator(mDiscriminator) | ||
.SetReadVIDPIDAttributes(true) | ||
.SetCallback(&mOnOpenCommissioningWindowCallback) | ||
.SetEndpointId(mEndpointId), | ||
ignored, true); | ||
} | ||
|
||
void OpenJointCommissioningWindowCommand::OnOpenCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err, | ||
SetupPayload payload) | ||
{ | ||
LogErrorOnFailure(err); | ||
|
||
OpenJointCommissioningWindowCommand * command = reinterpret_cast<OpenJointCommissioningWindowCommand *>(context); | ||
VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnOpenJointCommissioningWindowCommand: context is null")); | ||
command->SetCommandExitStatus(err); | ||
} |
64 changes: 64 additions & 0 deletions
64
examples/jf-control-app/commands/pairing/OpenJointCommissioningWindowCommand.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2025 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "../common/CHIPCommand.h" | ||
|
||
#include <controller/CommissioningWindowOpener.h> | ||
#include <lib/support/CHIPMem.h> | ||
|
||
class OpenJointCommissioningWindowCommand : public CHIPCommand | ||
{ | ||
public: | ||
OpenJointCommissioningWindowCommand(CredentialIssuerCommands * credIssuerCommands) : | ||
CHIPCommand("open-joint-commissioning-window", credIssuerCommands), | ||
mOnOpenCommissioningWindowCallback(OnOpenCommissioningWindowResponse, this) | ||
{ | ||
AddArgument("node-id", 0, UINT64_MAX, &mNodeId, "Node to send command to."); | ||
AddArgument("endpoint-id", 0, UINT16_MAX, &mEndpointId, "Endpoint the command is targeted at."); | ||
AddArgument("window-timeout", 0, UINT16_MAX, &mCommissioningWindowTimeout, | ||
"Time, in seconds, before the commissioning window closes."); | ||
AddArgument("iteration", chip::Crypto::kSpake2p_Min_PBKDF_Iterations, chip::Crypto::kSpake2p_Max_PBKDF_Iterations, | ||
&mIteration, "Number of PBKDF iterations to use to derive the verifier. Ignored if 'option' is 0."); | ||
AddArgument("discriminator", 0, 4095, &mDiscriminator, "Discriminator to use for advertising. Ignored if 'option' is 0."); | ||
AddArgument("timeout", 0, UINT16_MAX, &mTimeout, "Time, in seconds, before this command is considered to have timed out."); | ||
} | ||
|
||
/////////// CHIPCommand Interface ///////// | ||
CHIP_ERROR RunCommand() override; | ||
// We issue multiple data model operations for this command, and the default | ||
// timeout for those is 10 seconds, so default to 20 seconds. | ||
chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(20)); } | ||
|
||
private: | ||
NodeId mNodeId; | ||
uint16_t mCommissioningWindowTimeout; | ||
uint32_t mIteration; | ||
uint16_t mDiscriminator; | ||
|
||
chip::Optional<uint16_t> mTimeout; | ||
|
||
chip::EndpointId mEndpointId; | ||
|
||
chip::Platform::UniquePtr<chip::Controller::CommissioningWindowOpener> mWindowOpener; | ||
|
||
static void OnOpenCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload); | ||
|
||
chip::Callback::Callback<chip::Controller::OnOpenCommissioningWindow> mOnOpenCommissioningWindowCallback; | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.