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

paho-mqtt: add package and example #12647

Merged
merged 2 commits into from
Jul 6, 2020
Merged

Conversation

javierfileiv
Copy link
Contributor

@javierfileiv javierfileiv commented Nov 5, 2019

Contribution description

This PR adds PAHO-MQTT package and example running on native

Testing procedure

Application in examples/mqtt-paho builds for native board. Follow README in folder.

@PeterKietzmann PeterKietzmann added Area: network Area: Networking Area: pkg Area: External package ports State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Nov 6, 2019
@pokgak
Copy link
Contributor

pokgak commented Nov 27, 2019

Hi, is there a reason why you created the header file in RIOT? I have no experience using the library but based on a quick look on existing ports here I think this should be done there instead under directory named RIOT/ and the name for some functions should be changed to riot_read(), riot_write() instead of mqtt_read() and mqtt_write().

Generally, if you need to write glue code for the library, the *.c files can go to a pkg/<pkg name>/contrib/ directory and the header files can go to pkg/<pkg name>/includes/ directory. See this for example.

@javierfileiv
Copy link
Contributor Author

Hi, is there a reason why you created the header file in RIOT? I have no experience using the library but based on a quick look on existing ports here I think this should be done there instead under directory named RIOT/ and the name for some functions should be changed to riot_read(), riot_write() instead of mqtt_read() and mqtt_write().

Generally, if you need to write glue code for the library, the *.c files can go to a pkg/<pkg name>/contrib/ directory and the header files can go to pkg/<pkg name>/includes/ directory. See this for example.

Yes, there is some modifications in the pipe... Helped by @vincent-d I have modified this glue-code. Thanks!

@javierfileiv javierfileiv changed the title mqtt-paho: building for native board, for the moment no example provided WIP mqtt-paho: building for native board, for the moment no example provided Nov 27, 2019
@javierfileiv
Copy link
Contributor Author

javierfileiv commented Dec 31, 2019

Hello, well I worked this PR a little bit but I'm having issues with the example on native build. Even using the tap interface I can't reach a local mosquitto broker server. If someone can help me, would be awesome. I already tested the framework on a private board and it's working fine but wanted to build an example for native. I tried to contact @miri64 but I think she might be on holidays, what it is normal due to this time of the year :). Have great holidays to all of you.

@pokgak
Copy link
Contributor

pokgak commented Dec 31, 2019

I had a similar problem when testing #10222 on native. Try one of these:

  1. Listen on all interfaces ([::]) on the MQTT broker. OR
  2. Set a 2001:* address on tapbr0 and in the RIOT node:
# On Linux
$ sudo ip a a 2001:db8::1/64 dev tapbr0

# On RIOT, get <if_id> by running `ifconfig`
> ifconfig <if_id> add 2001:db8::2/64

# Try ping from RIOT to the server/broker
> ping6 2001:db8::1

@javierfileiv javierfileiv force-pushed the mqtt-paho branch 2 times, most recently from 86d402f to 2eb19e7 Compare December 31, 2019 14:40
@javierfileiv
Copy link
Contributor Author

I think that I'm not understanding the tap interface and tap bridge concept... Isn't the tap0 the one that RIOT uses when passing tap0 as parameter? Why are you modifying the ip address of tapbr0?

@javierfileiv
Copy link
Contributor Author

@pokgak regarding ifconfig add, I don't know how to use as I don' t use gnrc becayse I need TCP packets. I'm using LWIP

@javierfileiv javierfileiv force-pushed the mqtt-paho branch 2 times, most recently from 7fc24f2 to 85dcfba Compare December 31, 2019 15:00
@pokgak
Copy link
Contributor

pokgak commented Dec 31, 2019

I might be wrong, but the way I understand it tapbr0 is a bridge to connect the real network (localhost, eth0, wlan, etc) to the virtual network (tap0, tap1), so we just need to connect this two network together. Link-local IPv6 cannot be routed between two networks, that's why we need a 2001:* (global?) address for tapbr0 so that it is routable.

About LWIP TCP, I have never used it myself but If there is ifconfig command on the RIOT shell, you can type ifconfig -h to get instructions how to use it.

@javierfileiv
Copy link
Contributor Author

@pokgak when you tested #10222 did you use this type of configuration? Is there any test on RIOT where I can see how it works?

@pokgak
Copy link
Contributor

pokgak commented Jan 8, 2020

I usually set the server on linux to listen to any (::) address.

Is there any test on RIOT where I can see how it works?

I'm not sure about tests but there is the emcute MQTT-SN implementation and example application by @haukepetersen.

@javierfileiv
Copy link
Contributor Author

Thanks @pokgak , right now I have not much time to test it but I will do it as soon as I have a gap on my schedule. Have a nice day

@javierfileiv javierfileiv force-pushed the mqtt-paho branch 2 times, most recently from 0c5470f to 5c9f433 Compare January 16, 2020 17:54
Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be awesome if this package could be merged one day. I just had a brief look and I think the way the package is built still needs work. I haven't look that much in detail at the networking glue code but it seems quite good at first sight.

