Open uwsrf opened 3 years ago
Hi @uwsrf,
The type in the encoder is taken from the node that you pass as the first argument to the setValue
function. You can change the parameter type in that node to whatever you want before you pass it to the setValue call so it's not necessary to do it in the library.
If the ember decoder returns a Parameter with type Null that means either the parameter was unreadable for some reason or the provider you are connecting to does not implement the specification properly. As far as I can tell from the specification our implementation is currently correct.
If you have an example BER buffer that we could debug this against I'd be happy to help you figure out which one it is but without more information there is little I can do.
Hi @baltedewit, Setting the parameter type in the node works fine. Thanks. I sent you an email with some BER buffers...
From the BER buffers it was clear that some devices do not send a parameter type at all. And it turns out that when the ParameterType is empty there are other rules that hint the type of the parameter, the ember+ spec says the following:
To determine the effective type of a parameter, follow this rule: - If the parameter has the "type" field that equals "trigger", its type is "trigger". - If the parameter has either the "enumeration" or the "enumMap" field, its type is "enum". - If the parameter has the "value" field, its type corresponds to the BER type of the value. - If the parameter has the "type" field, its type is the value of this field
This piece of documentation for some reason never made it out of the ASN notation changelog, which is not a place one would typically look when implementing from scratch. oh well...
I will try to add this logic to the library soon.
setValue()
doesn't work for me. While debugging I found out, that the parameterType in my request was alwaysNULL
. Setting the parameterType explicitely in \Ember\Client\index.js on line 180 toqualifiedParam.contents.parameterType = 'REAL'
fixed the problem. I always get the type "NULL" ongetElementsByPath()
. The problem seems to be, that in BER-Decoder the parameterType is not set correctly. Since I have no idea of BER, I couldn't investigate further...