-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 for multiple devices #3630
Conversation
rebased |
rebased |
* @brief | ||
* Set the delegate object which will be called when a message is received. | ||
* The user of this Device object must reset the delegate (by calling | ||
* SetDelegate(nullptr)) before releasing their delegate object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implies they control the lifetime of the Device somehow, right? That is, that the device can't go away on them?
Please file a followup to either document ownership here better or add more callbacks to allow a variety of ownership models to be implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: #3763
src/controller/CHIPDevice.h
Outdated
* interface etc) are part of the serialized device, so those are not required to be | ||
* initialized. | ||
* | ||
* Note: The lifetime of session manager, and inet layer objects must be longer than |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Note: The lifetime of session manager, and inet layer objects must be longer than | |
* Note: The lifetime of session manager and inet layer objects must be longer than |
src/controller/CHIPDevice.h
Outdated
|
||
/** | ||
* @brief | ||
* Return if the current device object is actively associated with a paired CHIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Return if the current device object is actively associated with a paired CHIP | |
* Return whether the current device object is actively associated with a paired CHIP |
src/controller/CHIPDevice.h
Outdated
/* IP Address of the CHIP device */ | ||
Inet::IPAddress mDeviceAddr; | ||
|
||
/* Port on which the CHIP device is receiving message. Typically it is CHIP_PORT */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* Port on which the CHIP device is receiving message. Typically it is CHIP_PORT */ | |
/* Port on which the CHIP device is receiving messages. Typically it is CHIP_PORT */ |
serializable.mDeviceId = Encoding::LittleEndian::HostSwap64(mDeviceId); | ||
serializable.mDevicePort = Encoding::LittleEndian::HostSwap16(mDevicePort); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, separate PR is fine, but we should make sure it happens....
src/controller/CHIPDevice.cpp
Outdated
VerifyOrExit(deserializedLen > 0, error = CHIP_ERROR_INVALID_ARGUMENT); | ||
VerifyOrExit(deserializedLen <= sizeof(serializable), error = CHIP_ERROR_INVALID_ARGUMENT); | ||
|
||
// The second paramter to FromString takes the strlen value. We are subtracting 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The second paramter to FromString takes the strlen value. We are subtracting 1 | |
// The second parameter to FromString takes the strlen value. We are subtracting 1 |
mPairingDelegate = nullptr; | ||
mRendezvousSession = nullptr; | ||
mDeviceBeingPaired = kNumMaxActiveDevices; | ||
mPairedDevicesUpdated = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vaguely do, but it's not that big a deal.
{ | ||
mOnComplete.Response(this, mAppReqState, msgBuf); | ||
// Let's release the device that's being paired. | ||
// If pairing was successful, it's information is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If pairing was successful, it's information is | |
// If pairing was successful, its information is |
mOnNewConnection(this, nullptr, mAppReqState); | ||
} | ||
ChipLogDetail(Controller, "Remote device completed SPAKE2+ handshake\n"); | ||
mRendezvousSession->GetPairingSession().Serializable(device->GetPairing()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, ToSerializable
would be better.
public PersistentStorageResultDelegate | ||
/** | ||
* @brief | ||
* The controller applications can use this class to commuicate with already paired CHIP devices. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* The controller applications can use this class to commuicate with already paired CHIP devices. The | |
* Controller applications can use this class to communicate with already paired CHIP devices. The |
/** | ||
* @brief | ||
* Connect to a CHIP device with the provided Rendezvous connection parameters | ||
* This function derserializes the provided deviceInfo object, and initialzes and output the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* This function derserializes the provided deviceInfo object, and initialzes and output the | |
* This function deserializes the provided deviceInfo object, and initializes and outputs the |
* Connect to a CHIP device with the provided Rendezvous connection parameters | ||
* This function derserializes the provided deviceInfo object, and initialzes and output the | ||
* corresponding Device object. The lifetime of the output object is tied to that of DeviceController | ||
* object. The caller must not use the Device object If they free the DeviceController object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or after calling ReleaseDevice
in the returned Device
?
|
||
State mState; | ||
|
||
/* A list of device objects that can be used for commincating with corresponding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* A list of device objects that can be used for commincating with corresponding | |
/* A list of device objects that can be used for communicating with corresponding |
State mState; | ||
|
||
/* A list of device objects that can be used for commincating with corresponding | ||
CHIP device. The list does not contain all the paired devices, but only the ones |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHIP device. The list does not contain all the paired devices, but only the ones | |
CHIP devices. The list does not contain all the paired devices, but only the ones |
void ClearRequestState(); | ||
void ClearOpState(); | ||
/* This field is an index in mActiveDevices list. The object at this index in the list | ||
contains the device object that's tracking the state of the device that's being paired */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contains the device object that's tracking the state of the device that's being paired */ | |
contains the device object that's tracking the state of the device that's being paired. | |
If no device is currently being paired, this value will be kNumMaxPairedDevices. */ |
Right?
return error; | ||
} | ||
|
||
CHIP_ERROR SecurePairingSession::Serializable(SecurePairingSessionSerializable & serializable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer ToSerializable
, yes.
Size increase report for "nrfconnect-example-build" from 81f0566
Full report output
|
Size increase report for "esp32-example-build" from 81f0566
Full report output
|
Problem
CHIP Controller API doesn't support pairing of multiple devices. The controller class stores information of one paired device.
Summary of Changes
CHIPDevice
class.Controller
andCommissioner
interfacesFixes #2795