from .i2c_address import I2CAddress

class AbstractI2CDevice:
    def __init__(self, name: str, device_class: int, device_address: int, channel: int = -1):
        self.name = name
        self.dev_addr = I2CAddress(device_class, device_address, channel)
        self.i2c = None

    def set_i2c(self, i2c):
        self.i2c = i2c
        if i2c:
            self._init_device()

    def _init_device(self):
        pass

    def __str__(self):
        return f"{self.name}: {self.dev_addr}"