2021-01-09 09:58:56 -05:00
|
|
|
import logging
|
|
|
|
import time
|
|
|
|
|
2021-01-29 10:07:49 -05:00
|
|
|
from aprsd import plugin, 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-07-14 20:50:41 -04:00
|
|
|
class PingPlugin(plugin.APRSDMessagePluginBase):
|
2021-01-09 09:58:56 -05:00
|
|
|
"""Ping."""
|
|
|
|
|
|
|
|
version = "1.0"
|
|
|
|
command_regex = "^[pP]"
|
|
|
|
command_name = "ping"
|
|
|
|
|
2021-01-29 10:07:49 -05:00
|
|
|
@trace.trace
|
2021-07-14 20:50:41 -04:00
|
|
|
def command(self, packet):
|
2021-01-09 09:58:56 -05:00
|
|
|
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()
|