from nperipherals_core.model.device import Device


class PrinterStatusInteractor(object):
    def __init__(self, writer_device):
        # type: (Device) -> None

        self.device = writer_device

    def get_device_status(self):
        connected = False
        try:
            self.device.initialize()
            self.device.connect()
            connected = True
            return self.device.get_status()
        finally:
            if connected:
                self.device.disconnect()
