Skip to content
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

Encapsulation #15

Open
trivialkettle opened this issue Feb 15, 2024 · 5 comments
Open

Encapsulation #15

trivialkettle opened this issue Feb 15, 2024 · 5 comments

Comments

@trivialkettle
Copy link

Hi,
Do I see it correct, that encapsulation is not supported?

In the spec:
https://www.oasis-open.org/committees/download.php/66091/MQTT-SN_spec_v1.2.pdf

5.5 Forwarder Encapsulation

I have an forwarder and a connect from the client is responded with a "normal" CONNAK package

03 05 00

@arobenko
Copy link
Member

Yes, you are correct. The forwarding encapsulation functionality is not implemented. For two reasons:

  • I personally didn't need this functionality at the time of implementation and I haven't seen any practical application to it.
  • I find the spec about the functionality confusing (length of the "Wireless Node ID" is not properly defined, and the reason why forwarder encapsulates message sent to a gateway is not clear).

Please properly describe your use case so I can advice on the solution. Do you use a gateway implementation from this project? If this is the case you'll probably have to implement the "facade" by yourself identifying the encapsulated packet and stripping the encapsulation framing before forwarding the data to the gateway, and for response packets wrap them in the appropriate encapsulation frame and send the data to the forwarder.

Note that this project provides a gateway functionality as the library exposing all the exchanged data to the driving application. It allows you to add any extra framing (such as forwarding encapsulation) and/or encryption if needed.

Maybe in the future I will add extra "forwarder" that will help handle appropriate use cases once I properly understand it.

@trivialkettle
Copy link
Author

My usecase is:
I have some PCB with a BLE chip that I want to connect to MQTT, I use your MQTT-SN client and the gateway.
The BLE chip connects to a BLE dongle on the host system, that is by itself a MQTTSN client but also forwards the traffic by the BLE chip to the MQTT broker.

Currently I use https://github.com/eclipse/paho.mqtt-sn.embedded-c on commit ca4675 as MQTTSN gateway for the forwarder only. The reason I use this specific commit is, that newer commits are sometimes broken, though this commit is also broken and the connected clients are sometimes disconnected (it seems like it just forgets that the clients exist) or the gateway segfaults. So I tried to move to your gateway, so far everything works better than the paho gateway except for the forwarder.

@arobenko
Copy link
Member

arobenko commented Feb 16, 2024 via email

@arobenko
Copy link
Member

arobenko commented Feb 16, 2024 via email

@trivialkettle
Copy link
Author

Hi,
thanks for you explanation.

The BT dongle is not just a BT dongle, but another PCB with a BLE chip and is by itself an MQTT client and also forwards the traffic from the BLE chip.
In fact the whole "pipeline" is like this: BLE PCB -> BLE-Dongle -> USB-to-UDP -> MQTTSN-Gateway.

For now I found a commit of the paho gateway that works with forwarding and seems to be stable.

Is it ok for you, if I integrate the forwarder into your example gateway and make a pull request? Maybe I find some time in the next weeks. Since I hope I can avoid the 'client:client:port:forwarder` configuration that paho mqttsn gateway needs for forwarders. So that I can use the gateway inside a docker container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants