from . import common
from .gps303proto import *
-from .zmsg import Bcast, Resp
+from .zmsg import Bcast, Resp, topic
log = getLogger("gps303/termconfig")
"SETUP",
"POSITION_UPLOAD_INTERVAL",
):
- topic = pack("B", proto_by_name(protoname))
- zsub.setsockopt(zmq.SUBSCRIBE, topic)
+ tosub = topic(proto_by_name(protoname))
+ zsub.setsockopt(zmq.SUBSCRIBE, tosub)
zpush = zctx.socket(zmq.PUSH)
zpush.connect(conf.get("collector", "listenurl"))
datetime.fromtimestamp(zmsg.when).astimezone(tz=timezone.utc),
msg,
)
- if msg.DIR is not Dir.EXT:
+ if msg.RESPOND is not Respond.EXT:
log.error(
"%s does not expect externally provided response", msg
)
):
if key in termconfig:
kwargs[key] = termconfig[key]
- resp = Resp(imei=zmsg.imei, packet=msg.response(**kwargs))
+ resp = Resp(imei=zmsg.imei, packet=msg.Out(**kwargs).packed)
log.debug("Response: %s", resp)
zpush.send(resp.packed)