class LocationManager(object):
The LocationManager class implements the location service and helper functions.
| Method | add |
Add a location policy. |
| Method | check |
Check if a location is inside or outside the polygon of a location policy. |
| Method | check |
Check if a resource's location confirms to a geo location. |
| Method | configure |
Configure the WebSocket server. |
| Method | get |
Get the geo-polygon from a geoJSON object. This is just a wrapper for the getGeoPolygon function in GeoTools. |
| Method | get |
Get the new location for a location policy. Also, update the internal policy info if necessary. |
| Method | handle |
Handle a latest RETRIEVE request for a CNT with a location policy. |
| Method | init |
Initialization of the LocationManager module. |
| Method | location |
Worker function for location policies. This will be called periodically to update the location. |
| Method | remove |
Remove a location policy. This will stop the worker and remove the LCP from the internal list. |
| Method | restart |
Restart the LocationManager. |
| Method | stop |
Shutdown the LocationManager. |
| Method | update |
Update the location event for a location policy if the location has changed and/or the event criteria is met. |
| Method | update |
Update a location policy. This will remove the old location policy and add a new one. |
| Class Variable | __slots__ |
Slots for LocationManager class. |
| Class Variable | dispatcher |
Injected IDispatcher instance. |
| Instance Variable | device |
The default position type for device-based location sources. This is used when the location information type is not set. |
| Instance Variable | location |
A dictionary of location policy information, keyed by the location policy resource ID. |
Check if a location is inside or outside the polygon of a location policy.
| Parameters | |
lcpstr | The resource ID of the location policy |
location:tuple[ | The location to check |
| Returns | |
GeofencePositionType | The geofence position of the location. Either inside or outside. |
Resource, gmty: GeometryType, geom: list, gsf: GeoSpatialFunctionType) -> bool:
¶
Check if a resource's location confirms to a geo location.
| Parameters | |
r:Resource | The resource to check. |
gmty:GeometryType | The geometry type. |
geom:list | The geometry. |
gsf:GeoSpatialFunctionType | The geo spatial function. |
| Returns | |
bool | True if the resource's location confirms to the geo location, False otherwise. |
Configure the WebSocket server.
| Parameters | |
config:Configuration | The configuration object to update with the location manager configuration. |
Get the geo-polygon from a geoJSON object. This is just a wrapper for the getGeoPolygon function in GeoTools.
| Parameters | |
jsn:dict | str | None | The geoJSON object as a dictionary or a string. |
| Returns | |
list[ | A list of tuples of the geo-polygon (latitude, longitude). None if not found. |
str, content: str | None = None) -> tuple[ LocationType, LocationType] | None:
¶
Get the new location for a location policy. Also, update the internal policy info if necessary.
| Parameters | |
lcpstr | The resource ID of the location policy |
content:str | None | The content of the latest CIN of the location policy's container resource |
| Returns | |
tuple[ | The new and old locations as a tuple of (latitude, longitude), or None if the location is invalid or not found |
Handle a latest RETRIEVE request for a CNT with a location policy.
| Parameters | |
latest:CIN | The latest CIN |
lcpstr | The location policy resource ID |
Worker function for location policies. This will be called periodically to update the location.
| Parameters | |
lcpstr | The resource ID of the location policy |
| Returns | |
bool | True if the worker should be continued, False otherwise. |
Remove a location policy. This will stop the worker and remove the LCP from the internal list.
| Parameters | |
lcp:LCP | The LCP to remove. |
Update the location event for a location policy if the location has changed and/or the event criteria is met.
| Parameters | |
newLocationType | The new location |
oldLocationType | The old location |
lcpstr | The resource ID of the location policy |
The default position type for device-based location sources. This is used when the location information type is not set.