public void Initialize(ChannelConnectionOptions channelOptions)
        {
            _hostDevice = DeviceFactory.CreateHostDevice("lightbulb", "Colorful lightbulb");

            #region General node

            _hostDevice.UpdateNodeInfo("general", "General information and properties", "no-type");

            // I think properties are pretty much self-explanatory in this producer.
            _color = _hostDevice.CreateHostColorProperty(PropertyType.Parameter, "general", "color", "Color", ColorFormat.Rgb);
            _color.PropertyChanged += (sender, e) => {
                _log.Info($"Color changed to {_color.Value.ToRgbString()}");
            };
            _onOffSwitch = _hostDevice.CreateHostChoiceProperty(PropertyType.Parameter, "general", "is-on", "Is on", new[] { "OFF", "ON" }, "OFF");
            _onOffSwitch.PropertyChanged += (sender, e) => {
                // Simulating some lamp behaviour.
                if (_onOffSwitch.Value == "ON")
                {
                    _intensity.Value = 50;
                }
                else
                {
                    _intensity.Value = 0;
                }
            };

            _intensity = _hostDevice.CreateHostNumberProperty(PropertyType.Parameter, "general", "intensity", "Intensity", 0, "%");

            #endregion

            _broker.Initialize(channelOptions);
            _hostDevice.Initialize(_broker);
        }
Example #2
0
        public void CreateS7Device()
        {
            // prepare
            var dpConfig = new List <DeviceConfig> {
                new DeviceConfig {
                    Name   = "plc01",
                    Driver = "s7",
                    Config = "host=127.0.0.1;rack=0;slot=0",
                    Tags   = null
                },
                new DeviceConfig {
                    Name   = "plc02",
                    Driver = "s7",
                    Config = "host=127.0.0.1;rack=0;slot=0",
                    Tags   = null
                }
            };

            var loggerMock = new Mock <ILogger>();
            var devices    = DeviceFactory.CreateDevices(dpConfig, loggerMock.Object);

            Assert.Equal(2, devices.Count);

            Assert.IsType <S7Device>(devices["plc01"]);

            Assert.IsType <S7Device>(devices["plc02"]);
        }
Example #3
0
        public void ShellAdbCommand_ValidRequestExternalProcessThrowsException_ErrorResponse()
        {
            var device =
                new DeviceFactory().NewDevice("111", "device_111", true, DeviceType.Android, DeviceStatus.Online);

            var restClientMock = new Mock <IRestClient>();

            restClientMock.Setup(r => r.GetDevice(It.IsAny <string>())).Returns(Task.FromResult <Device>(device));

            var externalProcessesMock = new Mock <IExternalProcesses>();

            externalProcessesMock
            .Setup(e => e.RunProcessAndReadOutput(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>()))
            .Throws <Exception>();

            var adbController = new AdbController(restClientMock.Object, Logger, externalProcessesMock.Object);

            var result = adbController.ShellAdbCommand(new AdbCommand {
                AndroidDeviceId = device.Id, Command = "test"
            });

            var viewResult = Assert.IsType <ObjectResult>(result);

            Assert.Equal(500, viewResult.StatusCode);
        }
Example #4
0
        public void AdbCommand_ValidRequest_CorrectOutput()
        {
            var device =
                new DeviceFactory().NewDevice("111", "device_111", true, DeviceType.Android, DeviceStatus.Online);

            var restClientMock = new Mock <IRestClient>();

            restClientMock.Setup(r => r.GetDevice(It.IsAny <string>())).Returns(Task.FromResult <Device>(device));

            var          externalProcessesMock = new Mock <IExternalProcesses>();
            const string output = "output";

            externalProcessesMock
            .Setup(e => e.RunProcessAndReadOutput(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>()))
            .Returns(output);

            var adbController = new AdbController(restClientMock.Object, Logger, externalProcessesMock.Object);

            var result = adbController.Command(new AdbCommand {
                AndroidDeviceId = device.Id, Command = "test"
            });

            var viewResult = Assert.IsType <ObjectResult>(result);

            Assert.Equal(200, viewResult.StatusCode);
            Assert.Equal(output, viewResult.Value);
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        public void Do()
        {
            // devices
            //
            DeviceCollection devices = DeviceFactory.CreateDeviceCollection();

            // foreach device
            //
            foreach (DeviceClass d in devices)
            {
                DateTime dtlast = d.GetLastDateTimeForm10MinuteDataTable();
                DateTime begin  = dtlast.Date + TimeSpan.FromDays(1d);
                DateTime end    = DateTime.Now.Date;
                for (DateTime temp = begin; temp < end; temp += TimeSpan.FromDays(1d))
                {
                    DataTable source = d.GetDitchData(temp, temp + TimeSpan.FromDays(1d));
                    DataTable dest   = Create10MinuteDataTable(source);
                    if (dest != null && dest.Rows.Count > 0)
                    {
                        d.Write10MinuteDataTable(dest);
                    }
                }
            }
            // device last zb data dt
            //
        }
Example #6
0
        public static void Main()
        {
            var networkProvider      = new NetworkProvider();
            var isConnectedToNetwork = networkProvider.ConnectToNetwork(WifiSsid, WifiPassword);

            var rgbLedProvider = new RgbLedProvider();
            var rgbLedConsumer = new RgbLedConsumer(BrokerIp);

            if (isConnectedToNetwork)
            {
                DeviceFactory.Initialize();
                rgbLedProvider.Initialize();

                ;
                rgbLedConsumer.MqttClientGuid = Guid.NewGuid().ToString();
                rgbLedConsumer.RgbLedProvider = rgbLedProvider;
                rgbLedConsumer.Initialize();

                Thread.Sleep(-1);
            }
            else
            {
                Debug.WriteLine("Exiting...");
            }
        }
Example #7
0
        public override unsafe void Initialize(Size data, IOutputOwner output)
        {
            using var factory = DeviceFactory.Create();
            foreach (var device in factory)
            {
                Console.WriteLine(device);
            }

            _device = GraphicsDevice.Create(FeatureLevel.GraphicsLevel11_0, null);

            var desc = new OutputConfiguration
            {
                BackBufferFormat = BackBufferFormat.R8G8B8A8UnsignedNormalized,
                BackBufferCount  = 3,
                SyncInterval     = 0
            };

            _output = Output.Create(desc, _device, output);

            _settings = new PipelineSettings
            {
                Msaa        = MsaaDesc.None,
                Resolution  = _output.Resolution,
                AspectRatio = _output.AspectRatio
            };


            _renderer   = new BasicSceneRenderer(_device);
            _msaaPass   = new MsaaPass();
            _outputPass = new TonemapPass(_output);

            _graph = new RenderGraph(_device, _output.Configuration.BackBufferCount);
        }
Example #8
0
        public Linx()
        {
            // Canberra.DSA3K.DataTypes.Communications.DeviceFactory.CreateInstance(Canberra.DSA3K.DataTypes.Communications.DeviceFactory.DeviceInterface);

            object o = DeviceFactory.CreateInstance(DeviceFactory.DeviceInterface.IDevice);

            device = (IDevice)o;

            string local = "10.0.3.122";

            string linx = "192.168.114.001";

            try
            {
                device.Open(local, linx);
            }
            catch (Canberra.DSA3K.DataTypes.DeviceException ex)
            {
                string exce = ex.Description;
            }
            bool opened = device.IsOpen;

            object real = device.GetProperty("Real Time");

            string retext = real.ToString();
        }
Example #9
0
        private void CreateDevices(List <dynamic> configs)
        {
            foreach (var deviceConfig in configs)
            {
                DeviceBase device;
                try
                {
                    DeviceCreationInfo info = new DeviceCreationInfo(deviceConfig, mServiceManager, mDeviceManager);
                    device = DeviceFactory.CreateDevice(info);
                    mDeviceManager.AddDevice(device);
                }
                catch (Exception e)
                {
                    Log.Error("Failed creating device for node with config: " + deviceConfig.name);
                    if (e.InnerException != null)
                    {
                        Log.Error("Inner Exception: {0}\nCallstack:\n{1}", e.InnerException.Message, e.InnerException.StackTrace);
                    }
                    else
                    {
                        Log.Error("Exception: {0}\nCallstack:\n{1}", e.Message, e.StackTrace);
                    }

                    continue;
                }

                Log.Info("Created device: {0} of type: {1}", device.Name, device.GetType().ToString());
            }
        }
Example #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            this.UCChannelStationDTOne1.IsSelectOneStation = true;
            MasterPageHelper.SetTitle(this, "水位修改");

            this.UCChannelStationDTOne1.QueryEvent += new EventHandler(UCChannelStationDTOne1_QueryEvent);

            if (!IsPostBack)
            {
                if (GetQueryParams())
                {
                    this.Device = DeviceFactory.CreateDevice(_queryDeviceID);
                    StationClass station = this.Device.StationClass;

                    this.UCChannelStationDTOne1.SelectedChannel = station.Channel;
                    this.UCChannelStationDTOne1.SelectedStation = station;

                    DateTime begin = _queryDateTime.Date;
                    DateTime end   = begin.Add(TimeSpan.FromDays(1d));

                    QueryData(_queryDeviceID, begin, end);
                }
            }
            else
            {
                //this.Device = this.UCChannelStationDTOne1.SelectedStation.DeviceCollection[0];
            }
        }
Example #11
0
        public Game()
        {
            DeviceFactory factory = new DeviceFactory();

            HelloWorldProducers = factory.HelloWorldProducers;
            Karma = 0;
        }
Example #12
0
        /// <summary>
        /// Sets Paperless Print Mode to ON or OFF on the device
        /// </summary>
        /// <param name="paperlessModeOn"></param>
        /// <returns></returns>
        private bool SetPaperlessPrintMode(string ipAddress, string adminPassword)
        {
            JobMediaMode mode    = PaperlessModeOn ? JobMediaMode.Paperless : JobMediaMode.Paper;
            bool         success = false;

            try
            {
                using (var device = DeviceFactory.Create(ipAddress, adminPassword))
                {
                    try
                    {
                        IDeviceSettingsManager manager = DeviceSettingsManagerFactory.Create(device);
                        success = manager.SetJobMediaMode(mode);
                    }
                    catch (DeviceFactoryCoreException)
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(success);
        }
        /// <summary>
        /// Creates an <see cref="IDevice"/> object for the specified <see cref="IDeviceInfo"/> object.
        /// </summary>
        /// <param name="deviceInfo">The device information from Asset Inventory.</param>
        /// <returns></returns>
        public static IDevice Create(Framework.Assets.IDeviceInfo deviceInfo)
        {
            if (deviceInfo == null)
            {
                throw new ArgumentNullException(nameof(deviceInfo));
            }

            DeviceConstructionParameterCollection parameters = new DeviceConstructionParameterCollection()
            {
                new DeviceAddressParameter(deviceInfo.Address),
                new DeviceAdminPasswordParameter(deviceInfo.AdminPassword)
            };

            if (string.IsNullOrEmpty(deviceInfo.Address2))
            {
                LogDebug($"Creating DAT controller for device at {deviceInfo.Address}.  Admin password: '******'");
            }
            else
            {
                parameters.Add(new JediDebugAddressParameter(deviceInfo.Address2));
                LogDebug($"Creating DAT controller for device at {deviceInfo.Address} with debug LAN {deviceInfo.Address2}.  Admin password: '******'");
            }

            return(DeviceFactory.Create(parameters));
        }
Example #14
0
 private void OnPrinterChanged(object sender, System.EventArgs e)
 {
     //Event handler for change in port
     try {
         if (this.mPrinter != null && this.mPrinter.On)
         {
             this.mPrinter.TurnOff();
         }
         this.mPrinter = DeviceFactory.CreatePrinter(this.cboPrinter.SelectedItem.ToString(), this.cboPort.SelectedItem.ToString());
         if (this.mPrinter != null && this.mPrinter.Settings.PortName != null)
         {
             this.cboPort.SelectedItem     = this.mPrinter.Settings.PortName;
             this.cboBaud.SelectedItem     = this.mPrinter.Settings.BaudRate.ToString();
             this.cboDataBits.SelectedItem = this.mPrinter.Settings.DataBits.ToString();
             this.cboParity.SelectedItem   = this.mPrinter.Settings.Parity.ToString();
             this.cboStopBits.SelectedItem = Convert.ToInt32(this.mPrinter.Settings.StopBits).ToString();
         }
         else
         {
             this.cboPort.SelectedIndex     = 0;
             this.cboBaud.SelectedIndex     = 0;
             this.cboDataBits.SelectedIndex = 0;
             this.cboParity.SelectedIndex   = 0;
             this.cboStopBits.SelectedIndex = 0;
         }
         if (this.PrinterChanged != null)
         {
             this.PrinterChanged(this.mPrinter, EventArgs.Empty);
         }
     }
     catch (Exception ex) { reportError(ex); }
     finally { setUserServices(); }
 }
Example #15
0
        private void CheckAndWaitForDeviceReboot(Framework.Assets.IDeviceInfo printdeviceinfo)
        {
            int maxRetries = 20;
            var device     = DeviceFactory.Create(printdeviceinfo.Address, printdeviceinfo.AdminPassword);

            if (Retry.UntilTrue(() => HasDeviceRebooted(device), maxRetries / 2, TimeSpan.FromSeconds(10)))
            {
                UpdateStatus("Device has rebooted...");
                if (Retry.UntilTrue(() => IsDeviceRunning(device), maxRetries, TimeSpan.FromSeconds(10)))
                {
                    UpdateStatus("Device is in Running status...");
                    if (Retry.UntilTrue(() => IsJetDirectUp(device), maxRetries / 4, TimeSpan.FromSeconds(10)))
                    {
                        UpdateStatus("JetDirect Initialised...");
                    }

                    if (Retry.UntilTrue(() => IsWebServicesUp(device), (maxRetries / 4), TimeSpan.FromSeconds(10)))
                    {
                        UpdateStatus("Device is in Ready state.");
                    }
                }
            }
            else
            {
                UpdateStatus("Device has not rebooted.");
            }
        }
        public void Add()
        {
            var repo   = new DeviceRepository();
            var device = DeviceFactory.CreateDevice("OldCamera", "old camera");

            Assert.Equal(device, repo.Add(device));
        }
Example #17
0
        public void Initialize(IClientDeviceConnection brokerConnection)
        {
            // Creating a air conditioner device.
            _clientDevice = DeviceFactory.CreateClientDevice("air-conditioner");

            // Creating properties.
            _turnOnOfProperty = _clientDevice.CreateClientChoiceProperty(new ClientPropertyMetadata {
                PropertyType = PropertyType.Command, NodeId = "general", PropertyId = "turn-on-off", Format = "ON,OFF"
            });
            _actualState = _clientDevice.CreateClientChoiceProperty(new ClientPropertyMetadata {
                PropertyType = PropertyType.State, NodeId = "general", PropertyId = "actual-state", Format = "ON,OFF,STARTING", InitialValue = "OFF"
            });
            _actualState.PropertyChanged += (sender, e) => {
                _log.Info($"{_clientDevice.DeviceId}: property {_actualState.PropertyId} changed to {_actualState.Value}.");
            };

            _inletTemperature = _clientDevice.CreateClientNumberProperty(new ClientPropertyMetadata {
                PropertyType = PropertyType.State, NodeId = "general", PropertyId = "actual-air-temperature", DataType = DataType.Float, InitialValue = "0"
            });
            _inletTemperature.PropertyChanged += (sender, e) => {
                // Simulating some overheated dude.
                if (_inletTemperature.Value > 25)
                {
                    _log.Info($"{_clientDevice.Name}: getting hot in here, huh?.. Let's try turning air conditioner on.");
                    if (_actualState.Value != "ON")
                    {
                        _turnOnOfProperty.Value = "ON";
                    }
                }
            };

            // Initializing all the Homie stuff.
            _clientDevice.Initialize(brokerConnection);
        }
Example #18
0
        protected override void GivenThat()
        {
            base.GivenThat();
            // genius: .NET4 doesnt work properly with Rhino
            // https://stackoverflow.com/questions/3444581/mocking-com-interfaces-using-rhino-mocks
            // if we need to use .NET4 then uncomment this line
            //Castle.DynamicProxy.Generators.AttributesToAvoidReplicating.Add(typeof(TypeIdentifierAttribute));

            PortableDeviceManager = new MockPortableDeviceManager();

            PortableDevice = GenerateMock <IPortableDevice>();

            Device1 = GenerateMock <IDevice>();
            Device1.Stub(device => device.Name)
            .Return("Device 1");
            Device1.Stub(device => device.Id)
            .Return("Device_Id_1");

            Device2 = GenerateMock <IDevice>();
            Device2.Stub(device => device.Name)
            .Return("Device 2");
            Device2.Stub(device => device.Id)
            .Return("Device_Id_2");

            DeviceFactory = GenerateMock <IDeviceFactory>();
            DeviceFactory.Stub(factory => factory.CreateDevice("Device_Id_1"))
            .Return(Device1);
            DeviceFactory.Stub(factory => factory.CreateDevice("Device_Id_2"))
            .Return(Device2);

            DeviceManager = new DeviceManager(PortableDeviceManager, DeviceFactory);
        }
Example #19
0
        /// <summary>
        /// Entry point into the WS* process.
        /// Endpoint: address book, email, FIM, ...
        /// Resource URL: urn:hp:imaging:con:service:email:EmailService
        ///
        /// The call to WSTranferClient.Get will return an XML string of data.36030
        /// </summary>
        /// <param name="endPoint">string</param>
        /// <param name="resourceUri">string</param>
        /// <returns>XElement</returns>
        public XElement GetEndPointLog(string endPoint, string resourceUri)
        {
            XElement xeDeviceData = null;

            JediDevice jedi = DeviceFactory.Create(IPAddress, Password) as JediDevice;

            if (jedi != null)
            {
                try
                {
                    xeDeviceData = jedi.WebServices.GetDeviceTicket(endPoint, resourceUri);
                }
                catch (DeviceCommunicationException dce)
                {
                    if (dce.InnerException != null)
                    {
                        if (!dce.InnerException.GetType().Equals(typeof(System.ServiceModel.EndpointNotFoundException)) && !dce.InnerException.GetType().Equals(typeof(System.ServiceModel.ProtocolException)))
                        {
                            throw;
                        }
                    }
                    else
                    {
                        throw new Exception("Unable to communicate with IP Address " + IPAddress + "\n\r" + dce.Message);
                    }
                }
                catch (EntryPointNotFoundException nf)
                {
                    throw new Exception("Unable to communicate with IP Address " + IPAddress + "\n\r" + nf.Message);
                }
            }
            return(xeDeviceData);
        }
        protected override void GivenThat()
        {
            base.GivenThat();

            PortableDeviceManager = new MockPortableDeviceManager();

            PortableDevice = GenerateMock <IPortableDevice>();

            Device1 = GenerateMock <IDevice>();
            Device1.Stub(device => device.Name)
            .Return("Device 1");
            Device1.Stub(device => device.Id)
            .Return("Device_Id_1");

            Device2 = GenerateMock <IDevice>();
            Device2.Stub(device => device.Name)
            .Return("Device 2");
            Device2.Stub(device => device.Id)
            .Return("Device_Id_2");

            DeviceFactory = GenerateMock <IDeviceFactory>();
            DeviceFactory.Stub(factory => factory.CreateDevice("Device_Id_1"))
            .Return(Device1);
            DeviceFactory.Stub(factory => factory.CreateDevice("Device_Id_2"))
            .Return(Device2);

            DeviceManager = new DeviceManager(PortableDeviceManager, DeviceFactory);
        }
        private void saveBtn_Click(object sender, EventArgs e)
        {
            var selectedDevice = (DeviceModel)(allDevicesCb.SelectedItem);
            var storageModel   = (DataStorageConfigModel)fileTypeSelectionCb.SelectedItem;
            var operatorModel  = (OperatorModel)operatorsCb.SelectedItem;
            var facilityModel  = (FacilityModel)facilitiesCb.SelectedItem;
            var activeChannels = GetActiveChannels();
            var configBox      = (IDeviceConfigControl)deviceSettingsContainer.Controls[0];
            var devConfig      = configBox.GetDeviceConfig();

            if (devConfig != null && selectedDevice != null && storageModel != null)
            {
                this.DialogResult = DialogResult.OK;
                currentDevice     = DeviceFactory.CreateDevice(selectedDevice);
                var devInterface = PeripheralFactory.CreatePeripheral(devConfig);
                var dataWriter   = DataWriterFactory.CreateDataWriter(fileNameTb.Text, storageModel.Type);
                var errorHandler = new FileErrorHandler("application_errors.txt");

                dataWriter.create();
                dataWriter.open();
                dataWriter.writeHeader(activeChannels, operatorModel, facilityModel);
                dataWriter.close();

                currentDevice.SetDataWriter(dataWriter);
                currentDevice.SetPeripheralInterface(devInterface);
                currentDevice.SetErrorHandler(errorHandler);

                this.Close();
            }
        }
Example #22
0
        /// <summary>
        /// Sends a message to the device with the given
        /// DeviceId in order to try to identify it, and
        /// if successful, returns a DeviceBase object.
        /// The derived type of the returned object varies
        /// depending on the Device category discovered
        /// during the identification process.
        /// </summary>
        /// <returns>null if unsuccessful - check plm.Exception</returns>
        public bool TryConnectToDevice(DeviceId deviceId, out DeviceBase device)
        {
            if (deviceId == null)
            {
                throw new ArgumentNullException("deviceId");
            }
            DeviceBase result = null;

            if (this.deviceCache.ContainsKey(deviceId))
            {
                result = this.deviceCache[deviceId];
            }
            else
            {
                this.plm.exceptionHandler(() =>
                {
                    byte[] responseAck = this.plm.sendStandardLengthMessageAndWait4Response(
                        deviceId, Constants.MSG_FLAGS_DIRECT, 0x10, 0x00);
                    byte[] responseIdRequest = this.plm.waitForStandardMessageFrom(deviceId);
                    result = DeviceFactory.BuildDevice(this.plm, responseIdRequest);
                });
                if (result != null)
                {
                    this.deviceCache.Add(deviceId, result);
                }
            }
            device = result;
            return(result != null);
        }
Example #23
0
        public static void Main(string[] args)
        {
            var d = new DeviceA("asdfsdf");

            DeviceFactory.Create(d, "asdfsdf");

            Console.ReadKey();
        }
Example #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectManager"/> class.
 /// </summary>
 /// <param name="client">The client to use for executing API requests.</param>
 internal ObjectManager(PrtgClient client)
 {
     Sensor   = new SensorFactory(client);
     Device   = new DeviceFactory(client);
     Group    = new GroupFactory(client);
     Probe    = new ProbeFactory(client);
     Trigger  = new TriggerFactory(client);
     Property = new PropertyFactory(client);
 }
Example #25
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 private DeviceClass GetDevice()
 {
     if (IsAdd())
     {
         int deviceid = GetDeviceID();
         return(DeviceFactory.CreateDevice(deviceid));
     }
     return(null);
 }
Example #26
0
        public DeviceBase CreateDevice(dynamic deviceConfiguration)
        {
            var info   = new DeviceCreationInfo(deviceConfiguration, ServiceManager, DeviceManager);
            var device = DeviceFactory.CreateDevice(info);

            DeviceManager.AddDevice(device);

            return(device);
        }
Example #27
0
 /// <summary>
 /// The basic system object, sets up the connection to the serial port.
 /// </summary>
 /// <param name="portName"></param>
 public FluffInsteon(string portName, DeviceProvider provider)
 {
     this.port = new CommunicationDevice(new SerialPort(portName, 19000, Parity.None, 8, StopBits.One));
     this.port.ReceivedMessage += port_ReceivedMessage;
     this.linkingEvent          = new AutoResetEvent(false);
     this.deviceFactory         = new DeviceFactory(this);
     this.provider              = provider;
     log.Info("Started FluffInsteon up");
 }
Example #28
0
        public async Task <bool> ExecuteAsync(DeviceRequest request)
        {
            var serializer = SerializerFactory.CreateSerializerFromType(request.Command);
            var device     = DeviceFactory.CreateDeviceFromType(request.Command);
            var data       = serializer.Serialize(request.Data);
            var result     = await device.ExecuteAsync(data);

            return(result);
        }
        public void GetNotExistedDevice()
        {
            var repo = new DeviceRepository();
            //add one
            var oldDevice = DeviceFactory.CreateDevice("OldCamera", "old camera");

            repo.Add(oldDevice);

            Assert.Null(repo.Get("somethingNotExisted"));
        }
Example #30
0
        private async void SetDeviceFromIdAsync(string Id)
        {
            try
            {
                Device = await DeviceFactory.Get(Id);

                SetDevice(Device);
            }
            catch { }
        }