Exemplo n.º 1
0
 private void DeviceAddedEvent(object sender, DeviceAddedEventArgs e)
 {
     if (e.Device.IsSetBusylightSupported)
     {
         _availableDevices.Add(e.Device);
     }
 }
Exemplo n.º 2
0
        void ConnectModel_DeviceAdded(object sender, DeviceAddedEventArgs e)
        {
            // add webcam
            if (e.Info.WebCameraInfo != null)
            {
                var createdCamera = new WebCameraEngine(e.Info.WebCameraInfo);
                AddCamera(createdCamera);
                //CurrentModel = createdCamera;
            }
            else if (e.Info.IpCameraInfo != null)
            {
                // add IP camera
                if (e.Info.IpCameraInfo.Uri == null)
                {
                    return;
                }

                var ipCamera = new IpCameraEngine(e.Info.IpCameraInfo.Uri.ToString(), UserName, Password);

                if (CurrentModel != null && CurrentModel.CameraInfo.Equals(ipCamera.CameraInfo))
                {
                    CurrentModel = null;
                }

                AddCamera(ipCamera);
                // CurrentModel = ipCamera;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Raises the DeviceAdded event.
 /// </summary>
 /// <param name="e">The event arguments.</param>
 protected virtual void OnDeviceAdded(DeviceAddedEventArgs e)
 {
     if (DeviceAdded != null)
     {
         DeviceAdded.GetInvocationList().InvokeEventGUIThreadSafe(this, e);
     }
 }
Exemplo n.º 4
0
        void insteon_DeviceAdded(object sender, DeviceAddedEventArgs args)
        {
            DeviceId        id        = args.Device.Address;
            DeviceReference reference = new DeviceReference(id.ToString(), PluginName);
            BasicDevice     device    = callbacks.Devices.FindDevice(reference);

            if (device != null)
            {
                InsteonDeviceData deviceData = (InsteonDeviceData)device.AutomationData;
            }
            else
            {
                InsteonDeviceData deviceData = new InsteonDeviceData(args.Device.Category, args.Device.Subcategory);
                if (args.Device is DimmingLight)
                {
                    DimmingLight dimmer = (DimmingLight)args.Device;
                    FroggyPlugin.Devices.PercentLevelDevice basic = new FroggyPlugin.Devices.PercentLevelDevice();
                    basic.Address        = reference;
                    basic.Name           = args.Device.DeviceName;
                    basic.Level          = dimmer.OnLevel * 100 / 255;
                    basic.AutomationData = deviceData;
                    callbacks.Devices.AddDevice(basic);
                }
                else if (args.Device is OnOffDevice)
                {
                    OnOffDevice onOffDevice = (OnOffDevice)args.Device;
                    FroggyPlugin.Devices.OnOffDevice basic = new FroggyPlugin.Devices.OnOffDevice();
                    basic.Address        = reference;
                    basic.Name           = args.Device.DeviceName;
                    basic.On             = onOffDevice.OnLevel != 0;
                    basic.AutomationData = deviceData;
                    callbacks.Devices.AddDevice(basic);
                }
            }
        }
Exemplo n.º 5
0
 static void insteon_DeviceAdded(object sender, DeviceAddedEventArgs args)
 {
     if (args.Device is OnOffDevice)
     {
         OnOffDevice dimmer = (OnOffDevice)args.Device;
         log.InfoFormat("{0} OnLevel {1}", dimmer.DeviceName, dimmer.OnLevel);
     }
 }
        private void OnJabraDeviceAdded(object sender, DeviceAddedEventArgs deviceAddedEventArgs)
        {
            Action action = () =>
            {
                AddJabraDevice(deviceAddedEventArgs.Device);
            };

            workQueue.Add(action);
        }
Exemplo n.º 7
0
        async void HandleDeviceAdded(object aObj, DeviceAddedEventArgs aArgs)
        {
            _device = aArgs.Device;
            await _client.StopScanningAsync();

            Device.BeginInvokeOnMainThread(() =>
            {
                btnVibrate.IsEnabled = true;
            });
        }
Exemplo n.º 8
0
 public void OnDeviceAdded(object aObj, DeviceAddedEventArgs aArgs)
 {
     Dispatcher.Invoke(() =>
     {
         try
         {
             DevicesList.Add(new CheckedListItem(aArgs.Device));
         }
         catch (Exception ex)
         {
             // Ignore already added devices
         }
     });
 }
Exemplo n.º 9
0
 void Indi_DeviceAdded(Object sender, DeviceAddedEventArgs e)
 {
     try
     {
         if (IsHandleCreated)
         {
             this.Invoke((MethodInvoker) delegate
             {
                 Device.Items.Add(e.Device.Name);
                 Device.SelectedIndex = 0;
             });
         }
     }
     catch
     {
     }
 }
        private void ClientOnDeviceAdded(object sender, DeviceAddedEventArgs e)
        {
            if (Devices.TryGetValue(e.Device.Index, out var dev))
            {
                if (!dev.Name.Equals(e.Device.Name, StringComparison.Ordinal))
                {
                    Devices.Remove(e.Device.Index);
                    Devices.Add(e.Device.Index, new ButtplugPanelDevice(e.Device));
                    return;
                }

                dev.Device      = e.Device;
                dev.IsConnected = true;
            }
            else
            {
                Devices.Add(e.Device.Index, new ButtplugPanelDevice(e.Device));
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Handles the DeviceAdded event.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The event arguments.</param>
 private void mdDiscovery_DeviceAdded(object sender, DeviceAddedEventArgs e)
 {
     DeviceFound(e, true);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Raises the DeviceAdded event.
 /// </summary>
 /// <param name="e">The event arguments.</param>
 protected virtual void OnDeviceAdded(DeviceAddedEventArgs e)
 {
     if (DeviceAdded != null)
         DeviceAdded.GetInvocationList().InvokeEventGUIThreadSafe(this, e);
 }
Exemplo n.º 13
0
        /// <summary>
        /// Raises events for when a new device is found.
        /// </summary>
        /// <param name="e">The event arguments containing the device information for the device that was found.</param>
        /// <param name="foundRoot">True if the device came from the discovery, false if it came from child devices.</param>
        protected void DeviceFound(DeviceAddedEventArgs e, bool foundRoot)
        {
            if (foundRoot || mdfoDeviceFindOption == Components.DeviceFindOption.AllChildrenDeivces)
                OnDeviceAdded(e);

            if (msfoServiceFindOption != ServiceFindOption.None)
            {
                if (msfoServiceFindOption == ServiceFindOption.AllDeviceChildrenServices ||
                    msfoServiceFindOption == ServiceFindOption.AllSearchURIMatchesServiceTypeId ||
                    (foundRoot || mdfoDeviceFindOption == DeviceFindOption.AllChildrenDeivces))
                    try
                    {
                        foreach (UPNPLib.IUPnPService lsService in e.COMDevice.Services)
                        {
                                if (
                                    (
                                        msfoServiceFindOption != ServiceFindOption.AllSearchURIMatchesServiceTypeId &&
                                        msfoServiceFindOption != ServiceFindOption.FoundDeviceDirectChildrenOnlySearchURIMatchesServiceTypeId
                                    )
                                    ||
                                    lsService.ServiceTypeIdentifier == msSearchUri)
                                    OnServiceAdded(new ServiceAddedEventArgs(e, lsService));
                        }
                    }
                    catch (Exception loE)
                    {
                        if (Logging.Enabled)
                            Logging.Log(
                                this,
                                string.Format("Exception occurred while enumerating Services: {0}", loE.ToString()));
                    }
            }

            if (mdfoDeviceFindOption == DeviceFindOption.AllChildrenDeivces ||
                msfoServiceFindOption == ServiceFindOption.AllDeviceChildrenServices ||
                msfoServiceFindOption == ServiceFindOption.AllSearchURIMatchesServiceTypeId)
                try
                {
                    foreach (UPNPLib.IUPnPDevice ldCOMDevice in e.COMDevice.Children)
                            DeviceFound(new DeviceAddedEventArgs(ldCOMDevice, e), false);
                }
                catch (Exception loE)
                {
                    if (Logging.Enabled)
                        Logging.Log(
                            this,
                            string.Format("Exception occurred while enumerating Devices: {0}", loE.ToString()));
                }
        }
Exemplo n.º 14
0
 /// <summary>
 /// Handles the DeviceAdded event.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The event arguments.</param>
 private void mdDiscovery_DeviceAdded(object sender, DeviceAddedEventArgs e)
 {
     DeviceFound(e, true);
 }
Exemplo n.º 15
0
 private static void clientDeviceAdded(object sender, DeviceAddedEventArgs args)
 {
     Log_Manager.write($"Device ${args.Device.Name} connected");
 }
Exemplo n.º 16
0
 private void Client_DeviceAdded(object sender, DeviceAddedEventArgs deviceEventArgs)
 {
     AddDevice(deviceEventArgs.Device);
 }
 // Now we scan for devices. Since we didn't add any Subtype Managers yet, this will go
 // out and find them for us. They'll be reported in the logs as they are found.
 //
 // We'll scan for devices, and print any time we find one.
 void HandleDeviceAdded(object aObj, DeviceAddedEventArgs aArgs)
 {
     PublishLogs($"Device connected: {aArgs.Device.Name}");
 }
Exemplo n.º 18
0
 /// <summary>
 /// Occurs when the UPnPDiscovery component finds a new device.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="a">The event arguments.</param>
 private void UPnP_DeviceAdded(object sender, DeviceAddedEventArgs a)
 {
     // Notify user
     WriteLine(String.Format("Device Found '{0}' - {1} - {2}", a.Device.FriendlyName, a.Device.UniqueDeviceName, a.Device.Type));
 }
Exemplo n.º 19
0
 static void OnDeviceAdded(object o, DeviceAddedEventArgs args)
 {
     Console.WriteLine($"Device ${args.Device.Name} connected");
 }
Exemplo n.º 20
0
 private void clientDeviceAdded(object sender, DeviceAddedEventArgs args)
 {
     Log_Manager.write($"Device ${args.Device.Name} connected");
     remote.buzz(50);
 }
Exemplo n.º 21
0
 private async void DeviceFound(object sender, DeviceAddedEventArgs e)
 {
     await client.StopScanningAsync();
 }
Exemplo n.º 22
0
 private void OnDeviceAttached(object sender, DeviceAddedEventArgs e)
 {
     AddNewDevice(e.Device);
 }
Exemplo n.º 23
0
 static void HandleDeviceAdded(object aObj, DeviceAddedEventArgs aArgs)
 {
     Console.Out.WriteLine($"Device connected: {aArgs.Device.Name}");
 }
 private void AddDevice(object sender, DeviceAddedEventArgs e)
 {
     Log($"Device {e.Device.Name} Connected!");
     Devices.Add(e.Device);
     UpdateDevices();
 }
Exemplo n.º 25
0
 void mdDiscovery_DeviceAdded(object sender, DeviceAddedEventArgs e)
 {
     QuickDevices.Add((ManagedUPnP.Device)e.Device);
     Devices.Add((ManagedUPnP.Device)e.Device);
     treeUpdateRequired = true;
 }
Exemplo n.º 26
0
        /// <summary>
        /// Raises events for when a new device is found.
        /// </summary>
        /// <param name="e">The event arguments containing the device information for the device that was found.</param>
        /// <param name="foundRoot">True if the device came from the discovery, false if it came from child devices.</param>
        protected void DeviceFound(DeviceAddedEventArgs e, bool foundRoot)
        {
            if (foundRoot || mdfoDeviceFindOption == Components.DeviceFindOption.AllChildrenDeivces)
            {
                OnDeviceAdded(e);
            }

            if (msfoServiceFindOption != ServiceFindOption.None)
            {
                if (msfoServiceFindOption == ServiceFindOption.AllDeviceChildrenServices ||
                    msfoServiceFindOption == ServiceFindOption.AllSearchURIMatchesServiceTypeId ||
                    (foundRoot || mdfoDeviceFindOption == DeviceFindOption.AllChildrenDeivces))
                {
                    try
                    {
                        foreach (UPNPLib.IUPnPService lsService in e.COMDevice.Services)
                        {
                            if (
                                (
                                    msfoServiceFindOption != ServiceFindOption.AllSearchURIMatchesServiceTypeId &&
                                    msfoServiceFindOption != ServiceFindOption.FoundDeviceDirectChildrenOnlySearchURIMatchesServiceTypeId
                                )
                                ||
                                lsService.ServiceTypeIdentifier == msSearchUri)
                            {
                                OnServiceAdded(new ServiceAddedEventArgs(e, lsService));
                            }
                        }
                    }
                    catch (Exception loE)
                    {
                        if (Logging.Enabled)
                        {
                            Logging.Log(
                                this,
                                string.Format("Exception occurred while enumerating Services: {0}", loE.ToString()));
                        }
                    }
                }
            }

            if (mdfoDeviceFindOption == DeviceFindOption.AllChildrenDeivces ||
                msfoServiceFindOption == ServiceFindOption.AllDeviceChildrenServices ||
                msfoServiceFindOption == ServiceFindOption.AllSearchURIMatchesServiceTypeId)
            {
                try
                {
                    foreach (UPNPLib.IUPnPDevice ldCOMDevice in e.COMDevice.Children)
                    {
                        DeviceFound(new DeviceAddedEventArgs(ldCOMDevice, e), false);
                    }
                }
                catch (Exception loE)
                {
                    if (Logging.Enabled)
                    {
                        Logging.Log(
                            this,
                            string.Format("Exception occurred while enumerating Devices: {0}", loE.ToString()));
                    }
                }
            }
        }