mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-25 14:50:37 +01:00
Added support for location provider plugins
This commit is contained in:
parent
c93fe2ce0d
commit
6122df0600
@ -620,6 +620,7 @@ class Location(Sensor):
|
|||||||
self._min_distance = Location.MIN_DISTANCE
|
self._min_distance = Location.MIN_DISTANCE
|
||||||
self._accuracy_target = Location.ACCURACY_TARGET
|
self._accuracy_target = Location.ACCURACY_TARGET
|
||||||
self._query_method = None
|
self._query_method = None
|
||||||
|
self._synthesized_updates = False
|
||||||
|
|
||||||
self.latitude = None
|
self.latitude = None
|
||||||
self.longitude = None
|
self.longitude = None
|
||||||
@ -679,12 +680,17 @@ class Location(Sensor):
|
|||||||
self._raw = kwargs
|
self._raw = kwargs
|
||||||
self._last_update = time.time()
|
self._last_update = time.time()
|
||||||
|
|
||||||
|
def set_update_time(self, update_time):
|
||||||
|
self._synthesized_updates = True
|
||||||
|
self._last_update = update_time
|
||||||
|
|
||||||
def update_data(self):
|
def update_data(self):
|
||||||
try:
|
try:
|
||||||
if self.synthesized:
|
if self.synthesized:
|
||||||
if self.latitude != None and self.longitude != None:
|
if self.latitude != None and self.longitude != None:
|
||||||
|
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
if not self._synthesized_updates:
|
||||||
if self._last_update == None:
|
if self._last_update == None:
|
||||||
self._last_update = now
|
self._last_update = now
|
||||||
elif now > self._last_update + self._stale_time:
|
elif now > self._last_update + self._stale_time:
|
||||||
|
Loading…
Reference in New Issue
Block a user