Beispiel #1
0
        /// <summary>
        /// Generic state change request that represents the P-ROC's PRDriverUpdateState function
        /// </summary>
        /// <param name="newState"></param>
        public void update_state(DriverState newState)
        {
            // Copy the newState object to the current local state
            this._state.DriverNum            = newState.DriverNum;
            this._state.OutputDriveTime      = newState.OutputDriveTime;
            this._state.PatterEnable         = newState.PatterEnable;
            this._state.PatterOffTime        = newState.PatterOffTime;
            this._state.PatterOnTime         = newState.PatterOnTime;
            this._state.Polarity             = newState.Polarity;
            this._state.State                = newState.State;
            this._state.Timeslots            = newState.Timeslots;
            this._state.WaitForFirstTimeSlot = newState.WaitForFirstTimeSlot;

            if (!newState.State)
            {
                this.Disable();
            }
            else if (newState.Timeslots == 0)
            {
                this.Pulse(newState.OutputDriveTime);
            }
            else
            {
                this.Schedule(newState.Timeslots, newState.OutputDriveTime, newState.WaitForFirstTimeSlot);
            }
        }
		private SlideshowDriver(SlideshowModel model, ISlideshowViewer viewer, IPlatformService platformService)
		{
			PlatformService = platformService;
			Model = model;
			Viewer = viewer;
			State = DriverState.Created;
		}
Beispiel #3
0
 public void OnNext(ITaskMessage msg)
 {
     CheckMsgOrder(msg);
     Debug.Assert(Enumerable.SequenceEqual(HelloStringByteArray, msg.Message));
     Debug.Assert(_state == DriverState.SendMsg);
     _state = DriverState.Suspend;
     _clock.ScheduleAlarm(MsgDelay, this);
 }
Beispiel #4
0
        private void CheckMsgOrder(object obj)
        {
            string msgClassName = _failMsgClass.FullName;

            Log.Log(Level.Info, "Driver state {0} event sequence {1} message obj type {2}",
                    _state, EventSequence[_expectIdx].Type, obj.GetType());

            if (_state == DriverState.Failed)
            {
                // If already failed, do not do anything
                return;
            }

            // Simulate failure at this step?
            if (_failMsgClass.IsInstanceOfType(obj))
            {
                _state = DriverState.Failed;
            }

            // Make sure events arrive in the right order (specified in EVENT_SEQUENCE):
            bool notFound = true;

            for (; _expectIdx < EventSequence.Length; ++_expectIdx)
            {
                if (EventSequence[_expectIdx].Type.IsInstanceOfType(obj))
                {
                    Log.Log(Level.Info, "Object type {0} is instance of expected type {1}", new object[] { obj.GetType(), EventSequence[_expectIdx].Type });
                    notFound = false;
                    break;
                }
                else if (EventSequence[_expectIdx].Flag == ExpectedMessage.RequiredFlag.Required)
                {
                    Log.Log(Level.Info, "Object type {0} is NOT instance of expected type {1}", new object[] { obj.GetType(), EventSequence[_expectIdx].Type });
                    break;
                }
            }

            if (notFound)
            {
                Log.Log(Level.Info, "Event out of sequence: Driver state {0} event sequence {1} message obj type {2}",
                        new object[] { _state, EventSequence[_expectIdx].Type, obj.GetType() });
                throw new DriverSideFailure("Event out of sequence: " + msgClassName);
            }

            Log.Log(Level.Info, "{0}: send: {1} got: {2}", new object[] {
                _state, EventSequence[_expectIdx], msgClassName
            });

            ++_expectIdx;

            if (_state == DriverState.Failed)
            {
                SimulatedDriverFailure ex = new SimulatedDriverFailure(
                    "Simulated Failure at FailDriver :: " + msgClassName);
                Log.Log(Level.Info, "Simulated Failure:", ex);
                throw ex;
            }
        }
Beispiel #5
0
 public Driver(string Nom, string Prenom, string Pseudo, string Email, string Password, string NTelephone, string Image) : base(Nom, Prenom, Pseudo, Email, Password, NTelephone, Image)
 {
     Rating = 0;
     PosX   = 0;
     PosY   = 0;
     Active = false;
     Free   = false;
     State  = DriverState.Disabled;
 }
 public DriverInfo(int id, string name, Guid guid, int systemRate, SpeakerMode speakerMode, int speakerModeChannels, DriverState driverState)
     : this()
 {
     Id                  = id;
     Name                = name;
     Guid                = guid;
     SystemRate          = systemRate;
     SpeakerMode         = speakerMode;
     SpeakerModeChannels = speakerModeChannels;
     DriverState         = driverState;
 }
