-
Notifications
You must be signed in to change notification settings - Fork 409
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
SENML_JSON encoder modifications proposal #1554
Comments
|
It probably depends on the use case. However I checked examples in rfc8428 and I see that we have e.g. in this section: [
{"bn":"urn:dev:ow:10e2073a0108006:","bt":1.276020076001e+09,
"bu":"A","bver":5,
"n":"voltage","u":"V","v":120.1},
{"n":"current","t":-5,"v":1.2},
{"n":"current","t":-4,"v":1.3},
{"n":"current","t":-3,"v":1.4},
{"n":"current","t":-2,"v":1.5},
{"n":"current","t":-1,"v":1.6},
{"n":"current","v":1.7}
] or here: [
{"bn":"urn:dev:ow:10e2073a01080063","bt":1.320067464e+09,
"bu": "%RH", "v":20},
{"u":"lon","v":24.30621},
{"u":"lat","v":60.07965},
{"t": 60, "v": 20,3},
{"u":"lon","t":60,"v":24.30622},
{"u": "lat", "t": 60, "v": 60.07965},
{"t": 120, "v": 20,7},
{"u":"lon","t":120,"v":24.30623},
{"u": "lat", "t": 120, "v": 60.07966},
{"u":"%EL","t":150,"v":98},
{"t": 180, "v": 21,2},
{"u":"lon","t":180,"v":24.30628},
{"u": "lat", "t": 180, "v": 60.07967}
] in OMA LwM2M specification we also can find similar record: [{"bn":"/72/","bt":25462634,"n":"1/2","v":22.4,"t":-5},
{"n":"1/2","v":22.9,"t":-30},
{"n":"1/2","v":24.1,"t":-50}] I noticed that similar rules apply to Device vendors are also using the following formats: [
{
"bn": "/",
"bt": 12,
"n": "3303/0/5700",
"v": 23.9034576
},
{
"n": "3304/0/5701",
"vs": "%hum"
}
] Please find above SenML record produced by IoTerop SDK ☝️ |
I must confess that I didn't get your point. I will try to summarize my understanding. SenML is not a one to one encoding format. There is several way to encode a given data in valid SenML format. All those valid SenML example express exactly the same thing {"bn":"/base/", "n":"name1", "v":101},
{ "n":"name2", "v":102},
{ "n":"name3", "v":103}, { "n":"/base/name1", "v":101},
{ "n":"/base/name2", "v":102},
{ "n":"/base/name3", "v":103}, {"bn":"/base/name1", "v":101},
{"bn":"/base/name2", "v":102},
{"bn":"/base/name3", "v":103}, Leshan Decoder As SenML is not a one to one encoding format, Leshan Decoder should be able to decode any possible way to express data in SenML. Currently, I think Leshan Default SenML decoder to that. Leshan Encoder Currently, I think Leshan Default SenML encoder to that. Questions Just to be sure I understand you :
|
Yes I think current encoding is valid.
I was thinking about using in this test the same data structure as produces Ioterop SDK, but finally we can leave it as is. |
Oh ok, this was just about writing test, I get it now 🤔. I don't think this is a good reason to change default leshan encoder behavior. But it could make sense to add Decoder tests with different kind of encoding than the one used by Leshan Encoder.
|
Co-authored-by: Simon Bernard <code@simonbernard.eu>
with #1577 integrated, I guess we can close this issue. (If I was wrong do not hesitate to reopen) |
Question
Currently leshan SENML_JSON encoder can encode following records:
can we change this format to following one: ?
Is it possible to modify the encoder to support mixed data with timestamp and without it in one SENML record e.g.:
The text was updated successfully, but these errors were encountered: