Ejemplo n.º 1
0
        public void Connect(EventHandler<SaleaeStringEventArgs> saleaeApiMonitor = null,
            EventHandler<LoggingEventArgs> loggingEventHandler = null)
        {
            saleae = new SocketAPI(host, port);

            if (saleaeApiMonitor != null)
            {
                saleae.SaleaeStringEvent += saleaeApiMonitor;
            }
            CallerLoggingEventHandler = loggingEventHandler;

            connDevs = saleae.GetConnectedDevices();
            dev = (from d in connDevs where d.type == "LOGIC_PRO_16_DEVICE" select d).FirstOrDefault();
            if( dev.index == 0 )
            {   // Can't find logic pro 16.  Just pick the first one.
                var dLst = (from d in connDevs where d.index > 0 select d);
                var minIdx = (from d in dLst select d.index).Min();
                dev = (from d in dLst where d.index == minIdx select d ).FirstOrDefault();
            }

            if (dev.index != 0)
            {
                saleae.SelectActiveDevice(dev.index);
            }
            else
            {   // Can't find any device.  Not sure what is wrong.
                saleae = null;
            }

            OnPropertyChanged("HasConnection");
        }
Ejemplo n.º 2
0
 public LoggingThread(SocketAPI saleae, int ScanSeconds, int BurstSeconds, EventHandler<LoggingEventArgs> CallerLoggingEventHandler)
 {
     this.saleae = saleae;
     this.ScanSeconds = ScanSeconds;
     this.BurstSeconds = BurstSeconds;
     Register(CallerLoggingEventHandler);
 }