Beispiel #7
0
 public DriverInfo(int id, string name, Guid guid, int systemRate, SpeakerMode speakerMode, int speakerModeChannels, DriverState driverState)
     : this()
 {
     Id = id;
     Name = name;
     Guid = guid;
     SystemRate = systemRate;
     SpeakerMode = speakerMode;
     SpeakerModeChannels = speakerModeChannels;
     DriverState = driverState;
 }
Beispiel #8
0
        private void HandleReport(object sender, IDeviceReport report)
        {
            if (BindingEnabled && OutputMode?.TabletProperties != null)
            {
                OutputMode?.Read(report);
                if (OutputMode is IBindingHandler <IBinding> binding)
                {
                    binding.HandleBinding(report);
                }
            }

            DriverState.PostReport(sender, report);
        }
Beispiel #9
0
        public VirtualDriver(GameController game, string name, ushort number, bool polarity)
            : base(game, name, number)
        {
            this._state = new DriverState();
            this._state.Polarity = polarity;
            this._state.Timeslots = 0x0;
            this._state.PatterEnable = false;
            this._state.DriverNum = number;
            this._state.PatterOnTime = 0;
            this._state.PatterOffTime = 0;
            this._state.State = false;
            this._state.OutputDriveTime = 0;
            this._state.WaitForFirstTimeSlot = false;

            this._currentValue = !(_currentState ^ this._state.Polarity);
        }
Beispiel #10
0
        public VirtualDriver(GameController game, string name, ushort number, bool polarity)
            : base(game, name, number)
        {
            this._state                      = new DriverState();
            this._state.Polarity             = polarity;
            this._state.Timeslots            = 0x0;
            this._state.PatterEnable         = false;
            this._state.DriverNum            = number;
            this._state.PatterOnTime         = 0;
            this._state.PatterOffTime        = 0;
            this._state.State                = false;
            this._state.OutputDriveTime      = 0;
            this._state.WaitForFirstTimeSlot = false;

            this._currentValue = !(_currentState ^ this._state.Polarity);
        }
Beispiel #11
0
        public async Task StartCardReaderAsync(string deviceId)
        {
            if (isDriverManagerStarting)
            {
                await libWrapper.StartCardReaderAsync(deviceId);

                StartDriverManager();
                desiredDriverState = DriverState.ReaderConnected;
            }
            else
            {
                if (currentDriverState == DriverState.ReaderAuthenticated)
                {
                    desiredDriverState = DriverState.ReaderPolling;
                }
            }
        }
Beispiel #12
0
        public void InitializeDrivers(IProcDevice proc)
        {
            // Loop through all of the drivers, initializing them with the polarity
            for (ushort i = 0; i < 208; i++)
            {
                DriverState state = new DriverState();
                state.DriverNum            = i;
                state.OutputDriveTime      = 0;
                state.Polarity             = true;
                state.State                = false;
                state.WaitForFirstTimeSlot = false;
                state.Timeslots            = 0;
                state.PatterOnTime         = 0;
                state.PatterOffTime        = 0;
                state.PatterEnable         = false;
                state.futureEnable         = false;

                proc.driver_update_state(ref state);
            }
        }
Beispiel #13
0
        private void DoTaskWithTimeout(DriverState driverState, int timeout)
        {
            CancellationTokenSource ct = new CancellationTokenSource();
            Task t = Task.Run(async() =>
            {
                while (currentDriverState != driverState)
                {
                    await Task.Delay(100);
                }
            }, ct.Token);

            if (!t.Wait(timeout))
            {
                if (!ct.IsCancellationRequested)
                {
                    ct.Cancel();
                }
                throw new TimeoutException();
            }

            //currentDriverState = driverState;
        }
