public static void Configure(TestContext tc)
        {
            //Diag output will go to the "output" logs if you add tehse two lines
            //TextWriterTraceListener writer = new TextWriterTraceListener(System.Console.Out);
            //Debug.Listeners.Add(writer);

            Debug.WriteLine("Diag Called inside Configure before log4net setup");
            XmlConfigurator.Configure(new FileInfo("log4net.properties"));
            // create the first logger AFTER we run the configuration
            ILog LOG = LogManager.GetLogger(typeof(TestHarnessSetup));

            //IOIOLog LOG = IOIOLogManager.GetLogger(typeof(LoggingSetup));
            LOG.Debug("log4net initialized for tests");
            Debug.WriteLine("Diag Called inside Configure after log4net setup");

            if (TestHarnessSetup.GOOD_CONN_NAME == null)
            {
                TestHarnessSetup.GOOD_CONN_NAME = FindDeviceHack.TryAndFindIOIODevice();
                if (TestHarnessSetup.GOOD_CONN_NAME == null)
                {
                    LOG.Debug("Hack did not find connection ");
                }
                else
                {
                    LOG.Debug("Hack found connection " + TestHarnessSetup.GOOD_CONN_NAME);
                }
            }
            else
            {
                LOG.Debug("There was a previously configured connection");
            }
        }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();
            string comPort = FindDeviceHack.TryAndFindIOIODevice();

            ComPort_Field.Text = comPort;
            if (comPort != null)
            {
                IOIOConnection connection = new SerialConnectionFactory().CreateConnection(comPort);

                ObserverConnectionState handlerCaptureState = new ObserverConnectionState();
                RotationObserver        rotationObserver    = new RotationObserver(
                    L3G4200DConstants.Gyro_DPS_LSB_2000,        // must match the sensitivity in register initialization
                    PollingIntervalMsec,
                    this.X_Angle, this.Y_Angle, this.Z_Angle,
                    this.X_RawField, this.Y_RawField, this.Z_RawField,
                    this.X_CallibField, this.Y_CallibField, this.Z_CallibField,
                    this.Teapot
                    );

                OurImpl_ = new IOIOImpl(connection, new List <IObserverIOIO>()
                {
                    handlerCaptureState, rotationObserver
                }
                                        );
                OurImpl_.WaitForConnect();

                IConnectedDeviceResponse device = handlerCaptureState.ConnectedDeviceDescription();
                if (device != null)
                {
                    // could display board details
                }
                CommandFactory_ = new IOIOMessageCommandFactory();
                ConfigureCompass();
                ConfigureTimedEvents();
            }
            else
            {
                ComPort_Field.Text = "Unable to find an IOIO device";
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            string comPort = FindDeviceHack.TryAndFindIOIODevice();

            ComPort_Field.Text = comPort;
            if (comPort != null)
            {
                IOIOConnection connection = new SerialConnectionFactory().CreateConnection(comPort);

                ObserverConnectionState handlerCaptureState = new ObserverConnectionState();
                MessageObserver         textBoxObserver     = new MessageObserver(this.MessageLog);

                OurImpl_ = new IOIOImpl(connection, new List <IObserverIOIO>()
                {
                    handlerCaptureState, textBoxObserver
                }
                                        );
                OurImpl_.WaitForConnect();

                IConnectedDeviceResponse device = handlerCaptureState.ConnectedDeviceDescription();
                if (device != null)
                {
                    BoardDetails.Text = "Bootloader:" + device.BootloaderId
                                        + "\n" + "Firmware:" + device.FirmwareId
                                        + "\n" + "Hardware: " + device.HardwareId;
                }
                IOIOMessageCommandFactory commandFactory = new IOIOMessageCommandFactory();
                ConfigurePwm(commandFactory);
                ConfigureLed(commandFactory);
                ConfigureDigitalInput(commandFactory);
            }
            else
            {
                //this.Close();
                BoardDetails.Text = "Unable to find an IOIO device";
            }
        }