diff options
author | Edi Feschiyan <edi.feschiyan@konsulko.com> | 2020-04-15 15:04:02 +0300 |
---|---|---|
committer | Edi Feschiyan <edi.feschiyan@konsulko.com> | 2020-04-15 15:04:02 +0300 |
commit | 7519a78657685f14f93983f474d75ae0efb4a2ad (patch) | |
tree | 29461ca66ec4b07e4d2ab89e25c2c5aaf34049e6 /geoclue.py | |
parent | 43d73e9cd7fe1ee5f08a8a62feb96c35750ca588 (diff) |
Cleaning up services' classes
Diffstat (limited to 'geoclue.py')
-rw-r--r-- | geoclue.py | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -4,15 +4,16 @@ from aglbaseservice import AGLBaseService class GeoClueService(AGLBaseService): - def __init__(self, ip, port, api='geoclue'): - super().__init__(ip=ip, port=port, api=api) + def __init__(self, ip, port=None, api='geoclue', service='agl-service-geoclue'): + super().__init__(ip=ip, port=port, api=api, service=service) - async def location(self): - verb = 'location' - msgid = randint(0, 999999) - - await self.send(f'[2,"{msgid}","{self.api}/{verb}",""]') - return await self.receive() + async def location(self, waitresponse=False): + return await self.request('location', waitresponse=waitresponse) + # verb = 'location' + # msgid = randint(0, 999999) + # + # await self.send(f'[2,"{msgid}","{self.api}/{verb}",""]') + # return await self.receive() async def subscribe(self, event='location'): super().subscribe(event=event) @@ -22,7 +23,7 @@ class GeoClueService(AGLBaseService): async def main(loop): - GCS = await GeoClueService(ip='192.168.234.202', port='30009') + GCS = await GeoClueService(ip='192.168.128.13') print(await GCS.location()) listener = loop.create_task(GCS.listener()) await listener |