pc -> server

This commit is contained in:
Devaev Maxim
2018-07-03 00:43:31 +03:00
parent 8fd506fa1b
commit c4d861cc35
2 changed files with 5 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ class IsNotOperationalError(MassStorageError):
class AlreadyConnectedToPcError(MassStorageError):
def __init__(self) -> None:
super().__init__("Mass-storage is already connected to PC")
super().__init__("Mass-storage is already connected to Server")
class AlreadyConnectedToKvmError(MassStorageError):
@@ -180,12 +180,12 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
raise AlreadyConnectedToPcError()
# TODO: enable gpio
self.__device_info = None
get_logger().info("Mass-storage device switched to PC")
get_logger().info("Mass-storage device switched to Server")
def get_state(self) -> Dict:
return {
"in_operate": bool(self._bind),
"connected_to": ("kvm" if self.__device_info else "pc"),
"connected_to": ("kvm" if self.__device_info else "server"),
"is_busy": bool(self._device_file),
"writed": self.__writed,
"info": (self.__device_info._asdict() if self.__device_info else None),

View File

@@ -159,9 +159,9 @@ class Server: # pylint: disable=too-many-instance-attributes
if to == "kvm":
await self.__msd.connect_to_kvm()
await self.__broadcast_event("msd_state", state="connected_to_kvm") # type: ignore
elif to == "pc":
elif to == "server":
await self.__msd.connect_to_pc()
await self.__broadcast_event("msd_state", state="connected_to_pc") # type: ignore
await self.__broadcast_event("msd_state", state="connected_to_server") # type: ignore
else:
raise RuntimeError("Missing or invalid 'to=%s'" % (to))
return _json_200(self.__msd.get_state())