aboutsummaryrefslogtreecommitdiffstats
path: root/gps.py
diff options
context:
space:
mode:
authorEdi Feschiyan <edi.feschiyan@konsulko.com>2020-05-08 12:11:10 +0300
committerEdi Feschiyan <edi.feschiyan@konsulko.com>2020-05-08 12:11:10 +0300
commit219e992aa8a8e5a7db48cc9d66bb0ddbbe7c21a3 (patch)
treeb6a39f637851ad41f04420012fac5c659c4fae85 /gps.py
parentb2db7fb84b44c3c2cc464475b84494570f057882 (diff)
Adding requirements, work in progress to integrate this thing with pytest
Diffstat (limited to 'gps.py')
-rw-r--r--gps.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/gps.py b/gps.py
index 82f1545..2fd1c36 100644
--- a/gps.py
+++ b/gps.py
@@ -2,6 +2,8 @@ from aglbaseservice import AGLBaseService
import asyncio
import os
+from concurrent import futures
+xc = futures.ThreadPoolExecutor(1)
class GPSService(AGLBaseService):
service = 'agl-service-gps'
@@ -25,10 +27,20 @@ async def main(loop):
args = GPSService.parser.parse_args()
gpss = await GPSService(args.ipaddr)
+ r = await loop.run_in_executor(xc, gpss.response)
+
if args.loglevel:
GPSService.logger.setLevel(args.loglevel)
if args.location:
- print(await gpss.location(waitresponse=True))
+ await gpss.location()
+ async for response in r:
+ await gpss.location()
+ print(await r.__anext__())
+
+
+ # loc = await l
+ # print(loc)
+
if args.subscribe:
await gpss.subscribe(args.subscribe)