Пример #1
0
 /// <summary>
 /// Creates the record based onthe data from the modem.
 /// </summary>
 /// <param name="data">the data from the modem</param>
 public LinkingRecord(byte[] data)
 {
     flags     = data[0];
     group     = data[1];
     id        = new DeviceId(data[2], data[3], data[4]);
     linkData1 = data[5];
     linkData2 = data[6];
     linkData3 = data[7];
 }
Пример #2
0
 /// <summary>
 /// Create from an input byte array from the power line modem.
 /// </summary>
 /// <param name="data">The input data</param>
 public InsteonPacket(byte[] data)
 {
     FromAddress = new DeviceId(data[0], data[1], data[2]);
     ToAddress   = new DeviceId(data[3], data[4], data[5]);
     Flags       = new InsteonFlags();
     Flags.FromByte(data[6]);
     Command1 = data[7];
     Command2 = data[8];
     UserData = new byte[data.Length - 9];
     Array.Copy(data, 9, UserData, 0, data.Length - 9);
 }
Пример #3
0
 /// <summary>
 /// Create a new standard length command.
 /// </summary>
 /// <param name="id">id to sent to</param>
 /// <param name="cmd">cmd1 bit</param>
 /// <param name="cmd2">cmd2 bit</param>
 public InsteonPacket(DeviceId id, Command cmd, byte cmd2)
 {
     Command1          = (byte)cmd;
     Command2          = cmd2;
     FromAddress       = id;
     ToAddress         = id;
     flags             = new InsteonFlags();
     flags.MessageType = InsteonFlags.MessageTypeEnum.Direct;
     flags.MaxHops     = 0x3;
     flags.HopsLeft    = 0x3;
 }
Пример #4
0
 public override bool Equals(object obj)
 {
     if (obj is DeviceId)
     {
         DeviceId id = (DeviceId)obj;
         return(id.Address[0] == this.Address[0] &&
                id.Address[1] == this.Address[1] &&
                id.Address[2] == this.Address[2]);
     }
     return(base.Equals(obj));
 }
Пример #5
0
 /// <summary>
 /// Creates an insteon packet with an extended command.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="cmd"></param>
 public InsteonPacket(DeviceId id, ExtendedCommand cmd, byte cmd2, byte[] data)
 {
     Command1              = (byte)((int)cmd >> 8);
     Command2              = (byte)(((int)cmd & 0xff) | cmd2);
     UserData              = data;
     FromAddress           = id;
     ToAddress             = id;
     flags                 = new InsteonFlags();
     flags.MessageType     = InsteonFlags.MessageTypeEnum.Direct;
     flags.ExtendedMessage = true;
     flags.MaxHops         = 0x3;
     flags.HopsLeft        = 0x3;
 }
Пример #6
0
 /// <summary>
 /// Creates a new standard length command.
 /// </summary>
 /// <param name="id">id to send to</param>
 /// <param name="cmd">Standard command to send</param>
 public InsteonPacket(DeviceId id, Command cmd)
     : this(id, cmd, 0)
 {
 }