Closed mooazn closed 2 years ago
The vendor hook should return an error if it fails to get or set the parameter. If a parameter does not exist, you should not register it into the data model (ie. you should not call USP_REGISTER_XXX). If you do register it into the data model, then you would have no alternative other than to return USP_ERR_INTERNAL_ERROR - however this is not the right way to do things. And it may cause problems with controllers.
For your second question, how the AGENT should react depends on a lot of things. Please see https://usp.technology/specification/index.htm#sec:messages How the CONTROLLER reacts to errors is dependant on the controller and what the controller is trying to do with the agent. There aren't any rules for how a controller should react to the type of errors you're asking about. It may be able to ignore the error, or it might prevent the controller doing something.
Hello again,
We have been using Get/Set functions in our vendor code for object parameters and use an API to retrieve specific values on our device. One thing which we are now looking into is what steps we should take to make sure that we handle any errors successfully. For example, let's say there's a parameter called "Device.DeviceInfo.ABC". The API we utilize will attempt to fetch this parameter. As of now, we return "USP_ERR_OK" in cases where the API fails to retrieve the parameter or the API retrieves it successfully. The reason for this is that the vendor code will return "USP_ERR_OK" by default and ignore any errors from the API. We want to change this current workaround to a permanent solution for when Get/Set fails.
So, our first question is: how should the USP Agent actually behave when a parameter does not exist? We looked a little bit at the core code and saw that GetVendorParam/SetVendorParam both call the callback functions that are registered for the parameters and then return the error from the callback function itself. Should the vendor code also return "USP_INTERNAL_ERROR" in the case that a parameter does not exist? If that is the case, we can let the core code handle the error. If not, we will need to suppress the error in the vendor code and perform some steps.
Our second question is: how should the USP Controller behave in the case that the USP Agent sends an error from one of the parameters but other parameters are retrieved fine? For example, if we had "Device.DeviceInfo.ABC", "Device.DeviceInfo.BCD", "Device.DeviceInfo.CDE" and ABC returned an error while BCD and CDE did not after a Get/Set is performed, how should the Controller react?
Thank you!