from typing import Union, ByteString from zmq import Frame if __name__ == '__main__': from Manager import Manager from proto.Message_pb2 import Message from proto.enums_pb2 import MessageType else: from .Manager import Manager from .proto.Message_pb2 import Message from .proto.enums_pb2 import MessageType class Bridge: def __init__(self, recv_addr='tcp://127.0.0.1:5557', send_addr='tcp://127.0.0.1:5558'): self.__manager = Manager(recv_addr, send_addr) def start(self): self.__manager.start(self._message_processor) def _message_processor(self, msg_str: Union[Frame, ByteString]) -> None: msg = Message() msg.ParseFromString(msg_str) if msg.msgType == MessageType.MESSAGE_TYPE_IMAGE: pass elif msg.msgType == MessageType.MESSAGE_TYPE_TOGGLE_TRACK: pass elif msg.msgType == MessageType.MESSAGE_TYPE_TOGGLE_DETECT: pass elif msg.msgType == MessageType.MESSAGE_TYPE_TRACK_COORD: pass elif msg.msgType == MessageType.MESSAGE_TYPE_TRACK_SETTINGS: pass elif msg.msgType == MessageType.MESSAGE_TYPE_SWITCH_CAMERA: pass elif msg.msgType == MessageType.MESSAGE_TYPE_SET_CAMERA: pass if __name__ == '__main__': print(MessageType.MESSAGE_TYPE_TOGGLE_TRACK)