Exemple #1
0
    private void StartListening()
    {
        StopBroadcasting();
        bool listening = discovery.StartAsClient();

        state = listening ? DiscoveryState.Listening : DiscoveryState.Stopped;
    }
Exemple #2
0
 private void StopBroadcasting()
 {
     if (discovery.Running)
     {
         discovery.StopBroadcast();
     }
     state = DiscoveryState.Stopped;
 }
Exemple #3
0
    private void StartBroadcasting(string deviceName, int networkPort)
    {
        StopBroadcasting();
        discovery.BroadcastData = deviceName + ":port:" + networkPort;
        bool broadcasting = discovery.StartAsServer();

        state = broadcasting ? DiscoveryState.Broadcasting: DiscoveryState.Stopped;
    }
Exemple #4
0
 public override void CreateNew(int width, int height)
 {
     base.CreateNew(width, height);
     DiscoveryArray = new DiscoveryState[width][];
     for (int ii = 0; ii < width; ii++)
     {
         DiscoveryArray[ii] = new DiscoveryState[height];
     }
 }
Exemple #5
0
        /**
         * Deserialise the contents of the structure.
         *
         * @param deserializer the {@link ZigBeeDeserializer} used to deserialize
         */
        public void Deserialize(IZigBeeDeserializer deserializer)
        {
            // Deserialize the fields
            DestinationAddress = deserializer.ReadZigBeeType <ushort>(DataType.UNSIGNED_16_BIT_INTEGER);
            byte temp = deserializer.ReadZigBeeType <byte>(DataType.UNSIGNED_8_BIT_INTEGER);

            switch (temp & 0x07)
            {
            case 0:
                Status = DiscoveryState.ACTIVE;
                break;

            case 1:
                Status = DiscoveryState.DISCOVERY_UNDERWAY;
                break;

            case 2:
                Status = DiscoveryState.DISCOVERY_FAILED;
                break;

            case 3:
                Status = DiscoveryState.INACTIVE;
                break;

            case 4:
                Status = DiscoveryState.VALIDATION_UNDERWAY;
                break;

            default:
                Status = DiscoveryState.UNKNOWN;
                break;
            }

            IsMemoryConstrained   = (temp & 0x08) != 0;
            IsManyToOne           = (temp & 0x10) != 0;
            IsRouteRecordRequired = (temp & 0x20) != 0;
            IsNextHopAddress      = deserializer.ReadZigBeeType <ushort>(DataType.UNSIGNED_16_BIT_INTEGER);
        }
 /// <summary>
 ///     Manages the discovery.
 /// </summary>
 /// <param name = "crawlRequest">The crawl request.</param>
 /// <param name = "discoveryState">State of the discovery.</param>
 /// <param name = "arachnodeDAO">The arachnode DAO.</param>
 public abstract void ManageDiscovery(CrawlRequest <TArachnodeDAO> crawlRequest, DiscoveryState discoveryState, IArachnodeDAO arachnodeDAO);
Exemple #7
0
        /// <summary>
        ///     Manages the discovery.
        /// </summary>
        /// <param name = "crawlRequest">The crawl request.</param>
        /// <param name = "discoveryState">State of the discovery.</param>
        /// <param name = "arachnodeDAO">The arachnode DAO.</param>
        public override void ManageDiscovery(CrawlRequest <TArachnodeDAO> crawlRequest, DiscoveryState discoveryState, IArachnodeDAO arachnodeDAO)
        {
            switch (discoveryState)
            {
            case DiscoveryState.PreRequest:

                crawlRequest.Discovery.DiscoveryState = DiscoveryState.PreRequest;

                crawlRequest.Crawl.Crawler.Cache.AddDiscoveryToInternalCache(crawlRequest.Discovery.CacheKey.AbsoluteUri + ApplicationSettings.UniqueIdentifier, crawlRequest.Discovery);

                if (_memoryManager.IsUsingDesiredMaximumMemoryInMegabytes(false))
                {
                    //we need to update the Discovery in the Database...
                    if (ApplicationSettings.InsertDiscoveries && crawlRequest.InsertDiscovery)
                    {
                        arachnodeDAO.InsertDiscovery(crawlRequest.Discovery.ID, crawlRequest.Discovery.CacheKey.AbsoluteUri + ApplicationSettings.UniqueIdentifier, (int)crawlRequest.Discovery.DiscoveryState, (int)crawlRequest.Discovery.DiscoveryType, crawlRequest.Discovery.ExpectFileOrImage, crawlRequest.Discovery.NumberOfTimesDiscovered);
                    }
                }
                break;

            case DiscoveryState.PostRequest:

                crawlRequest.Discovery.DiscoveryState = DiscoveryState.PostRequest;
                crawlRequest.Discovery.DiscoveryType  = crawlRequest.DataType.DiscoveryType;

                crawlRequest.Crawl.Crawler.Cache.AddDiscoveryToInternalCache(crawlRequest.Discovery.CacheKey.AbsoluteUri + ApplicationSettings.UniqueIdentifier, crawlRequest.Discovery);
                break;

            case DiscoveryState.Discovered:
                crawlRequest.Discovery.DiscoveryState = DiscoveryState.Discovered;

                crawlRequest.Crawl.Crawler.Cache.AddDiscoveryToInternalCache(crawlRequest.Discovery.CacheKey.AbsoluteUri + ApplicationSettings.UniqueIdentifier, crawlRequest.Discovery);

                //we need to update the Discovery in the Database...
                if (ApplicationSettings.InsertDiscoveries && crawlRequest.InsertDiscovery)
                {
                    arachnodeDAO.InsertDiscovery(crawlRequest.Discovery.ID, crawlRequest.Discovery.CacheKey.AbsoluteUri + ApplicationSettings.UniqueIdentifier, (int)crawlRequest.Discovery.DiscoveryState, (int)crawlRequest.Discovery.DiscoveryType, crawlRequest.Discovery.ExpectFileOrImage, crawlRequest.Discovery.NumberOfTimesDiscovered);
                }

                CloseAndDisposeManagedDiscovery(crawlRequest, arachnodeDAO);

                break;
            }
        }