mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-25 14:50:37 +01:00
Improved example plugins
This commit is contained in:
parent
3967a85ab0
commit
2da2fc26e7
@ -1,3 +1,7 @@
|
|||||||
|
# This is a bare-minimum command plugin
|
||||||
|
# example that you can build upon to
|
||||||
|
# implement your own command plugins.
|
||||||
|
|
||||||
import RNS
|
import RNS
|
||||||
|
|
||||||
class BasicCommandPlugin(SidebandCommandPlugin):
|
class BasicCommandPlugin(SidebandCommandPlugin):
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
# This plugin example fetches an XKCD comic
|
||||||
|
# from an external URL and returns it as an
|
||||||
|
# embedded image in an LXMF message.
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import RNS
|
import RNS
|
||||||
import requests
|
import requests
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
import RNS
|
# This plugin allows using GPSd as a location
|
||||||
import time
|
# telemetry provider on Linux systems.
|
||||||
import threading
|
|
||||||
|
|
||||||
# This plugin requires the "gpsdclient" pip
|
# This plugin requires the "gpsdclient" pip
|
||||||
# package to be installed on your system.
|
# package to be installed on your system.
|
||||||
# Install it with: pip install gpsdclient
|
# Install it with: pip install gpsdclient
|
||||||
|
|
||||||
|
import RNS
|
||||||
|
import time
|
||||||
|
import threading
|
||||||
|
|
||||||
from gpsdclient import GPSDClient
|
from gpsdclient import GPSDClient
|
||||||
|
|
||||||
class GpsdLocationPlugin(SidebandTelemetryPlugin):
|
class GpsdLocationPlugin(SidebandTelemetryPlugin):
|
||||||
@ -50,12 +54,21 @@ class GpsdLocationPlugin(SidebandTelemetryPlugin):
|
|||||||
RNS.log("Connected, streaming GPSd data", RNS.LOG_DEBUG)
|
RNS.log("Connected, streaming GPSd data", RNS.LOG_DEBUG)
|
||||||
|
|
||||||
self.client_connected = True
|
self.client_connected = True
|
||||||
|
|
||||||
|
gpsd_latitude = result.get("lat", None)
|
||||||
|
gpsd_longitude = result.get("lon", None)
|
||||||
|
gpsd_altitude = result.get("altHAE", None)
|
||||||
|
gpsd_speed = result.get("speed", None)
|
||||||
|
gpsd_bearing = result.get("track", None)
|
||||||
|
gpsd_required = [gpsd_latitude, gpsd_longitude, gpsd_altitude, gpsd_speed, gpsd_bearing]
|
||||||
|
|
||||||
|
if not None in gpsd_required:
|
||||||
self.last_update = time.time()
|
self.last_update = time.time()
|
||||||
self.latitude = result.get("lat", None)
|
self.latitude = gpsd_latitude
|
||||||
self.longitude = result.get("lon", None)
|
self.longitude = gpsd_longitude
|
||||||
self.altitude = result.get("altHAE", None)
|
self.altitude = gpsd_altitude
|
||||||
self.speed = result.get("speed", None)
|
self.speed = gpsd_speed
|
||||||
self.bearing = result.get("track", None)
|
self.bearing = gpsd_bearing
|
||||||
|
|
||||||
epx = result.get("epx", None); epy = result.get("epy", None)
|
epx = result.get("epx", None); epy = result.get("epy", None)
|
||||||
epv = result.get("epv", None)
|
epv = result.get("epv", None)
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
# This is a bare-minimum service plugin
|
||||||
|
# example that you can build upon to
|
||||||
|
# implement your own service plugins.
|
||||||
|
|
||||||
import RNS
|
import RNS
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
# This is a bare-minimum telemetry plugin
|
||||||
|
# example that you can build upon to
|
||||||
|
# implement your own telemetry plugins.
|
||||||
|
|
||||||
import RNS
|
import RNS
|
||||||
|
|
||||||
class BasicTelemetryPlugin(SidebandTelemetryPlugin):
|
class BasicTelemetryPlugin(SidebandTelemetryPlugin):
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# This plugin lets you remotely query and view a
|
# This plugin lets you remotely query and view a
|
||||||
# number of different image sources in Sideband.
|
# number of different image sources in Sideband,
|
||||||
|
# including remote or local webcams, video sources
|
||||||
|
# or images stored in a filesystem.
|
||||||
#
|
#
|
||||||
# This plugin requires the "pillow" pip package.
|
# This plugin requires the "pillow" pip package.
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user