Ejemplo n.º 1
0
        public Lamp(PDBConfig pdb, string number_str)
        {
            this.pdb = pdb;
            string upper_str = number_str.ToUpper();

            if (IsDirectLamp(upper_str))
            {
                this.lamp_type = "dedicated";
                this.output    = (byte)(Int32.Parse(number_str.Substring(1)));
            }
            else if (IsPDBLamp(number_str))
            {
                this.lamp_type = "pdb";
                string[] addr_parts = PDBFunctions.SplitMatrixAddressParts(number_str);
                string   source_addr, sink_addr;
                source_addr = addr_parts[0];
                sink_addr   = addr_parts[1];


                PDBAddress addr = PDBFunctions.DecodePdbAddress(source_addr, pdb.aliases.ToArray());
                source_boardnum  = addr.board;
                source_banknum   = addr.bank;
                source_outputnum = addr.output;

                addr           = PDBFunctions.DecodePdbAddress(sink_addr, pdb.aliases.ToArray());
                sink_boardnum  = addr.board;
                sink_banknum   = addr.bank;
                sink_outputnum = addr.output;
            }
            else
            {
                lamp_type = "unknown";
            }
        }
Ejemplo n.º 2
0
 public bool IsPDBLamp(string str)
 {
     string[] _params = PDBFunctions.SplitMatrixAddressParts(str);
     if (_params.Length != 2)
     {
         return(false);
     }
     foreach (string addr in _params)
     {
         if (!PDBFunctions.IsPdbAddress(addr, this.pdb.aliases.ToArray()))
         {
             Console.WriteLine("Not PDB address! " + addr);
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 3
0
        public Coil(PDBConfig pdb, string number_str)
        {
            this.pdb = pdb;
            string upper_str = number_str.ToUpper();

            if (this.is_direct_coil(upper_str))
            {
                this.coil_type  = "dedicated";
                this.bank_num   = (byte)((Int32.Parse(number_str.Substring(1)) - 1) / 8);
                this.output_num = (byte)(Int32.Parse(number_str.Substring(1)));
            }
            else if (this.is_pdb_coil(number_str))
            {
                this.coil_type = "pdb";
                PDBAddress addr = PDBFunctions.DecodePdbAddress(number_str, this.pdb.aliases.ToArray());
                this.board_num  = addr.board;
                this.bank_num   = addr.bank;
                this.output_num = addr.output;
            }
        }
Ejemplo n.º 4
0
 public bool is_pdb_coil(string str)
 {
     return(PDBFunctions.IsPdbAddress(str, this.pdb.aliases.ToArray()));
 }