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

Implement User Directed Commissioning - Phase 2 #8084

Merged
merged 17 commits into from
Jul 22, 2021
Merged

Conversation

chrisdecenzo
Copy link
Contributor

@chrisdecenzo chrisdecenzo commented Jul 2, 2021

Address 6789 - User Directed Commissioning (UDC) needs implementation

Summary of Changes

  • Add Message handler for UDC messages, enabled when CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY=1
  • Add Client for UDC messages, enabled when CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT=1
  • Add shell commands to invoke these features
  • Enable commissioner on tv-app
  • Enable UDC client on linux lighting-app for testing via shell
  • Fixes Implement User Directed Commissioning #6789

How was this Tested

  • tv-app now includes the device commissioner code along with shell commands for managing the UDC state cache.
  • lighting-app for linux now includes the UDC client along with shell commands for sending the UDC message. To do this call "commissionee sendudc 127.0.0.1 11100" from lighting app. See printouts of tv-app indicating UDC message received, perform commissionable discovery on result, print out callback intended for UX (for user to accept commissioning of client).

@todo
Copy link

todo bot commented Jul 2, 2021

fix listen port

// TODO: fix listen port
ReturnErrorOnFailure(mUdcTransportMgr->Init(Transport::UdpListenParameters(mInetLayer)
.SetAddressType(Inet::kIPAddressType_IPv6)
.SetListenPort((uint16_t)(mListenPort + 1))
#if INET_CONFIG_ENABLE_IPV4
,
Transport::UdpListenParameters(mInetLayer)
.SetAddressType(Inet::kIPAddressType_IPv4)
.SetListenPort((uint16_t)(mListenPort + 1))
#endif
#if CONFIG_NETWORK_LAYER_BLE


This comment was generated by todo based on a TODO comment in e86bd42 in #8084. cc @project-chip.

@todo
Copy link

todo bot commented Jul 2, 2021

determine when UDC client's state should time out

// TODO: determine when UDC client's state should time out
constexpr const uint64_t kUDCClientTimeoutMs = 60 * 60 * 1000;
/**
* Handles a set of UDC Client Processing States.
*
* Intended for:
* - ignoring/dropping duplicate UDC messages for the same instance
* - tracking state of UDC work flow (see UDCClientProcessingState)
* - timing out failed/declined UDC Clients
*/


This comment was generated by todo based on a TODO comment in e86bd42 in #8084. cc @project-chip.

@todo
Copy link

todo bot commented Jul 2, 2021

check length of instanceName

// TODO: check length of instanceName
if (strncmp(iter->GetInstanceName(), instanceName, chip::Mdns::kMaxInstanceNameSize + 1) == 0)
{
state = iter;
break;
}
}
return state;
}
// Reset all states to kNotInitialized


This comment was generated by todo based on a TODO comment in e86bd42 in #8084. cc @project-chip.

@todo
Copy link

todo bot commented Jul 2, 2021

do we need these std::move calls?

// TODO: do we need these std::move calls?
System::PacketBufferHandle && msg = std::move(msgBuf);
PayloadHeader payloadHeader;
ReturnOnFailure(payloadHeader.DecodeAndConsume(msg));
System::PacketBufferHandle && payload = std::move(msg);
char instanceName[chip::Mdns::kMaxInstanceNameSize + 1];
int instanceNameLength =
(payload->DataLength() > (chip::Mdns::kMaxInstanceNameSize)) ? chip::Mdns::kMaxInstanceNameSize : payload->DataLength();


This comment was generated by todo based on a TODO comment in e86bd42 in #8084. cc @project-chip.

@todo
Copy link

todo bot commented Jul 2, 2021

determine when UDC client's state should time out

// TODO: determine when UDC client's state should time out
constexpr const uint64_t kUDCClientTimeoutMs = 60 * 60 * 1000;
/**
* Handles a set of UDC Client Processing States.
*
* Intended for:
* - ignoring/dropping duplicate UDC messages for the same instance
* - tracking state of UDC work flow (see UDCClientProcessingState)
* - timing out failed/declined UDC Clients
*/


This comment was generated by todo based on a TODO comment in 5547040 in #8084. cc @project-chip.

@todo
Copy link

todo bot commented Jul 2, 2021

determine when UDC client's state should time out

// TODO: determine when UDC client's state should time out
constexpr const uint64_t kUDCClientTimeoutMs = 60 * 60 * 1000;
/**
* Handles a set of UDC Client Processing States.
*
* Intended for:
* - ignoring/dropping duplicate UDC messages for the same instance
* - tracking state of UDC work flow (see UDCClientProcessingState)
* - timing out failed/declined UDC Clients
*/


This comment was generated by todo based on a TODO comment in e9f1f48 in #8084. cc @project-chip.

@todo
Copy link

todo bot commented Jul 18, 2021

determine when UDC client's state should time out

// TODO: determine when UDC client's state should time out
constexpr const uint64_t kUDCClientTimeoutMs = 60 * 60 * 1000;
/**
* Handles a set of UDC Client Processing States.
*
* Intended for:
* - ignoring/dropping duplicate UDC messages for the same instance
* - tracking state of UDC work flow (see UDCClientProcessingState)
* - timing out failed/declined UDC Clients
*/


This comment was generated by todo based on a TODO comment in 66acd5a in #8084. cc @project-chip.

@msandstedt
Copy link
Contributor

I only saw one thing that I thought could warrant action:

https://github.com/project-chip/connectedhomeip/pull/8084/files#r674043623

All else looks good to me. My other comments about ports are editorial in regards to larger stack architecture and / or covered by future work.

@woody-apple woody-apple merged commit 250d5f7 into master Jul 22, 2021
@woody-apple woody-apple deleted the udc-phase2 branch July 22, 2021 02:28
@todo todo bot mentioned this pull request Jul 22, 2021
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
* second round of UDC feature

* build fixes

* build fixes

* CI build fixes

* CI build fixes

* CI build fixes - Android

* CI build fixes

* CI linux build fix

* Restyled by whitespace (project-chip#8247)

Co-authored-by: Restyled.io <commits@restyled.io>

* address comments

* address comments

* address comments

* address comments

* address comments

* revert changes to echo requester/responder

* fix CI builds

Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <commits@restyled.io>
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.

Implement User Directed Commissioning
6 participants