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

Configure impl #154

Merged
merged 29 commits into from
Mar 22, 2023
Merged

Configure impl #154

merged 29 commits into from
Mar 22, 2023

Conversation

forwardpointer
Copy link
Contributor

@forwardpointer forwardpointer commented Mar 21, 2023

Type

  • Bug fix
  • Feature addition
  • Feature update
  • Breaking change
  • Non-functional change
  • Documentation
  • Infrastructure

Goals

This PR changes the interface of UwbSession::Configure to take in the sessionId and a vector of UwbApplicationConfigurationParameter because those are what UCI defines as inputs to the driver for the IOCTL.

This PR also fixes some minor documentation issues with the UwbDeviceConnector

Also the UwbConfiguration::uwbConfigurationAvailable boolean was deemed unnecessary because you can just check the output of UwbConfiguration::GetValueMap(), and so it was removed.

Future Work

We need to implement the translation function between the OOB app config params to the UCI config params. I have the function declared as

std::vector<UwbApplicationConfigurationParameter>
uwb::protocol::fira::GetUciConfigParams(const UwbConfiguration& config, DeviceType deviceType)

and it is declared in lib/uwb/protocols/fira/UwbSession.hxx

Checklist

  • Build target all compiles cleanly.
  • clang-format and clang-tidy deltas produced no new output.
  • Newly added functions include doxygen-style comment block.

@forwardpointer forwardpointer requested a review from a team as a code owner March 21, 2023 07:30
abeltrano
abeltrano previously approved these changes Mar 21, 2023
lib/uwb/protocols/fira/UwbConfiguration.cxx Outdated Show resolved Hide resolved
lib/uwb/protocols/fira/UwbConfiguration.cxx Outdated Show resolved Hide resolved
lib/uwb/protocols/fira/UwbConfiguration.cxx Outdated Show resolved Hide resolved
lib/uwb/UwbSession.cxx Outdated Show resolved Hide resolved
lib/uwb/protocols/fira/UwbConfiguration.cxx Outdated Show resolved Hide resolved
tools/cli/NearObjectCliHandler.cxx Outdated Show resolved Hide resolved
corbin-phipps
corbin-phipps previously approved these changes Mar 21, 2023
corbin-phipps
corbin-phipps previously approved these changes Mar 21, 2023
}
if (deviceType == DeviceType::Controller) {
if (mode == uwb::UwbMacAddressType::Short) {
return config.GetControleeShortMacAddress(); // TODO this should reflect the possibility for multiple peers
Copy link
Contributor

Choose a reason for hiding this comment

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

This might not be necessary. If our current understanding is accurate, then we'll expect many UwbSessionData (with UwbConfiguration in them) to be provided via OOB, so we'd call UwbSession::Configure for each of them after converting them with this code, and each of them should only contain a single address for the controllee. Eg.

DeviceType deviceType = DeviceType::Controller; // from OOB "profile"
UwbSession uwbSession = uwbDevice.CreateSession(deviceType);
foreach (UwbSessionData from OOB /* = N */) {
    auto applicationConfigurationParameters = GetUciConfigParams(UwbSessionData.uwbConfiguration, deviceType);
    uwbSession.Configure(uwbSessionData.sessionId, std::move(applicationConfigurationParameters));
}
// uwbSession is now configured for 'N' sets of parameters for 'N' controlees

I think that when the host is a controller, it will set a lot of the application configuration parameters itself, whereas when the host is a controlee, it gets most of the parameters from the controller, and there will likely only be one UwbSessionData from OOB.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that I think about it, it might not make sense for UwbSession to be constructed and also not call SessionInitialize at the same time. This is because currently the interface does allow the sessionId to change after Configure has been called (via multiple calls of Configure), while what we really want is UwbSession to represent one unique session. We can address this in another PR

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking something similar, where the caller could check the session id prior to calling Configure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UCI has a parameter named NUMBER_OF_CONTROLEES. Does this mean that in our implementation it will always be set to 1?

lib/uwb/protocols/fira/UwbOobConversions.cxx Show resolved Hide resolved
@@ -549,7 +549,7 @@ using UwbApplicationConfigurationParameterValue = std::variant<
RangingRoundUsage, // RANGING_ROUND_USAGE, tag0x01, size 1
RangingMode, // RANGING_TIME_STRUCT, tag 0x1A, size 1
RangingRoundControl, // RANGING_ROUND_CONTROL, tag 0x0C, size 1,
ResultReportConfiguration, // RESULT_REPORT_CONFIG, tag 0x2E, size 1
ResultReportConfiguration, // RESULT_REPORT_CONFIG, tag 0x2E, size 1 // TODO this should really be a set
Copy link
Contributor

Choose a reason for hiding this comment

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

Might as well fix this now so we can close this chapter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would prefer to do this in another PR (keeps this one small)

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

lib/uwb/include/uwb/UwbSession.hxx Outdated Show resolved Hide resolved
lib/uwb/protocols/fira/UwbOobConversions.cxx Outdated Show resolved Hide resolved
abeltrano
abeltrano previously approved these changes Mar 22, 2023
lib/uwb/protocols/fira/UwbOobConversions.cxx Show resolved Hide resolved
@abeltrano abeltrano merged commit 1adfae3 into develop Mar 22, 2023
@abeltrano abeltrano deleted the ConfigureIml branch March 22, 2023 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants