#!D:/IDE/anaconda3/envs/Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
@FileName：DetectionRegisterContext.py
@Description：
@Author：XSH
@Time：2025/11/14 16:46
@Department：研发部
@Copyright：©2025 乐辰生物
"""
import sys
from PyQt5                              import Qt
from AppInterfaces.ModelInterface       import ContextModelInterface
from AppCore.Levels                     import *
from AppUtils.utils                     import *
from AppCore.Requests                   import *


class DetectionRegisterContext(ContextModelInterface):
    __slots__ = (
        'Level'                         ,
        'OilPumpRegister'               ,
        'OilSpeedRegister'              ,
        'OilStatusRegister'             ,
        'DoorStatusRegister'            ,
        'BuzzerRegister'                ,
        'ChamberStatusRegister'         ,
    )
    __types__ = (
        int             ,
        int             ,
        int             ,
        int             ,
        int             ,
        int             ,
        int             ,
    )
    Level                 : int
    OilPumpRegister       : int
    BuzzerRegister        : int
    OilStatusRegister     : int
    DoorStatusRegister    : int
    ChamberStatusRegister : int
    OilSpeedRegister      : int


    def __init__(self, Information: str = "", **args):
        super(DetectionRegisterContext, self).__init__()
        self.initialization(Information)
        self.initParameter(**args)

    def initValue(self):
        super(DetectionRegisterContext, self).initValue()
        self.Level                      = AxisLevel.Detection
        self.OilPumpRegister      = 70
        self.BuzzerRegister       = 71
        self.OilStatusRegister    = 13
        self.DoorStatusRegister   = 312
        self.ChamberStatusRegister= 310
        self.OilSpeedRegister     = 3000
        self.flushInfo()

    def initDetection(self):
        self.Level                      = AxisLevel.Detection
        self.OilPumpRegister      = 70
        self.BuzzerRegister       = 71
        self.OilStatusRegister    = 13
        self.DoorStatusRegister   = 312
        self.ChamberStatusRegister= 310
        self.OilSpeedRegister     = 3000
        self.flushInfo()

    def flushInfo(self):
        if self.Level == AxisLevel.AxisX:
            self.Information = "Ｘ轴地址"
        elif self.Level == AxisLevel.AxisY:
            self.Information = "Ｙ轴地址"
        elif self.Level == AxisLevel.AxisH:
            self.Information = "快扫Ｈ轴地址"
        elif self.Level == AxisLevel.AxisZ:
            self.Information = "快扫Ｚ轴地址"
        elif self.Level == AxisLevel.ScanX:
            self.Information = "快扫Ｘ轴地址"
        elif self.Level == AxisLevel.ScanY:
            self.Information = "快扫Ｙ轴地址"
        elif self.Level == AxisLevel.SlowScanX:
            self.Information = "慢扫Ｘ轴地址"
        elif self.Level == AxisLevel.SlowScanY:
            self.Information = "慢扫Ｙ轴地址"
        elif self.Level == AxisLevel.DropOilX:
            self.Information = "滴油Ｘ轴地址"
        elif self.Level == AxisLevel.DropOilY:
            self.Information = "滴油Ｙ轴地址"
        elif self.Level == AxisLevel.AxisZ:
            self.Information = "片仓Ｚ轴地址"
        elif self.Level == AxisLevel.Detection:
            self.Information = "传感器地址"
        else:
            self.Information = "Ｘ轴地址"