mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-15 18:50:29 +08:00
refactoring
This commit is contained in:
parent
646d2cd996
commit
db56bf90db
@ -13,6 +13,7 @@ class Atx:
|
|||||||
self,
|
self,
|
||||||
power_led: int,
|
power_led: int,
|
||||||
hdd_led: int,
|
hdd_led: int,
|
||||||
|
|
||||||
power_switch: int,
|
power_switch: int,
|
||||||
reset_switch: int,
|
reset_switch: int,
|
||||||
click_delay: float,
|
click_delay: float,
|
||||||
|
|||||||
@ -79,7 +79,13 @@ def _key_event_to_ps2_codes(event: _KeyEvent) -> List[int]:
|
|||||||
class Keyboard(multiprocessing.Process):
|
class Keyboard(multiprocessing.Process):
|
||||||
# http://dkudrow.blogspot.com/2013/08/ps2-keyboard-emulation-with-arduino-uno.html
|
# http://dkudrow.blogspot.com/2013/08/ps2-keyboard-emulation-with-arduino-uno.html
|
||||||
|
|
||||||
def __init__(self, clock: int, data: int, pulse: float) -> None:
|
def __init__(
|
||||||
|
self,
|
||||||
|
clock: int,
|
||||||
|
data: int,
|
||||||
|
pulse: float,
|
||||||
|
) -> None:
|
||||||
|
|
||||||
super().__init__(daemon=True)
|
super().__init__(daemon=True)
|
||||||
|
|
||||||
self.__clock = gpio.set_output(clock, initial=True)
|
self.__clock = gpio.set_output(clock, initial=True)
|
||||||
|
|||||||
@ -70,10 +70,12 @@ class Server: # pylint: disable=too-many-instance-attributes
|
|||||||
atx: Atx,
|
atx: Atx,
|
||||||
msd: MassStorageDevice,
|
msd: MassStorageDevice,
|
||||||
streamer: Streamer,
|
streamer: Streamer,
|
||||||
|
|
||||||
heartbeat: float,
|
heartbeat: float,
|
||||||
atx_state_poll: float,
|
atx_state_poll: float,
|
||||||
streamer_shutdown_delay: float,
|
streamer_shutdown_delay: float,
|
||||||
msd_chunk_size: int,
|
msd_chunk_size: int,
|
||||||
|
|
||||||
loop: asyncio.AbstractEventLoop,
|
loop: asyncio.AbstractEventLoop,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
@ -81,10 +83,12 @@ class Server: # pylint: disable=too-many-instance-attributes
|
|||||||
self.__atx = atx
|
self.__atx = atx
|
||||||
self.__msd = msd
|
self.__msd = msd
|
||||||
self.__streamer = streamer
|
self.__streamer = streamer
|
||||||
|
|
||||||
self.__heartbeat = heartbeat
|
self.__heartbeat = heartbeat
|
||||||
self.__streamer_shutdown_delay = streamer_shutdown_delay
|
self.__streamer_shutdown_delay = streamer_shutdown_delay
|
||||||
self.__atx_state_poll = atx_state_poll
|
self.__atx_state_poll = atx_state_poll
|
||||||
self.__msd_chunk_size = msd_chunk_size
|
self.__msd_chunk_size = msd_chunk_size
|
||||||
|
|
||||||
self.__loop = loop
|
self.__loop = loop
|
||||||
|
|
||||||
self.__sockets: Set[aiohttp.web.WebSocketResponse] = set()
|
self.__sockets: Set[aiohttp.web.WebSocketResponse] = set()
|
||||||
|
|||||||
@ -18,9 +18,11 @@ class Streamer: # pylint: disable=too-many-instance-attributes
|
|||||||
conv_power: int,
|
conv_power: int,
|
||||||
sync_delay: float,
|
sync_delay: float,
|
||||||
init_delay: float,
|
init_delay: float,
|
||||||
|
|
||||||
width: int,
|
width: int,
|
||||||
height: int,
|
height: int,
|
||||||
cmd: List[str],
|
cmd: List[str],
|
||||||
|
|
||||||
loop: asyncio.AbstractEventLoop,
|
loop: asyncio.AbstractEventLoop,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
@ -28,6 +30,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes
|
|||||||
self.__conv_power = (gpio.set_output(conv_power) if conv_power > 0 else conv_power)
|
self.__conv_power = (gpio.set_output(conv_power) if conv_power > 0 else conv_power)
|
||||||
self.__sync_delay = sync_delay
|
self.__sync_delay = sync_delay
|
||||||
self.__init_delay = init_delay
|
self.__init_delay = init_delay
|
||||||
|
|
||||||
self.__width = width
|
self.__width = width
|
||||||
self.__height = height
|
self.__height = height
|
||||||
self.__cmd = cmd
|
self.__cmd = cmd
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user