mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-04 03:42:44 +08:00
gpio view and refactoring
This commit is contained in:
@@ -167,6 +167,8 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
|
||||
# =====
|
||||
class UserGpio:
|
||||
def __init__(self, config: Section) -> None:
|
||||
self.__view = config.view
|
||||
|
||||
self.__state_notifier = aiotools.AioNotifier()
|
||||
self.__reader = gpio.BatchReader(
|
||||
pins=[gpio.set_input(ch_config.pin) for ch_config in config.scheme.values()],
|
||||
@@ -189,6 +191,9 @@ class UserGpio:
|
||||
"outputs": {channel: gout.get_scheme() for (channel, gout) in self.__outputs.items()},
|
||||
}
|
||||
|
||||
async def get_view(self) -> Dict:
|
||||
return self.__view
|
||||
|
||||
async def get_state(self) -> Dict:
|
||||
return {
|
||||
"inputs": {channel: gin.get_state() for (channel, gin) in self.__inputs.items()},
|
||||
|
||||
Reference in New Issue
Block a user