-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add remaining UCI app config parameters to nocli uwb range start #196
Conversation
… update GetValueMap()
…onfig, and StaticStsInitializationVector
💯 I've never liked it. |
I'm also hoping we can make some of the primary parameters positional such that switches don't always need to be provided. This is mostly for commands that only take 1 or 2 arguments. |
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.
Thanks for doing this, I know it must have been tedious 😒
@@ -483,6 +545,40 @@ NearObjectCli::AddSubcommandUwbRangeStart(CLI::App* parent) | |||
m_cliData->appConfigParamsData.destinationMacAddresses.value().insert(uwb::UwbMacAddress::FromString(m_cliData->destinationMacAddressString, macAddressType).value()); | |||
} | |||
|
|||
// Parse and validate ResultReportConfig | |||
constexpr int resultReportConfigurationSize = 4; // TODO: Find a way to calculate this number |
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.
constexpr int resultReportConfigurationSize = 4; // TODO: Find a way to calculate this number | |
constexpr int resultReportConfigurationSize = magic_enum::enum_count<ResultReportConfig>(); |
if (IsValidResultReportConfigurationString(m_cliData->resultReportConfigurationString)) { | ||
m_cliData->appConfigParamsData.resultReportConfig.emplace(); | ||
|
||
const std::bitset<4> resultReportConfigurationBits(m_cliData->resultReportConfigurationString); |
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.
Should this be resultReportConfigurationSize
instead?
const std::bitset<4> resultReportConfigurationBits(m_cliData->resultReportConfigurationString); | |
const std::bitset<resultReportConfigurationSize > resultReportConfigurationBits(m_cliData->resultReportConfigurationString); |
m_cliData->appConfigParamsData.resultReportConfig.emplace(); | ||
|
||
const std::bitset<4> resultReportConfigurationBits(m_cliData->resultReportConfigurationString); | ||
if (resultReportConfigurationBits[0]) { |
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.
FYI, std::bitset
also has a test()
function is does the same thing as the subscript operator here. I like that test()
more directly indicates what's being done, but I'm mostly bringing this up for informational purposes. Feel free to close.
Type
Goals
This PR adds the remaining UCI app config params to nocli. This includes CLI options, some additional validation (not all), and additional code to print out parameters.
Technical Details
Test Results
nocli output looks correct
Reviewer Focus
Apologies for the long PR, but there are so many UCI app config parameters!
Also, in this line:
oss << "0x" << std::setw(2) << std::internal << std::setfill('0') << std::hex << +value << " ";
, I had to add"0x"
instead ofstd::showbase
because it interferes withstd::setw(2)
andstd::setfill('0')
, since the added base is considered part of the width, thus truncating the added 0.Future Work
Additional validation for the newly added parameters.
I also really don't like how CLI11 adds "UINT" or "ENUM" when displaying the options. Perhaps this can be changed.
Checklist
all
compiles cleanly.