mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
improved ugpio scheme api
This commit is contained in:
parent
71aa087b3e
commit
4767a44af8
@ -81,7 +81,12 @@ class _GpioInput:
|
|||||||
self.__driver.register_input(self.__pin)
|
self.__driver.register_input(self.__pin)
|
||||||
|
|
||||||
def get_scheme(self) -> Dict:
|
def get_scheme(self) -> Dict:
|
||||||
return {}
|
return {
|
||||||
|
"hw": {
|
||||||
|
"driver": self.__driver.get_instance_id(),
|
||||||
|
"pin": self.__pin,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
def get_state(self) -> Dict:
|
def get_state(self) -> Dict:
|
||||||
(online, state) = (True, False)
|
(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),
|
"max_delay": (self.__max_pulse_delay if self.__pulse_delay else 0),
|
||||||
},
|
},
|
||||||
"hw": {
|
"hw": {
|
||||||
"driver": str(self.__driver),
|
"driver": self.__driver.get_instance_id(),
|
||||||
"pin": self.__pin,
|
"pin": self.__pin,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,9 @@ class BaseUserGpioDriver(BasePlugin):
|
|||||||
self._instance_name = instance_name
|
self._instance_name = instance_name
|
||||||
self._notifier = notifier
|
self._notifier = notifier
|
||||||
|
|
||||||
|
def get_instance_id(self) -> str:
|
||||||
|
return self._instance_name
|
||||||
|
|
||||||
def register_input(self, pin: int) -> None:
|
def register_input(self, pin: int) -> None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user