import logging

import zmq

from flandre.BusClient import BusClient
from flandre.config import C
from flandre.nodes.Node import Node

logger = logging.getLogger(__name__)


class Monitor(Node):
    def __init__(self, level=logging.INFO):
        super(Monitor, self).__init__(level=level)
        self.c2: BusClient = None

    def custom_setup(self):
        self.c2 = BusClient()
        self.device_rep_socket = self.context.socket(zmq.REQ)
        self.device_rep_socket.connect(C.live_rep_socket)

    def loop(self):
        while True:
            msg = self.c2.recv()
            print(type(msg))
