nrkno / sofie-emberplus-connection

Ember+ Connection: A Part of the Sofie TV Studio Automation System
https://github.com/nrkno/Sofie-TV-automation/
MIT License
20 stars 15 forks source link

ParameterType is 'NULL' #18

Open uwsrf opened 3 years ago

uwsrf commented 3 years ago

setValue() doesn't work for me. While debugging I found out, that the parameterType in my request was always NULL. Setting the parameterType explicitely in \Ember\Client\index.js on line 180 to qualifiedParam.contents.parameterType = 'REAL' fixed the problem. I always get the type "NULL" on getElementsByPath(). 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...

mint-dewit commented 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.

uwsrf commented 3 years ago

Hi @baltedewit, Setting the parameter type in the node works fine. Thanks. I sent you an email with some BER buffers...

mint-dewit commented 3 years ago

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.