diff --git a/config.toml b/config.toml index 7b6e452..11da1a0 100644 --- a/config.toml +++ b/config.toml @@ -520,20 +520,6 @@ theme = "doc-theme" parent = "tutorials@lora" weight = 70 -[[menu.main]] - name = "LoRa Mesh" - url = "/tutorials/lora/lora-mesh/" - identifier = "tutorials@lora@lora-mesh" - parent = "tutorials@lora" - weight = 80 - -[[menu.main]] - name = "PyMesh Border Router" - url = "/tutorials/lora/pymesh-br/" - identifier = "tutorials@lora@pymesh-br" - parent = "tutorials@lora" - weight = 90 - [[menu.main]] name = "Sigfox Examples" url = "/tutorials/sigfox/" @@ -1229,6 +1215,48 @@ theme = "doc-theme" parent = "pybytes@integrations" weight = 10 +# *** Pymesh +[[menu.main]] + name = "Pymesh" + url = "/pymesh/" + identifier = "pymesh" + weight = 95 + +[[menu.main]] + name = "Pymesh Library API" + url = "/pymesh/library" + identifier = "pymesh@library" + parent = "pymesh" + weight = 10 + +[[menu.main]] + name = "Micropython API" + url = "/firmwareapi/pycom/network/lora/pymesh" + identifier = "pymesh@api" + parent = "pymesh" + weight = 20 + +[[menu.main]] + name = "Simple Example" + url = "/pymesh/lora-mesh" + identifier = "pymesh@lora-mesh" + parent = "pymesh" + weight = 30 + +[[menu.main]] + name = "Border Router Examplee" + url = "/pymesh/pymesh-br" + identifier = "pymesh@pymesh-br" + parent = "pymesh" + weight = 40 + +[[menu.main]] + name = "Advanced Security Example" + url = "/pymesh/security-advanced" + identifier = "pymesh@security-advanced" + parent = "pymesh" + weight = 50 + # *** Documentation Notes [[menu.main]] name = "Documentation Notes" diff --git a/content/pymesh/_index.md b/content/pymesh/_index.md new file mode 100644 index 0000000..b627cc6 --- /dev/null +++ b/content/pymesh/_index.md @@ -0,0 +1,32 @@ +--- +title: "Pymesh" +aliases: + - pymesh/introduction +--- + +Pymesh + +## What is Pymesh? + +Pymesh is the LoRa full Mesh network technology. + +Mesh networks essentially get rid of gateways, which decentralises the network’s infrastructure. This then means that the network becomes flexible, so it can do many wonderful things – such as generate, change and fix itself. The success of the Mesh network is down to its parts, as any node within the network will automatically connect to the best radio-link available. + +Pymesh solution works on all of our LoRa supporting development boards, the LoPy4 and FiPy as well as on our OEM modules, L01 and L04. + +## What Pymesh offers you? + +* Ad-hoc communication network over raw-LoRa radio +* Multi-gateway (Border Routers) Nodes that connect Mesh-internal data with the Cloud +* Each Node uses LBS - Listen Before Talk +* Security on multiple levels +** base level: authentication and encryption using AES 128bit key, so all traffic inside Pymesh is secured +** advanced level: RSA or AES at application level allows private communication channels above Pymesh. +* Any LoRa device (Lopy4/Fipy) can have any of the Pymesh Node Role: Leader, Router, Child or Border Router. + +## Let's get started! + +* [Pymesh Micropython API](/firmwareapi/pycom/network/lora/pymesh) +* [Simple Example](/pymesh/lora-mesh) +* [Border Router Example](/pymesh/pymesh-br) +* ​[Advanced Security Example](/pymesh/security-advanced)​ diff --git a/content/pymesh/library.md b/content/pymesh/library.md new file mode 100644 index 0000000..1439fe5 --- /dev/null +++ b/content/pymesh/library.md @@ -0,0 +1,45 @@ +--- +title: "Pymesh Library" +aliases: + - pymesh/library +--- + +## What is Pymesh micropython library? + +Pymesh micropython library is a set of scripts included (as frozen) in the Pymesh firmware binary release (Not yet released). + +It allows users to use Pymesh in a few lines of code, as shown in the following code snippet. + +```python +import pycom +import time + +from _pymesh_config import PymeshConfig +from _pymesh import Pymesh + +pycom.heartbeat(False) + +# read config file, or set default values +pymesh_config = PymeshConfig.read_config() + +#initialize Pymesh +pymesh = Pymesh(pymesh_config, new_message_cb) + +while not pymesh.is_connected(): + print(pymesh.status_str()) + time.sleep(3) + +# send message to the Node having MAC address 6 +pymesh.send_mess(6, "Hello World") + +def new_message_cb(rcv_ip, rcv_port, rcv_data): + ''' callback triggered when a new packet arrived ''' + print('Incoming %d bytes from %s (port %d):' % + (len(rcv_data), rcv_ip, rcv_port)) + print(rcv_data) + + # user code to be inserted, to send packet to the designated Mesh-external interface + # ... + return + +``` diff --git a/content/tutorials/lora/lora-mesh.md b/content/pymesh/lora-mesh.md similarity index 98% rename from content/tutorials/lora/lora-mesh.md rename to content/pymesh/lora-mesh.md index b2d9c85..93324eb 100644 --- a/content/tutorials/lora/lora-mesh.md +++ b/content/pymesh/lora-mesh.md @@ -1,12 +1,12 @@ --- -title: "Pymesh" +title: "Pymesh Example" aliases: - tutorials/lora/lora-mesh.html - tutorials/lora/lora-mesh.md - chapter/tutorials/lora/lora-mesh --- -{{% hint style="info" %}} +{{% hint style="info" %}} These API's are currently only available in the latest RC builds. {{% /hint %}} diff --git a/content/tutorials/lora/pymesh-br.md b/content/pymesh/pymesh-br.md similarity index 100% rename from content/tutorials/lora/pymesh-br.md rename to content/pymesh/pymesh-br.md diff --git a/static/gitbook/assets/pymesh/pymesh_roles.png b/static/gitbook/assets/pymesh/pymesh_roles.png new file mode 100644 index 0000000..bc35783 Binary files /dev/null and b/static/gitbook/assets/pymesh/pymesh_roles.png differ