Beispiel #14
0
 public void OnNext(ISuspendedTask suspendedTask)
 {
     CheckMsgOrder(suspendedTask);
     _state = DriverState.Resume;
     try
     {
         suspendedTask.ActiveContext.SubmitTask(TaskConfiguration.ConfigurationModule
                                                .Set(TaskConfiguration.Identifier, suspendedTask.Id + "_RESUMED")
                                                .Set(TaskConfiguration.Task, GenericType <NoopTask> .Class)
                                                .Set(TaskConfiguration.OnMessage, GenericType <NoopTask> .Class)
                                                .Set(TaskConfiguration.OnSuspend, GenericType <NoopTask> .Class)
                                                .Set(TaskConfiguration.OnClose, GenericType <NoopTask> .Class)
                                                .Set(TaskConfiguration.OnTaskStop, GenericType <NoopTask> .Class)
                                                .Set(TaskConfiguration.OnSendMessage, GenericType <NoopTask> .Class)
                                                .Set(TaskConfiguration.Memento, ByteUtilities.ByteArraysToString(HelloStringByteArray))
                                                .Build());
     }
     catch (BindException ex)
     {
         Log.Log(Level.Error, "Task configuration error", ex);
         throw new DriverSideFailure("Task configuration error", ex);
     }
 }
Beispiel #15
0
        public void OnNext(IRunningTask runningTask)
        {
            CheckMsgOrder(runningTask);
            _task = runningTask;
            switch (_state)
            {
            case DriverState.Init:
                Log.Log(Level.Info, "Move to state {0}", DriverState.SendMsg);
                _state = DriverState.SendMsg;
                break;

            case DriverState.Resume:
                Log.Log(Level.Info, "Move to state {0}", DriverState.Close);
                _state = DriverState.Close;
                break;

            default:
                Log.Log(Level.Warning, "Unexpected state at TaskRuntime: {0}", _state);
                throw new DriverSideFailure("Unexpected state: " + _state);
            }

            // After a delay, send message or suspend the task:
            _clock.ScheduleAlarm(MsgDelay, this);
        }
Beispiel #16
0
        private static void handleOne(Socket driverSocket)
        {
            var state = new DriverState { socket = driverSocket };

            StartReceiveCommand(state);
        }
Beispiel #17
0
        private static void HandleCommand(DriverState state)
        {
            var parts = Encoding.ASCII.GetString(state.receiveBuffer, 0, state.receivedBytes).Split(' ');

            var cmd = parts[0];

            if (cmd == "LISTEN")
            {
                Console.WriteLine("Creating listening port " + parts[1]);

                var port = int.Parse(parts[1]);
                var newListeningPort = new TcpListener(IPAddress.Any, port);
                newListeningPort.Start();

                var acceptState = new ListenerState { listener = newListeningPort, driver = state, port = port };
                state.listeningPorts.Add(acceptState.port, acceptState);

                StartReceiveCommand(state);
            }
            else if (cmd == "STOP_LISTEN")
            {
                Console.WriteLine("Stopping listening port " + parts[1]);

                var port = int.Parse(parts[1]);
                var listenerState = state.listeningPorts[port];
                listenerState.listener.Stop();
                state.listeningPorts.Remove(port);

                StartReceiveCommand(state);
            }
            else if (cmd == "CLOSE_CONNECTION")
            {
                Console.WriteLine("Closing connection " + parts[1]);

                var connectionId = int.Parse(parts[1]);
                var connectionState = state.connections[connectionId];
                connectionState.socket.Shutdown(SocketShutdown.Both);
                connectionState.socket.Close();
                state.connections.Remove(connectionId);

                StartReceiveCommand(state);
            }
            else if (cmd == "ACCEPT_ONE")
            {
                Console.WriteLine("Accepting one connection on port " + parts[1]);

                var port = int.Parse(parts[1]);
                var listenerState = state.listeningPorts[port];
                listenerState.listener.BeginAcceptSocket(new AsyncCallback(OnAcceptSocketOnce), listenerState);

                StartReceiveCommand(state);
            }
            else if (cmd == "ACCEPT_ALL")
            {
                Console.WriteLine("Accepting all connections on port " + parts[1]);

                var port = int.Parse(parts[1]);
                var listenerState = state.listeningPorts[port];
                listenerState.listener.BeginAcceptSocket(new AsyncCallback(OnAcceptSocket), listenerState);

                StartReceiveCommand(state);
            }
            else if (cmd == "SEND")
            {
                Console.WriteLine("Sending " + parts[2] + " bytes to " + parts[1]);

                var connectionId = int.Parse(parts[1]);
                var messageLength = int.Parse(parts[2]);
                var payloadState = new SendPayloadState
                {
                    bytesToReceive = messageLength,
                    target = state.connections[connectionId]
                };
                state.socket.BeginReceive(state.receiveBuffer, 0, Math.Min(payloadState.bytesToReceive, state.receiveBuffer.Length),
                    SocketFlags.None, new AsyncCallback(OnPayloadReceived), payloadState);
            }
            else if (cmd == "READ_ONCE")
            {
                Console.WriteLine("Reading once (max " + parts[2] + " bytes) from " + parts[1]);

                var connectionId = int.Parse(parts[1]);
                var maxBytes = int.Parse(parts[2]);
                var connectionState = state.connections[connectionId];
                if (maxBytes == 0)
                {
                    maxBytes = connectionState.receiveBuffer.Length;
                }
                connectionState.socket.BeginReceive(connectionState.receiveBuffer, 0, maxBytes, SocketFlags.None, new AsyncCallback(OnReceiveClientDataOnce), connectionState);

                StartReceiveCommand(state);
            }
            else if (cmd == "READ_ALL")
            {
                Console.WriteLine("Reading all from " + parts[1]);

                var connectionId = int.Parse(parts[1]);
                var connectionState = state.connections[connectionId];
                connectionState.socket.BeginReceive(connectionState.receiveBuffer, 0, connectionState.receiveBuffer.Length, SocketFlags.None, new AsyncCallback(OnReceiveClientData), connectionState);

                StartReceiveCommand(state);
            }
            else
            {
                Console.WriteLine("Unknown command: " + string.Join(" ", parts));
            }
        }
