Esempio n. 1
0
        public async Task <bool> getSleepStatus(int port)
        {
            bool isSleeping = false;

            try
            {
                // devuelve si el modo continuo está activado
                // y si está en sleep, que sirve para empezar el gráfico en las modalidades Auto y Single
                CContinuousModeStatus cmStatus = await jbc.GetContinuousModeAsync((long)ID);

                if (cmStatus.speed == SpeedContinuousMode.OFF)
                {
                    // si el modo continuo está desactivado, obtener el sleep del estado del puerto
                    // get remote WCF data
                    await jbc.UpdatePortStatusAsync((long)ID, (Port)(port - 1));

                    // check port status
                    if (StationType == eStationType.SOLD)
                    {
                        if (jbc.GetPortToolSleepStatus((long)ID, (Port)(port - 1)) == OnOff._ON ||
                            jbc.GetPortToolHibernationStatus((long)ID, (Port)(port - 1)) == OnOff._ON ||
                            jbc.GetPortToolStandStatus((long)ID, (Port)(port - 1)) == OnOff._ON)
                        {
                            isSleeping = true;
                        }
                        else
                        {
                            isSleeping = false;
                        }
                    }
                    if (StationType == eStationType.HA)
                    {
                        if (jbc.GetPortToolHeaterStatus((long)ID, (Port)(port - 1)) == OnOff._ON)
                        {
                            isSleeping = false;
                        }
                        else
                        {
                            isSleeping = true;
                        }
                    }
                    //Debug.Print("isSleeping cont mode OFF: {0}", isSleeping.ToString)
                }
                else
                {
                    // si el modo continuo está activado, se obtiene el sleep de los datos del modo continuo
                    //getting the required data
                    await updatePortsAsync();

                    //retunring the data
                    if (StationType == eStationType.SOLD)
                    {
                        //isSleeping = (portList(port - 1).status = JBC_API.ToolStatus.SLEEP)
                        if (portList[port - 1].status == ToolStatus.SLEEP |
                            portList[port - 1].status == ToolStatus.HIBERNATION |
                            portList[port - 1].status == ToolStatus.STAND)
                        {
                            isSleeping = true;
                        }
                        else
                        {
                            isSleeping = false;
                        }
                    }
                    if (StationType == eStationType.HA)
                    {
                        if (portList[port - 1].status_HA == ToolStatus_HA.HEATER | portList[port - 1].status_HA == ToolStatus_HA.HEATER_REQUESTED)
                        {
                            isSleeping = false;
                        }
                        else
                        {
                            isSleeping = true;
                        }
                    }
                    //Debug.Print("isSleeping cont mode ON: {0}", isSleeping.ToString)
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cstation::getSleepStatus . error:" + ex.Message);
                isSleeping = false;
            }

            return(isSleeping);
        }