Exemplo n.º 1
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();
                }
            }
        }
Exemplo n.º 2
0
        internal ER CreateUdpCep(ID cepid, ref T_UDP_CCEP pk_ccep, out ID p_cepid)
        {
            int i;

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

            if (cepid == ID.ID_AUTO)
            {
                //if (p_cepid == 0)
                //	return ER.E_PAR;

                cepid.Value = 1;

                for (i = 0; ; i++)
                {
                    if (i >= m_UdpCepTable.Count)
                    {
                        UdpCep udpCep = new UdpCep(cepid, ref pk_ccep, this, m_lwIP);
                        m_UdpCepTable.Add(udpCep);
                        break;
                    }

                    if (cepid == m_UdpCepTable[i].CepID)
                    {
                        cepid.Value++;
                    }
                    else
                    {
                        UdpCep udpCep = new UdpCep(cepid, ref pk_ccep, this, m_lwIP);
                        m_UdpCepTable.Insert(i, udpCep);
                        break;
                    }
                }
                p_cepid = cepid;
            }
            else
            {
                ID tmpid;

                p_cepid = ID.NULL;

                for (i = 0; i < m_UdpCepTable.Count; i++)
                {
                    tmpid = m_UdpCepTable[i].CepID;

                    if (cepid == tmpid)
                    {
                        return(ER.E_OBJ);
                    }
                    else if (cepid < tmpid)
                    {
                        break;
                    }
                }
                UdpCep udpCep = new UdpCep(cepid, ref pk_ccep, this, m_lwIP);
                m_UdpCepTable.Insert(i, udpCep);
            }

            return(ER.E_OK);
        }