Giter VIP home page Giter VIP logo

openthread-mqttsn's Introduction

OpenThread MQTT-SN Examples

This repository contains C/C++ examples of using MQTT-SN client on Thread network. Feature is implemented in fork of OpenThread SDK released by Google.

Before using MQTT-SN client in Thread network you must install OpenThread Border Router and MQTT-SN Gateway. For more information about building and running CLI application with MQTT-SN client see kyberpunk/openthread.

Border Router and MQTT-SN gateway setup

It is recommended to use all examples including SEARCHGW and ADVERTISE messages with IPv6 MQTT-SN gateway. Gateway is attached directly to Border Router wpan0 interface and can receive and send broadcast messages directly to Thread network. Border Router and MQTT-SN gateway may be run as Docker images. See full guide for more information about required services.

Run OpenThread border router container. No custom network is needed in this case:

sudo docker run -d --name otbr --sysctl "net.ipv6.conf.all.disable_ipv6=0 \
        net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" -p 80:8080 \
        --dns=127.0.0.1 -v --radio-url spinel+hdlc+uart:///dev/ttyACM0 --privileged \
        openthread/otbr --ncp-path /dev/ttyACM0

If needed replace /dev/ttyACM0 in -v and --ncp-path parameter with name under which appear NCP device in your system (/dev/ttyS0, /dev/ttyUSB0 etc.).

Then run IPv6 MQTT-SN gateway:

sudo docker run -d --name paho --net "service:otbr" kyberpunk/paho6 \
        --broker-name <mqtt-broker> --broker-port 1883

Replace <mqtt-broker> with MQTT broker IPv4 address or hostname. Gateway container uses the same network stack as Border Router container and is able to listen to wpan0 interface.

C API Examples

C++ Examples

openthread-mqttsn's People

Contributors

kyberpunk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

openthread-mqttsn's Issues

Can not subscribe and publish

I have finished mqtt connection between my mqtt-sn client device and mqtt-sn gateway, everything is ok but when I tried to make my cli device publish "sensors" message, it failed.
Logs are below.
60aab0b90700eaef068c18b5cae534f

Setting up MQTT_SN gateway failed

Hi there,

I am trying to setup Thread network with MQTT-SN over it and I came across your docker for paho. I've been trying to follow instructions provided here https://github.com/kyberpunk/openthread/blob/master/README.md#Trying-MQTT-SN-client-with-CLI-application-example, however I fail at the step when I want to run MQTT_SN Gateway docker. I correctly run OTBR through docker and started mosquitto docker as 172.18.0.8. When I run the command:
sudo docker run --name paho --net test --ip 172.18.0.8 kyberpunk/paho --broker-name 172.18.0.7 --broker-port 1883
I receive the error:
exec /app/paho/MQTTSNGateway/docker_entrypoint.sh: exec format error

If i decide to choose binding to container:otbr I am not able to specify neither broker port nor ip address.

I have been trying to use gateway from official paho repository, but I am struggling to understand: To connect to a gateway through a client I need its ip address, but I can see only multicast adresses to configure in .conf file.

I'd appreciate help from you. I would not bother but it's crucial for my studies.

Add automatic connection feature

Maintain gateways list automatically with ADVERTISE and GWINFO messages and optionally perform connection without explicit gw address.

Can't get gateway advertising working

I've been having all sorts of problems trying to get the gateway advertising example working. I suspect I am doing somethng wrong here but I can't for the life of me work out what it is.

I can build and run the example - I've added a WIP version into my build here

https://github.com/DynamicDevices/openthread/blob/ajl/adding-examples/examples/apps/mqtt-snsearchgw/main.c

Now when I run this up I can see the SEARCHGW coming into the UDP6 MQTT-SNGATEWAY via the OTBR. I see the application sending the response but I never get that back into the application.

I've looked into PAHO and found some weird things. There's a bug which prevents it setting the remote multicast port correctly which I have fixed here (although I've not really fixed it properly - it should use the string ctor)

DynamicDevices/paho.mqtt-sn.embedded-c@db235f7

I thought multicast still used ports so I am not sure how this would have ever worked?

I should say I can ping the multicast IPv6 address and I get a response from the CLI

With debugging on the CLI the packets I get are a bit odd as they involve "hops". Not sure if these are the data UDP packets or something else

Any help or signposting would be much appreciated !!!

Remove MCUXpresso project

Remove MCUXpresso project from openthread-mqttsn and make code able to be built by make or automake.

Make library independent on platform

For test purposes is MQTT-SN library included in KW41Z MCUXpresso project, it should be independent on specific platform and work only with openthread SDK.

How to build examples?

First of all, thank you for all of the great work you've done. Of all the Nordic sdk examples, other tutorials, your MQTTSN over docker is the only example that I've been able to get to working consistently.

I was hoping to explore your SED mqttsn cpp example, but I'm not exactly sure what the build and flash process is. For context, I'm using the NRF52840 dongles (PCA10059).

I tried a few shots in the dark: make/cmake from the openthread/src directory, gcc the .cpp, but the build references seem off. Not sure what the build context is supposed to be.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.