Example #1
0
        public ER DefineCyclicHandler(HNO cycno, ref T_DCYC pk_dcyc)
        {
            CyclicHandler Cyc;

            //if (pk_dcyc == null)
            //	return ER.E_PAR;

            if (cycno >= m_CyclicHandlerTable.Count)
            {
                return(ER.E_PAR);
            }

            Cyc = m_CyclicHandlerTable[cycno];

            // 登録の場合
            if (!pk_dcyc.cycdel)
            {
                if (pk_dcyc.cychdr == null)
                {
                    return(ER.E_PAR);
                }

                if (((uint)pk_dcyc.cycact & (~1u)) != 0)
                {
                    return(ER.E_PAR);
                }

                if (pk_dcyc.cyctim <= 0)
                {
                    return(ER.E_PAR);
                }

                if (Cyc != null)
                {
                    Cyc.Redefine(ref pk_dcyc);
                }
                else
                {
                    Cyc = new CyclicHandler(cycno, ref pk_dcyc, this);
                    m_CyclicHandlerTable[cycno] = Cyc;
                }
            }
            // 登録破棄の場合
            else
            {
                if (Cyc != null)
                {
                    //delete Cyc;
                    m_CyclicHandlerTable[cycno] = null;
                }
            }

            return(ER.E_OK);
        }
Example #2
0
        public void OnSysTime()
        {
            bool Retry = false;

            m_SysTime.Value += m_SysTmrIntv;

            do
            {
                foreach (CyclicHandler Cyc in m_CyclicHandlerTable)
                {
                    if (Cyc != null)
                    {
                        Retry = Cyc.OnTime(m_SysTmrIntv) || Retry;
                    }
                }
            } while (Retry);

            foreach (Task Task in m_TaskTable)
            {
                if ((Task != null) &&
                    ((Task.rtsk.tskstat == TSKSTAT.TTS_WAI) || (Task.rtsk.tskstat == TSKSTAT.TTS_WAS)))
                {
                    Task.Progress(m_SysTmrIntv);
                }
            }

            foreach (UdpCep UdpCep in m_UdpCepTable)
            {
                if ((UdpCep != null) && (UdpCep.State))
                {
                    UdpCep.Progress(m_SysTmrIntv);
                }
            }

            foreach (Udp6Cep Udp6Cep in m_Udp6CepTable)
            {
                if ((Udp6Cep != null) && (Udp6Cep.State))
                {
                    Udp6Cep.Progress(m_SysTmrIntv);
                }
            }

            foreach (TcpCep TcpCep in m_TcpCepTable)
            {
                if ((TcpCep != null) && (TcpCep.State))
                {
                    TcpCep.Progress(m_SysTmrIntv);
                }
            }

            foreach (Task Task in m_TaskTable)
            {
                if ((Task != null) &&
                    ((Task.rtsk.tskstat == TSKSTAT.TTS_WAI) || (Task.rtsk.tskstat == TSKSTAT.TTS_WAS)))
                {
                    Task.CallTimeOut();
                }
            }

            foreach (UdpCep UdpCep in m_UdpCepTable)
            {
                if ((UdpCep != null) && (UdpCep.State))
                {
                    UdpCep.CallTimeOut();
                }
            }

            foreach (Udp6Cep Udp6Cep in m_Udp6CepTable)
            {
                if ((Udp6Cep != null) && (Udp6Cep.State))
                {
                    Udp6Cep.CallTimeOut();
                }
            }

            foreach (TcpCep TcpCep in m_TcpCepTable)
            {
                if ((TcpCep != null) && (TcpCep.State))
                {
                    TcpCep.CallTimeOut();
                }
            }
        }