added send notification feature
Signed-off-by: jfekete1 <fekete.jozsef@protonmail.com>
This commit is contained in:
parent
8b7c707ffe
commit
89be0be23c
1 changed files with 18 additions and 0 deletions
|
@ -368,6 +368,13 @@ def handle_upload(c, fname, tname):
|
|||
|
||||
c.expect('>>> ')
|
||||
|
||||
def send_notification(c, title, body, id):
|
||||
msg= {'title': title, 'body': body}
|
||||
c.sendline(f'wasp.system.notify(id, {msg})')
|
||||
c.sendline(f'watch.vibrator.pulse(ms=wasp.system.notify_duration)')
|
||||
c.expect('>>> ')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Wasp-os command and control client')
|
||||
|
@ -377,6 +384,8 @@ if __name__ == '__main__':
|
|||
help="Report remaining battery charge")
|
||||
parser.add_argument('--bootloader', action='store_true',
|
||||
help="Reboot into the bootloader mode for OTA update")
|
||||
parser.add_argument('--body', default='Body',
|
||||
help='Body of the notification')
|
||||
parser.add_argument('--binary', action='store_true',
|
||||
help="Enable non-ASCII mode for upload command")
|
||||
parser.add_argument('--console', action='store_true',
|
||||
|
@ -389,6 +398,8 @@ if __name__ == '__main__':
|
|||
help='Execute the contents of a file')
|
||||
parser.add_argument('--eval',
|
||||
help='Execute the provided python string')
|
||||
parser.add_argument('--id', default=1,
|
||||
help='ID of the notification')
|
||||
parser.add_argument('--memfree', action='store_true',
|
||||
help='Report on the current memory usage.')
|
||||
parser.add_argument('--pull',
|
||||
|
@ -403,6 +414,10 @@ if __name__ == '__main__':
|
|||
help="Deliver an OTA update to the device")
|
||||
parser.add_argument('--rtc', action='store_true',
|
||||
help='Set the time on the wasp-os device')
|
||||
parser.add_argument('--send-notification', action='store_true',
|
||||
help='Send a notification to the wasp-os device (e.g. wasptool --send-notification --title hello --body world --id 1')
|
||||
parser.add_argument('--title', default='Title',
|
||||
help='Title of the notification')
|
||||
parser.add_argument('--upload',
|
||||
help='Copy the specified file to the wasp-os device')
|
||||
parser.add_argument('--verbose', action='store_true',
|
||||
|
@ -450,6 +465,9 @@ if __name__ == '__main__':
|
|||
if args.check_rtc:
|
||||
check_rtc(console)
|
||||
|
||||
if args.send_notification:
|
||||
send_notification(console, args.title, args.body, args.id)
|
||||
|
||||
if args.exec:
|
||||
handle_exec(console, args.exec)
|
||||
|
||||
|
|
Loading…
Reference in a new issue