//public List<Driver_UT71D> Devices_UT71D = new List<Driver_UT71D>(); //public Driver_VirtualDevice Obj_Driver_VirtualDevice; //public LabDevice() //{ //} public LabDevice(SupportedDevices _currentDevice, DataTypes _dataType = DataTypes.Abstract, int TargIdDrv = -1) { MillsBetweenMeasure = new List <int>(); DeviceName = _currentDevice; DataType = _dataType; IDTargetDriver = TargIdDrv; //if (_currentDevice == SupportedDevices.UT71D) Devices_UT71D.Add(new Driver_UT71D(NewValue)); //binding method for compute and storage new value //if (_currentDevice == SupportedDevices.Virtual) { Obj_Driver_VirtualDevice = new Driver_VirtualDevice(NewValue); Obj_Driver_VirtualDevice.Connect(); } }
private async Task Update(string payload) { Logger.Debug(() => $"{nameof(ChromaSink)} received payload: {payload}. Applying to {string.Join(", ", SupportedDevices)}"); try { JObject.Parse(payload); await Task.WhenAll(SupportedDevices.Select((device) => Client.UpdateAsync(device, payload))); } catch (JsonReaderException e) { Logger.Debug(() => $"{nameof(ChromaSink)} received invalid json: {payload} ({e.Message})"); } }
public APObject CreateInstance(string type, JObject json) { JToken value; var deviceType = string.Empty; if (json.TryGetValue("devicetype", out value) == true && value.Type != JTokenType.Null) { deviceType = value.ToString(); } else { throw new Exception("DeviceType not present in response."); } return(new APDevice(SupportedDevices.ResolveDeviceType(deviceType))); }
protected override Entity CreateEntity(JObject json) { JToken value; string type = string.Empty; if (json.TryGetValue("devicetype", out value) == true && value.Type != JTokenType.Null) { type = value.ToString(); } else { throw new Exception("DeviceType not present in response."); } return(new Device(SupportedDevices.ResolveDeviceType(type))); }
private async Task ApplyStaticEffect(Color color) { Logger.Debug(() => $"{nameof(ChromaSink)} received {color}. Applying to {string.Join(", ", SupportedDevices)}"); await Task.WhenAll(SupportedDevices.Select((device) => Client.ApplyStaticEffectAsync(device, color))); }