mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
export contact
This commit is contained in:
parent
b1a2a8cb4c
commit
bcee36abe0
1 changed files with 12 additions and 0 deletions
12
mccli.py
12
mccli.py
|
|
@ -329,6 +329,8 @@ class MeshCore:
|
||||||
self.result.set_result(int.from_bytes(data[1:5], byteorder='little'))
|
self.result.set_result(int.from_bytes(data[1:5], byteorder='little'))
|
||||||
case 10: # no more msgs
|
case 10: # no more msgs
|
||||||
self.result.set_result(False)
|
self.result.set_result(False)
|
||||||
|
case 11: # contact
|
||||||
|
self.result.set_result(data[1:].decode())
|
||||||
case 12: # battery voltage
|
case 12: # battery voltage
|
||||||
self.result.set_result(int.from_bytes(data[1:2], byteorder='little'))
|
self.result.set_result(int.from_bytes(data[1:2], byteorder='little'))
|
||||||
# push notifications
|
# push notifications
|
||||||
|
|
@ -462,6 +464,10 @@ class MeshCore:
|
||||||
data = b"\x10" + key
|
data = b"\x10" + key
|
||||||
return await self.send(data)
|
return await self.send(data)
|
||||||
|
|
||||||
|
async def export_contact(self, key=""):
|
||||||
|
data = b"\x11" + key
|
||||||
|
return await self.send(data)
|
||||||
|
|
||||||
async def remove_contact(self, key):
|
async def remove_contact(self, key):
|
||||||
data = b"\x0f" + key
|
data = b"\x0f" + key
|
||||||
return await self.send(data)
|
return await self.send(data)
|
||||||
|
|
@ -624,6 +630,12 @@ async def next_cmd(mc, cmds):
|
||||||
argnum = 1
|
argnum = 1
|
||||||
await mc.ensure_contacts()
|
await mc.ensure_contacts()
|
||||||
print(await mc.share_contact(bytes.fromhex(mc.contacts[cmds[1]]["public_key"])))
|
print(await mc.share_contact(bytes.fromhex(mc.contacts[cmds[1]]["public_key"])))
|
||||||
|
case "export_contact" | "ec":
|
||||||
|
argnum = 1
|
||||||
|
await mc.ensure_contacts()
|
||||||
|
print(await mc.export_contact(bytes.fromhex(mc.contacts[cmds[1]]["public_key"])))
|
||||||
|
case "export_myself" | "e":
|
||||||
|
print(await mc.export_contact())
|
||||||
case "remove_contact" :
|
case "remove_contact" :
|
||||||
argnum = 1
|
argnum = 1
|
||||||
await mc.ensure_contacts()
|
await mc.ensure_contacts()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue