public void Push(ControlDevice controlDevice) { int deviceIndex = ((CorsairDevice)controlDevice).CorsairDeviceIndex; int numberOfLedsToUpdate = controlDevice.LEDs.Length; int structSize = Marshal.SizeOf(typeof(_CorsairLedColor)); int ptrSize = structSize * numberOfLedsToUpdate; IntPtr ptr = Marshal.AllocHGlobal(ptrSize); IntPtr addPtr = new IntPtr(ptr.ToInt64()); foreach (var led in controlDevice.LEDs) { _CorsairLedColor color = new _CorsairLedColor { ledId = led.Data is CorsairLedData cld ? cld.CorsairLedId : ((CorsairPositionalLEDData)led.Data).CorsairLedId, r = (byte)led.Color.Red, g = (byte)led.Color.Green, b = (byte)led.Color.Blue }; Marshal.StructureToPtr(color, addPtr, false); addPtr = new IntPtr(addPtr.ToInt64() + structSize); } _CUESDK.CorsairSetLedsColorsBufferByDeviceIndex(deviceIndex, numberOfLedsToUpdate, ptr); _CUESDK.CorsairSetLedsColorsFlushBuffer(); Marshal.FreeHGlobal(ptr); }
public void Push(ControlDevice controlDevice) { if (isWriting) { return; } isWriting = true; Task.Run(() => { if (controlDevice.In2DMode) { var xxx = controlDevice.LEDs.OrderBy(p => p.Data.LEDNumber).ToList(); ((HyperXAlloyRgbControlDevice)controlDevice).HyperXSupport.SendColors(xxx.Select(x => x.Color) .ToArray()); } else { ((HyperXAlloyRgbControlDevice)controlDevice).HyperXSupport.SendColors(controlDevice.LEDs .Select(x => x.Color).ToArray()); } isWriting = false; }); }
public void TurnOnFlowTest() { ControlDevice device = new ControlDevice(); device.ConnectToDevice(); device.TurnOnFlow(); }
private void TurnOffDevice(ControlDevice device) { Type deviceType = device.GetType(); switch (deviceType.Name) { case "AirFlowController": _mainGui.AirFlowControllerPB.Image = device.DisabledImageDevice; break; case "AntiFireSystem": _mainGui.AntiFirePB.Image = device.DisabledImageDevice; break; case "QualityDevice": _mainGui.ConditionerPB.Image = device.DisabledImageDevice; break; case "Pump": _mainGui.FanPB2.Image = device.DisabledImageDevice; break; case "Filter": _mainGui.FilterPB.Image = device.DisabledImageDevice; break; case "RedirectDevice": _mainGui.RedirectPB.Image = device.DisabledImageDevice; break; } }
private async Task <Tuple <bool, RightMaterialServiceErrorCodeEnum> > RightMaterialFlow() { bool ret = false; bool S_HouseRequestFCS = false; ret = ControlDevice.GetHouseRequestFCS(ref S_HouseRequestFCS); if (ret != true) { return(new Tuple <bool, RightMaterialServiceErrorCodeEnum>(false, RightMaterialServiceErrorCodeEnum.GETREQ)); } if (S_HouseRequestFCS == true) { Temp_S_House_RequestFCS_Last = S_HouseRequestFCS; //防错处理 ret = CheckOnBegin(); if (ret != true) { return(new Tuple <bool, RightMaterialServiceErrorCodeEnum>(false, RightMaterialServiceErrorCodeEnum.CHECKONBEGIN)); } //料库通讯 bool S_House_InOut = false; var ret_inout = ControlDevice.GetHouseInOut(ref S_House_InOut); if (ret_inout == false) { return(new Tuple <bool, RightMaterialServiceErrorCodeEnum>(ret_inout, RightMaterialServiceErrorCodeEnum.INOUT)); } if (S_House_InOut == true) { var ret_out = await RightMaterialOutFlow(); if (ret_out.Item1 == false) { return(ret_out); } } else { var ret_in = await RightMaterialInFlow(); if (ret_in.Item1 == false) { return(ret_in); } } } else { Temp_S_House_RequestFCS_Last = S_HouseRequestFCS; } return(new Tuple <bool, RightMaterialServiceErrorCodeEnum>(true, RightMaterialServiceErrorCodeEnum.NORMAL)); }
private bool CheckOnBegin() { bool ret = false; ret = ControlDevice.SetHouseFCSAlarm(false); if (ret != true) { return(ret); } ret = ControlDevice.SetHouseFCSReset(false); if (ret != true) { return(ret); } ret = ControlDevice.SetHouseRequestFCSFin(false); if (ret != true) { return(ret); } ret = ControlDevice.SetHouseRequestInfoFCSFin(false); if (ret != true) { return(ret); } return(true); }
public void ConnectToDeviceTest() { ControlDevice device = new ControlDevice(); Assert.IsTrue(device.ConnectToDevice()); device.DisConnectFromDevice(); }
public void Pull(ControlDevice controlDevice) { foreach (ControlDevice.LedUnit ledUnit in controlDevice.LEDs) { RGBNetLed slsLED = (RGBNetLed)ledUnit; Led rgbNetLed = RGBSurface.Instance.Leds.First(led => led.Id == (LedId)slsLED.LedId && led.Device.DeviceInfo.DeviceName == slsLED.DeviceName); slsLED.Color = new LEDColor((int)rgbNetLed.Color.R * 255, (int)rgbNetLed.Color.G * 255, (int)rgbNetLed.Color.B * 255); } }
public UserControl GetCustomConfig(ControlDevice controlDevice) { var config = new WLEDConfig(this) { DataContext = configModel }; return(config); }
public void Push(ControlDevice controlDevice) { ORGBControlDevice orgbControlDevice = controlDevice as ORGBControlDevice; Device orgbDevice = client.GetAllControllerData().First(dev => dev.Name == controlDevice.Name); var leds = Enumerable.Range(0, orgbDevice.Colors.Length) .Select(_ => new Color((byte)controlDevice.LEDs[0].Color.Red, (byte)controlDevice.LEDs[0].Color.Green, (byte)controlDevice.LEDs[0].Color.Blue)) .ToArray(); client.UpdateLeds(orgbControlDevice.id, leds); }
private void InitD3D() { cDev = new ControlDevice(EmptyControl); MakeMipTexture(); MakeIntermediateTexture(); MakeCpuTexture(); ScreenQuad.Init(cDev.device); passThroughFilter = new PassThroughFilter(cDev.device); screenCapture = new ScreenCapture(cDev.device); StartRenderLoop(); }
public void GetMainTemperatueForDeviceTest() { ControlDevice device = new ControlDevice(); device.ConnectToDevice(); device.SetTemperatueLimitsForDevice(10, 28); float currentTemp = device.GetMainAirTemperatureFromDevice(); Assert.IsTrue(currentTemp >= 10 && currentTemp <= 28); device.DisConnectFromDevice(); }
public void Pull(ControlDevice controlDevice) { if (!isCueSetUp || !okayToUseCue) { return; } int structSize = Marshal.SizeOf(typeof(_CorsairLedColor)); IntPtr ptr = Marshal.AllocHGlobal(structSize * controlDevice.LEDs.Count()); IntPtr addPtr = new IntPtr(ptr.ToInt64()); foreach (var led in controlDevice.LEDs) { _CorsairLedColor color = new _CorsairLedColor { ledId = led.Data is CorsairLedData cld ? cld.CorsairLedId : ((CorsairPositionalLEDData)led.Data).CorsairLedId }; Marshal.StructureToPtr(color, addPtr, false); addPtr = new IntPtr(addPtr.ToInt64() + structSize); } _CUESDK.CorsairGetLedsColorsByDeviceIndex(((CorsairDevice)controlDevice).CorsairDeviceIndex, controlDevice.LEDs.Count(), ptr); IntPtr readPtr = ptr; for (int i = 0; i < controlDevice.LEDs.Count(); i++) { _CorsairLedColor ledColor = (_CorsairLedColor)Marshal.PtrToStructure(readPtr, typeof(_CorsairLedColor)); try { var setme = controlDevice.LEDs.FirstOrDefault(x => (x.Data is CorsairLedData data && data.CorsairLedId == ledColor.ledId) || (x.Data is CorsairPositionalLEDData pdata && pdata.CorsairLedId == ledColor.ledId)); if (setme != null) { setme.Color = new LEDColor(ledColor.r, ledColor.g, ledColor.b); } } catch { var setme = controlDevice.LEDs.FirstOrDefault(x => (x.Data is CorsairLedData data && data.CorsairLedId == ledColor.ledId) || (x.Data is CorsairPositionalLEDData pdata && pdata.CorsairLedId == ledColor.ledId)); if (setme != null) { setme.Color = new LEDColor(ledColor.r, ledColor.g, ledColor.b); } } readPtr = new IntPtr(readPtr.ToInt64() + structSize); } Marshal.FreeHGlobal(ptr); }
public UserControl GetCustomConfig(ControlDevice controlDevice) { var config = new RainbowWaveConfig() { DataContext = configModel }; configModel.CurrentControlDevice = controlDevice; return(config); }
public void Push(ControlDevice controlDevice) { foreach (RGBNetLed slsLED in controlDevice.LEDs) { Led rgbNetLed = RGBSurface.Instance.Leds.First(led => led.Id == (LedId)slsLED.LedId && led.Device.DeviceInfo.DeviceName == slsLED.DeviceName); double r = slsLED.Color.Red / 255.0; double g = slsLED.Color.Green / 255.0; double b = slsLED.Color.Blue / 255.0; rgbNetLed.Color = new RGB.NET.Core.Color(r, g, b); } }
public UserControl GetCustomConfig(ControlDevice controlDevice) { var config = new SolidColorConfig { DataContext = configModel }; configModel.CurrentControlDevice = controlDevice; return(config); }
public void Push(ControlDevice controlDevice) { MSIControlDevice msiDevice = controlDevice as MSIControlDevice; for (int i = 0; i < controlDevice.LEDs.Length; i++) { _MsiSDK.SetLedStyle(msiDevice.MSIDeviceType, i, "Steady"); _MsiSDK.SetLedColor(msiDevice.MSIDeviceType, i, controlDevice.LEDs[i].Color.Red, controlDevice.LEDs[i].Color.Green, controlDevice.LEDs[i].Color.Blue); } }
// Token: 0x06000003 RID: 3 RVA: 0x0000215E File Offset: 0x0000035E public void Configure(DriverDetails driverDetails) { ControlDevice rainbowWaveDevice = new ControlDevice { Name = "Rainbow Wave", Driver = this, ProductImage = (Bitmap)System.Drawing.Image.FromStream(imageStream), LEDs = this.leds, DeviceType = DeviceTypes.Effect }; DeviceAdded?.Invoke(rainbowWaveDevice, new Events.DeviceChangeEventArgs(rainbowWaveDevice)); }
public void Push(ControlDevice controlDevice) { SteelSeriesControlDevice cs = (SteelSeriesControlDevice)controlDevice; Dictionary <string, int[]> mdata = new Dictionary <string, int[]>(); foreach (ControlDevice.LedUnit controlDeviceLeD in controlDevice.LEDs) { mdata.Add(((SteelSeriesLedData)controlDeviceLeD.Data).ZoneName, controlDeviceLeD.Color.ToIntArray()); } GameSenseSdk.UpdateLeds(cs.SSDeviceType.GetAPIName(), mdata); }
public void Pull(ControlDevice controlDevice) { if ((DateTime.Now - lastScreenShot).TotalMilliseconds > 30) { var _screenshot = TakingScreenshotEx2(); if (_screenshot != null) { Color avg = CalculateAverageColor(_screenshot); oneLeds[0].Color = new LEDColor(avg); lastScreenShot = DateTime.Now; } } }
public void Push(ControlDevice controlDevice) { if (uri == null) { Console.WriteLine("No URI"); } else { RazerControlDevice razerControlDevice = controlDevice as RazerControlDevice; RESTHelpers.Put(razerControlDevice.UpdateUrl, razerControlDevice.GetUpdateModel()); } }
/// <summary> /// Initializes all Kinect based control systems. /// Defaults to keyboard input if the Kinect is not available. /// </summary> private void InitializeKinect() { if (!this.TryStartKinect()) { this.colourStreamEnabled = false; this.kinectSensor = null; this.controlDevice = ControlDevice.Keyboard; } else { this.coordinateMapper = new CoordinateMapper(this.kinectSensor); this.gestureManager = new GestureManager(); } }
public void GetLimitsAirTemperatureFromDeviceTest() { ControlDevice device = new ControlDevice(); device.ConnectToDevice(); device.SetTemperatueLimitsForDevice(17, 29); float lowLimitTemperature = device.GetLowAirTemperatureLimit(); Assert.AreEqual(lowLimitTemperature, 17); float highLimitTemperature = device.GetHighAirTemperatureLimit(); Assert.AreEqual(highLimitTemperature, 29); device.DisConnectFromDevice(); }
public void Push(ControlDevice controlDevice) { MadLedControlDevice mlcd = (MadLedControlDevice)controlDevice; byte[] leds = new byte[mlcd.LEDs.Length * 3]; for (int i = 0; i < mlcd.LEDs.Length; i++) { leds[(i * 3) + 0] = (byte)(mlcd.LEDs[i].Color.Blue * globalBrightness); leds[(i * 3) + 1] = (byte)(mlcd.LEDs[i].Color.Green * globalBrightness); leds[(i * 3) + 2] = (byte)(mlcd.LEDs[i].Color.Red * globalBrightness); } mlcd.MadLedDevice.SendLeds(mlcd.MadLedDevice.stream, leds, (byte)mlcd.Pin); }
public void SetDeviceOverride(ControlDevice controlDevice, CustomDeviceSpecification deviceSpec) { WLEDControlDevice csd = controlDevice as WLEDControlDevice; List <ControlDevice.LedUnit> leds = new List <ControlDevice.LedUnit>(); for (int i = 0; i < deviceSpec.LedCount; i++) { ControlDevice.LedUnit newLed = new ControlDevice.LedUnit(); newLed.Data = new ControlDevice.LEDData(); newLed.Data.LEDNumber = i; leds.Add(newLed); } controlDevice.LEDs = leds.ToArray(); }
public void Push(ControlDevice controlDevice) { if (ApiInUse) { return; } ApiInUse = true; AsusControlDevice asusDevice = (AsusControlDevice)controlDevice; for (int inc = 0; inc < controlDevice.LEDs.Length; inc++) { asusDevice.device.Lights[inc].Red = (byte)controlDevice.LEDs[inc].Color.Red; asusDevice.device.Lights[inc].Green = (byte)controlDevice.LEDs[inc].Color.Green; asusDevice.device.Lights[inc].Blue = (byte)controlDevice.LEDs[inc].Color.Blue; } asusDevice.device.Apply(); ApiInUse = false; }
public void SetDeviceOverride(ControlDevice controlDevice, CustomDeviceSpecification deviceSpec) { controlDevice.LEDs = new ControlDevice.LedUnit[deviceSpec.LedCount]; for (int p = 0; p < deviceSpec.LedCount; p++) { controlDevice.LEDs[p] = new ControlDevice.LedUnit { Data = new ControlDevice.LEDData { LEDNumber = p }, LEDName = "LED " + (p + 1), Color = new LEDColor(0, 0, 0) }; } controlDevice.CustomDeviceSpecification = deviceSpec; }
public void Push(ControlDevice controlDevice) { foreach (ControlDevice.LedUnit led in controlDevice.LEDs) { if (((MadLedData)led.Data).SetColor.Red != led.Color.Red || ((MadLedData)led.Data).SetColor.Green != led.Color.Green || ((MadLedData)led.Data).SetColor.Blue != led.Color.Blue) { ((MadLedDevice)controlDevice).SerialDriver.SetLED(((MadLedDevice)controlDevice).Bank, ((MadLedData)led.Data).LEDNumber, led.Color.Red, led.Color.Green, led.Color.Blue); ((MadLedData)led.Data).SetColor.Red = led.Color.Red; ((MadLedData)led.Data).SetColor.Green = led.Color.Green; ((MadLedData)led.Data).SetColor.Blue = led.Color.Blue; } } }
public void Pull(ControlDevice controlDevice) { foreach (var ledUnit in leds) { if (ledUnit.Color == null) { ledUnit.Color = new LEDColor(255, 0, 0); } ledUnit.Color = ledUnit.Color.LerpTo(new LEDColor(255, 0, 0), 0.01f); } foreach (Particle particle in Particles.ToList()) { int top = particle.Y - particle.Distance; int left = particle.X - particle.Distance; int bottom = particle.Y + particle.Distance; int right = particle.X + particle.Distance; for (int x = left; x < right; x++) { for (int y = top; y < bottom; y++) { if (x == left || x + 1 == right || y == top || y + 1 == bottom) { myControlDevice.SetGridLED(x, y, new LEDColor((int)((float)particle.R * particle.Strength), (int)((float)particle.G * particle.Strength), (int)((float)particle.B * particle.Strength))); } } } particle.Distance++; particle.Strength = particle.Strength * 0.95f; } List <Particle> deadParticles = Particles.ToList().Where(x => x.Strength < 0.05f).ToList(); foreach (var deadParticle in deadParticles) { Particles.Remove(deadParticle); } }
public List <ControlDevice> GetDevices() { myControlDevice = new ControlDevice { DeviceType = DeviceTypes.Effect, Driver = this, GridHeight = 12, GridWidth = 60, Has2DSupport = true, LEDs = leds, Name = "Grid Ripple", }; myControlDevice.DestTriggeredEvent += MyControlDeviceOnDestTriggeredEvent; return(new List <ControlDevice> { myControlDevice }); }