/// <summary> /// /// </summary> /// <param name="Name"></param> /// <returns></returns> public static CardDefBase CreateCardByName(int Slot, string Name) {// adding Card: add card here CardDefBase Card = null; if (Name == "841") { Card = new CardDef841(Slot); } else if (Name == "530") { Card = new CardDef530(Slot); } else if (Name == "430") { Card = new CardDef430(Slot); } else if (Name == "841") { Card = new CardDef841(Slot); } else if (Name == "842") { Card = new CardDef842(Slot); } else if (Name == "461") { Card = new CardDef461(Slot); } else if (Name == "468") { Card = new CardDef468(Slot); } else if (Name == "479") { Card = new CardDef479(Slot); } else if (Name == "511") { Card = new CardDef511(Slot); } else if (Name == "550") { Card = new CardDef550(Slot); } if (Card == null) { throw new Exception("unknown card: " + Name); } return(Card); }
/// <summary> /// converts the configuration register value of koppler into card definition /// </summary> /// <param name="Code"></param> /// <returns></returns> public static CardDefBase CreateCardByCode(int Slot, UInt16 Code) {// adding Card: add card here CardDefBase Card = null; #region digital cards detection //special handling of digital cards goes here if ((Code & 0x8000) > 0) { int ChannelCount = ((int)Code >> 8) & 0x7F; if ((Code & 0x0003) == 3) { // in & out //?? } else if ((Code & 0x0001) > 0) { // in switch (ChannelCount) { case 8: Card = new CardDef430(Slot); break; default: break; } } else if ((Code & 0x0002) > 0) { // out switch (ChannelCount) { case 8: Card = new CardDef530(Slot); break; default: break; } } } #endregion else if (Code == 841) { Card = new CardDef841(Slot); } else if (Code == 842) { Card = new CardDef842(Slot); } else if (Code == 430) { Card = new CardDef430(Slot); } else if (Code == 461) { Card = new CardDef461(Slot); } else if (Code == 468) { Card = new CardDef468(Slot); } else if (Code == 479) { Card = new CardDef479(Slot); } else if (Code == 511) { Card = new CardDef511(Slot); } else if (Code == 530) { Card = new CardDef530(Slot); } else if (Code == 550) { Card = new CardDef550(Slot); } if (Card == null) { throw new Exception("unknown card: " + Code.ToString()); } return(Card); }