2021-01-09 09:58:56 -05:00
|
|
|
import logging
|
|
|
|
import time
|
|
|
|
|
2022-07-07 10:47:34 -04:00
|
|
|
from aprsd import plugin
|
|
|
|
from aprsd.utils import trace
|
2021-01-09 09:58:56 -05:00
|
|
|
|
2021-08-23 12:14:19 -04:00
|
|
|
|
2021-01-09 09:58:56 -05:00
|
|
|
LOG = logging.getLogger("APRSD")
|
|
|
|
|
|
|
|
|
2021-08-19 11:39:29 -04:00
|
|
|
class PingPlugin(plugin.APRSDRegexCommandPluginBase):
|
2021-01-09 09:58:56 -05:00
|
|
|
"""Ping."""
|
|
|
|
|
2022-12-29 14:18:38 -05:00
|
|
|
command_regex = r"^([p]|[p]\s|ping)"
|
2021-01-09 09:58:56 -05:00
|
|
|
command_name = "ping"
|
2021-11-12 11:36:22 -05:00
|
|
|
short_description = "reply with a Pong!"
|
2021-01-09 09:58:56 -05:00
|
|
|
|
2021-01-29 10:07:49 -05:00
|
|
|
@trace.trace
|
2021-08-19 11:39:29 -04:00
|
|
|
def process(self, packet):
|
|
|
|
LOG.info("PingPlugin")
|
2021-07-14 20:50:41 -04:00
|
|
|
# fromcall = packet.get("from")
|
|
|
|
# message = packet.get("message_text", None)
|
|
|
|
# ack = packet.get("msgNo", "0")
|
2021-01-09 09:58:56 -05:00
|
|
|
stm = time.localtime()
|
|
|
|
h = stm.tm_hour
|
|
|
|
m = stm.tm_min
|
|
|
|
s = stm.tm_sec
|
|
|
|
reply = (
|
|
|
|
"Pong! " + str(h).zfill(2) + ":" + str(m).zfill(2) + ":" + str(s).zfill(2)
|
|
|
|
)
|
|
|
|
return reply.rstrip()
|