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 cEMI(EIB_Telegramm tele) { this.m_destination = tele.DestAdr; this.m_APCI = tele.apci; this.m_source = tele.SourceAdr; m_value = tele.RawData; m_DataLen = tele.DataLen; }
// 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; }
/// <summary> /// Konstruktor for EIS3/EIS4 (Datum oder Zeit) /// </summary> /// <param name="EIB Destination Adress"></param> /// <param name="bool"></param> public cEMI(EIB_Adress eIB_Adress, DateTime time, bool IsDatum) { this.m_destination = eIB_Adress; m_APCI = APCI_Typ.Send; if (IsDatum) { Eis4 = time; } else { Eis3 = time; } }
// 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; } }
/// <summary> /// Konstruktor aus Byte Array /// </summary> /// <param name="array"></param> public cEMI(byte[] array) { m_ReceiveTime = DateTime.Now; try { // Quelle eintragen m_source = new EIB_Adress((array[sourceAdrH] << 8) + array[sourceAdrL], EIB_Adress_Typ.PhysAdr); // Ziel eintragen if ((array[control2] & 0x80) == 0x80) { m_destination = new EIB_Adress((array[DestAdrH] << 8) + array[DestAdrL], EIB_Adress_Typ.GroupAdr); } else { m_destination = new EIB_Adress((array[DestAdrH] << 8) + array[DestAdrL], EIB_Adress_Typ.PhysAdr); } // Datenlänge m_DataLen = array[dataLen] & 0x0f; // APCI bestimmen m_APCI = (APCI_Typ)((array[10] >> 6) & 0x03); // Daten kopieren m_value = new byte[m_DataLen]; Array.Copy(array, 10, m_value, 0, m_DataLen); for (ushort i = 0; i < m_DataLen; i++) { m_value[i] = array[i + 10]; } // APCI-Flag aus den Daten ausblenden if (m_DataLen > 0) { m_value[0] = (byte)((byte)m_value[0] & (byte)0x3F); } } catch (Exception e) { throw new Exception("Fehler in cEMI-Konstruktor aus Array", e); } return; }
/// <summary> /// Konstruktor for EIS1 (bool) /// </summary> /// <param name="EIB Destination Adress"></param> /// <param name="bool"></param> public cEMI(EIB_Adress eIB_Adress, bool flag) { this.m_destination = eIB_Adress; m_APCI = APCI_Typ.Send; Eis1 = flag; }
/// <summary> /// Konstruktor for EIS11 (long) /// </summary> /// <param name="EIB Destination Adress"></param> /// <param name="value"></param> public cEMI(EIB_Adress eIB_Adress, uint value) { this.m_destination = eIB_Adress; m_APCI = APCI_Typ.Send; Eis11 = value; }
/// <summary> /// Konstruktor for EIS5 (float) /// </summary> /// <param name="EIB Destination Adress"></param> /// <param name="Float"></param> public cEMI(EIB_Adress eIB_Adress, float value) { this.m_destination = eIB_Adress; m_APCI = APCI_Typ.Send; Eis5 = (float)value; }
/// <summary> /// Konstruktor for EIS3 (Zeit) /// </summary> /// <param name="EIB Destination Adress"></param> /// <param name="bool"></param> public cEMI(EIB_Adress eIB_Adress, DateTime time) { this.m_destination = eIB_Adress; m_APCI = APCI_Typ.Send; Eis3 = time; }
/// <summary> /// Konstruktoe für EIS2 (Dim) /// </summary> /// <param name="eIB_Adress"></param> /// <param name="flag"></param> public cEMI(EIB_Adress eIB_Adress, byte val) { this.m_destination = eIB_Adress; m_APCI = APCI_Typ.Send; Eis2 = val; }