-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
subsys: net: lwm2m: Add LwM2M gateway object #40051
Conversation
fbaade4
to
215719e
Compare
@ahedin25 do you want to take this out of draft and continue work on it? |
Adding the RSSI to the gateway object was rejected by the OMA. I'll remove that change and take this out of draft. |
215719e
to
1a53ada
Compare
1a53ada
to
07dbde2
Compare
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.
The object specification looks pretty neat, nothing really to complain about.
I'd appreciate however if you could shed some light on how could this LwM2M gateway be implemented. I understand that the data transfer between the gateway and end-device is out of the scope of this PR, since it's not defined by the spec and actually application-specifc, thus should by handled by the application.
It's not clear to me however how are the end-device objects represented on the gateway side. If I understand correctly, the Gateway device should create the appropriate object instances on behalf of the end-device, it seems however that this requires one additional path level (device prefix) which isn't supported by the LwM2M engine. How did you manage to make LwM2M Gateway functional w/o changes in the engine?
@@ -0,0 +1,20 @@ | |||
/** |
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.
Perhaps we could just incorporate this header content into .c file, since it's not used elsewhere? The header is not exposed to the application.
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.
We used the values in our application, so maybe I am did something wrong.
For example, during runtime we set the prefix of a discovered sensor.
if (cfg->prefix != NULL) {
snprintk(
path, sizeof(path),
STRINGIFY(LWM2M_OBJECT_GATEWAY_ID) "/%u/" STRINGIFY(
LWM2M_GATEWAY_PREFIX_RID),
cfg->instance);
lwm2m_engine_set_string(path, cfg->prefix);
}
Is there a different way this should be done?
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.
in our app
#include "lwm2m_resource_ids.h"
#include "lwm2m_obj_gateway.h"
work to include those values. Is that a mistake in the Zephyr build system?
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.
It seems to be possible due to this line:
https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/net/lib/lwm2m/CMakeLists.txt#L5
I think it's not correct though - any API intended to be public, and thus used by the application should be added to /include/
directory. This needs a little cleanup I believe, i. e. we could create a public header for resoruce IDs and move all declarations in there.
07dbde2
to
464b72f
Compare
We need to add the prefix to the engine. For our first test, we used object 25 to show what sensors were present and we created instances for the sensor data that we wanted to use (that was gathered from advertisements). In the future, we may not create any of the end node object instances on the gateway (other than object 25). We are going to tunnel the data. Thread or an IP based scheme seems like a natural choice, but we need to talk to sensors using BLE Long Range. I think that leads to a custom solution. That is why we asked about selecting between multiple LwM2M transports. |
This plays directly into #41313 |
A few more questions regarding the target solution, based on https://www.openmobilealliance.org/release/LwM2M_Gateway/V1_1-20210518-A/OMA-TS-LWM2M_Gateway-V1_1-20210518-A.pdf (apologies for my ignorance, the topic is pretty fresh for me).
Wouldn't that be contrary to the aforementioned spec? In chapter 6 it states:
My understanding is that if the Gateway device creates a Gateway object instance for the end-device, it should also create instances for the objects reported by the end-device.
Is my understanding correct that in this solution, the end-device would be a fully fledged LwM2M client? Does that mean that the gateway device would then need to act as both LwM2M client and LwM2M server (to which the end-device would register to)? |
The end-device will be a fully fledged LwM2M client. Since the 1.1 specification uses the word SHOULD, we plan to make the gateway a proxy/bridge and only create object 25 for each end-device. |
Add support for the gateway object [EXPERIMENTAL] used by the MG100, BT510, and BT610 LwM2M demo. Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
464b72f
to
a365573
Compare
Add support for the gateway object used by the MG100
BT510, and BT610 LwM2M demo.
Signed-off-by: Andrew Hedin andrew.hedin@lairdconnect.com