Example #1
0
        private void StartScanning(
            ScanConfirmHandler handler)
        {
            _scanning           = true;
            _scanConfirmHandler = handler; // if scannig is true, handler must be valid!
            _scanResults.Clear();

            // get supported radio channels
            _net.Mac.GetRequest(PibAttribute.phyChannelsSupported, 0, HandlerChannelsSupported);
        }
Example #2
0
        /// <summary>
        /// To find nearby networks. Result list only include 802.15.4 networks that provide the protocol ID of this protocol in the beacons.
        /// </summary>
        /// <param name="handler">handler for result</param>
        public void ScanRequest(
            ScanConfirmHandler handler)
        {
            if (handler == null)
            {
                return;
            }
            if (_running || _scanning)
            {
                handler.Invoke(_net, Status.Busy, null);
                return;
            }

            StartScanning(handler);
        }
Example #3
0
        private void FinishScanningThread()
        {
            Status status = _scanStatus;

            ScanResult[] networks = null;

            if (status == Status.Success)
            {
                lock (_scanResults)
                {
                    int countMesh = 0;
                    int countAll  = _scanResults.Count;
                    for (int i = 0; i < countAll; i++)
                    {
                        ScanResultInternal itemInt = (ScanResultInternal)_scanResults[i];
                        if (itemInt.isMeshProtocol)
                        {
                            countMesh++;
                        }
                    }

                    if (countMesh > 0)
                    {
                        networks  = new ScanResult[countMesh];
                        countMesh = 0;
                        for (int i = 0; i < countAll; i++)
                        {
                            ScanResultInternal itemInt = (ScanResultInternal)_scanResults[i];
                            if (itemInt.isMeshProtocol)
                            {
                                ScanResult itemExt = new ScanResult();
                                itemExt.panId         = itemInt.panDescriptor.coordPanId;
                                itemExt.linkQuality   = itemInt.panDescriptor.linkQuality;
                                networks[countMesh++] = itemExt;
                            }
                        }
                    }
                }
            }

            ScanConfirmHandler handler = _scanConfirmHandler;

            _scanning = false; // when invoking handler, handler can start next scan
            handler.Invoke(_net, status, networks);
        }
Example #4
0
        private void StartScanning(
            ScanConfirmHandler handler)
        {
            _scanning = true;
            _scanConfirmHandler = handler; // if scannig is true, handler must be valid!
            _scanResults.Clear();

            // get supported radio channels
            _net.Mac.GetRequest(PibAttribute.phyChannelsSupported, 0, HandlerChannelsSupported);
        }
Example #5
0
        /// <summary>
        /// To find nearby networks. Result list only include 802.15.4 networks that provide the protocol ID of this protocol in the beacons.
        /// </summary>
        /// <param name="handler">handler for result</param>
        public void ScanRequest(
            ScanConfirmHandler handler)
        {
            if (handler == null)
                return;
            if (_running || _scanning)
            {
                handler.Invoke(_net, Status.Busy, null);
                return;
            }

            StartScanning(handler);
        }
 /// <summary>
 /// To find nearby networks. Result list only include 802.15.4 networks that provide the protocol ID of this protocol in the beacons.
 /// </summary>
 /// <param name="handler">handler for result</param>
 public void ScanRequest(
     ScanConfirmHandler handler)
 {
     _mgmt.ScanRequest(handler);
 }
Example #7
0
 /// <summary>
 /// To find nearby networks. Result list only include 802.15.4 networks that provide the protocol ID of this protocol in the beacons.
 /// </summary>
 /// <param name="handler">handler for result</param>
 public void ScanRequest(
     ScanConfirmHandler handler)
 {
     _mgmt.ScanRequest(handler);
 }