Beispiel #18
0
 public LampStateRecord(double time, DriverState state)
 {
     this.time  = time;
     this.state = state;
 }
 private static extern Result FMOD_System_GetRecordDriverInfo(IntPtr system, int id, IntPtr name, int namelen,
                                                              out Guid guid, out int systemRate, out SpeakerMode speakerMode, out int speakerModeChannels, out DriverState state);
		public void PauseOrResume()
		{
			logger.Info("SlideshowDriver.Pause: {0}", State);
			if (State == DriverState.Paused)
			{
				Play();
			}
			else if (State == DriverState.Playing)
			{
				State = DriverState.Paused;
                DestroyTimer();
			}
			PlatformService.InvokeOnUiThread( () => Viewer.UpdateUiState());
		}
Beispiel #21
0
        public void link_flipper_switch(string switch_name, string[] linked_coils)
        {
            // Hold all of the linked coils * 2 (one for Main, one for Hold)
            DriverState[] drivers = new DriverState[linked_coils.Length * 2];
            Driver main_coil, hold_coil;
            ushort switch_num = _switches[switch_name].Number;
            int driverIdx = 0;
            if (_flippers_enabled)
            {
                foreach (string coil in linked_coils)
                {
                    main_coil = _coils[coil + "Main"];
                    hold_coil = _coils[coil + "Hold"];
                    drivers[driverIdx] = _proc.driver_state_pulse(main_coil.State, 34);
                    driverIdx++;
                    drivers[driverIdx] = _proc.driver_state_pulse(hold_coil.State, 0);
                    driverIdx++;
                }
                // Add switch rule for activating flippers (when switch closes)
                _proc.switch_update_rule(switch_num,
                    EventType.SwitchClosedNondebounced,
                    new SwitchRule { NotifyHost = false, ReloadActive = false },
                    drivers,
                    false
                );

                // --------------------------------------------------------------
                // Now add the rule for open switches and disabling flippers
                // --------------------------------------------------------------
                driverIdx = 0;
                foreach (string coil in linked_coils)
                {
                    main_coil = _coils[coil + "Main"];
                    hold_coil = _coils[coil + "Hold"];
                    drivers[driverIdx] = _proc.driver_state_disable(main_coil.State);
                    driverIdx++;
                    drivers[driverIdx] = _proc.driver_state_disable(hold_coil.State);
                    driverIdx++;
                }
                _proc.switch_update_rule(switch_num,
                    EventType.SwitchOpenNondebounced,
                    new SwitchRule { NotifyHost = false, ReloadActive = false },
                    drivers,
                    false
                );
            }
            else
            {
                // Remove all switch linkages
                _proc.switch_update_rule(switch_num,
                    EventType.SwitchClosedNondebounced,
                    new SwitchRule { NotifyHost = false, ReloadActive = false },
                    null,
                    false
                );
                _proc.switch_update_rule(switch_num,
                    EventType.SwitchOpenNondebounced,
                    new SwitchRule { NotifyHost = false, ReloadActive = false },
                    null,
                    false
                );
                // Disable flippers
                foreach (string coil in linked_coils)
                {
                    main_coil = _coils[coil + "Main"];
                    hold_coil = _coils[coil + "Hold"];
                    main_coil.Disable();
                    hold_coil.Disable();
                }
            }
        }
