Ejemplo n.º 1
0
                public static void SetBothLedsTo(LEDColor col, byte Strength)
                {
                    switch (col)
                    {
                    case (LEDColor.off):
                        RightRedLED   = 0;
                        RightGreenLED = 0;
                        LeftRedLED    = 0;
                        LeftGreenLED  = 0;
                        break;

                    case (LEDColor.Green):
                        RightRedLED   = 0;
                        RightGreenLED = Strength;
                        LeftRedLED    = 0;
                        LeftGreenLED  = Strength;
                        break;

                    case (LEDColor.red):
                        RightRedLED   = Strength;
                        RightGreenLED = 0;
                        LeftRedLED    = Strength;
                        LeftGreenLED  = 0;
                        break;

                    case (LEDColor.orange):
                        RightRedLED   = Strength;
                        RightGreenLED = Strength;
                        LeftRedLED    = Strength;
                        LeftGreenLED  = Strength;
                        break;
                    }
                }
Ejemplo n.º 2
0
        public void StaticRingsAnimated()
        {
            double progress = this.config.beatBroadcaster.ProgressThroughBeat(
                this.config.domeVolumeRotationSpeed
                );

            double level = this.audio.LevelForChannel(0);

            for (int i = 0; i < 5; i++)
            {
                StrutLayoutSegment segment =
                    this.ringsLayout.GetSegment(i);

                double totalLength = segment.TotalLength;
                double totalPos    = 0;
                foreach (Strut strut in segment.GetStruts())
                {
                    double frac = totalPos / totalLength;
                    double dist = Math.Abs(progress - frac);
                    dist  = dist > 0.5 ? 1.0 - dist : dist;
                    dist *= 2;
                    double d = dist * dist * level * progress;
                    int    c = LEDColor.FromDoubles(d, d, d);

                    for (int j = 0; j < strut.Length; j++, totalPos += 1)
                    {
                        this.dome.SetPixel(strut.Index, j, c);
                    }
                }
            }
        }
Ejemplo n.º 3
0
                public static void SetRightLedsTo(LEDColor col)
                {
                    switch (col)
                    {
                    case (LEDColor.off):
                        RightRedLED   = 0;
                        RightGreenLED = 0;
                        break;

                    case (LEDColor.Green):
                        LeftRedLED    = 0;
                        RightGreenLED = 255;
                        break;

                    case (LEDColor.red):
                        RightRedLED   = 255;
                        RightGreenLED = 0;
                        break;

                    case (LEDColor.orange):
                        RightRedLED   = 255;
                        RightGreenLED = 255;
                        break;
                    }
                }
Ejemplo n.º 4
0
        public int GetGradientColor(
            int index,
            double pixelPos,
            double focusPos,
            bool wrap
            )
        {
            if (this.config.beatBroadcaster.CurrentlyFlashedOff)
            {
                return(0x000000);
            }
            int absoluteIndex = LEDColor.GetAbsoluteColorIndex(
                index,
                this.config.colorPaletteIndex
                );

            if (this.config.colorPalette.colors[absoluteIndex] == null)
            {
                return(0x000000);
            }
            if (!this.config.colorPalette.colors[absoluteIndex].IsGradient)
            {
                return(this.GetSingleColor(absoluteIndex));
            }
            return(LEDColor.ScaleColor(
                       this.config.colorPalette.GetGradientColor(
                           absoluteIndex,
                           pixelPos,
                           focusPos,
                           wrap
                           ),
                       this.config.stageBrightness
                       ));
        }
Ejemplo n.º 5
0
 private void updateColorTrackBar(object sender, EventArgs e)
 {
     LEDColor color = new LEDColor(trackBar1.Value, trackBar2.Value, trackBar3.Value);
     if (sender == colorRadio)
         proxy.call("LerpRange", JObject.FromObject(color), 0, 23, 100, 5);
     else
         proxy.call("SetRange", JObject.FromObject(color), 0, 23);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Sets the color of the module's LED to the passed in LEDColor enum.
        /// </summary>
        /// <param name="color"></param>
        public void SetColor(LEDColor color)
        {
            int r = ((int)(color) & 4);

            m_RedPin.Write((((int)color & 4) != 0 ? true : false));
            m_GreenPin.Write((((int)color & 2) != 0 ? true : false));
            m_BluePin.Write((((int)color & 1) != 0 ? true : false));
        }
Ejemplo n.º 7
0
		/// <summary>
		/// Sets the color for the LED on the Kinect.
		/// </summary>
		/// <param name="color">
		/// Color value 
		/// </param>
		private void SetLEDColor(LEDColor color)
		{
			int result = KinectNative.freenect_set_led(this.parentDevice.devicePointer, color);
			if(result != 0)
			{
				throw new Exception("Could not set color to " + color + ". Error Code:" + result);
			}
			this.color = color;
		}
Ejemplo n.º 8
0
        public void ParametricTest()
        {
            double progress = this.config.beatBroadcaster.ProgressThroughBeat(
                this.config.domeVolumeRotationSpeed
                );

            double level = this.audio.LevelForChannel(0);

            for (int i = 0; i < LEDDomeOutput.GetNumStruts(); i++)
            {
                Strut strut = Strut.FromIndex(this.config, i);
                var   leds  = LEDDomeOutput.GetNumLEDs(i);
                for (int j = 0; j < leds; j++)
                {
                    var    p = StrutLayoutFactory.GetProjectedLEDPointParametric(i, j);
                    double r = 0;
                    double g = 0;
                    double b = 0;

                    //radar effect
                    double a = (p.Item3 + Math.PI) / (Math.PI * 2);
                    r = progress - a;
                    if (r < 0)
                    {
                        r += 1;
                    }
                    if (r > 1)
                    {
                        r = 1;
                    }

                    //pulse effect
                    double dist = Math.Abs(progress - p.Item4);
                    r = 1 - dist;
                    if (r < 0.9)
                    {
                        r = 0;
                    }

                    //spiral effect
                    double m = p.Item4 - a;
                    if (m < 0)
                    {
                        m += 1;
                    }
                    double n = progress - m;
                    if (n < 0)
                    {
                        n += 1;
                    }
                    r = 1 - n;

                    this.dome.SetPixel(i, j, LEDColor.FromDoubles(r, g, b));
                }
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Sets the state for LED on the confirm button. This does not turn off the display.
 /// </summary>
 /// <param name="gateway">Gateway id</param>
 /// <param name="node">Node id. (252 is for all nodes)</param>
 /// <param name="color">The LED Color</param>
 /// <param name="status">The status of LED</param>
 public bool SetLEDStatus(int gateway, int node, LEDColor color, LEDStatus status)
 {
     if (CapsAPI.AB_GW_Status(gateway) != 7)
     {
         return(false);
     }
     CapsAPI.AB_LED_Status(gateway, node, (byte)color, (byte)status);
     return(true);
     //CapsAPI.AB_LED_Dsp(gateway, node, (byte)status, 0);
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Sets the color for the LED on the Kinect.
        /// </summary>
        /// <param name="color">
        /// Color value
        /// </param>
        private void SetLEDColor(LEDColor color)
        {
            int result = KinectNative.freenect_set_led(this.parentDevice.devicePointer, color);

            if (result != 0)
            {
                throw new Exception("Could not set color to " + color + ". Error Code:" + result);
            }
            this.color = color;
        }
Ejemplo n.º 11
0
        public static LEDInstance Flash(LEDColor color, int blinkCount = 0)
        {
            var instance = new LEDInstance(Guid.NewGuid());

            if (!instance.Update(color, blinkCount))
            {
                Util.ThrowExceptionForLastErrno();
            }
            return(instance);
        }
Ejemplo n.º 12
0
 public void fillRectangle(byte x, byte y, byte width, byte height, LEDColor color)
 {
     for (byte tx = x; tx < x + width; tx++)
     {
         for (byte ty = y; ty < y + height; ty++)
         {
             setPixel(tx, ty, color);
         }
     }
 }
Ejemplo n.º 13
0
 public static SendLEDPattern Create(LEDPattern ledPattern, LEDColor ledColor, uint durationMs)
 {
     return(new SendLEDPattern
     {
         baseCommand = new InputDeviceCommand(Type, kSize),
         pattern = (uint)ledPattern,
         color = (uint)ledColor,
         duration = durationMs
     });
 }
Ejemplo n.º 14
0
        // Token: 0x06000002 RID: 2 RVA: 0x000020E0 File Offset: 0x000002E0
        private void TimerCallback(object state)
        {
            LEDColor ledcolor = LEDColor.FromHSV(105, 100, 100);

            float  num  = (float)(((this.cycle / 5)) % 20);
            double num2 = (double)num / 20.0;
            int    num3 = (int)(num2 * 360.0);

            this.leds[0].Color = LEDColor.FromHSV(num3, 100, 100);

            this.cycle += configModel.Speed;
        }
Ejemplo n.º 15
0
        public override void Animate(LEDDomeOutput dome)
        {
            double intensity          = this.AnimationIntensity;
            double scaleColor         = Math.Min(intensity * 2 * this.velocity, 1.0);
            int    totalParts         = this.shape.layout.NumSegments;
            int    animationSplitInto = 2 * ((totalParts - 1) / 2 + 1);

            for (int part = 0; part < totalParts; part += 2)
            {
                double startRange = (double)part / animationSplitInto;
                double endRange   = (double)(part + 2) / animationSplitInto;
                double scaled     = (intensity - startRange) /
                                    (endRange - startRange);
                scaled     = Math.Max(Math.Min(scaled, 1.0), 0.0);
                startRange = Math.Min(startRange / intensity, 1.0);
                endRange   = Math.Min(endRange / intensity, 1.0);

                var spokeSegment = this.shape.layout.GetSegment(part);
                foreach (var strut in spokeSegment.GetStruts())
                {
                    for (int i = 0; i < strut.Length; i++)
                    {
                        double gradientPos =
                            strut.GetGradientPos(scaled, startRange, endRange, i);
                        int color1 = gradientPos != -1.0
              ? LEDColor.ScaleColor(
                            dome.GetGradientColor(this.pad, gradientPos, 0.0, false),
                            scaleColor
                            )
              : 0x000000;
                        dome.SetPixel(strut.Index, i, color1);
                    }
                }

                if (part + 1 == totalParts)
                {
                    break;
                }

                var circleSegment = this.shape.layout.GetSegment(part + 1);
                var color2        = scaled == 1.0
          ? LEDColor.ScaleColor(dome.GetSingleColor(this.pad), scaleColor)
          : 0x000000;
                foreach (var strut in circleSegment.GetStruts())
                {
                    for (int i = 0; i < strut.Length; i++)
                    {
                        dome.SetPixel(strut.Index, i, color2);
                    }
                }
            }
        }
Ejemplo n.º 16
0
    public void setLED(LEDColor color)
    {
        var   LED   = transform.Find("Indicator");
        Image image = LED.GetComponent <Image> ();

        flashTimer.Stop();
        if (color == LEDColor.Green_Flash || color == LEDColor.Red_Flash)
        {
            flashTimer.Start();
            flashOn = true;             // Start the flash on.
        }
        currentColor = color;
    }
Ejemplo n.º 17
0
 public void drawRectangle(byte x, byte y, byte width, byte height, LEDColor color)
 {
     for (byte tx = x; tx < x + width; tx++)
     {
         setPixel(tx, y, color);
         setPixel(tx, (byte)(y + height - 1), color);
     }
     for (byte ty = y; ty < y + height; ty++)
     {
         setPixel(x, ty, color);
         setPixel((byte)(x + width - 1), ty, color);
     }
 }
Ejemplo n.º 18
0
    public void SendLEDPattern()
    {
#if UNITY_MAGIC_LEAP
        LEDPattern pattern  = (LEDPattern)ledPatternDropdown.value;
        LEDColor   color    = (LEDColor)ledColorDropdown.value;
        uint       duration = (uint)ledDurationSlider.value;

        MagicLeapController controller = InputSystem.GetDevice <MagicLeapController>();
        if (controller != null)
        {
            controller.StartLEDPattern(pattern, color, duration);
        }
#endif
    }
Ejemplo n.º 19
0
        private MifareResponse sendLedRequest(LEDColor ledColor)
        {
            byte[] readBuffer  = new byte[64];
            int    offset      = 0;
            int    bytesToRead = 0;

            WriteCommand(Command.SET_LED_COLOR, NODE_BROADCAST, (byte)ledColor);

            // Naive busy way. Rewrite to consumer stream pull!
            do
            {
                Thread.Sleep(50);
                bytesToRead = port.BytesToRead;
            } while (bytesToRead == 0);

            // TODO: Use callback, make response parser able to read lazily from input stream
            int bytesRead = port.Read(readBuffer, offset, bytesToRead);

            // Evaluate data in buffer

            MifareResponse response = new MifareResponse();

            ushort length = readBuffer.Subset(2, 2).ToUInt16();
            //Console.WriteLine ("Length: {0} ( {1})", length, readBuffer.Subset (2, 2).ToHex ());

            ushort nodeID = readBuffer.Subset(4, 2).ToUInt16();

            //Console.WriteLine ("NodeID: {0} ( {1})", nodeID, readBuffer.Subset (4, 2).ToHex ());
            response.NodeId = nodeID;

            ushort commandCode = readBuffer.Subset(6, 2).ToUInt16();

            //Console.WriteLine ("Command: {0} ( {1})", Enum.GetName (typeof(CommandCode), commandCode), readBuffer.Subset (6, 2).ToHex ());
            response.Command = (Command)commandCode;

            byte responseCode = readBuffer[8];

            //Console.WriteLine ("Response Code: {0} ( {1})", Enum.GetName (typeof(ResponseCode), responseCode), responseCode.ToHex ());
            response.Response = (Response)responseCode;

            //byte checksum = readBuffer [readBuffer.Length-1];
            byte checksum = readBuffer[4 + length];

            byte calculatedChecksum = CalcCheckSum(readBuffer, 4, 4 + length);

            validateChecksum(checksum, calculatedChecksum);

            return(response);
        }
Ejemplo n.º 20
0
    void Update()
    {
        var   LED   = transform.Find("Indicator");
        Image image = LED.GetComponent <Image> ();

        // Flashing
        if (currentColor == LEDColor.Red_Flash || currentColor == LEDColor.Green_Flash)
        {
            if (flashOn)
            {
                switch (currentColor)
                {
                case LEDColor.Green_Flash:
                    image.sprite = LED_GREEN;
                    break;

                case LEDColor.Red_Flash:
                    image.sprite = LED_RED;
                    break;
                }
                liveColor = currentColor;
            }
            else
            {
                image.sprite = LED_OFF;
                liveColor    = LEDColor.Off;
            }
            // Static
        }
        else
        {
            switch (currentColor)
            {
            case LEDColor.Green:
                image.sprite = LED_GREEN;
                break;

            case LEDColor.Red:
                image.sprite = LED_RED;
                break;

            case LEDColor.Off:
                image.sprite = LED_OFF;
                break;
            }
            liveColor = currentColor;
        }
    }
Ejemplo n.º 21
0
        public void Visualize()
        {
            if (this.stopwatch.ElapsedMilliseconds <= 1000)
            {
                return;
            }
            this.stopwatch.Restart();
            int triangles = this.config.stageSideLengths.Length / 3;

            for (int i = 0; i < triangles; i++)
            {
                int tracerIndex = LEDStageTracerVisualizer.TracerLEDIndex(
                    this.config,
                    i
                    );
                int triangleCounter    = 0;
                int maxTriangleCounter = this.config.stageSideLengths[i * 3] +
                                         this.config.stageSideLengths[i * 3 + 1] +
                                         this.config.stageSideLengths[i * 3 + 2];
                for (int j = 0; j < 3; j++)
                {
                    for (
                        int k = 0;
                        k < this.config.stageSideLengths[i * 3 + j];
                        k++, triangleCounter++
                        )
                    {
                        bool secondPart = this.sideParts[i * 3 + j] ^
                                          (this.config.beatBroadcaster.ProgressThroughBeat(0.25) > 0.5);
                        int color = this.stage.GetGradientColor(
                            secondPart ? 1 : 0,
                            (double)triangleCounter / maxTriangleCounter,
                            (double)tracerIndex / maxTriangleCounter,
                            true
                            );
                        int dimmedColor = LEDColor.ScaleColor(
                            color,
                            this.audio.LevelForChannel(secondPart ? 2 : 1)
                            );
                        for (int l = 0; l < 3; l++)
                        {
                            this.stage.SetPixel(i * 3 + j, k, l, dimmedColor);
                        }
                    }
                }
            }
            this.stage.Flush();
        }
Ejemplo n.º 22
0
        public byte GetOrdered(LEDColor cl, RGBOrder order, int pos)
        {
            string r = order.ToString();
            string p = r.Substring(pos, 1);

            switch (p)
            {
            case "R": return((byte)cl.Red);

            case "G": return((byte)cl.Green);

            case "B": return((byte)cl.Blue);
            }

            return(0);
        }
Ejemplo n.º 23
0
        public bool Update(LEDColor color, int blinkCount = 0)
        {
            if (blinkCount < 0)
            {
                throw new ArgumentOutOfRangeException("blinkCount", blinkCount, "0 <= blinkCount");
            }
            var success = LED.led_request_color(id, color, blinkCount) == BPS.BPS_SUCCESS;

            if (success)
            {
                Color = color;
                ContinuousBlinking = blinkCount == 0;
                BlinkCount         = blinkCount;
            }
            return(success);
        }
Ejemplo n.º 24
0
        public int GetSingleColor(int index)
        {
            if (this.config.beatBroadcaster.CurrentlyFlashedOff)
            {
                return(0x000000);
            }
            int absoluteIndex = LEDColor.GetAbsoluteColorIndex(
                index,
                this.config.colorPaletteIndex
                );

            return(LEDColor.ScaleColor(
                       this.config.colorPalette.GetSingleColor(absoluteIndex),
                       this.config.stageBrightness
                       ));
        }
Ejemplo n.º 25
0
        public LED this[LEDColor color]                     //Lässt sich wie ein Array aufrufen und man kann mithilfe eine LEDfarbe das entsprechende LED-Objekt abfragen.
        {
            get
            {
                switch (color)
                {
                case LEDColor.Green: return(ledGreen);

                case LEDColor.Yellow: return(ledYellow);

                case LEDColor.Blue: return(ledBlue);

                case LEDColor.Red: return(ledRed);

                default: Console.WriteLine("Unbekannte LED" + color); return(ledError);
                }
            }
        }
Ejemplo n.º 26
0
        public static async Task <bool> SetLED(int id, LEDMode mode, LEDColor color = LEDColor.All)
        {
            if (isDemoModeActive)
            {
                return(false);
            }

            try
            {
                bool response = await Task.Run(() => MasterDelegate(() => connection.SetLED(id, mode.ToString(), color.ToString())));

                return(false);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                return(false);
            }
        }
Ejemplo n.º 27
0
 public int Color(LEDDomeOutput dome, Configuration config, double loc_y, double loc_ang)
 {
     if (conf.coloring == Coloring.Fade)
     {
         return(LEDColor.ScaleColor(dome.GetSingleColor(this.idx), loc_ang));
     }
     else if (conf.coloring == Coloring.FadeExp)
     {
         var s = 4 * loc_ang - 4;
         return(LEDColor.ScaleColor(
                    dome.GetSingleColor(this.idx),
                    1.0 / (1 + Math.Pow(Math.E, -s))
                    ));
     }
     else if (conf.coloring == Coloring.Multi)
     {
         var end_index = config.colorPalette.colors.Length - 1;
         return(dome.GetGradientBetweenColors(end_index - 4, end_index, loc_ang, 0.0, false));
     }
     return(dome.GetSingleColor(this.idx));
 }
Ejemplo n.º 28
0
        // Token: 0x06000002 RID: 2 RVA: 0x000020E0 File Offset: 0x000002E0
        private void TimerCallback(object state)
        {
            LEDColor ledcolor = LEDColor.FromHSV(105, 100, 100);

            for (int i = 0; i < 20; i++)
            {
                float  num  = (float)((i + (this.cycle / 5)) % 20);
                double num2 = (double)num / 20.0;
                int    num3 = (int)(num2 * 360.0);
                this.leds[i].Color = LEDColor.FromHSV(num3, 1, 1);
            }

            if (configModel.ReverseDirection)
            {
                this.cycle -= (int)configModel.Speed;
            }
            else
            {
                this.cycle += (int)configModel.Speed;
            }
        }
Ejemplo n.º 29
0
        public void ManagePOV()
        {
            LEDColor[] myleds = new LEDColor[15];
            while (!disposing)
            {
                if (pushRequested)
                {
                    for (int i = 0; i < 15; i++)
                    {
                        myleds[i] = new LEDColor(leds[i].Color.Red, leds[i].Color.Green, leds[i].Color.Blue);
                    }

                    pushRequested = false;
                }

                if (!cmrgb.SetFrame(myleds))
                {
                    Thread.Sleep(33);
                }
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Sets the color and brightness of the led.
        /// </summary>
        /// <param name="LEDIndex">The index of the LED. 0 = Bottom, 3 = Top.</param>
        /// <param name="Color">The Color to use. Red or Green</param>
        /// <param name="Brightness">0 = off, 100 = on, 1-99 Brightness</param>
        public void SetLED(int LEDIndex, LEDColor Color, int Brightness)
        {
            List <byte> _sendList = new List <byte>();
            //LEDs start at 5
            //Green = +0
            //Red = +1
            //Example:
            //  Bottom LED Green = GPIO 5
            //  Bottom LED Red = GPIO 6
            //Thanks to cool stuff like that we get slick code!
            //Once Again Bottom LED is GPIO 5 our Index is 0, see the cool factor?

            //Okay, this is a long command but really simple
            //Bassicaly we are sending the command
            //Next: New Byte Array Length 2
            //First Byte LED
            //Second Brightness

            int gpio = 5 + (LEDIndex * 2) + (int)Color;

            this.SendCommand(Commands.SET_CONFIGURE_GPIO_PIN, new [] { (byte)gpio, (byte)Brightness });
        }
        public LEDColor[] From2D(ControlDevice.LedUnit[,] input)
        {
            var rrr = new LEDColor[106];
            int ct  = 0;

            for (int y = 0; y < input.GetLength(1); y++)
            {
                for (int x = 0; x < input.GetLength(0); x++)
                {
                    var mm = matrixMap[y][x];
                    if (mm != NA)
                    {
                        if (input[x, y] != null)
                        {
                            rrr[mm] = (input[x, y].Color);
                            ct++;
                        }
                    }
                }
            }

            return(rrr.ToArray());
        }
Ejemplo n.º 32
0
        public void Push(ControlDevice controlDevice)
        {
            GameSensePayloadPeripheryColorEventJSON payload = new GameSensePayloadPeripheryColorEventJSON();

            GameSenseSdk.setupEvent(payload);
            switch (controlDevice.DeviceType)
            {
            case DeviceTypes.Headset:
                LEDColor color = controlDevice.LEDs.First().Color;
                GameSenseSdk.setHeadsetColor((byte)color.Red, (byte)color.Green, (byte)color.Blue, payload);
                GameSenseSdk.sendFullColorRequest(payload);
                break;

            case DeviceTypes.Keyboard:

                List <byte> hids = new List <byte>();
                List <Tuple <byte, byte, byte> > colors = new List <Tuple <byte, byte, byte> >();
                foreach (var controlDeviceLeD in controlDevice.LEDs)
                {
                    LEDColor clr = controlDeviceLeD.Color;
                    hids.Add((byte)((SteelSeriesLedData)controlDeviceLeD.Data).KeyCode);
                    colors.Add(new Tuple <byte, byte, byte>((byte)clr.Red, (byte)clr.Blue, (byte)clr.Green));
                }

                GameSenseSdk.setKeyboardColors(hids, colors, payload);
                break;

            case DeviceTypes.Mouse:
                GameSenseSdk.setMouseScrollWheelColor((byte)controlDevice.LEDs[0].Color.Red, (byte)controlDevice.LEDs[0].Color.Green, (byte)controlDevice.LEDs[0].Color.Blue, payload);
                GameSenseSdk.setMouseColor((byte)controlDevice.LEDs[1].Color.Red, (byte)controlDevice.LEDs[1].Color.Green, (byte)controlDevice.LEDs[1].Color.Blue, payload);
                GameSenseSdk.setMouseLogoColor((byte)controlDevice.LEDs[2].Color.Red, (byte)controlDevice.LEDs[2].Color.Green, (byte)controlDevice.LEDs[2].Color.Blue, payload);

                GameSenseSdk.sendFullColorRequest(payload);
                break;
            }
        }
Ejemplo n.º 33
0
 public static extern int freenect_set_led(IntPtr device, LEDColor color);
Ejemplo n.º 34
0
 internal static extern int led_request_color([MarshalAs(UnmanagedType.LPStr)]string id, LEDColor color, int blink_count);
Ejemplo n.º 35
0
 public bool Update(LEDColor color, int blinkCount = 0)
 {
     if (blinkCount < 0)
     {
         throw new ArgumentOutOfRangeException("blinkCount", blinkCount, "0 <= blinkCount");
     }
     var success = LED.led_request_color(id, color, blinkCount) == BPS.BPS_SUCCESS;
     if (success)
     {
         Color = color;
         ContinuousBlinking = blinkCount == 0;
         BlinkCount = blinkCount;
     }
     return success;
 }
Ejemplo n.º 36
0
 public static LEDInstance Flash(LEDColor color, int blinkCount = 0)
 {
     var instance = new LEDInstance(Guid.NewGuid());
     if (!instance.Update(color, blinkCount))
     {
         Util.ThrowExceptionForLastErrno();
     }
     return instance;
 }