Example #1
0
 private void DeviceAddedEvent(object sender, DeviceAddedEventArgs e)
 {
     if (e.Device.IsSetBusylightSupported)
     {
         _availableDevices.Add(e.Device);
     }
 }
        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;
            }
        }
Example #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);
     }
 }
Example #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);
                }
            }
        }
Example #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);
        }
Example #7
0
        async void HandleDeviceAdded(object aObj, DeviceAddedEventArgs aArgs)
        {
            _device = aArgs.Device;
            await _client.StopScanningAsync();

            Device.BeginInvokeOnMainThread(() =>
            {
                btnVibrate.IsEnabled = true;
            });
        }
 public void OnDeviceAdded(object aObj, DeviceAddedEventArgs aArgs)
 {
     Dispatcher.Invoke(() =>
     {
         try
         {
             DevicesList.Add(new CheckedListItem(aArgs.Device));
         }
         catch (Exception ex)
         {
             // Ignore already added devices
         }
     });
 }
Example #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));
            }
        }
Example #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);
 }
Example #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);
 }
Example #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()));
                }
        }
Example #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);
 }
Example #15
0
 private static void clientDeviceAdded(object sender, DeviceAddedEventArgs args)
 {
     Log_Manager.write($"Device ${args.Device.Name} connected");
 }
Example #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}");
 }
Example #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));
 }
Example #19
0
 static void OnDeviceAdded(object o, DeviceAddedEventArgs args)
 {
     Console.WriteLine($"Device ${args.Device.Name} connected");
 }
Example #20
0
 private void clientDeviceAdded(object sender, DeviceAddedEventArgs args)
 {
     Log_Manager.write($"Device ${args.Device.Name} connected");
     remote.buzz(50);
 }
Example #21
0
 private async void DeviceFound(object sender, DeviceAddedEventArgs e)
 {
     await client.StopScanningAsync();
 }
Example #22
0
 private void OnDeviceAttached(object sender, DeviceAddedEventArgs e)
 {
     AddNewDevice(e.Device);
 }
Example #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();
 }
Example #25
0
 void mdDiscovery_DeviceAdded(object sender, DeviceAddedEventArgs e)
 {
     QuickDevices.Add((ManagedUPnP.Device)e.Device);
     Devices.Add((ManagedUPnP.Device)e.Device);
     treeUpdateRequired = true;
 }
Example #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()));
                    }
                }
            }
        }