meshcore 0.3.2__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcore
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Base classes for communicating with meshcore companion radios
5
5
  Project-URL: Homepage, https://github.com/fdlamotte/meshcore_py
6
6
  Project-URL: Issues, https://github.com/fdlamotte/meshcore_py/issues
@@ -18,5 +18,7 @@ Description-Content-Type: text/markdown
18
18
 
19
19
  Bindings to access your [MeshCore](https://meshcore.co.uk) companion radio nodes in python.
20
20
 
21
+ Can be installed via `pip` using `pip install meshcore`
22
+
21
23
  Used by [mccli](https://github.com/fdlamotte/mccli).
22
24
 
@@ -2,5 +2,7 @@
2
2
 
3
3
  Bindings to access your [MeshCore](https://meshcore.co.uk) companion radio nodes in python.
4
4
 
5
+ Can be installed via `pip` using `pip install meshcore`
6
+
5
7
  Used by [mccli](https://github.com/fdlamotte/mccli).
6
8
 
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/python
2
+
3
+ import asyncio
4
+ import json
5
+ from meshcore import TCPConnection
6
+ from meshcore import MeshCore
7
+
8
+ HOSTNAME = "mchome"
9
+ PORT = 5000
10
+
11
+ async def main () :
12
+ con = TCPConnection(HOSTNAME, PORT)
13
+ await con.connect()
14
+ mc = MeshCore(con)
15
+ await mc.connect()
16
+
17
+ print(json.dumps(await mc.get_contacts(),indent=4))
18
+ asyncio.run(main())
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/python
2
+
3
+ from meshcore import TCPConnection
4
+ from meshcore import MeshCore
5
+ import asyncio
6
+
7
+ HOSTNAME = "mchome"
8
+ PORT = 5000
9
+
10
+ async def main () :
11
+ con = TCPConnection(HOSTNAME, PORT)
12
+ await con.connect()
13
+ mc = MeshCore(con)
14
+ await mc.connect()
15
+
16
+ print(mc.self_info)
17
+
18
+ asyncio.run(main())
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/python
2
+
3
+ import asyncio
4
+ import json
5
+ from meshcore import TCPConnection
6
+ from meshcore import MeshCore
7
+
8
+ HOSTNAME = "mchome"
9
+ PORT = 5000
10
+ DEST = "t1000"
11
+ MSG = "Hello World"
12
+
13
+ async def main () :
14
+ con = TCPConnection(HOSTNAME, PORT)
15
+ await con.connect()
16
+ mc = MeshCore(con)
17
+ await mc.connect()
18
+
19
+ await mc.ensure_contacts()
20
+ await mc.send_msg(bytes.fromhex(mc.contacts[DEST]["public_key"])[0:6],MSG)
21
+
22
+ asyncio.run(main())
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/python
2
+
3
+ import asyncio
4
+ import json
5
+ from meshcore import TCPConnection
6
+ from meshcore import MeshCore
7
+
8
+ HOSTNAME = "mchome"
9
+ PORT = 5000
10
+ DEST = "t1000"
11
+ MSG = "Hello World"
12
+
13
+ async def main () :
14
+ con = TCPConnection(HOSTNAME, PORT)
15
+ await con.connect()
16
+ mc = MeshCore(con)
17
+ await mc.connect()
18
+
19
+ res = True
20
+ while res:
21
+ res = await mc.get_msg()
22
+ if res :
23
+ print (res)
24
+
25
+ asyncio.run(main())
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/python
2
+ DISPLAYNAME="Center at MC node location"
3
+
4
+ from meshcore import BLEConnection
5
+ from meshcore import MeshCore
6
+ import asyncio
7
+
8
+ ADDRESS = "t1000"
9
+
10
+ async def main () :
11
+ con = BLEConnection(ADDRESS)
12
+ await con.connect()
13
+ mc = MeshCore(con)
14
+ await mc.connect()
15
+
16
+ infos = mc.self_info
17
+
18
+ lat=infos["adv_lat"]
19
+ lon=infos["adv_lon"]
20
+
21
+ print('[{"cmd":"prefset_n","args":{"pref":"lat","value":' + str(lat) + '}},')
22
+ print('{"cmd":"prefset_n","args":{"pref":"lon","value":' + str(lon) + '}}]')
23
+
24
+ asyncio.run(main())
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/python
2
+
3
+ from meshcore import TCPConnection
4
+ from meshcore import MeshCore
5
+ import asyncio
6
+
7
+ HOSTNAME = "mchome"
8
+ PORT = 5000
9
+
10
+ async def main () :
11
+ con = TCPConnection(HOSTNAME, PORT)
12
+ await con.connect()
13
+ mc = MeshCore(con)
14
+ await mc.connect()
15
+
16
+ print(mc.self_info)
17
+
18
+ asyncio.run(main())
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "meshcore"
7
- version = "0.3.2"
7
+ version = "0.3.3"
8
8
  authors = [
9
9
  { name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
10
10
  ]
@@ -364,7 +364,7 @@ class MeshCore:
364
364
  case 11: # contact
365
365
  self.result.set_result("meshcore://" + data[1:].hex())
366
366
  case 12: # battery voltage
367
- self.result.set_result(int.from_bytes(data[1:2], byteorder='little'))
367
+ self.result.set_result(int.from_bytes(data[1:3], byteorder='little'))
368
368
  case 13: # device info
369
369
  res = {}
370
370
  res["fw ver"] = data[1]
File without changes