mirror of
https://github.com/sascha-hemi/pycom-documentation.git
synced 2026-03-21 07:06:20 +01:00
[Pymesh] Corrected Lora.Mesh class, add link mobile
This commit is contained in:
@@ -20,7 +20,7 @@ lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868,
|
||||
frequency = 863000000, bandwidth=LoRa.BW_125KHZ, sf=7)
|
||||
|
||||
print("Enable Pymesh")
|
||||
pymesh = lora.Pymesh()
|
||||
pymesh = lora.Mesh()
|
||||
|
||||
# check node state inside Pymesh
|
||||
# PYMESH_ROLE_DISABLED = 0, ///< The Pymesh stack is disabled.
|
||||
@@ -39,9 +39,9 @@ For various other Pymesh examples, check the [Pymesh Chapter](/pymesh).
|
||||
|
||||
## Constructor
|
||||
|
||||
#### class network.LoRa.Pymesh(\*, key=masterkey)
|
||||
#### class network.LoRa.Mesh(\*, key=masterkey)
|
||||
|
||||
This constructor `network.LoRa.Pymesh()` creates and configures the Pymesh object.
|
||||
This constructor `network.LoRa.Mesh()` creates and configures the Pymesh object.
|
||||
|
||||
By default, the key is `0134C0DE1AB51234C0DE1AB5CA1A110F`.
|
||||
|
||||
@@ -53,7 +53,7 @@ from network import LoRa
|
||||
|
||||
lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868)
|
||||
masterkey = ubinascii.unhexlify("112233")
|
||||
pymesh = lora.Pymesh(key=masterkey)
|
||||
pymesh = lora.Mesh(key=masterkey)
|
||||
|
||||
# as test, the masterkey can be printed
|
||||
>>> print("masterkey:", pymesh.cli("masterkey"))
|
||||
@@ -65,7 +65,7 @@ masterkey: 11223300000000000000000000000000
|
||||
#### pymesh.deinit()
|
||||
|
||||
This destroys the Pymesh task. Any further Pymesh commands will return no answer.
|
||||
To recreate the Pymesh, use the `LoRa.Pymesh()` constructor.
|
||||
To recreate the Pymesh, use the `LoRa.Mesh()` constructor.
|
||||
|
||||
```python
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@ aliases:
|
||||
- pymesh/simple-example
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Pymesh mobile application is available [here for both iOS and Android platforms](https://github.com/pycom/pycom-libraries/tree/master/pymesh/mobile_app). Using it, users can connect over BLE with a Pymesh node and find out network information.
|
||||
|
||||
## RPC protocol
|
||||
|
||||
It is implemented in [ble_rpc.py](https://github.com/pycom/pycom-libraries/blob/master/lib/pymesh/lib/ble_rpc.py).
|
||||
@@ -44,7 +48,8 @@ This returns the list of pairs that form a mesh connection, as shown bellow:
|
||||
|
||||
#### get_node_info(mac_id = ' ')
|
||||
|
||||
This returns the node data for a specified mac address, or own data if `mac_id` is not specified. Node data is dictionary with the following structure:
|
||||
This returns the node data for a specified MAC address, or returns own data if the `mac_id` is not specified. The node data is given as a dictionary with the following structure:
|
||||
|
||||
```
|
||||
{
|
||||
'ip': 4c00, # last 2bytes from the ip v6 RLOC16 address
|
||||
|
||||
@@ -6,12 +6,14 @@ aliases:
|
||||
|
||||
## What is Pymesh micropython library?
|
||||
|
||||
The Pymesh Micropython library is a set of frozen scripts in the Pymesh firmware binary release (which has not yet been released).
|
||||
The Pymesh Micropython library is a set of frozen scripts in the Pymesh firmware binary release.
|
||||
|
||||
[Open-source on github](https://github.com/pycom/pycom-libraries/tree/master/lib/pymesh)
|
||||
[Open-source on github](https://github.com/pycom/pycom-libraries/tree/master/pymesh/pymesh_frozen)
|
||||
|
||||
It allows users to access Pymesh in a few lines of code, as shown in the following code snippet.
|
||||
|
||||
Additionally, users could install the Pymesh mobile application, which is available [here for both iOS and Android platforms](https://github.com/pycom/pycom-libraries/tree/master/pymesh/mobile_app). Using it, users can connect over BLE with a Pymesh node and find out network information.
|
||||
|
||||
```python
|
||||
|
||||
import pycom
|
||||
|
||||
Reference in New Issue
Block a user