improved ugpio scheme api

This commit is contained in:
Devaev Maxim 2020-09-08 06:30:13 +03:00
parent 71aa087b3e
commit 4767a44af8
2 changed files with 10 additions and 2 deletions

View File

@ -81,7 +81,12 @@ class _GpioInput:
self.__driver.register_input(self.__pin)
def get_scheme(self) -> Dict:
return {}
return {
"hw": {
"driver": self.__driver.get_instance_id(),
"pin": self.__pin,
},
}
def get_state(self) -> Dict:
(online, state) = (True, False)
@ -136,7 +141,7 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
"max_delay": (self.__max_pulse_delay if self.__pulse_delay else 0),
},
"hw": {
"driver": str(self.__driver),
"driver": self.__driver.get_instance_id(),
"pin": self.__pin,
},
}

View File

@ -58,6 +58,9 @@ class BaseUserGpioDriver(BasePlugin):
self._instance_name = instance_name
self._notifier = notifier
def get_instance_id(self) -> str:
return self._instance_name
def register_input(self, pin: int) -> None:
raise NotImplementedError