-
Notifications
You must be signed in to change notification settings - Fork 25
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
Well-know Media Types content paremeters #161
Conversation
✅ Deploy Preview for wot-binding-templates ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
I think that the byteSeq contribution is fine but the other introductory content should actually go to Arch spec. There is already the following section there that almost has the same https://w3c.github.io/wot-architecture/#media-types |
Should I solve this issue here, or can we refactor it later, perhaps? |
It would be better to not delay it but I would be open to commenting it and putting a TODO label in the html. |
TODO: also add an example in MODBUS. |
c610eba
to
15581a1
Compare
I rebased this PR; it might still be controversial to add this information to the main document. Furthermore, I noticed that in the content-type section, we refer to types with the |
|
"href": "modbus+tcp://127.0.0.1:60000/1", | ||
"modbus:function": "readCoil", | ||
"op": "readproperty", | ||
"contentType": "application/octet-stream;byteSeq=LITTLE_ENDIAN" |
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.
According to the IANA registration of application/octet-stream
, there are two possible parameters that can be used: TYPE
and PADDING
. There is no parameter byteSeq
defined, and IMHO this document is not the right place to update the definition of this media type.
If the data returned when reading this property actually has semantics that are more specific than that of an octet stream, I think it's a sign that you need a media type that is more specific than application/octet-stream
.
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.
Yes, I agree as it was discussed during the call probably we should find other means to support that usecase.
Call of 12.04:
Question to @relu91 : Does the contentType matter for Modbus? Can you choose other media types? |
I do not see any conflict to use I played around with const contentTypeParser = require("content-type-parser");
const contentType = contentTypeParser(`application/octet-stream;byteSeq=BIG_ENDIAN;length=4`);
console.log(contentType.toString());
console.log(contentType.get("byteSeq"));
console.log(contentType.get("length")); and the parameters are passed by the content type parser. In the context of the Web of Things (as defined by the bindings), the parameters can be interpreted correctly and passed to the corresponding place (e.g. protocol driver). |
OK, my suggestion does not seem to be well received. What are alternatives such as discussed here?
Option 1 would need a REC, similar we did for the Thing Description and Thing Model media type registration. Bindings, however, defined as W3C Note. Alternative we create a new RFC which also involves a certain amount of effort. In my opinion, option 3 is the only realistic and simple option then. What other thoughts are there? |
Some points on the discussion. I believe that in the last call, there was the "misconception" that we are talking about Another not-clear point is that we were trying to describe some "modbus" specific payload. We are not. In practice, some manufacturers can even transfer So probably, what we really need is a About the options that @sebastiankb is suggesting above:
|
For CoAP we are providing similar information as vocabulary terms. In any case the consumer has to be aware of the details of the protocol it uses so all depends on what is in use for |
Just for further clarification, in implementations like node-wot, the whole form is not passed on to the encoder/decoder but only the contentType . To accommodate Modbus, we would need to change this whole mechanism and move encoder/decoder to each protocol separately (hopefully not but that was the first solution came to mind) |
I guess another part that is potentially interesting is what is transport configuration and what is payload encoding. In the case of modbus-tcp there is already a quite rich set of vocabulary terms to express what you want to map to, so I'm not sure why endianness and framing should stay in the content type instead of being two more terms. |
Because as I stated above, it is not modbus specific 😺 .
Thank you for clarifying that. I'm too used to node-wot architecture that sometimes I fuse it in the WoT abstract architecture. However, I would say that this kind of processing could be taken as a generic way of handling communication between two endpoints. You have two levels
This is exactly what is happening here. Again, the proper solution is not modbus-specific but rather a generic content-type that can describe the encoding and decoding of a single number / or array of numbers. I want to add another point from the RFC of octet-stream:
Basically, we are allowed to define our user-specified process to handle this unstructured payload information. Again since we are dealing with IoT protocol, I won't be surprised if, in the short future, we stumble upon another similar use case within other protocols. |
Let me recap today discussion with @relu91 :
If we want to support non-standard impl that send data as LE or as bytes we'd need to have both a On top of this, this protocol is probably also a good candidate for the data mapping activities since apparently some implementations in the wild do bit-stuffing so you'd also need a way to extract information for the data you care from the data that's being exchanged. |
by the way, @fexpal has pointed me to a Modbus driver in Golang that also cares about word/byte swapping. This means that we have 4 cases in total. See https://github.com/simonvetter/modbus/blob/master/encoding.go#L49 |
To add more to the discussion. I started from {
// ... other fields
"content-type": 'text/plain;charset=UTF-16LE'
"endianness"=BE // <-- what does it mean? we should not allow BE here.
} So once again, I'm not really sure if any of the two solutions is good. |
TD Call of 22.11: we will close this PR without merging. We can revisit it later when we know more on how to handle this generically, which can include media (audio-video) streaming or byte streams in general. Modbus will have a modbus-specific solution, at least for now. |
In implementing the MODBUS protocol binding for node-wot, we found the need to define a Media Type parameter for indicating the endianness of a payload encoded with application/octet-stream. Since the parameter might also be used in other protocols, this PR updates the main document with a section dedicated to a set of well-known parameters used in WoT.
Consider it as a first draft of the section as I would like to discuss our options to describe these parameters.
Preview | Diff