private APCI_Typ m_APCI; // APCI-Typ // Konstruktor aus empfangenen Rohdaten public EIB_Telegramm(byte [] raw) { m_ReceiveTime = DateTime.Now; //xxx if (raw.Length < 10) throw new Exception("Rohdaten zu kurz"); // Quelle eintragen m_source = new EIB_Adress((raw[1] << 8) + raw[2], EIB_Adress_Typ.PhysAdr); // Ziel eintragen //if ((raw[5]&0x80 ) == 0x80) m_destination = new EIB_Adress((raw[3] << 8) + raw[4], EIB_Adress_Typ.GroupAdr); //else // m_destination = new EIB_Adress((raw[3] << 8) + raw[4], EIB_Adress_Typ.PhysAdr); // Datenlänge bestimmen m_DataLen = raw[5] & 0x0F; // APCI bestimmen m_APCI = (APCI_Typ)((raw[7] >> 6) & 0x03); // Daten kopieren m_value = new byte[m_DataLen]; for (ushort i = 0; i < m_DataLen; i++) { m_value[i] = raw[i + 7]; } // APCI-Flag aus den Daten ausblenden if (m_DataLen > 0) { m_value[0] = (byte)((byte)m_value[0] & (byte)0x3F); } }
public static EIB_Adress Parse(string EibAdrString) { Exception ex = new EndOfStreamException("Falsches Format der EIB-Adresse"); EIB_Adress e = null; char[] delimiterChars = { '/', '.' }; String[] parts = EibAdrString.Split(delimiterChars); if (parts.Length != 3) { throw ex; } ushort a = ushort.Parse(parts[0]); ushort b = ushort.Parse(parts[1]); ushort c = ushort.Parse(parts[2]); if (EibAdrString.Contains("/")) { // Gruppenadr e = new EIB_Adress(a, b, c); } else if (EibAdrString.Contains(".")) { // Physik. Adr e = new EIB_Adress(0, EIB_Adress_Typ.PhysAdr); e.Set_PA(a, b, c); } return(e); }
public EIB_Adress(string EibAdrString) { EIB_Adress adr = EIB_Adress.Parse(EibAdrString); m_Adr = adr.m_Adr; m_Typ = adr.m_Typ; }
// Konstruktor für EIS11: uint public EIB_Telegramm(EIB_Adress DestinationAdr, uint value, APCI_Typ apci) { m_ReceiveTime = DateTime.Now; m_source = new EIB_Adress(EIB_Phys_Source_Adr, EIB_Adress_Typ.PhysAdr); m_destination = DestinationAdr; m_APCI = apci; Eis11 = value; }
public EIB_Telegramm(HDKnx hdKnx) { m_ReceiveTime = hdKnx.time; m_source = hdKnx.emi.sourceAdr;// new EIB_Adress(EIB_Phys_Source_Adr, EIB_Adress_Typ.PhysAdr); m_destination = hdKnx.destAdr; m_APCI = hdKnx.emi.APCI; m_value = hdKnx.rawValue; m_DataLen = hdKnx.emi.DataLen; }
// Vergleich zweier Adr. public bool Equals(EIB_Adress obj) { if (obj == null) { return(false); } if (m_Typ != obj.m_Typ) { return(false); } return(m_Adr == obj.m_Adr); }
// Konstruktor für EIS1 Telegramm: bool public EIB_Telegramm(EIB_Adress DestinationAdr, bool value, APCI_Typ apci) { m_ReceiveTime = DateTime.Now; m_source = new EIB_Adress(EIB_Phys_Source_Adr, EIB_Adress_Typ.PhysAdr); m_destination = DestinationAdr; m_APCI = apci; m_DataLen = 1; m_value = new byte[m_DataLen]; if (value) { m_value[0] = (byte)1; } else { m_value[0] = (byte)0; } }
public int CompareTo(object obj) { if (obj == null) { return(1); } EIB_Adress otherAdr = obj as EIB_Adress; if (m_Typ != otherAdr.m_Typ) { return(1); } if (otherAdr != null) { return(this.m_Adr.CompareTo(otherAdr.m_Adr)); } else { throw new ArgumentException("Object is not a EIB_Adress"); }; }