Example #1
0
        public void L6_Setup(UpDnEngine udEngine)
        {
            this.udEngine = udEngine;

            this.udEngine.set_OnRXcallbackdelegate(L6_OnDataRxCallback);
        }
        /// <summary>
        /// Collection of method calls to start and setup MasterEmulator.
        /// The calls are placed in a background task for not blocking the gui thread.
        /// </summary>
        public void Initialize()
        {
            Task.Factory.StartNew(() =>
            {
                try
                {
                    InitializeMasterEmulator();
                    RegisterEventHandlers();
                    String device = FindUsbDevice();
                    OpenMasterEmulatorDevice(device);

                    //----- PipeSetup -----
                    //PPP pipeSetup = new PipeSetup(masterEmulator);
                    //PPP pipeSetup.PerformPipeSetup();//pipeSetup.PerformPipeSetup_nRFUart();

                    udEngine = new UpDnEngine();
                    udEngine.UpDnEngine_Setup(masterEmulator);//PPP, pipeSetup);
                    udEngine.PerformPipeSetup();

                    ctrlEngine = new CtrlEngine();
                    ctrlEngine.CtrlEngine_Setup(masterEmulator);//PPP, pipeSetup);
                    ctrlEngine.PerformPipeSetup();

                    //----- Start the MasterEmulator -----
                    Run();

                    //----- Send Out Initialized Event -----
                    Initialized(this, EventArgs.Empty);

                    /*ORIG
                    InitializeMasterEmulator();
                    RegisterEventHandlers();
                    string device = FindUsbDevice();
                    OpenMasterEmulatorDevice(device);
                    pipeSetup = new PipeSetup(masterEmulator);
                    pipeSetup.PerformPipeSetup_nRFUart();
                    Run();
                    Initialized(this, EventArgs.Empty);
                    */
                }
                catch (Exception ex)
                {
                    LogErrorMessage(string.Format("Exception in StartMasterEmulator: {0}", ex.Message),
                    ex.StackTrace);
                }
            });
        }