Exemple #1
0
        private static Pr1132ControlGroup ParseGroup(byte[] buf)
        {
            var group = new Pr1132ControlGroup();

            var nameBytes = buf.Take(24).ToArray();

            group.Name    = Windows1251Encoding.Instance.GetString(nameBytes, 0, 24).TrimEnd((char)0);
            group.Enabled = buf[24] < 64;

            for (int j = 0; j < 4; j++)
            {
                group.Sensors[j] = buf[25 + j] >= 64;
            }

            for (int j = 0; j < 8; j++)
            {
                var channel = buf[24 + j] & 63;
                group.ChannelNumbers[j] = channel == 0 ? (int?)null : channel - 1;
            }

            return(group);
        }
Exemple #2
0
 public Pr1132Configuration()
 {
     Groups   = new Pr1132ControlGroup[16];
     Channels = new Pr1132Channel[32];
     Timers   = new Pr1132Timer[7];
 }