#!D:/IDE/anaconda3/envs/Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
@FileName：AppBusinessInterface.py
@Description：
@Author：XSH
@Time：2025/11/15 11:54
@Department：研发部
@Copyright：©2025 乐辰生物
"""
import asyncio
import copy
from AppSettings.Settings import *
from PyQt5                                                      import Qt
from abc                                                        import abstractmethod, abstractclassmethod, abstractstaticmethod
from AppInterfaces.utils                                        import *
from AppUtils.utils                                             import *
from AppCore.Levels                                             import *
from AppCore.DBModels                                           import *
from AppInterfaces.Interfaces                                   import *

class AppBusinessInterface(AdapterInterface):
    ScanLevel                       : int                                   #
    FlowLocker                      : Qt.QMutex                             # 流程锁
    Config                          : ContextConfigureInterface             # 参数配置文件
    SystemConfig                    : SystemConfigInterface                 # 系统配置
    HardWare                        : HardWareManagerInterface              # 硬件模块功能
    GlobalStatus                    : StatusConfigInterface                 # 玻片状态
    Application                     : Qt.QApplication                       # 事件循环模块
    Algorithm                       : AlgorithmManagerInterface             # 数据算法
    EventBus                        : EventBusInterface                     # 线程总线
    CheckBusiness                   : 'AppBusinessInterface'                # 片仓检测玻片业务
    PickBusiness                    : 'AppBusinessInterface'                # 片仓获取玻片业务
    DropBusiness                    : 'AppBusinessInterface'                # 片仓放置玻片业务
    FocusingBusiness                : 'AppBusinessInterface'                # 玻片定焦业务
    ScanningBusiness                : 'AppBusinessInterface'                # 玻片平扫业务
    OilingBusiness                  : 'AppBusinessInterface'                # 玻片滴油业务
    CellFocusingBusiness            : 'AppBusinessInterface'                # 高倍定焦业务
    SlideScanningBusiness           : 'AppBusinessInterface'                # 玻片扫描业务

    @abstractmethod
    def isValid(self) -> bool:
        return False

    @abstractmethod
    def Done(self, **args):
        pass

    @abstractmethod
    def WaitDone(self, **args) -> int:
        pass

    @abstractmethod
    def initModules(self, parent = None, **args):
        pass

    @property
    def checkbusiness(self) -> 'AppBusinessInterface':
        if not self.hasCheckBusiness:
            self.initCheckBusiness()
        return self.CheckBusiness

    @property
    def pickbusiness(self) -> 'AppBusinessInterface':
        if not self.hasPickBusiness:
            self.initPickBusiness()
        return self.PickBusiness

    @property
    def dropbusiness(self) -> 'AppBusinessInterface':
        if not self.hasDropBusiness:
            self.initDropBusiness()
        return self.DropBusiness


    @property
    def focusingbusiness(self) -> 'AppBusinessInterface':
        if not self.hasFocusingBusiness:
            self.initFocusingBusiness()
        return self.FocusingBusiness

    @property
    def scanningbusiness(self) -> 'AppBusinessInterface':
        if not self.hasScanningBusiness:
            self.initScanningBusiness()
        return self.ScanningBusiness

    @property
    def oilingbusiness(self) -> 'AppBusinessInterface':
        if not self.hasOilingBusiness:
            self.initOilingBusiness()
        return self.OilingBusiness

    @property
    def cellfocusingBusiness(self) -> 'AppBusinessInterface':
        if not self.hasCellFocusingBusiness:
            self.initCellFocusingBusiness()
        return self.CellFocusingBusiness



    @property
    def slidescanningbusiness(self) -> 'AppBusinessInterface':
        if not self.hasSlideScanningBusiness:
            self.initSlideScanningBusiness()
        return self.SlideScanningBusiness

    @property
    def config(self) -> ContextConfigureInterface:
        return None if not self.hasConfig else self.Config

    @property
    def system(self) -> SystemConfigInterface:
        return None if not self.hasSystemConfig else self.SystemConfig

    @property
    def devices(self) -> HardWareManagerInterface:
        return None if not self.hasHardWare else self.HardWare

    @property
    def status(self) -> StatusConfigInterface:
        return None if not self.hasGlobalStatus else self.GlobalStatus

    @property
    def application(self) -> Qt.QApplication:
        return None if not self.hasApplication else self.Application

    @property
    def algorithm(self) -> AlgorithmManagerInterface:
        return None if not self.hasAlgorithm else self.Algorithm

    @property
    def eventBus(self) -> EventBusInterface:
        return None if not self.hasEventBus else self.EventBus

    @property
    def eventbus(self) -> EventBusInterface:
        return None if not self.hasEventBus else self.EventBus


    @abstractmethod
    def UpdateDeviceStatus(self):
        pass

    @abstractmethod
    def initCamera(self):
        pass

    @abstractmethod
    def initMotion(self):
        pass

    @abstractmethod
    def initScanCode(self):
        pass

    @abstractmethod
    def initWebServer(self):
        pass


    @abstractmethod
    def initScanLevel                       (self):
        pass

    @abstractmethod
    def initFlowLocker                      (self):
        pass

    @abstractmethod
    def initConfig                          (self):
        pass

    @abstractmethod
    def initSystemConfig                    (self):
        pass

    @abstractmethod
    def initHardWare                        (self):
        pass

    @abstractmethod
    def initGlobalStatus                    (self):
        pass

    @abstractmethod
    def initApplication                     (self):
        pass

    @abstractmethod
    def initAlgorithm                       (self):
        pass

    @abstractmethod
    def initEventBus                        (self):
        pass

    @abstractmethod
    def initCheckBusiness                   (self):
        pass

    @abstractmethod
    def initPickBusiness                    (self):
        pass

    @abstractmethod
    def initDropBusiness                    (self):
        pass



    @abstractmethod
    def initFocusingBusiness                (self):
        pass

    @abstractmethod
    def initScanningBusiness                (self):
        pass

    @abstractmethod
    def initOilingBusiness                  (self):
        pass

    @abstractmethod
    def initCellFocusingBusiness            (self):
        pass

    @abstractmethod
    def initSlideScanningBusiness           (self):
        pass


    def initDevices(self):
        if not self.hasHardWare:
            self.initHardWare()
        if not self.hasHardWare:
            return
        if not self.hasCamera:
            self.devices.initDevices()
        if not self.hasMotion:
            self.devices.initDevices()
        if not self.hasScanCode:
            self.devices.initDevices()
        if not self.hasWebServer:
            self.devices.initDevices()
        pass

    def initEventPools(self):
        if not self.hasEventBus:
            self.initEventBus()
        if not self.hasEventBus:
            return
        self.eventBus.initPools()
        self.eventBus.StartWork()

    @property
    def uievent(self) -> AppEventInterface:
        return None if not self.hasUiEvent else self.eventBus.uievent  #

    @property
    def webevent(self) -> AppEventInterface:
        return None if not self.hasWebEvent else self.eventBus.webevent  #

    @property
    def focusingevent(self) -> AppEventInterface:
        return None if not self.hasFocusing else self.eventBus.focusingevent  #

    @property
    def scanningevent(self) -> AppEventInterface:
        return None if not self.hasScanning else self.eventBus.scanningevent  #

    @property
    def camerascanningevent(self) -> AppEventInterface:
        return None if not self.hasCameraScanning else self.eventBus.camerascanningevent  #

    @property
    def camerafocusingevent(self) -> AppEventInterface:
        return None if not self.hasCameraFocusing else self.eventBus.camerafocusingevent  #

    @property
    def webserverevent(self) -> AppEventInterface:
        return None if not self.hasWebServerEvent else self.eventBus.webserverevent  #

    @property
    def cellfocusingevent(self) -> AppEventInterface:
        return None if not self.hasCellFocusing else self.eventBus.cellfocusingevent  #

    @property
    def hasUiEvent(self) -> bool:
        return self.hasEventBus and self.eventBus.hasUiEvent

    @property
    def hasWebEvent(self) -> bool:
        return self.hasEventBus and self.eventBus.hasWebEvent

    @property
    def hasFocusing(self) -> bool:
        return self.hasEventBus and self.eventBus.hasFocusing

    @property
    def hasScanning(self) -> bool:
        return self.hasEventBus and self.eventBus.hasScanning

    @property
    def hasCameraScanning(self) -> bool:
        return self.hasEventBus and self.eventBus.hasCameraScanning

    @property
    def hasCameraFocusing(self) -> bool:
        return self.hasEventBus and self.eventBus.hasCameraFocusing

    @property
    def hasWebServerEvent(self) -> bool:
        return self.hasEventBus and self.eventBus.hasWebServerEvent

    @property
    def hasCellFocusing(self) -> bool:
        return self.hasEventBus and self.eventBus.hasCellFocusing


    @property
    def hasCamera(self) -> bool:
        return self.hasDevices and self.devices.hasCamera

    @property
    def hasMotion(self) -> bool:
        return self.hasDevices and self.devices.hasMotion


    @property
    def hasScanCode(self) -> bool:
        return self.hasDevices and self.devices.hasScanCode

    @property
    def hasWebServer(self) -> bool:
        return self.hasDevices and self.devices.hasWebServer

    @property
    def hasManipulator(self) -> bool:
        return self.hasDevices and self.devices.hasManipulator

    @property
    def hasMicroscope(self) -> bool:
        return self.hasDevices and self.devices.hasMicroscope

    @property
    def hasDetection(self) -> bool:
        return self.hasManipulator and self.manipulator.hasDetector

    @property
    def webserver(self) -> WebReaderInterface:
        return self.devices.webserver if self.hasWebServer else None

    @property
    def camera(self) -> CameraReaderInterface:
        return self.devices.camera if self.hasCamera else None

    @property
    def motion(self) -> MotionReaderInterface:
        return self.devices.motion if self.hasMotion else None

    @property
    def scancode(self) -> ScanCodeReaderInterface:
        return self.devices.scancode if self.hasScanCode else None

    @property
    def manipulator(self) -> ManipulatorReaderInterface:
        return self.devices.manipulator if self.hasManipulator else None

    @property
    def microscope(self) -> MicroscopeReaderInterface:
        return self.devices.microscope if self.hasMicroscope else None

    @property
    def detection(self) -> DetectionImplInterface:
        return self.manipulator.detector if self.hasDetector else None

    @property
    def axis_x(self) -> AxisImplInterface:
        return self.manipulator.axis_x if self.hasAxisX else None

    @property
    def axis_y(self) -> AxisImplInterface:
        return self.manipulator.axis_y if self.hasAxisY else None

    @property
    def axis_h(self) -> HookImplInterface:
        return self.manipulator.axis_h if self.hasAxisX else None

    @property
    def scan_x(self) -> AxisImplInterface:
        return self.manipulator.scan_x if self.hasScanX else None

    @property
    def scan_y(self) -> AxisImplInterface:
        return self.manipulator.scan_y if self.hasScanY else None

    @property
    def slow_x(self) -> AxisImplInterface:
        return self.manipulator.slow_x if self.hasSlowX else None

    @property
    def slow_y(self) -> AxisImplInterface:
        return self.manipulator.slow_y if self.hasSlowY else None

    @property
    def drop_x(self) -> AxisImplInterface:
        return self.manipulator.drop_x if self.hasDropX else None

    @property
    def drop_y(self) -> AxisImplInterface:
        return self.manipulator.drop_y if self.hasDropY else None

    @property
    def axis_z(self) -> AxisImplInterface:
        return self.manipulator.axis_z if self.hasAxisZ else None

    @property
    def detector(self) -> DetectionImplInterface:
        return self.Detector if self.hasDetector else None

    @property
    def isWebServerAvailable(self) -> bool:
        return self.hasWebSocket and self.webserver.isAvailable

    @property
    def isCameraAvailable(self) -> bool:
        return self.hasCamera and self.camera.isAvailable



    @property
    def isManipulatorAvailable(self) -> bool:
        return self.hasManipulator and self.manipulator.isAvailable

    @property
    def isMicroscopeAvailable(self) -> bool:
        return self.hasMicroscope and self.microscope.isAvailable

    @property
    def hasScanLevel                       (self) -> bool:
        return hasattr(self, 'ScanLevel'                ) and isinstance(self.ScanLevel                       , int                          )

    @property
    def hasFlowLocker                      (self) -> bool:
        return hasattr(self, 'FlowLocker'               ) and isinstance(self.FlowLocker                      , Qt.QMutex                    )

    @property
    def hasConfig                          (self) -> bool:
        return hasattr(self, 'Config'                   ) and isinstance(self.Config                          , ContextConfigureInterface    )

    @property
    def hasSystemConfig                    (self) -> bool:
        return hasattr(self, 'SystemConfig'             ) and isinstance(self.SystemConfig                    , SystemConfigInterface        )

    @property
    def hasDevices(self) -> bool:
        return hasattr(self, 'HardWare') and isinstance(self.HardWare, HardWareManagerInterface)

    @property
    def hasHardWare                        (self) -> bool:
        return hasattr(self, 'HardWare'                 ) and isinstance(self.HardWare                        , HardWareManagerInterface     )

    @property
    def hasGlobalStatus                    (self) -> bool:
        return hasattr(self, 'GlobalStatus'             ) and isinstance(self.GlobalStatus                    , StatusConfigInterface        )

    @property
    def hasApplication                     (self) -> bool:
        return hasattr(self, 'Application'              ) and isinstance(self.Application                     , Qt.QApplication              )

    @property
    def hasAlgorithm                       (self) -> bool:
        return hasattr(self, 'Algorithm'                ) and isinstance(self.Algorithm                       , AlgorithmManagerInterface    )

    @property
    def hasEventBus                        (self) -> bool:
        return hasattr(self, 'EventBus'                 ) and isinstance(self.EventBus                        , EventBusInterface            )

    @property
    def hasCheckBusiness                   (self) -> bool:
        return hasattr(self, 'CheckBusiness'            ) and self.CheckBusiness            is not None

    @property
    def hasPickBusiness                    (self) -> bool:
        return hasattr(self, 'PickBusiness'             ) and self.PickBusiness             is not None

    @property
    def hasDropBusiness                    (self) -> bool:
        return hasattr(self, 'DropBusiness'             ) and self.DropBusiness             is not None


    @property
    def hasFocusingBusiness                (self) -> bool:
        return hasattr(self, 'FocusingBusiness'         ) and self.FocusingBusiness         is not None

    @property
    def hasScanningBusiness                (self) -> bool:
        return hasattr(self, 'ScanningBusiness'         ) and self.ScanningBusiness         is not None

    @property
    def hasOilingBusiness                  (self) -> bool:
        return hasattr(self, 'OilingBusiness'           ) and self.OilingBusiness           is not None

    @property
    def hasCellFocusingBusiness            (self) -> bool:
        return hasattr(self, 'CellFocusingBusiness'     ) and self.CellFocusingBusiness     is not None

    @property
    def hasSlideScanningBusiness           (self) -> bool:
        return hasattr(self, 'SlideScanningBusiness'    ) and self.SlideScanningBusiness    is not None



    @property
    def hasAxisX(self) -> bool:
        return self.hasManipulator and self.manipulator.hasAxisX

    @property
    def hasAxisY(self) -> bool:
        return self.hasManipulator and self.manipulator.hasAxisY

    @property
    def hasAxisH(self) -> bool:
        return self.hasManipulator and self.manipulator.hasAxisH

    @property
    def hasScanX(self) -> bool:
        return self.hasManipulator and self.manipulator.hasScanX

    @property
    def hasScanY(self) -> bool:
        return self.hasManipulator and self.manipulator.hasScanY

    @property
    def hasSlowX(self) -> bool:
        return self.hasManipulator and self.manipulator.hasSlowX

    @property
    def hasSlowY(self) -> bool:
        return self.hasManipulator and self.manipulator.hasSlowY

    @property
    def hasDropX(self) -> bool:
        return self.hasManipulator and self.manipulator.hasDropX

    @property
    def hasDropY(self) -> bool:
        return self.hasManipulator and self.manipulator.hasDropY

    @property
    def hasAxisZ(self) -> bool:
        return self.hasManipulator and self.manipulator.hasAxisZ

    @property
    def hasDetector(self) -> bool:
        return self.hasManipulator and self.manipulator.hasDetector

    """报警控制"""

    @abstractmethod
    def clearWarning(self):
        pass

    @abstractmethod
    def setWarning(self, warning: str, enable: (bool, int) = True):
        pass

    @abstractmethod
    def sendWarning(self, warning: str):
        pass

    @abstractmethod
    def sendMessage(self, message: str):
        pass

    @abstractmethod
    def isBuzzerAvailable(self) -> bool:
        pass

    @abstractmethod
    def setBuzzerAvailable(self, enable: (bool, int)):
        pass

    @abstractmethod
    def process_scanning_status(self) -> int:
        """处理扫描状态: 暂停 退出 跳过"""
        pass

    @abstractmethod
    def waitForBuzzerOFF(self, waittimes: int = 30000) -> bool:
        pass

    @abstractmethod
    def waitForCloseTheDoor(self, waittimes: int = 30000) -> bool:
        pass

    @abstractmethod
    def isCloseTheDoor(self) -> bool:
        pass

    @abstractmethod
    def startOilDripping(self, speed) -> int:
        """设置油泵速度"""

    @abstractmethod
    def oilDripping(self, waittimes: int, finish_waittimes: int):
        """油泵滴油 等待一定时长后停止 等待一定时长"""

    @abstractmethod
    def isCellScan(self, chamber_number: int, row_number: int) -> int:
        pass

    @abstractmethod
    def isFocusingCellAvailable(self, model: SlideModelInterface) -> bool:
        pass

    """获取当前玻片的模型名称"""

    @classmethod
    def getFocusingClassifier(cls, item: SlideModelInterface) -> str:
        classifier: str = 'Aberration'
        if not item.hasPreview:
            template, Preview, Collect = AppStatus.getSlideScanTemplate(item.ChamberGroupNumber, item.ChamberRowNumber)
            if template is None or Preview is None or Collect is None:
                return classifier
            PreviewClassifier           = PreviewClassifierModel.Classifier(Preview.classifier)
            PreferredClassifier         = None
            CollectClassifier           = PreviewClassifierModel.Classifier(Collect.classifier)
            is_save                     = Collect.is_save if Collect.has_is_save else 1
            item.ScanTemplate           = template  #
            item.Preview                = Preview  #
            item.Collect                = Collect  #
            item.PreviewClassifier      = PreviewClassifier  #
            item.PreferredClassifier    = PreferredClassifier  #
            item.CollectClassifier      = CollectClassifier  #
            item.IsSave                 = is_save  #
        if ScanStatusLevel.isLowFocusing(item.Level):
            if item.preview.has_classifier:
                classifier = item.preview.classifier
        else:
            if item.collect.has_classifier:
                classifier = item.collect.classifier
        return classifier

    """获取当前玻片数据模型"""

    def getChamberSlideClassifier(self, chamber_number: int, row_number: int, isLowObjective: bool = True) -> str:
        classifier: str = 'Aberration'
        Preview: Previewsettings
        Collect: Collectsettings
        template, Preview, Collect = self.status.getSlideScanTemplate(chamber_number, row_number)
        if template is None or Preview is None or Collect is None:
            return classifier
        if isLowObjective:
            if Preview.has_classifier:
                classifier = Preview.classifier
        else:
            if Collect.has_classifier:
                classifier = Collect.classifier
        return classifier

    @abstractmethod
    def waitForEmpty(self, waittimes: int = None):
        """等待线程数据全部执行完成"""

    @abstractmethod
    def waitForFocusingEmpty(self, waittimes: int = None):
        """等待定焦线程数据全部执行完成"""

    @abstractmethod
    def waitForScanningEmpty(self, waittimes: int = None):
        """等待快扫线程数据全部执行完成"""


    @abstractmethod
    def waitForHome_xy_microscope(self):
        pass

    @abstractmethod
    def waitForHome_z(self):
        pass

    @abstractmethod
    def ChamberCheckTray(self, chamber_number: int, **args) -> int:
        pass

    @abstractmethod
    def ChamberCheck(self, **args) -> int:
        pass

    @abstractmethod
    def ChamberToSlideTable(self, chamber_number: int, isExit: bool = True, **args) -> int:
        pass

    @abstractmethod
    def SlideTableToChamber(self, chamber_number: int, isExit: bool = True, **args) -> int:
        pass


    @abstractmethod
    def waitForWarning(self, warning_string: str, **args):
        pass

    """定焦停止信号"""

    def SlotFocusingComplete(self):
        if self.status.focusing_status != ScanStatusLevel.FocusingFinish_Status:
            self.status.setFocusingStatus(ScanStatusLevel.FocusingFinish_Status)

    @abstractmethod
    def StartFocusing(self, slide: SlideFocusingModel, Objective: ObjectiveModel, focusing_status: int, isMono: bool = True, isGrabbing: bool = True, isShowFocusing: bool = True):
        pass


    @abstractmethod
    def StartClassifierFocusing(self, slide: SlideFocusingModel, Objective: ObjectiveModel, focusing_status: int, classifier: str = 'Aberration', isGrabbing: bool = True, isShowFocusing: bool = True):
        pass


    @abstractmethod
    def StartCellFocusing(self, slide: SlideFocusingModel, Objective: ObjectiveModel, focusing_status: int, isMono: bool = True, isGrabbing: bool = True, isShowFocusing: bool = True):
        pass


    @abstractmethod
    def StartCellClassifierFocusing(self, slide: SlideFocusingModel, Objective: ObjectiveModel, focusing_status: int, classifier: str = 'Aberration', isGrabbing: bool = True, isShowFocusing: bool = True):
        pass



    @abstractmethod
    def StartCustomClassifierFocusing(self, slide: SlideModelInterface, Objective: ObjectiveModel, b_z: int, e_z: int, focusing_z_speed: int, focusing_status: int, classifier: str = 'Aberration', isGrabbing: bool = True, isShowFocusing: bool = True) -> (int, SlideModelInterface):
        pass


    @abstractmethod
    def StartClassifierScanFocusing(self, slide: SlideModelInterface, Objective: ObjectiveModel, focusing_status: int, classifier: str = 'Aberration', isShowFocusing: bool = True) -> (int, SlideModelInterface):
        pass


    @abstractmethod
    def RangeClassifierFocusing(self, slide: SlideModelInterface, Objective: ObjectiveModel, focusing_b_z: int, focusing_e_z: int, focusing_z_speed: int, focusing_status: int, classifier: str = 'Aberration', isGrabbing: bool = True) -> (int, SlideModelInterface):
        pass

    @abstractmethod
    def start_z_moving(self, speed: int, max_waittimes: int = 300000) -> int:
        pass

    @abstractmethod
    def waitForFocusing(self, z: (float, int), max_waittimes: int = 55000, reset_times: int = 5000) -> int:
        pass

    @abstractmethod
    def waitForStartClassifierFocusing(self, slide: SlideModelInterface, classifier: str = 'Aberration', waittimes: int = 5000) -> int:
        pass


    @abstractmethod
    def save_specimen(self, chamber_number: int, row_number: int, tray_number: int):
        pass

    """###############################################玻片扫描流程"""
    """检测片仓"""
    @abstractmethod
    def CheckChamberSlide(self, chamber_number: int = None, isSafe: bool = False, isExit: bool = True, **args) -> int:
        pass

    """玻片取片"""

    @abstractmethod
    def PickChamberSlide(self, chamber_number: int, isSafe: bool = False, isExit: bool = True, **args) -> int:
        pass

    """片仓放片"""

    @abstractmethod
    def DropChamberSlide(self, chamber_number: int, isSafe: bool = False, isExit: bool = True, **args) -> int:
        pass

    """玻片低倍物镜定焦"""

    @abstractmethod
    def SlideLowFocusing(self, chamber_number: int, row_number: int, isSafe: bool = False, **args) -> int:
        pass

    """玻片低倍物镜快扫"""
    @abstractmethod
    def SlideLowScanning(self, chamber_number: int, row_number: int, isSafe: bool = False, **args) -> int:
        pass

    """玻片滴油"""
    @abstractmethod
    def SlideOilDropping(self, chamber_number: int, row_number: int, isSafe: bool = False, **args) -> int:
        pass

    """玻片高倍物镜定焦"""
    @abstractmethod
    def SlideSampleCellFocusing(self, chamber_number: int, row_number: int, isSafe: bool = False, isExit: bool = True, **args) -> int:
        pass

    """底倍扫描玻片 """

    @abstractmethod
    def LowScanningTraySlide(self, chamber_number: int, row_number: int, isSafe: bool = False, **args) -> int:
        pass

    """高倍扫描玻片 玻片滴油"""

    @abstractmethod
    def HigScanningTraySlide(self, chamber_number: int, row_number: int, isSafe: bool = False, **args) -> int:
        pass

    """玻片扫描"""

    @abstractmethod
    def waitForSlideScanning(self, chamber_number: int, row_number: int, isSafe: bool = False, **args) -> int:
        pass

    @abstractmethod
    def waitForClearSlideTable(self):
        pass

    @abstractmethod
    def waitForSucceedPickAvailable(self, chamber_number: int) -> (int, int):
        pass

    @abstractmethod
    def waitForSucceedSlideAvailable(self, chamber_number: int) -> (int, int):
        pass


    @abstractmethod
    def readyChamberScanning(self, isAutoScanning: bool = True) -> int:
        pass

    @abstractmethod
    def finishChamberScanning(self, flag: int = RECODE_SUCCEED) -> int:
        pass

    @abstractmethod
    def changedScanningStatus(self, chamber_number: int, row_number: int, tray_number: int, level: int, codestring: str = None, objective: int = None):
        """修改当前扫描状态"""
        pass

    @abstractmethod
    def setScanningStatus(self, tray_number: int, scan_status: int, model: SlideModelInterface):
        pass

    @abstractmethod
    def ChangedScanningStatus(self, chamber_number: int, row_number: int, status: int, objective: int = None, **args):
        """修改当前扫描状态"""