summaryrefslogtreecommitdiff
path: root/wasp/apps/testapp.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-07-19 19:50:33 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-07-19 19:50:33 (GMT)
commita01fb7df573e13a6f6b9fbf2e7688d4e9713df6d (patch)
tree5118831a0fa174681ade9aaf850b7613309a2803 /wasp/apps/testapp.py
parent6686f17e724b9a22318ff2248ce126a97dd19db4 (diff)
Introduction basic notification support
This requires a modified version of Gadgetbridge and currently works by implementing the BangleJS protocol. In Gadgetbridge ensure "Sync time" is *not* set and choose "Don't pair" when adding the PineTime device.
Diffstat (limited to 'wasp/apps/testapp.py')
-rw-r--r--wasp/apps/testapp.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py
index a312530..e2e8828 100644
--- a/wasp/apps/testapp.py
+++ b/wasp/apps/testapp.py
@@ -16,7 +16,7 @@ class TestApp():
ICON = icons.app
def __init__(self):
- self.tests = ('Button', 'Crash', 'Colours', 'Fill', 'Fill-H', 'Fill-V', 'RLE', 'String', 'Touch', 'Wrap')
+ self.tests = ('Button', 'Crash', 'Colours', 'Fill', 'Fill-H', 'Fill-V', 'Notifications', 'RLE', 'String', 'Touch', 'Wrap')
self.test = self.tests[0]
self.scroll = wasp.widgets.ScrollIndicator()
@@ -70,6 +70,19 @@ class TestApp():
self._update_colours()
elif self.test.startswith('Fill'):
self._benchmark_fill()
+ elif self.test == 'Notifications':
+ if event[1] < 120:
+ wasp.system.notify(wasp.watch.rtc.get_uptime_ms(),
+ {
+ "src":"Hangouts",
+ "title":"A Name",
+ "body":"message contents"
+ })
+ else:
+ if wasp.system.notifications:
+ wasp.system.unnotify(
+ next(iter(wasp.system.notifications.keys())))
+ self._update_notifications()
elif self.test == 'RLE':
self._benchmark_rle()
elif self.test == 'String':
@@ -166,6 +179,10 @@ class TestApp():
for s in self._sliders:
s.draw()
self._update_colours()
+ elif self.test == 'Notifications':
+ draw.string('+', 24, 100)
+ draw.string('-', 210, 100)
+ self._update_notifications()
elif self.test == 'RLE':
draw.blit(self.ICON, 120-48, 120-32)
@@ -181,3 +198,6 @@ class TestApp():
draw.string('RGB565 #{:04x}'.format(rgb), 0, 6, width=240)
draw.fill(rgb, 60, 35, 120, 50)
+
+ def _update_notifications(self):
+ wasp.watch.drawable.string(str(len(wasp.system.notifications)), 0, 140, 240)