fix(axparameter): clarify parameter name format for axparameter API#441
Conversation
a6deba9 to
8a9d237
Compare
8a9d237 to
d487b8b
Compare
|
I see how this can look a bit inconsistent, however how the ax_parameter_register_callback() functions work is that it will convert the parameter name to the full path name. I.e it does not matter if the input is "IsCustomized" or "root." APP_NAME ".IsCustomized", the former input will be converted to the latter one. When the callback parameter_changed is called the input name will always be the full name i.e So to keep it consistent I would prefer to also change the call to ax_parameter_register_callback() to use the full name. |
so the callback registrator and other API can differ "relative" parameter name like I think it is also required to add a comment next to |
|
Yes I agree we will update the documentation to make it clear that both formats can use but it will always be converted to the full path name, and it is the full path name that you get it the callback function. |
d487b8b to
fedb734
Compare
|
@FelixNilsson consider reviewing the updated PR with all the replaced parameter names to fully qualified. Also I have added a comment describing which alternative formats can be used as well. |
| // - "IsCustomized" | ||
| // - "root.axparameter.IsCustomized" | ||
| // | ||
| // There is alternative formar used only for system parameters: |
There was a problem hiding this comment.
Remove R197-198, it is only possible to register callbacks to the ACAPs own parameters.
fedb734 to
b548036
Compare
|
|
||
| if (!ax_parameter_get(handle, "BackupValue", &value, &error) || | ||
| !ax_parameter_add(handle, "CustomValue", value, NULL, &error)) | ||
| !ax_parameter_add(handle, "root." APP_NAME ".CustomValue", value, NULL, &error)) |
There was a problem hiding this comment.
Sorry I missed this but it is not possible to use the full path in the function ax_parameter_add().
I can update the library so that this will work, but it will take sometime until that change is released.
There was a problem hiding this comment.
I believe that if we have same multi format input we will improve consistency. So I think the library should be updated.
I would offer to add here a note also. Once it will be updated on the implementation side, we will remove it and update usage.
BTW, as I dont have any hardware to run it on. Is that possible to request someone to verify how it works?
There was a problem hiding this comment.
Yes we are veryfing the changes before we take them in that is how we noticed this issue.
I will update the library part so hopefully we can get that in to AXIS OS 12.9.
So if you update this now to use the short form we can bring in these changes and then I can update the documentation when the library changes has been delivered.
There was a problem hiding this comment.
ok, I will soon update it to use short name. I will also leave the explanation comment with additional line that says it works for all the API except of ax_parameter_add function
by the way, we need somehow to track who is adding new parameter so for example app "axparameter" cant create parameter with name "root.custom_app.MyParam" because it does not belong to "axparameter", But' that's on your side anyway
|
Why is this a desirable change? I understand that it is reasonable to handle the parameters as fully qualified parameters internally, inside libaxparam, but here? The ability to use the short names must be preserved, since removing that would be a breaking change and has to be announced in advance. Given that the short name option exists, why would anyone want to use the fully qualified when only dealing with your own parameters? It just leads to more typing and longer code to read. This reasoning also applies to this example, that should focus on API usage and not string concatenation. It could be an idea to replace one usage of a parameter here with a fully qualified one, just to show that it's possible, but as long as it is valid to use the short form, I'd argue that it's also the best choice for your own code. |
I agree. The original idea was to show that both formats of parameter names are possible so they always converted to full path if needed. Just because I have never used this API before, that wasn't clear that callback registered in |
26617d5 to
9c8b5e1
Compare
|
@FelixNilsson @killenheladagen Merry Christmas. consider to review pls |
- Add explanatory comment showing both short and fully qualified parameter names are valid - Use both fully qualified and short parameter names for clear demonstration
9c8b5e1 to
538376e
Compare
|
Thank you for your contribution! Our workflow involves cherry-picking external contributions into an internal staging repository for more extensive testing before syncing back to this public repo. Your changes have passed that process and are now merged as part of the sync in #465. Closing this PR since the changes are covered by the sync PR above. We welcome any future contributions! |
Describe your changes
Issue ticket number and link
Checklist before requesting a review