Exemple #1
0
        // Using device type decideds which device object to initilise, this allows for dynamic object creation.
        public static DeviceBase GetDeviceObject(DeviceInformation deviceInfo, DeviceType type)
        {
            DeviceBase device = null;

            // Main switch statement to handle the creation of the device objects.
            switch (type)
            {
            case DeviceType.GenericAccess:
                device = new GenericAccessDevice();
                break;

//中島追加
            case DeviceType.LightBlueBean:
                device = new LightBlueBeanDevice();
                break;
            }

            if (device == null)
            {
                // Display error if device does not have a value and return null.
                MessageHelper.DisplayBasicMessage(StringResources.InitialisationError);
                return(device);
            }

            device.Initialise(deviceInfo.Id);

            return(device);
        }
Exemple #2
0
        public Device(InstanceBase instance, DeviceType type, AdapterInfo[] adapters)
            : base(instance, type)
        {
            if (adapters == null || adapters.Length <= 1)
            {
                throw new ArgumentException("Adapters must be at least two in length");
            }
            devices = new DeviceBase[adapters.Length];
            for (int i = 0; i != devices.Length; ++i)
            {
                // allocate API specific device
                if (instance is D3D12.Instance)
                {
                    devices[i] = new D3D12.Device((D3D12.Instance)instance, adapters[i].isPrimary ? type : DeviceType.Background);
                }
                else if (instance is Vulkan.Instance)
                {
                    devices[i] = new Vulkan.Device((Vulkan.Instance)instance, adapters[i].isPrimary ? type : DeviceType.Background);
                }
                else
                {
                    throw new NotImplementedException("Failed to create devices based on instance type: " + instance.GetType().ToString());
                }

                // set primary device
                if (adapters[i].isPrimary)
                {
                    primaryDevice = devices[i];
                }
            }
        }
        /// <summary>
        /// 삭제 버튼 클릭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DelBtn_Click(object sender, EventArgs e)
        {
            if (this.DeviceLV.SelectedItems.Count == 0)
            {
                MessageBox.Show("삭제할 장비를 선택하세요.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (DialogResult.Yes == MessageBox.Show("장비를 삭제하겠습니까?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2))
            {
                List <DeviceBase> tmpDeviceList = new List <DeviceBase>();

                for (int i = 0; i < this.DeviceLV.SelectedItems.Count; i++)
                {
                    DeviceBase tmpDeviceBase = this.deviceMng.GetDevice(this.DeviceLV.SelectedItems[i].Name);
                    this.deviceMng.DeviceDelete(tmpDeviceBase);

                    if (!this.deviceMng.SerializedDevice.Contains(tmpDeviceBase))
                    {
                        tmpDeviceList.Add(tmpDeviceBase);
                    }
                }

                this.deviceMng.DeviceSerialize();

                for (int i = 0; i < tmpDeviceList.Count; i++)
                {
                    this.DeviceLV.Items.RemoveByKey(tmpDeviceList[i].Key);
                }

                this.SetListViewIndex(this.DeviceLV);
            }
        }
Exemple #4
0
        protected override void OnDrop(DragEventArgs e)
        {
            base.OnDrop(e);

            var deviceType = e.Data.GetData("DeviceType") as Type;

            if (deviceType != null)
            {
                if (DataContext is GraphAreaViewModel)
                {
                    var        vm       = DataContext as GraphAreaViewModel;
                    DeviceBase instance = (DeviceBase)Activator.CreateInstance(deviceType);

                    if (vm.TryAddDevice(instance))
                    {
                        g_area.AddVertex(instance, new VertexControlPE(instance));
                        g_area.VertexList[instance].SetPosition(e.GetPosition(g_area));
                    }
                }

                if (e.KeyStates.HasFlag(DragDropKeyStates.ControlKey))
                {
                    e.Effects = DragDropEffects.Copy;
                }
                else
                {
                    e.Effects = DragDropEffects.Move;
                }
            }
            e.Handled = true;
        }
        public ChangeIDFlow(DeviceBase device, byte moduleNumber, byte groupNumber)
            : base(device)
        {
            if (moduleNumber == 0)
            {
                throw new ArgumentException("Module number must be greater than 0");
            }

            if (groupNumber == 0)
            {
                throw new ArgumentException("Group number must be greater than 0");
            }

            ProgrammingData = new Queue <MemoryBlock>();
            var memoryBlock = new MemoryBlock()
            {
                Address = 0xF00020
            };

            memoryBlock.Data[6] = moduleNumber;
            memoryBlock.Data[7] = groupNumber;

            ProgrammingData.Enqueue(memoryBlock);
            ExtraModuleNumber = moduleNumber;
            ExtraGroupNumber  = groupNumber;
        }
        /// <summary>
        /// 수정 버튼 클릭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateBtn_Click(object sender, EventArgs e)
        {
            if (this.DeviceLV.SelectedItems.Count == 0)
            {
                MessageBox.Show("수정할 장비를 선택하세요.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else if (this.DeviceLV.SelectedItems.Count > 1)
            {
                MessageBox.Show("한개의 장비를 선택하세요.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else if (this.DeviceLV.SelectedItems.Count == 1)
            {
                DeviceBase tmpDeviceBase = this.deviceMng.GetDevice(this.DeviceLV.SelectedItems[0].Name);

                if (tmpDeviceBase != null)
                {
                    using (DeviceAddForm deviceAdd = new DeviceAddForm(this.deviceMng, tmpDeviceBase))
                    {
                        deviceAdd.OnDeviceUpdateSuccessEvt += new EventHandler <DeviceUpdateSuccessEventArgs>(deviceAdd_OnDeviceUpdateSuccessEvt);
                        deviceAdd.ShowDialog();
                        deviceAdd.OnDeviceUpdateSuccessEvt -= new EventHandler <DeviceUpdateSuccessEventArgs>(deviceAdd_OnDeviceUpdateSuccessEvt);
                    }
                }
            }
        }
 public IDevice CreateDevice(ILogger logger, ITransportFactory transportFactory, 
     ITelemetryFactory telemetryFactory, IConfigurationProvider configurationProvider, InitialDeviceConfig config)
 {
     var device = new DeviceBase(logger, transportFactory, telemetryFactory, configurationProvider);
     device.Init(config);
     return device;
 }
        public bool TryGetDeviceAllLinkDatabase(DeviceBase device)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }
            var records = new List <PlmAllLinkDatabaseRecord>();

            plm.exceptionHandler(() =>
            {
                plm.sendExtendedMessageAndWait4Response(device.DeviceId, Constants.MSG_FLAGS_DIRECT, 0x2F, 0x00);
                while (true)                      //this will bail when 0x6A returns a NACK
                {
                    var record = plm.waitForSpecificMessageFrom(device.DeviceId, 0x51);
                    var data   = record.Slice(14, 24);
                    if (data[4] == 0 && data[5] == 0 && data[6] == 0)
                    {
                        break;
                    }
                    records.Add(new PlmAllLinkDatabaseRecord(data));
                }
            });
            device.AllLinkDatabase = new PlmAllLinkDatabase(records);

            return(true);
        }
        /// <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);
        }
Exemple #10
0
        /// <summary>
        /// 생성자_수정
        /// </summary>
        public DeviceAddForm(DeviceMng _deviceMng, DeviceBase _deviceBase)
        {
            this.InitializeComponent();
            this.SetComboBox();
            this.deviceMng  = _deviceMng;
            this.deviceBase = _deviceBase;

            this.Text = "장비 수정";
            this.DeviceMainLB.Text            = "장비를 수정합니다.";
            this.DeviceMainPB.BackgroundImage = global::Strida.Properties.Resources.우량기정보관리_수정_41_40;
            this.DeviceIDTB.Text    = _deviceBase.Key;
            this.DeviceNameTB.Text  = _deviceBase.Name;
            this.DeviceIDTB.Enabled = false;

            if (_deviceBase is CasDevice)
            {
                this.DeviceDivisionCB.Text = this.cas;
            }
            else if (_deviceBase is DmbDevice)
            {
                this.DeviceDivisionCB.Text = this.dmb;
            }
            else if (_deviceBase is OaDevice)
            {
                this.DeviceDivisionCB.Text = this.oae;
            }

            this.SaveBtn.Enabled = false;
        }
Exemple #11
0
    private void shoot(DeviceBase device, DeviceShotController controller)
    {
        if (controller.ammunitionQty > 0 && controller.waitTime <= 0)
        {
            // Update controllers
            controller.waitTime = device.reloadTime;
            controller.ammunitionQty--;

            // Create new instance
            GameObject createdDevice = Instantiate(device.gameObject);

            // Configure
            createdDevice.SetActive(true);
            createdDevice.transform.position = this.transform.position + (this.transform.right.normalized * device.distanceFromPlayer);
            createdDevice.transform.right    = this.transform.right;
            DeviceBase aux = createdDevice.GetComponent <DeviceBase>();

            if (aux)
            {
                aux.owner = this.gameObject;
            }

            controller.lastShot = createdDevice;

            // Set to right parent
            createdDevice.transform.parent = aux != null && aux.attachToPlayer ? this.transform : this.transform.parent;
        }
    }
Exemple #12
0
        /// <summary>
        /// 添加变量映射关系
        /// </summary>
        /// <param name="variable">变量</param>
        /// <param name="deviceBase">映射方式</param>
        public static void AddMap(VariableBase variable, DeviceBase deviceBase)
        {
            if (variable == null)
            {
                return;
            }

            //如果变量为只写变量,不允许同步设备值
            if (variable.OperateProperty == VarOperateProperty.WriteOnly)
            {
                return;
            }

            if (deviceBase == null)
            {
                return;
            }
            var element = new DeviceMapMode()
            {
                DeviceModeId = 0,
                Name         = deviceBase.Name,
                CycleTime    = deviceBase.CycleTime,
                MaxValue     = deviceBase.MinValue,
                MinValue     = deviceBase.MaxValue,
                Variable     = variable
            };

            //DeviceMapContext.DeviceMapModeSet.Add(element);
            if (DeviceDictionary.ContainsKey(variable))
            {
                return;
            }
            DeviceDictionary.Add(variable, deviceBase);
            DeviceBaseManager.AddDevice(deviceBase);
        }
        internal static void FireNotification(DeviceBase device)
        {
            // Create a list of callbacks that need to be removed
            var removeList = new List <IWeatherServiceCallback>();

            // Loop over each subscriber
            foreach (var callback in Subscribers)
            {
                // If the callback connection isn't open...
                if ((callback as ICommunicationObject).State != CommunicationState.Opened)
                {
                    // ...add it to the remove list and continue
                    removeList.Add(callback);
                    continue;
                }

                try
                {
                    // Make the callback
                    callback.OnDeviceUpdate(device);
                }
                catch
                {
                    // The callback failed - add it to the remove list
                    removeList.Add(callback);
                }
            }

            // Remove all callbacks in the remove list
            removeList.ForEach(o => Subscribers.Remove(o));
        }
Exemple #14
0
 public void ZapErrorCallback(DeviceBase device, string message, string details, bool panic)
 {
     if (this.InvokeRequired)
     {
         var d = new DeviceBase.DeviceErrorCallback(ZapErrorCallback);
         this.BeginInvoke(d, new object[] { device, message, details, panic });
     }
     else
     {
         if (panic)
         {
             DoPanic();
         }
         if (!String.IsNullOrEmpty(message))
         {
             AddMessage(message);
         }
         if (!String.IsNullOrEmpty(details))
         {
             AddMessage(details);
         }
         Proxy.ReportError(new ErrorCommand()
         {
             Error = message, Details = details
         });
     }
 }
Exemple #15
0
        private static bool AdbLParse(string input, out IDevice device)
        {
            var match = _deviceLRegex.Match(input);

            if (!match.Success)
            {
                device = null;
                return(false);
            }
            DeviceBase dev = null;

            if (TryParseSerialAsIPEnd(match.Result("${sn}"), out IPEndPoint endPoint))
            {
                dev = new NetDevice()
                {
                    IPEndPoint = endPoint
                };
            }
            else
            {
                dev = new UsbDevice();
            }
            dev.SerialNumber = match.Result("${sn}");
            dev.State        = match.Result("${state}").ToDeviceState();
            dev.Model        = match.Result("${model}");
            dev.Product      = match.Result("${product}");
            dev.TransportId  = match.Result("${transport_id}");
            device           = dev;
            return(true);
        }
Exemple #16
0
        private static bool SimpleParse(string input, out IDevice device)
        {
            var match = _deviceRegex.Match(input);

            if (!match.Success)
            {
                device = null;
                return(false);
            }
            DeviceBase dev = null;

            if (TryParseSerialAsIPEnd(match.Result("${sn}"), out IPEndPoint endPoint))
            {
                dev = new NetDevice()
                {
                    IPEndPoint = endPoint
                };
            }
            else
            {
                dev = new UsbDevice();
            }
            dev.SerialNumber = match.Result("${sn}");
            dev.State        = match.Result("${state}").ToDeviceState();
            device           = dev;
            return(true);
        }
        /// <summary>
        /// 저장 버튼 클릭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddBtn_Click(object sender, EventArgs e)
        {
            if (this.DeviceLV.SelectedItems.Count == 1)
            {
                MapDevice mapDevice = this.deviceMng.GetDeviceOfDic(this.DeviceLV.SelectedItems[0].Name);

                if (mapDevice != null)
                {
                    mapDevice.OaDeviceList.Clear();

                    for (int i = 0; i < this.OaDeviceLV.Items.Count; i++)
                    {
                        if (this.OaDeviceLV.Items[i].Checked)
                        {
                            DeviceBase tmpDeviceBase = this.deviceMng.GetDevice(this.OaDeviceLV.Items[i].Name);
                            mapDevice.OaDeviceList.Add((OaDevice)tmpDeviceBase);
                        }
                    }

                    this.deviceMng.SetOaDeviceOfMap(mapDevice);
                    MessageBox.Show("성공적으로 저장되었습니다.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("저장을 실패했습니다.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("저장할 장비를 선택하세요.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #18
0
        public static void CreateFromStringTest()
        {
            //Type={0}; Network={1}; Address={2}; Location={3}; PollingInterval={4}

            string str = "Type=KIP_MAIN_POWERED_v1; Network=; Address=1; " +
                         "Location=; PollingInterval=1";
            DeviceBase device = DeviceBase.Create(str);
        }
Exemple #19
0
        public static void ToStringTest()
        {
            DeviceBase device =
                DeviceBase.Create(DeviceType.KIP_MAIN_POWERED_v1);

            //string str = device.ToString();
            Console.WriteLine(device.ToString());
        }
        public IDevice CreateDevice(ILogger logger, ITransportFactory transportFactory,
                                    ITelemetryFactory telemetryFactory, IConfigurationProvider configurationProvider, InitialDeviceConfig config)
        {
            var device = new DeviceBase(logger, transportFactory, telemetryFactory, configurationProvider);

            device.Init(config);
            return(device);
        }
Exemple #21
0
 public async void UpdateIDActionAsync(DeviceBase device, byte moduleNumber, byte groupNumber)
 {
     ChangeIDFlow = new Flows.ChangeIDFlow(device, moduleNumber, groupNumber);
     await ChangeIDFlow.RunAsync().ContinueWith((task) =>
     {
         ChangeIDFlow = null;
     });
 }
Exemple #22
0
 public ModbusAdapterContext(DeviceBase canDevice, File modbusDevice)
 {
     CanDevice               = new CAN();
     CanDevice.NetworkId     = canDevice.Network.NetworkId;
     CanDevice.NodeId        = canDevice.NodeId;
     ModbusDevice            = new Modbus();
     ModbusDevice.FileNumber = modbusDevice.Number;
 }
 public EnergyEventStatus(DeviceBase device, FeatureType featureType, uint featureId, int frequency, ObservableCollection<DeviceEventSettings> emitEvents)
     : base(device, featureType, featureId, frequency, emitEvents)
 {
     EnergyTotal = 0.0;
     EventPower = 0;
     LastPowerEmitted = 0;
     LastEnergyEmitted = 0.0;
 }
Exemple #24
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="owner"></param>
 public ObjectCollection(DeviceBase owner)
 {
     if (owner == null)
     {
         throw new NullReferenceException();
     }
     _Device = owner;
 }
Exemple #25
0
 public async void RestoreDefaultIdAsync(DeviceBase device, byte moduleNumber, byte groupNumber)
 {
     RestoreDefaultIDFlow = new Flows.RestoreDefaultIDFlow(device, moduleNumber, groupNumber);
     await RestoreDefaultIDFlow.RunAsync().ContinueWith((task) =>
     {
         RestoreDefaultIDFlow = null;
     });
 }
        // Get a list of devices which are the same type as the selected device type.
        public async void GetPossibleDevices()
        {
            this.SelectedDeviceViewModel.CleanAll();
            this.FoundDevices = new ObservableCollection <DeviceInformation>();

            if (this.selectedDeviceType == null)
            {
                return;
            }

            Guid id = selectedDeviceType.Guid;

            // Request the IsPaired property so we can display the paired status in the UI
            string[] requestedProperties = { "System.Devices.Aep.IsPaired" };

            //for bluetooth LE Devices
            string aqsFilter = "System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\"";

            // Find a list of devices with the same Uuid as the selected device type, and populate a list.
            //DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(
            //    aqsFilter,
            //    requestedProperties,
            //    DeviceInformationKind.AssociationEndpoint);

            DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(id));


            if (devices.Count > 0)
            {
                // If we have found some values add them to a list to be displayed on the UI.
                foreach (DeviceInformation item in devices)
                {
                    this.FoundDevices.Add(item);

                    DeviceBase device = DeviceHelper.GetDeviceObject(item, this.selectedDeviceType.Type);
                    if (device != null)
                    {
                        //Set the selectedDevice value to be equal to what was recieved from the get device object call.
                        this.selectedDevice = device;

                        this.SelectedDeviceViewModel.CleanServices();
                        this.SelectedDeviceViewModel.CleanCharacteristics();

                        // Get a list of supported servioces from the device, and update the viewmodel with the results.
                        this.SelectedDeviceViewModel.SupportedServices = await device.PopulateSupportedServices();

                        // Let the UI know that some data has changed.
                        this.RaisePropertyChanged("SelectedDeviceViewModel");
                    }
                    this.RaisePropertyChanged("FoundDevices");
                }
            }
            // If no device where found display an error message.
            else
            {
                MessageHelper.DisplayBasicMessage(StringResources.NoDevicesFound);
            }
        }
Exemple #27
0
        /// <summary>
        /// HSEvent callback informs us that one of used devices was deleted
        /// </summary>
        /// <param name="devID"></param>
        public void DeviceDeleted(int devID)
        {
            DeviceBase device = UsedDevices[devID];

            Log($"Device used by plugin was deleted! {device}", true);

            // TEMP - TODO: do something about it!
            device.Error = "Device was deleted in HomeSeer!";
        }
        /// <summary>
        /// DeviceBase 데이터를 ListViewItem로 만든 후 반환한다. (OA용)
        /// </summary>
        /// <param name="_db"></param>
        /// <returns></returns>
        private ListViewItem GetOAListViewItem(DeviceBase _db)
        {
            ListViewItem lvi = new ListViewItem();

            lvi.Name = _db.Key;
            lvi.Text = _db.Name;

            return(lvi);
        }
Exemple #29
0
        private readonly DeviceBase _ownerDevice;                   // Owner device

        #endregion

        #region Constructor

        public Value(WeatherValueType valueType, DeviceBase ownerDevice)
        {
            // Remember information we were given
            ValueType    = valueType;
            _ownerDevice = ownerDevice;

            // Create the readings
            Current = ReadingBase.CreateReading(ValueType);
        }
Exemple #30
0
        private void MQ_singleArrivalEvent(string data)
        {
            ShowMsg(data);
            MsgBase msg = null;

            try
            {
                msg = JsonConvert.DeserializeObject <MsgBase>(data);
            }
            catch (Exception ex)
            {
                string errMsg = "协议格式错误!";
                MyLog.WriteLog(errMsg, ex);
                ShowMsg(errMsg);
                return;
            }
            //判断时间戳在启动时间之前的信息丢弃
            DateTime dtMsg;

            if (DateTime.TryParse(msg.time_stamp, out dtMsg))
            {
                if (dtMsg < dtStart)
                {
                    return;
                }
            }
            List <string> jiaobiaoNos = new List <string>()
            {
                "E00113", "E00114", "E00115", "E00117", "E02001",
                "E02101", "E02201"//先跑初调1和复校1
            };

            try
            {
                if (msg.MESSAGE_TYPE == "plc")
                {
                    if (!jiaobiaoNos.Contains(msg.NO))
                    {
                        return;
                    }
                    var    dev    = DeviceBase.GetDevice(msg.NO);
                    PLCMsg plcMsg = JsonConvert.DeserializeObject <PLCMsg>(data);
                    dev.DoWork(plcMsg);
                    this.Dispatcher.Invoke(() =>
                    {
                        if (!dgDevices.Items.Contains(dev))
                        {
                            dgDevices.Items.Add(dev);
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message + ex.StackTrace);
            }
        }
Exemple #31
0
 private void initDevices()
 {
     _devices       = new TrulyObservableCollection <DeviceBase>();
     _defaultDevice = new Device(Audio, Video);
     Device         = _defaultDevice;
     Device.start();
     checkPotentialSensor();
     checkPotentialFiles();
     KinectSensor.KinectSensors.StatusChanged += KinectSensors_StatusChanged;;
 }
        public void PopulateDeviceWithTelemetryEventsTest()
        {
            DeviceBase device = this._fixture.Create <DeviceBase>();

            this.factory.PopulateDeviceWithTelemetryEvents(device);

            Assert.Equal(device.TelemetryEvents.Count, 2);
            Assert.IsType <StartupTelemetry>(device.TelemetryEvents[0]);
            Assert.IsType <RemoteMonitorTelemetry>(device.TelemetryEvents[1]);
        }
Exemple #33
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="device"></param>
 public VisitingCard(DeviceBase device)
 {
     this._Device = device;
 }
        public EventStatus(DeviceBase device, FeatureType featureType, uint featureId, int frequency, ObservableCollection<DeviceEventSettings> emitEvents)
        {
            Device = device;
            FeatureType = featureType;
            FeatureId = featureId;
            Frequency = frequency;
            ToDeviceLinks = new List<DeviceLink>();
            FromDeviceLinks = new List<DeviceLink>();

            EmitEvents = new List<DeviceEventConfig>();
            foreach(DeviceEventSettings es in device.DeviceManagerDeviceSettings.DeviceEvents)
                if (es.EventFeatureType == FeatureType && es.EventFeatureId == FeatureId)
                    EmitEvents.Add(new DeviceEventConfig(es));
        }
 public DeviceLink(DeviceBase fromDevice, FeatureType fromFeatureType, uint fromFeatureId, 
     ConsolidationDevice toDevice, FeatureType toFeatureType, uint toFeatureId,
     ConsolidateDeviceSettings.OperationType operation, EnergyEventStatus fromEventStatus, bool useTemperature)
 {
     FromDevice = fromDevice;
     FromFeatureType = fromFeatureType;
     FromFeatureId = fromFeatureId;
     ToDevice = toDevice;
     ToFeatureType = toFeatureType;
     ToFeatureId = toFeatureId;
     Operation = operation;
     UseTemperature = useTemperature;
     FromEventStatus = fromEventStatus;
     FromEventStatus.ToDeviceLinks.Add(this);
 }