Skip to content
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

Enable pairing of multiple admins with a device #4738

Merged
merged 8 commits into from
Feb 9, 2021

Conversation

pan-apple
Copy link
Contributor

Problem

Missing implementation for adding multiple administrator to a device.

Summary of Changes

This PR adds mechanism to trigger opening pairing window on a previously paired device. It generates a temporary manual setup code that the second admin can use to pair with the device. Alternatively, the first admin can let the second admin use the original setup code from the device.

The PR adds a bespoke/temporary implementation of commissioning cluster. This will eventually be moved to the code-generated implementation. The code is marked with TODO, and corresponding issue.

@todo
Copy link

todo bot commented Feb 8, 2021

This code is temporary, and must be updated to use the Cluster API.

// TODO: This code is temporary, and must be updated to use the Cluster API.
// Issue: https://github.com/project-chip/connectedhomeip/issues/4725
if (payloadHeader.GetProtocolID() == chip::Protocols::kProtocol_ServiceProvisioning)
{
CHIP_ERROR err = CHIP_NO_ERROR;
uint32_t timeout;
uint16_t discriminator;
PASEVerifier verifier;
ChipLogProgress(AppServer, "Received service provisioning message. Treating it as OpenPairingWindow request");
chip::System::PacketBufferTLVReader reader;


This comment was generated by todo based on a TODO comment in 6a67aab in #4738. cc @pan-apple.

@todo
Copy link

todo bot commented Feb 8, 2021

This code is temporary, and must be updated to use the Cluster API.

// TODO: This code is temporary, and must be updated to use the Cluster API.
// Issue: https://github.com/project-chip/connectedhomeip/issues/4725
// Construct and send "open pairing window" message to the device
System::PacketBufferHandle buf = System::PacketBufferHandle::New(0);
System::PacketBufferTLVWriter writer;
writer.Init(std::move(buf));
writer.ImplicitProfileId = chip::Protocols::kProtocol_ServiceProvisioning;
ReturnErrorOnFailure(writer.Put(DeviceLayer::ProfileTag(writer.ImplicitProfileId, 1), timeout));


This comment was generated by todo based on a TODO comment in 6a67aab in #4738. cc @pan-apple.

@woody-apple
Copy link
Contributor

@pan-apple

cc1plus: error: unrecognized command line option '-Wno-unknown-warning-option' [-Werror]
291
cc1plus: all warnings being treated as errors
292

@pan-apple
Copy link
Contributor Author

Some of the failures are in unrelated code. Maybe a rebase is needed..

   43 |     err = AdditionalDataPayloadParser(payloadData.data(), (uint32_t) payloadData.size()).populatePayload(resultPayload);
282
      |                                                                                                          ^~~~~~~~~~~~~
283
      |                                                                                                          |
284
      |                                                                                                          chip::AdditionalDataPayload
285
In file included from ../../examples/chip-tool/commands/payload/AdditionalDataParseCommand.cpp:21:
286
../../examples/chip-tool/third_party/connectedhomeip/src/setup_payload/AdditionalDataPayloadParser.h:77:70: note:   initializing argument 1 of 'CHIP_ERROR chip::AdditionalDataPayloadParser::populatePayload(int&)'
287
   77 |     CHIP_ERROR populatePayload(SetupPayload::AdditionalDataPayload & outPayload);
288
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

@boring-cyborg boring-cyborg bot added the linux label Feb 8, 2021
@todo
Copy link

todo bot commented Feb 9, 2021

The following class is setting the discriminator in Persistent Storage. This is

// TODO: The following class is setting the discriminator in Persistent Storage. This is
// is needed since BLE reads the discriminator using ConfigurationMgr APIs. The
// better solution will be to pass the discriminator to BLE without changing it
// in the persistent storage.
// https://github.com/project-chip/connectedhomeip/issues/4767
class DeviceDiscriminatorCache
{
public:
CHIP_ERROR UpdateDiscriminator(uint16_t discriminator)
{
if (!mOriginalDiscriminatorCached)


This comment was generated by todo based on a TODO comment in 81f21bb in #4738. cc @pan-apple.

@pan-apple pan-apple requested a review from mspang February 9, 2021 18:06
@pan-apple
Copy link
Contributor Author

@saurabhst, do you have any feedback?

src/app/server/AppDelegate.h Outdated Show resolved Hide resolved
src/controller/CHIPDevice.cpp Outdated Show resolved Hide resolved
src/transport/PASESession.h Outdated Show resolved Hide resolved
@pan-apple pan-apple requested a review from mspang February 9, 2021 19:40
Copy link

@hawk248 hawk248 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants