public DeviceChangedEventArgs(DeviceType deviceType, PluginDevice oldDevice, PluginDevice newDevice, IReadonlyContext oldDeviceParams) { DeviceType = deviceType; OldDevice = oldDevice; NewDevice = newDevice; OldDeviceParams = oldDeviceParams; }
public DeviceParams this[DeviceType deviceType] { get { var selectedDevice = SelectedDevices[deviceType]; var device = PluginDevice.CreateParameterizedEntity(selectedDevice.Device, selectedDevice.Params); var selectedConsumer = SelectedConsumers[deviceType]; var consumer = PluginStreamConsumer.CreateParameterizedEntity(selectedConsumer.Consumer, selectedConsumer.Params); return(new DeviceParams { Device = device, Consumers = new[] { consumer } }); } set { if (_deviceControlGroups[deviceType].DeviceComboBox.FindAndSelect(value.Device.Id ?? NoneIdentifier, null)) { var selectedDevice = SelectedDevices[deviceType]; selectedDevice.Params = selectedDevice.Device?.DeserializeParams(value.Device.Params) ?? (IReadonlyContext)EmptyContext.Instance; } var consumerEntity = value.Consumers.Length > 0 ? value.Consumers[0] : new ParameterizedEntity(); App.Instance.Registries.Registry <PluginStreamConsumer>().LookUp(consumerEntity.Id ?? NoneIdentifier, out var streamConsumer); SelectedConsumers[deviceType].Consumer = streamConsumer; SelectedConsumers[deviceType].Params = streamConsumer?.DeserializeParams(consumerEntity.Params) ?? (IReadonlyContext)EmptyContext.Instance; } }
private void InitializeDeviceConfigurationPanel(PluginDevice device) { DeviceConfigurationPanel.Descriptors = AsGroup("Device", device?.Factory.Parameters.Cast <IDescriptor>().ToArray() ?? EmptyArray <IDescriptor> .Instance); DeviceConfigurationPanel.Adapter = device?.Factory as IParameterPresentAdapter; ScrollView.InvalidateScrollInfo(); ScrollView.ScrollToTop(); _needResizeWindow = true; }
public DeviceConfigWindow([NotNull] PluginDevice device, [CanBeNull] IReadonlyContext deviceParams, [CanBeNull] PluginStreamConsumer consumer, [CanBeNull] IReadonlyContext consumerParams) { InitializeComponent(); InitializeDeviceConfigurationPanel(device ?? throw new ArgumentNullException(nameof(device))); DeviceConfigurationPanel.Context = deviceParams ?? EmptyContext.Instance; var experimentPanel = ConsumerSelectionPanel.AddGroupPanel("Consumer", "Consumer Selection"); _consumerComboBox = new ComboBox(); _consumerComboBox.SelectionChanged += ConsumerComboBox_OnSelectionChanged; _consumerComboBox.ItemsSource = GetConsumerList(device.DeviceType); _consumerComboBox.FindAndSelect(consumer?.Identifier, 0); experimentPanel.AddRow("Consumer", _consumerComboBox, ViewConstants.DefaultRowHeight); InitializeConsumerConfigurationPanel(consumer); ConsumerConfigurationPanel.Context = consumerParams ?? EmptyContext.Instance; Title = $"{device.Identifier} Configuration"; }
public KeeleCard(PluginDevice device) { }
public KeeleCard(PluginDevice device, string reader) { this.device = device; this.reader = reader; }
public bool connectReader() { string configType = readConfiguration.getString("type"); string configDevice = readConfiguration.getString("device"); string configSchema = readConfiguration.getString("schema"); if(configType == null || configDevice == null || configSchema == null) { return false; } LS8000 ls8000 = new LS8000(); if(ls8000.getName().CompareTo(configType)==0) { device = ls8000; } ACR122 acr122 = new ACR122(); if(acr122.getName().CompareTo(configType)==0) { device = acr122; } ACR122_Sim acr122_sim = new ACR122_Sim(); if(acr122_sim.getName().CompareTo(configType)==0) { device = acr122_sim; } ACR122_v2 acr122_v2 = new ACR122_v2(); if(acr122_v2.getName().CompareTo(configType)==0) { device = acr122_v2; } if(device == null){ return false; } KeeleCard keeleCard = new KeeleCard(device,configDevice); if(keeleCard.getName().CompareTo(configSchema)==0) { schema = keeleCard; } if(schema==null){ return false; //return device.connect(configDevice); } return true; /* if (_serialPort == -1) return false; int val = LS8000CommsLib.Comms.rf_init_com(_serialPort,NotificationIcon.baud); if (val == 0) return true; else MessageBox.Show("Failed to connect to reader on Com " + _serialPort, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; */ }
public bool connectReader() { string configType = readConfiguration.getString("type"); string configDevice = readConfiguration.getString("device"); string configSchema = readConfiguration.getString("schema"); if (configType == null || configDevice == null || configSchema == null) { return(false); } LS8000 ls8000 = new LS8000(); if (ls8000.getName().CompareTo(configType) == 0) { device = ls8000; } ACR122 acr122 = new ACR122(); if (acr122.getName().CompareTo(configType) == 0) { device = acr122; } ACR122_Sim acr122_sim = new ACR122_Sim(); if (acr122_sim.getName().CompareTo(configType) == 0) { device = acr122_sim; } ACR122_v2 acr122_v2 = new ACR122_v2(); if (acr122_v2.getName().CompareTo(configType) == 0) { device = acr122_v2; } if (device == null) { return(false); } KeeleCard keeleCard = new KeeleCard(device, configDevice); if (keeleCard.getName().CompareTo(configSchema) == 0) { schema = keeleCard; } if (schema == null) { return(false); //return device.connect(configDevice); } return(true); /* * if (_serialPort == -1) * return false; * int val = LS8000CommsLib.Comms.rf_init_com(_serialPort,NotificationIcon.baud); * if (val == 0) * return true; * * else * MessageBox.Show("Failed to connect to reader on Com " + _serialPort, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); * return false; */ }