Example #1
0
        public static InstrumentCollection GetInstruments()
        {
            // Add to list any instrument that has its own class structure
            InstrumentCollection list = new InstrumentCollection();

            foreach (var insFile in Directory.GetFiles("Instruments", "*.plf"))
            {
                var ins = Instrument.FromFile(insFile);
                if (ins != null)
                {
                    if (ins.ChannelType == ChannelType.I2C)
                    {
                        continue;
                    }
                    list.Items.Add(ins);
                }
            }
            return(list);
        }
Example #2
0
        public static I2CInstrument FromI2C(int i2cAddress, int instrumentID)
        {
            InstrumentCollection list = new InstrumentCollection();

            foreach (var insFile in Directory.GetFiles("Instruments", "*.plf"))
            {
                var ins_ = FromFile(insFile);
                if (ins_ != null)
                {
                    I2CInstrument ins = null;
                    if (ins_ is I2CInstrument)
                    {
                        ins = (I2CInstrument)ins_;
                        if (ins.InstrumentTypeIndex == instrumentID)
                        {
                            ins.InstrumentAddress = i2cAddress;
                            return(ins);
                        }
                    }
                }
            }
            return(null);
        }