void OnContentDirectoryAdded(DiscoveryEventArgs<ContentDirectory> e)
 {
     var handler = ContentDirectoryAdded;
     if (handler != null) {
         handler (this, e);
     }
 }
예제 #2
0
        void NuovoClient(object sender, DiscoveryEventArgs e)
        {
            String       ovs = e.batteria.ToString("#.#");
            ListViewItem i   = new ListViewItem(e.indirizzo.ToString());

            i.SubItems.Add(ovs);
            i.SubItems.Add(e.rssislave.ToString());
            i.SubItems.Add(e.rssimaster.ToString());
            i.ImageIndex = 0;
            if (e.batteria < 2.8)
            {
                i.Checked = false;
            }
            else
            {
                i.Checked = true;
            }
            if (e.rssimaster <= 200)
            {
                i.ImageIndex = 1;
            }
            this.Invoke((MethodInvoker) delegate { lv1.Items.Add(i); });

            //AddLvItem(i, lv1);
        }
예제 #3
0
        void IPCamera_DeviceDiscovered(object sender, DiscoveryEventArgs e)
        {
            var deviceInfo = new CameraDeviceInfo {
                IpCameraInfo = new IPVideoDeviceInfo(e.Device)
            };

            AddDeviceToList(deviceInfo);
        }