Beispiel #22
0
 public LampStateRecord(double time, DriverState state)
 {
     this.time = time;
     this.state = state;
 }
Beispiel #23
0
        public void link_flipper_switch(string switch_name, string[] linked_coils)
        {
            // Hold all of the linked coils * 2 (one for Main, one for Hold)
            DriverState[] drivers = new DriverState[linked_coils.Length * 2];
            Driver        main_coil, hold_coil;
            ushort        switch_num = _switches[switch_name].Number;
            int           driverIdx  = 0;

            if (_flippers_enabled)
            {
                foreach (string coil in linked_coils)
                {
                    main_coil          = _coils[coil + "Main"];
                    hold_coil          = _coils[coil + "Hold"];
                    drivers[driverIdx] = _proc.driver_state_pulse(main_coil.State, 34);
                    driverIdx++;
                    drivers[driverIdx] = _proc.driver_state_pulse(hold_coil.State, 0);
                    driverIdx++;
                }
                // Add switch rule for activating flippers (when switch closes)
                _proc.switch_update_rule(switch_num,
                                         EventType.SwitchClosedNondebounced,
                                         new SwitchRule {
                    NotifyHost = false, ReloadActive = false
                },
                                         drivers,
                                         false
                                         );

                // --------------------------------------------------------------
                // Now add the rule for open switches and disabling flippers
                // --------------------------------------------------------------
                driverIdx = 0;
                foreach (string coil in linked_coils)
                {
                    main_coil          = _coils[coil + "Main"];
                    hold_coil          = _coils[coil + "Hold"];
                    drivers[driverIdx] = _proc.driver_state_disable(main_coil.State);
                    driverIdx++;
                    drivers[driverIdx] = _proc.driver_state_disable(hold_coil.State);
                    driverIdx++;
                }
                _proc.switch_update_rule(switch_num,
                                         EventType.SwitchOpenNondebounced,
                                         new SwitchRule {
                    NotifyHost = false, ReloadActive = false
                },
                                         drivers,
                                         false
                                         );
            }
            else
            {
                // Remove all switch linkages
                _proc.switch_update_rule(switch_num,
                                         EventType.SwitchClosedNondebounced,
                                         new SwitchRule {
                    NotifyHost = false, ReloadActive = false
                },
                                         null,
                                         false
                                         );
                _proc.switch_update_rule(switch_num,
                                         EventType.SwitchOpenNondebounced,
                                         new SwitchRule {
                    NotifyHost = false, ReloadActive = false
                },
                                         null,
                                         false
                                         );
                // Disable flippers
                foreach (string coil in linked_coils)
                {
                    main_coil = _coils[coil + "Main"];
                    hold_coil = _coils[coil + "Hold"];
                    main_coil.Disable();
                    hold_coil.Disable();
                }
            }
        }
		public void Stop()
		{
			logger.Info("SlideshowDriver.Stop {0}", State);
			State = DriverState.Stopped;
            DestroyTimer();
		}
		private void BeginEnumerate()
		{
			State = DriverState.Enumerating;
			Task.Factory.StartNew( () => 
				{
					Model.Enumerate( () => 
						{
							logger.Info("Images available: {0}", Model.MediaList.Count);
							PlatformService.InvokeOnUiThread( delegate { Viewer.UpdateUiState(); } );
							Play();
						});
				})
			.ContinueWith( t =>
				{
					if (!t.IsFaulted && !t.IsCanceled)
					{
						if (State == DriverState.Playing || State == DriverState.Paused)
						{
							logger.Info("Images fully loaded: {0}", Model.MediaList.Count);
							PlatformService.InvokeOnUiThread( delegate 
								{
									Viewer.UpdateUiState(); 
								} );
							Play();
						}
						else
						{
							logger.Info("Not playing, ignoring completed enumeration");
						}
					}
					else
					{
						logger.Error("Failed or canceled: {0}", t.Exception);
						PlatformService.InvokeOnUiThread( delegate { Viewer.Error(t.Exception.Message); });
					}

					return t;
				});
		}
Beispiel #26
0
 private void UpdateState(DriverState state)
 {
     currentDriverState = state;
     LogMessage("===> Driver State Changed: " + state);
 }
Beispiel #27
0
        private void StartStateTransitionManager()
        {
            while (1 == 1)
            {
                try
                {
                    if (cancellationTokenForDriverManager.Token.IsCancellationRequested)
                    {
                        cancellationTokenForDriverManager.Dispose();
                        break;
                    }

                    //any reader event/exception causing a disconect must set DriverState to ReaderDiconnected
                    if (desiredDriverState != currentDriverState)
                    {
                        switch (desiredDriverState)
                        {
                        case DriverState.ReaderDiconnected:
                            DoTaskWithTimeout(doDisconnect(), 5000);
                            break;

                        case DriverState.ReaderConnected:
                            DoTaskWithTimeout(doConnect(), 5000);
                            desiredDriverState = DriverState.ReaderDetected;    //move to next state
                            break;

                        case DriverState.ReaderDetected:
                            DoTaskWithTimeout(doDetect(), 5000);
                            desiredDriverState = DriverState.ReaderAuthenticated; //move to next state
                            Task.Delay(1000).Wait();                              //wait after detection, before trying to auth
                            break;

                        case DriverState.ReaderAuthenticated:
                            if (currentDriverState == DriverState.ReaderPolling)
                            {
                                doStopPoll();
                                currentDriverState = DriverState.ReaderAuthenticated;
                                break;
                            }
                            DoTaskWithTimeout(doAuth(), 5000);
                            if (isDriverManagerStarting)
                            {
                                Task.Run(() => { doTurnOffSleepMode(); });
                                Task.Delay(1000).Wait();    //wait for sleep mode turned on
                                desiredDriverState      = DriverState.ReaderPolling;
                                isDriverManagerStarting = false;
                            }
                            break;

                        case DriverState.ReaderPolling:
                            currentDriverState = doStartPoll();
                            //fire an ReaderStarted event
                            break;
                        }
                    }
                    else
                    {
                        Task.Delay(100).Wait();
                    }
                }
                catch (Exception ex)
                {
                    LogMessage("Error in StateTransitionManager:" + ex.Message);
                    //if (currentDriverState == DriverState.ReaderAuthenticated || currentDriverState == DriverState.ReaderPolling)
                    //{
                    //    //restart the state engine
                    //    desiredDriverState = DriverState.ReaderConnected;
                    //}
                    //else
                    //{
                    //    //stop the state engine
                    //    desiredDriverState = DriverState.ReaderDiconnected;
                    //}
                    desiredDriverState = DriverState.ReaderConnected;
                }
            }
        }
Beispiel #28
0
 public void StopCardReaderAsync()
 {
     desiredDriverState = DriverState.ReaderAuthenticated;
 }
Beispiel #29
0
 private static void StartReceiveCommand(DriverState state)
 {
     state.receivedBytes = 0;
     state.socket.BeginReceive(state.receiveBuffer, state.receivedBytes, 1, SocketFlags.None, new AsyncCallback(OnCommandDataReceived), state);
 }
		public void Play()
		{
			logger.Info("SlideshowDriver.Play: {0}", State);
			if (State == DriverState.Playing)
			{
				return;
			}

			State = DriverState.Playing;
            SetupTimer();
			Next();
		}
Beispiel #31
0
 internal RecordDriverInfo(string name, Guid guid, int rate, SpeakerMode speakermode, int channels, DriverState state)
     : base(name, guid, rate, speakermode, channels)
 {
     State = state;
 }
Beispiel #32
0
        /// <summary>
        /// Generic state change request that represents the P-ROC's PRDriverUpdateState function
        /// </summary>
        /// <param name="newState"></param>
        public void update_state(DriverState newState)
        {
            // Copy the newState object to the current local state
            this._state.DriverNum = newState.DriverNum;
            this._state.OutputDriveTime = newState.OutputDriveTime;
            this._state.PatterEnable = newState.PatterEnable;
            this._state.PatterOffTime = newState.PatterOffTime;
            this._state.PatterOnTime = newState.PatterOnTime;
            this._state.Polarity = newState.Polarity;
            this._state.State = newState.State;
            this._state.Timeslots = newState.Timeslots;
            this._state.WaitForFirstTimeSlot = newState.WaitForFirstTimeSlot;

            if (!newState.State) this.Disable();
            else if (newState.Timeslots == 0) this.Pulse(newState.OutputDriveTime);
            else this.Schedule(newState.Timeslots, newState.OutputDriveTime, newState.WaitForFirstTimeSlot);
        }