1
0
mirror of https://github.com/craigerl/aprsd.git synced 2026-06-08 09:04:49 -04:00

Created plugin.py for Command Plugins

This patch adds the new APRSD Command Plugin architecture.
All Comand plugins must implement the same object API, which includes
plugin object is subclass of APRSDPluginBase
version attribute
command_regex attribute
command method

When an APRS command is detected, then the regex is run against
the command.  If the command_regex matches, then the plugin's
command() method will be called.   If the command() method returns
a string, then that string is sent as a reply to the APRS caller.

A new aprs.yml config section is added to support selecting
which plugins to enable.

If you want all plugins enabled, then omit "enabled_plugins" entirely
from the aprs section of the config.

To load custom plugins:
1) create a directory with an __init__.py file
2) Add a plugin.py file that contains your plugin

Look at the exmaples directory for an example plugin.
This commit is contained in:
2020-12-12 15:53:06 -05:00
parent 8c9c12b3fc
commit d09a66006b
8 changed files with 368 additions and 155 deletions
View File
+18
View File
@@ -0,0 +1,18 @@
import logging
from aprsd import plugin
LOG = logging.getLogger("APRSD")
class HelloPlugin(plugin.APRSDPluginBase):
"""Hello World."""
version = "1.0"
# matches any string starting with h or H
command_regex = "^[hH]"
def command(self, fromcall, message, ack):
LOG.info("HelloPlugin")
reply = "Hello '{}'".format(fromcall)
return reply