mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
hid with granularity prototype
This commit is contained in:
@@ -101,6 +101,19 @@ class BaseHid(BasePlugin): # pylint: disable=too-many-instance-attributes
|
||||
raise NotImplementedError
|
||||
|
||||
async def poll_state(self) -> AsyncGenerator[dict, None]:
|
||||
# ==== Granularity table ====
|
||||
# - enabled -- Full
|
||||
# - online -- Partial
|
||||
# - busy -- Partial
|
||||
# - connected -- Partial, nullable
|
||||
# - keyboard.online -- Partial
|
||||
# - keyboard.outputs -- Partial
|
||||
# - keyboard.leds -- Partial
|
||||
# - mouse.online -- Partial
|
||||
# - mouse.outputs -- Partial, follows with absolute
|
||||
# - mouse.absolute -- Partial, follows with outputs
|
||||
# ===========================
|
||||
|
||||
yield {}
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many-
|
||||
mouse_outputs["active"] = active_mouse
|
||||
|
||||
return {
|
||||
"enabled": True,
|
||||
"online": online,
|
||||
"busy": bool(state["busy"]),
|
||||
"connected": (bool(outputs2 & 0b01000000) if outputs2 & 0b10000000 else None),
|
||||
|
||||
@@ -141,6 +141,7 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
|
||||
state = await self.__server.get_state()
|
||||
outputs: dict = {"available": [], "active": ""}
|
||||
return {
|
||||
"enabled": True,
|
||||
"online": True,
|
||||
"busy": False,
|
||||
"connected": None,
|
||||
|
||||
@@ -104,6 +104,7 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
|
||||
absolute = self.__mouse.is_absolute()
|
||||
leds = await self.__keyboard.get_leds()
|
||||
return {
|
||||
"enabled": True,
|
||||
"online": state["online"],
|
||||
"busy": False,
|
||||
"connected": None,
|
||||
|
||||
@@ -134,6 +134,7 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
|
||||
keyboard_state = await self.__keyboard_proc.get_state()
|
||||
mouse_state = await self.__mouse_current.get_state()
|
||||
return {
|
||||
"enabled": True,
|
||||
"online": True,
|
||||
"busy": False,
|
||||
"connected": None,
|
||||
|
||||
Reference in New Issue
Block a user