コード例 #1
0
        internal CSearchConnectTCP(CSearchDevicesTCP RefPadre)
        {
            MS_WAIT_ACK      = 2000;
            MS_WAIT_FIRMWARE = 2000;

            discoveredStations       = new CStationtableTCP();
            m_StatusConnect          = StatusConnect.StopSearch;
            m_Timer_Search.Interval  = MS_WAIT_SEARCH;
            m_Timer_Search.AutoReset = false; // se debe activar de nuevo al salir del evento Elapsed
            m_Timer_Search.Enabled   = false;
            m_Timer_Search.Elapsed  += Timer_Search_Elapsed;
            m_Timer_Search.Start();
            m_reintentos = 0;
        }
コード例 #2
0
        /// <summary>
        /// Start searching connected stations.
        /// </summary>
        /// <param name="searchMode">Select the connection type</param>
        /// <remarks></remarks>
        internal void StartSearch(SearchMode searchMode = default(SearchMode))
        {
            switch (searchMode)
            {
            case SearchMode.ALL:
                m_StationSearcherUSB = new SearchDevicesUSB();
                m_StationSearcherUSB.NewConnection += StationSearcherUSB_NewConnection;
                m_StationSearcherTCP = new CSearchDevicesTCP(null);
                m_StationSearcherTCP.NewConnection += StationSearcherTCP_NewConnection;
                break;

            case SearchMode.USB:
                m_StationSearcherUSB = new SearchDevicesUSB();
                m_StationSearcherUSB.NewConnection += StationSearcherUSB_NewConnection;
                break;

            case SearchMode.ETH:
                m_StationSearcherTCP = new CSearchDevicesTCP(null);
                m_StationSearcherTCP.NewConnection += StationSearcherTCP_NewConnection;
                break;
            }
        }
コード例 #3
0
        /// <summary>
        /// Stop searching connected stations.
        /// </summary>
        /// <param name="searchMode">Select the connection type</param>
        /// <remarks></remarks>
        internal void StopSearch(SearchMode searchMode)
        {
            switch (searchMode)
            {
            case SearchMode.ALL:
                if (m_StationSearcherUSB != null)
                {
                    m_StationSearcherUSB.Eraser();
                    m_StationSearcherUSB.NewConnection -= StationSearcherUSB_NewConnection;
                    m_StationSearcherUSB = null;
                }
                if (m_StationSearcherTCP != null)
                {
                    m_StationSearcherTCP.Dispose();
                    m_StationSearcherTCP.NewConnection -= StationSearcherTCP_NewConnection;
                    m_StationSearcherTCP = null;
                }
                break;

            case SearchMode.USB:
                if (m_StationSearcherUSB != null)
                {
                    m_StationSearcherUSB.Eraser();
                    m_StationSearcherUSB.NewConnection -= StationSearcherUSB_NewConnection;
                    m_StationSearcherUSB = null;
                }
                break;

            case SearchMode.ETH:
                if (m_StationSearcherTCP != null)
                {
                    m_StationSearcherTCP.Dispose();
                    m_StationSearcherTCP.NewConnection -= StationSearcherTCP_NewConnection;
                    m_StationSearcherTCP = null;
                }
                break;
            }
        }