Documentation for Gpsmodule Module¶
GPSModule
¶
Bases: ABC
Abstract base class representing a GPS module interface.
This class defines the required asynchronous methods that any concrete GPS module implementation must provide. These methods allow for lifecycle control (start/stop), status checking, and distance calculation between coordinates.
Any subclass must implement all the following asynchronous methods:
- start()
: Begins GPS tracking or data acquisition.
- stop()
: Halts the GPS module's operation.
- is_running()
: Checks whether the GPS module is currently active.
- calculate_distance()
: Computes the distance between two geographic coordinates (latitude and longitude).
All implementations should ensure that methods are non-blocking and integrate smoothly with async event loops.
Source code in nebula/addons/gps/gpsmodule.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
calculate_distance(self_lat, self_long, other_lat, other_long)
abstractmethod
async
¶
Calculates the distance between two geographic points.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
self_lat
|
float
|
Latitude of the source point. |
required |
self_long
|
float
|
Longitude of the source point. |
required |
other_lat
|
float
|
Latitude of the target point. |
required |
other_long
|
float
|
Longitude of the target point. |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
Distance in meters (or implementation-defined units) between the two coordinates. |
Source code in nebula/addons/gps/gpsmodule.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
is_running()
abstractmethod
async
¶
Checks whether the GPS module is currently active.
Returns:
Name | Type | Description |
---|---|---|
bool |
True if the module is running, False otherwise. |
Source code in nebula/addons/gps/gpsmodule.py
38 39 40 41 42 43 44 45 46 |
|
start()
abstractmethod
async
¶
Starts the GPS module operation.
This may involve initiating hardware tracking, establishing connections, or beginning periodic updates.
Source code in nebula/addons/gps/gpsmodule.py
20 21 22 23 24 25 26 27 |
|
stop()
abstractmethod
async
¶
Stops the GPS module operation.
Ensures that any background tasks or hardware interactions are properly terminated.
Source code in nebula/addons/gps/gpsmodule.py
29 30 31 32 33 34 35 36 |
|