Makefile.dep Outdated Show resolved Hide resolved
pkg/mqtt-paho/Makefile.riot Outdated Show resolved Hide resolved
pkg/mqtt-paho/Makefile.riot Outdated Show resolved Hide resolved
pkg/mqtt-paho/contrib/Makefile Outdated Show resolved Hide resolved
pkg/mqtt-paho/Makefile.include Outdated Show resolved Hide resolved
pkg/mqtt-paho/patches/0001-mods-to-RIOT-building.patch Outdated Show resolved Hide resolved
pkg/mqtt-paho/patches/0001-mods-to-RIOT-building.patch Outdated Show resolved Hide resolved
pkg/mqtt-paho/Makefile Outdated Show resolved Hide resolved
pkg/mqtt-paho/Makefile.riot Outdated Show resolved Hide resolved
pkg/mqtt-paho/Makefile Outdated Show resolved Hide resolved
@javierfileiv javierfileiv force-pushed the mqtt-paho branch 3 times, most recently from 20d6cd2 to 525b4f9 Compare January 19, 2020 17:29
@javierfileiv javierfileiv changed the title WIP mqtt-paho: building for native board, for the moment no example provided mqtt-paho: building for native board, for the moment no example provided Jan 19, 2020
@javierfileiv javierfileiv changed the title mqtt-paho: building for native board, for the moment no example provided mqtt-paho: building for native board using Lwip package, for the moment example not working Jan 19, 2020
@gschorcht
Copy link
Contributor

gschorcht commented Jul 3, 2020

Should I squash??

For my part yes. @gschorcht @aabadie what do you say?

One of my change requests is still not addressed. But it can be squashed directly.

Copy link
Contributor

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is the - in the identifier. Changing it from pkg_paho-mqtt to pkg_paho_mqtt in both files works as expected. For consistency, I would prefer to have a doc.txt file as for all other packages which documents the package and groups the related files.

pkg/paho-mqtt/include/mqtt.h Outdated Show resolved Hide resolved
@javierfileiv
Copy link
Contributor Author

javierfileiv commented Jul 3, 2020

Should I squash??

For my part yes. @gschorcht @aabadie what do you say?

One of my change requests is still not addressed. But it can be squashed directly.

It was addressed, I just forgot to resolve the conversation :$

@javierfileiv
Copy link
Contributor Author

Ok, I think we are good now, right? :D I squash??

@gschorcht
Copy link
Contributor

Should I squash??

For my part yes. @gschorcht @aabadie what do you say?

One of my change requests is still not addressed. But it can be squashed directly.

It was addressed, I just forgot to resolve the conversation :$

No, it is not addressed. It ist still

ifneq (,$(filter arch_esp32,$(FEATURES_USED)))
but it has to be

    ifneq (,$(filter arch_esp,$(FEATURES_USED)))

Copy link
Contributor

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still not addressed.

examples/paho-mqtt/Makefile Outdated Show resolved Hide resolved
miri64
miri64 previously requested changes Jul 4, 2020
Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg/paho-mqtt/include/paho_mqtt.h Outdated Show resolved Hide resolved
pkg/paho-mqtt/include/paho_mqtt.h Outdated Show resolved Hide resolved
@miri64 miri64 dismissed their stale review July 4, 2020 10:23

Comments were addressed.

Copy link
Contributor

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested it again with ESP8266 and ESP32. Works as expected. I have a last change request but it can squashed directly. Please squash after this last change.

@javierfileiv
Copy link
Contributor Author

Squash done. What's the last change about?

@miri64
Copy link
Member

miri64 commented Jul 5, 2020

@aabadie are you fine with the state of this PR?

Copy link
Contributor

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squash done. What's the last change about?

Hm strange, the requested changes were not submitted last time. Anyway, here they are again. You can squash this small change directly.

examples/paho-mqtt/Makefile Show resolved Hide resolved
@javierfileiv
Copy link
Contributor Author

javierfileiv commented Jul 5, 2020

STACK SIZE updated !

Copy link
Contributor Author

@javierfileiv javierfileiv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine for me

@miri64 miri64 added this to the Release 2020.07 milestone Jul 5, 2020
@javierfileiv
Copy link
Contributor Author

javierfileiv commented Jul 5, 2020

Close to the merge I would like to say thank you very much for all the support, @aabadie @miri64 @gschorcht . Hopefully, if merged, this will be my first open source contribution. :)

Copy link
Contributor

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now.

@miri64
Copy link
Member

miri64 commented Jul 6, 2020

Close to the merge I would like to say thank you very much for all the support, @aabadie @miri64 @gschorcht . Hopefully, if merged, this will be my first open source contribution. :)

Thank you, for your patience :)

@aabadie
Copy link
Contributor

aabadie commented Jul 6, 2020

Hopefully, if merged, this will be my first open source contribution. :)

I hope you enjoyed it and learned new things :)

@aabadie aabadie merged commit d918c8e into RIOT-OS:master Jul 6, 2020
@javierfileiv
Copy link
Contributor Author

Hopefully, if merged, this will be my first open source contribution. :)

I hope you enjoyed it and learned new things :)

No doubts! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants