protected FanucControlConnectionBase(TConnectionSettings connectionSettings) { this.connectionSettings = connectionSettings; currentConnectionState = FanucControlConnectionState.Disconnected; ConnectionState = new BehaviorSubject <FanucControlConnectionState>(currentConnectionState); }
private void SetConnectionState(FanucControlConnectionState connectionState) { if (connectionState != currentConnectionState) { currentConnectionState = connectionState; connectionStateSubject.OnNext(currentConnectionState); } }
public FanucControlConnectionLoop( Func <ConnectionHandleAllocationResult> allocateHandle, IFanucControlReadWriteActionsProvider readWriteActionsProvider, Action <ushort> freeHandle) { currentConnectionState = FanucControlConnectionState.Disconnected; connectionStateSubject = new BehaviorSubject <FanucControlConnectionState>(currentConnectionState); this.allocateHandle = allocateHandle; this.readWriteActionsProvider = readWriteActionsProvider; this.freeHandle = freeHandle; waitForConnectedOrFailed = new ManualResetEvent(false); waitForStopped = new ManualResetEvent(false); connectionThread = new Thread(() => ConnectionLoop()); }