diff options
author | Edi Feschiyan <edi.feschiyan@konsulko.com> | 2020-05-08 12:11:10 +0300 |
---|---|---|
committer | Edi Feschiyan <edi.feschiyan@konsulko.com> | 2020-05-08 12:11:10 +0300 |
commit | 219e992aa8a8e5a7db48cc9d66bb0ddbbe7c21a3 (patch) | |
tree | b6a39f637851ad41f04420012fac5c659c4fae85 /gps.py | |
parent | b2db7fb84b44c3c2cc464475b84494570f057882 (diff) |
Adding requirements, work in progress to integrate this thing with pytest
Diffstat (limited to 'gps.py')
-rw-r--r-- | gps.py | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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) |