예제 #4
0
        /*
        class USBDeviceInfo
        {
            public USBDeviceInfo(string deviceID, string pnpDeviceID, string description)
            {
                this.DeviceID = deviceID;
                this.PnpDeviceID = pnpDeviceID;
                this.Description = description;
            }
            public string DeviceID { get; private set; }
            public string PnpDeviceID { get; private set; }
            public string Description { get; private set; }
        }
        */

        // fired either at startup time and after a new z-wave node has been added to the controller
        private void DiscoveryEvent(object sender, DiscoveryEventArgs e)
        {
            switch (e.Status)
            {
            case DISCOVERY_STATUS.DISCOVERY_START:
                RaisePropertyChanged(new InterfacePropertyChangedAction() {
                    Domain = this.Domain,
                    SourceId = "1",
                    SourceType = "Z-Wave Controller",
                    Path = "Controller.Status",
                    Value = "Discovery Started"
                });
                break;
            case DISCOVERY_STATUS.DISCOVERY_END:
                RaisePropertyChanged(new InterfacePropertyChangedAction() {
                    Domain = this.Domain,
                    SourceId = "1",
                    SourceType = "Z-Wave Controller",
                    Path = "Controller.Status",
                    Value = "Discovery Complete"
                });
                if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction(){ Domain = this.Domain });
                break;
            case DISCOVERY_STATUS.NODE_ADDED:
                RaisePropertyChanged(new InterfacePropertyChangedAction() {
                    Domain = this.Domain,
                    SourceId = "1",
                    SourceType = "Z-Wave Controller",
                    Path = "Controller.Status",
                    Value = "Added node " + e.NodeId
                });
                lastAddedNode = e.NodeId;
                if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction(){ Domain = this.Domain });
                break;
            case DISCOVERY_STATUS.NODE_UPDATED:
                RaisePropertyChanged(new InterfacePropertyChangedAction() {
                    Domain = this.Domain,
                    SourceId = "1",
                    SourceType = "Z-Wave Controller",
                    Path = "Controller.Status",
                    Value = "Updated node " + e.NodeId
                });
                //if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction(){ Domain = this.Domain });
                break;
            case DISCOVERY_STATUS.NODE_REMOVED:
                lastRemovedNode = e.NodeId;
                RaisePropertyChanged(new InterfacePropertyChangedAction() {
                    Domain = this.Domain,
                    SourceId = "1",
                    SourceType = "Z-Wave Controller",
                    Path = "Controller.Status",
                    Value = "Removed node " + e.NodeId
                });
                if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction(){ Domain = this.Domain });
                break;
            }
        }
        void OnContentDirectoryAdded(DiscoveryEventArgs <ContentDirectory> e)
        {
            var handler = ContentDirectoryAdded;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #6
0
 static void client_ContentDirectoryAdded(object sender, DiscoveryEventArgs<ContentDirectory> e)
 {
     Console.WriteLine ("Found");
     var root = e.Item.GetRootContainer ();
     foreach (var item in root.SearchForType<MusicTrack> (new ResultsSettings { RequestCount = 10 })) {
         Console.WriteLine (item);
         foreach (var res in item.Resources) {
             Console.WriteLine ("\t{0}{1}", res.ProtocolInfo, res.Uri);
         }
     }
 }
예제 #7
0
        /*
         * class USBDeviceInfo
         * {
         *  public USBDeviceInfo(string deviceID, string pnpDeviceID, string description)
         *  {
         *      this.DeviceID = deviceID;
         *      this.PnpDeviceID = pnpDeviceID;
         *      this.Description = description;
         *  }
         *  public string DeviceID { get; private set; }
         *  public string PnpDeviceID { get; private set; }
         *  public string Description { get; private set; }
         * }
         */

        private void DiscoveryEvent(object sender, DiscoveryEventArgs e)
        {
            //ZWaveNode node = _controller.GetDevice(e.NodeId);
            //
            if (e.Status == DISCOVERY_STATUS.NODE_REMOVED)
            {
                _lastnoderemoved = e.NodeId;
            }
            else if (e.Status == DISCOVERY_STATUS.NODE_ADDED)
            {
                _lastnodeadded = e.NodeId;
            }
        }
예제 #8
0
        static void client_ContentDirectoryAdded(object sender, DiscoveryEventArgs <ContentDirectory> e)
        {
            Console.WriteLine("Found");
            var root = e.Item.GetRootContainer();

            foreach (var item in root.SearchForType <MusicTrack> (new ResultsSettings {
                RequestCount = 10
            }))
            {
                Console.WriteLine(item);
                foreach (var res in item.Resources)
                {
                    Console.WriteLine("\t{0}{1}", res.ProtocolInfo, res.Uri);
                }
            }
        }
예제 #9
0
        void _nsq_DiscoveryCompleted(object s, DiscoveryEventArgs e)
        {
            if (IsDisposed)
            {
                return;
            }

            InvokeIfRequired(() =>
            {
                _endPoints.Clear();
                foreach (var address in e.NsqAddresses)
                {
                    _endPoints.Add(address.BroadcastAddress + ":" + address.TcpPort);
                }

                LastDiscoveryTime.Text = DateTime.Now.ToString("T");
            });
        }
예제 #10
0
 private void EventHandlerDiscoveryStateChanged(object s, DiscoveryStateChangedEventArgs e)
 {
     LogImplementation.DLog("EventHandlerDiscoveryStateChanged");
     if (e.DiscoveryState == WiFiDirectDiscoveryState.Found)
     {
         LogImplementation.DLog("Found");
         // Get the found Wi-Fi Direct peer list
         IEnumerable <WiFiDirectPeer> peerList = WiFiDirectManager.GetDiscoveredPeers();
         List <String> deviceList = new List <String>();
         foreach (WiFiDirectPeer peer in peerList)
         {
             LogImplementation.DLog("Peer " + peer.Name);
             // Add name of the found device to device list
             deviceList.Add(peer.Name);
         }
         // Generate the DeviceDiscovered event
         DiscoveryEventArgs de = new DiscoveryEventArgs(deviceList);
         DeviceDiscovered(s, de);
     }
 }
예제 #11
0
    /*
     *  protected virtual void OnThresholdReached(EventArgs e)
     *  {
     *          EventHandler handler = ThresholdReached;
     *          if (handler != null)
     *          {
     *                  handler(this, e);
     *          }
     *  }
     */
    private void ReadSerial()
    {
        //EventHandler handler = ThresholdReached;
        do
        {
            try
            {
                String   comandoricevuto = com.ReadLine().Trim();
                String[] sottocomandi    = comandoricevuto.Split(' ');
                switch (sottocomandi.Length)
                {
                case 1:
                    stato = sottocomandi[0];
                    switch (sottocomandi[0])
                    {
                    case "s0":
                        votoincorso = false;
                        if (EventoStatoZero != null)
                        {
                            EventoStatoZero(this, new EventArgs());
                        }
                        break;

                    case "ds":         // discovery
                        if (EventoInizioDiscovery != null)
                        {
                            EventoInizioDiscovery(this, new EventArgs());
                        }
                        break;

                    case "is":         // invia sync
                        if (EventoInviaSync != null)
                        {
                            EventoInviaSync(this, new EventArgs());
                        }
                        break;

                    case "ip":         // inizio poll
                        votoincorso = true;
                        if (EventoInizioPoll != null)
                        {
                            EventoInizioPoll(this, new EventArgs());
                        }
                        break;

                    default:
                        cmderr(comandoricevuto);
                        break;
                    }
                    break;

                case 2:
                    switch (sottocomandi[0])
                    {
                    case "e":         // messaggio dal master
                        MsgEventArgs mea = new MsgEventArgs();
                        mea.msg = sottocomandi[1];
                        if (EventoNuovoMessaggio != null)
                        {
                            EventoNuovoMessaggio(this, mea);
                        }
                        break;

                    case "ns":         // max numero slave
                        NumSlaveEventArgs nse = new NumSlaveEventArgs();
                        nse.numslave = int.Parse(sottocomandi[1]);
                        if (EventoRxNumMaxSlave != null)
                        {
                            EventoRxNumMaxSlave(this, nse);
                        }
                        break;

                    case "dx":         // max numero slave
                        DiscFailEventArgs dfe = new DiscFailEventArgs();
                        dfe.indirizzo = int.Parse(sottocomandi[1]);
                        if (EventoDiscFail != null)
                        {
                            EventoDiscFail(this, dfe);
                        }
                        break;

                    default:
                        cmderr(comandoricevuto);
                        break;
                    }
                    break;

                case 3:
                    switch (sottocomandi[0])
                    {
                    case "v":         // nuovo voto acquisito
                        VotoEventArgs vea = new VotoEventArgs();
                        vea.indirizzo = int.Parse(sottocomandi[1]);
                        vea.oravoto   = uint.Parse(sottocomandi[2]);
                        if (EventoVotoAcquisito != null)
                        {
                            EventoVotoAcquisito(this, vea);
                        }
                        break;

                    default:
                        cmderr(comandoricevuto);
                        break;
                    }
                    break;

                case 5:
                    switch (sottocomandi[0])
                    {
                    case "d":         // trovato nuovo client
                        DiscoveryEventArgs dea = new DiscoveryEventArgs();
                        dea.indirizzo  = int.Parse(sottocomandi[1]);
                        dea.batteria   = ((float)3.0 * float.Parse(sottocomandi[2])) / 255;
                        dea.rssislave  = int.Parse(sottocomandi[3]);
                        dea.rssimaster = int.Parse(sottocomandi[4]);
                        if (EventoNuovoClient != null)
                        {
                            EventoNuovoClient(this, dea);
                        }
                        break;

                    default:
                        cmderr(comandoricevuto);
                        break;
                    }
                    break;

                default:
                    cmderr(comandoricevuto);
                    break;
                }
            }
            catch (TimeoutException te)
            {
            }
            catch (InvalidOperationException ee)
            {
                cmderr(ee.Message);
                //return;
            }
            catch (System.IO.IOException ioe)
            {
                return;
            }
        } while (mustexit == false);
    }
 void IPCamera_DeviceDiscovered(object sender, DiscoveryEventArgs e)
 {
     var deviceInfo = new CameraDeviceInfo { IpCameraInfo = new IPVideoDeviceInfo(e.Device) };
     AddDeviceToList(deviceInfo);
 }
예제 #13
0
 private void IPCameraFactory_DeviceDiscovered(object sender, DiscoveryEventArgs e)
 {
     _devices.Add("[IPCamera] Host: " + e.Device.Host + " Uri: " + e.Device.Uri);
     IPDevicesDiscovered = true;
 }
예제 #14
0
 private void IPCamera_DiscoveryCompleted(object sender, DiscoveryEventArgs e)
 {
     _deviceList.Add(e.Device);
     InvokeGuiThread(() => comboBox_Devices.Items.Add(e.Device.Name));
 }