示例#1
0
        /// <summary>
        /// Schedules a given group
        /// </summary>
        /// <param name="groupBits">Group number</param>
        /// <param name="schedule">32-bit schedule</param>
        /// <param name="now">If set to <c>true</c> schedule now.</param>
        /// <param name="matchType">Match type.</param>
        public void GroupSchedule(byte groupBits, UInt32 schedule, bool now, GroupMatchType matchType = GroupMatchType.ANY)
        {
            byte byte1 = 11;

            if (now)
            {
                byte1 = 10;
            }

            byte1 <<= 4;
            byte1   = (byte)(byte1 | (byte)matchType);

            byte byte2 = groupBits;
            byte byte3 = (byte)((schedule & Convert.ToUInt32("11111111000000000000000000000000", 2)) >> 24);
            byte byte4 = (byte)((schedule & Convert.ToUInt32("00000000111111110000000000000000", 2)) >> 16);
            byte byte5 = (byte)((schedule & Convert.ToUInt32("00000000000000001111111100000000", 2)) >> 8);
            byte byte6 = (byte)(schedule & Convert.ToUInt32("00000000000000000000000011111111", 2));
            byte byte7 = 0x00;

            byte[] buff = new byte[7] {
                byte1, byte2, byte3, byte4, byte5, byte6, byte7
            };
            _driver.Write(buff, 0, buff.Length);
        }
示例#2
0
 public SimplePattern Where(string variable, GroupMatchType matchtype)
 {
     switch(matchtype)
     {
     case GroupMatchType.AlphaNumeric:
         return Where(variable, "^[0-9a-zA-Z]+$");
     case GroupMatchType.Float:
         return Where(variable, @"^[-+]?[0-9]*\.?[0-9]+$");
     case GroupMatchType.Integer:
         return Where(variable, "^[-+]?[0-9]*$");
     case GroupMatchType.HexString:
         return Where(variable, "^[0-9A-Fa-f]+$");
     default:
         throw new NotSupportedException("That match type isn't supported");
     }
 }
示例#3
0
        /// <summary>
        /// Fades the given group to the given color
        /// </summary>
        /// <param name="groupBits">Group number</param>
        /// <param name="r">The red component.</param>
        /// <param name="g">The green component.</param>
        /// <param name="b">The blue component.</param>
        /// <param name="time">How many time steps to fade over</param>
        /// <param name="matchType">Match type.</param>
        public void GroupFadeToColor(byte groupBits, byte r, byte g, byte b, byte time, GroupMatchType matchType = GroupMatchType.ANY)
        {
            byte byte1 = 9;

            byte1 <<= 4;
            byte1   = (byte)(byte1 | (byte)matchType);
            byte byte2 = groupBits;

            byte[] buff = new byte[7] {
                byte1, byte2, r, g, b, time, 0
            };
            _driver.Write(buff, 0, buff.Length);
        }