# Path: fluxghost/simulate/camera.py
# class SimulateCamera(object):
#     def __init__(self):
#         self.__running = True
# 
#         try:
#             with open(SIMULATE_CAMERA_FILE, "rb") as f:
#                 self._buf = f.read()
#         except Exception:
#             from .failedimg import IMAGE_BUF
#             self._buf = IMAGE_BUF
# 
#         self._fd_r, self._fd_w = os.pipe()
#         self._thread = Thread(target=self.__trigger)
#         self._thread.daemon = True
#         self._thread.start()
# 
#     def __trigger(self):
#         while self.__running:
#             os.write(self._fd_w, b"\x00")
#             sleep(0.25)
# 
#     # TODO: remove
#     @property
#     def sock(self):
#         return self
# 
#     def fileno(self):
#         return self._fd_r
# 
#     def feed(self, callback):
#         os.read(self._fd_r, 1)
#         callback(self, self._buf)
# 
#     def close(self):
#         if self.__running:
#             self.__running = False
#             os.close(self._fd_w)
#             os.close(self._fd_r)
# 
# Path: fluxghost/simulate/robot.py
# class SimulateRobot(object):
#     selected_node = None
# 
#     def __init__(self, device):
#         self.device = device
# 
#     def list_files(self, path):
#         is_dir, node = get_simulate_path(path)
#         if is_dir:
#             folders = tuple(((True, name) for name in node["folders"].keys()))
#             files = tuple(((False, name) for name in node["files"].keys()))
#             return folders + files
#         else:
#             raise RobotError("Not a folder",
#                              error_symbol=["NOT_EXIST", "BAD_NODE22"])
# 
#     def file_info(self, path):
#         return get_simulate_file_info(path), ((IMAGE_MIMETYPE, IMAGE_BUF), )
# 
#     def close(self):
#         pass
# 
#     def select_file(self, path):
#         self.selected_node = get_simulate_file_info(path)
# 
#     def report_play(self):
#         return self.device.simulate_report_play()
# 
#     def start_play(self):
#         if self.selected_node:
#             self.device.simulate_start_player(self.selected_node)
#         else:
#             raise RobotError(error_symbol=["NO_TASK"])
# 
#     def pause_play(self):
#         pass
# 
#     def resume_play(self):
#         pass
# 
#     def abort_play(self):
#         pass
# 
#     def quit_play(self):
#         pass
# 
#     def kick(self):
#         pass
# 
#     def maintain_home(self):
#         pass
# 
#     def scan_backward(self):
#         pass
# 
#     def scan_next(self):
#         pass


from time import time
from uuid import UUID
from fluxclient.utils.version import StrictVersion
from .camera import SimulateCamera
from .robot import SimulateRobot
        from threading import Thread



class SimulatePlayerMixIn(object):
    __simulate_player = None

    def simulate_player(self, timecost=60, ):


# Path: fluxghost/simulate/camera.py
# class SimulateCamera(object):
#     def __init__(self):
#         self.__running = True
# 
#         try:
#             with open(SIMULATE_CAMERA_FILE, "rb") as f:
#                 self._buf = f.read()
#         except Exception:
#             from .failedimg import IMAGE_BUF
#             self._buf = IMAGE_BUF
# 
#         self._fd_r, self._fd_w = os.pipe()
#         self._thread = Thread(target=self.__trigger)
#         self._thread.daemon = True
#         self._thread.start()
# 
#     def __trigger(self):
#         while self.__running:
#             os.write(self._fd_w, b"\x00")
#             sleep(0.25)
# 
#     # TODO: remove
#     @property
#     def sock(self):
#         return self
# 
#     def fileno(self):
#         return self._fd_r
# 
#     def feed(self, callback):
#         os.read(self._fd_r, 1)
#         callback(self, self._buf)
# 
#     def close(self):
#         if self.__running:
#             self.__running = False
#             os.close(self._fd_w)
#             os.close(self._fd_r)
# 
# Path: fluxghost/simulate/robot.py
# class SimulateRobot(object):
#     selected_node = None
# 
#     def __init__(self, device):
#         self.device = device
# 
#     def list_files(self, path):
#         is_dir, node = get_simulate_path(path)
#         if is_dir:
#             folders = tuple(((True, name) for name in node["folders"].keys()))
#             files = tuple(((False, name) for name in node["files"].keys()))
#             return folders + files
#         else:
#             raise RobotError("Not a folder",
#                              error_symbol=["NOT_EXIST", "BAD_NODE22"])
# 
#     def file_info(self, path):
#         return get_simulate_file_info(path), ((IMAGE_MIMETYPE, IMAGE_BUF), )
# 
#     def close(self):
#         pass
# 
#     def select_file(self, path):
#         self.selected_node = get_simulate_file_info(path)
# 
#     def report_play(self):
#         return self.device.simulate_report_play()
# 
#     def start_play(self):
#         if self.selected_node:
#             self.device.simulate_start_player(self.selected_node)
#         else:
#             raise RobotError(error_symbol=["NO_TASK"])
# 
#     def pause_play(self):
#         pass
# 
#     def resume_play(self):
#         pass
# 
#     def abort_play(self):
#         pass
# 
#     def quit_play(self):
#         pass
# 
#     def kick(self):
#         pass
# 
#     def maintain_home(self):
#         pass
# 
#     def scan_backward(self):
#         pass
# 
#     def scan_next(self):
#         pass


# Path: fluxghost/simulate/device.py
from time import time
from uuid import UUID
from fluxclient.utils.version import StrictVersion
from .camera import SimulateCamera
from .robot import SimulateRobot
        from threading import Thread




class SimulatePlayerMixIn(object):
    __simulate_player = None

    def simulate_player(self, timecost=60, ):


        def player():