From e430874a2abe8e6b4507a32bc24ed217a07ef9a9 Mon Sep 17 00:00:00 2001 From: Eileen Yoon Date: Tue, 23 Jan 2024 20:12:08 +0900 Subject: [PATCH] afk.epic: Support sending direct notify messages Much simpler than the command messages. We just write directly into the TX ringbuffer. Signed-off-by: Eileen Yoon --- proxyclient/m1n1/fw/afk/epic.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/proxyclient/m1n1/fw/afk/epic.py b/proxyclient/m1n1/fw/afk/epic.py index 5981060c..3b12eee2 100644 --- a/proxyclient/m1n1/fw/afk/epic.py +++ b/proxyclient/m1n1/fw/afk/epic.py @@ -195,6 +195,15 @@ class EPICService: self.ep.asc.work() return self.reply + def send_notify(self, type, data, **kwargs): + self.reply = None + self.iface.writemem(self.txbuf, data) + self.ep.send_epic(self.chan, EPICType.NOTIFY, EPICCategory.NOTIFY, type, self.seq, data, **kwargs) + self.seq += 1 + while self.reply is None: + self.ep.asc.work() + return self.reply + class EPICStandardService(EPICService): def call(self, group, cmd, data=b'', replen=None): msg = struct.pack("<2xHIII48x", group, cmd, len(data), 0x69706378) + data @@ -325,6 +334,15 @@ class EPICEndpoint(AFKRingBufEndpoint): def handle_cmd(self, hdr, sub, fd): self.chan_map[hdr.channel].handle_cmd(sub.category, sub.type, sub.seq, fd) + def send_roundtrip(self, chan, call, **kwargs): + self.serv_map[chan].last_call = call + ret = self.serv_map[chan].send_notify(call.TYPE, call.ARGS.build(call.args), **kwargs) + self.serv_map[chan].last_call = None + return ret + + def send_notify(self, chan, call, **kwargs): + return self.serv_map[chan].send_notify(call.TYPE, call.ARGS.build(call.args), **kwargs) + def send_epic(self, chan, ptype, category, type, seq, data, inline_len=0): hdr = Container() hdr.channel = chan