public static void InitializeApp() { USBIOBoardService.Start(); InitializeIoDeviceLocations(); InitializeRs232Devices(); InitializeTcpDevices(); InitializeTrays(); InitializePrecisors(); InitializeTestSockets(); InitializeBuckets(); signalDecrypter = new IOBoardSignalDecrypterService(ActiveIOBoards); }
/// <summary> /// This thread is responsible for constantly updating our IOBoard Models with the correct /// boolean value based on our IOBoard input signals. Start this thread after RP2005 has completed /// detecting all of our boards and populating the dictionary which holds the active Io boards. /// Use the Stop function in the RP2005 destructor before it closes connection to the boards. /// </summary> public void Start() { CancelReadInputSignalThread = new CancellationTokenSource(); Delay = Convert.ToInt32(MainHandlerService.Read_Io_Interval_Setting); var task = Task.Run(() => { while (!CancelReadInputSignalThread.Token.IsCancellationRequested) { uint isSuccess = USBIOBoardService.ReadPort(_CurrentIOBoard.BoardNum, 0, ref InputSignal_Port0); _CurrentIOBoard.InputSignal_Port0 = InputSignal_Port0; isSuccess = USBIOBoardService.ReadPort(_CurrentIOBoard.BoardNum, 1, ref InputSignal_Port1); _CurrentIOBoard.InputSignal_Port1 = InputSignal_Port1; } }, CancelReadInputSignalThread.Token); }