public void StatusUpdateReceived(IHardwareStatus status)
 {
     Log.Info()
     .Message($"[{decoratedState.Name}] Trigger: Status update")
     .Property("status", status)
     .Write();
     decoratedState.StatusUpdateReceived(status);
 }
Ejemplo n.º 2
0
 protected override void OnCompleted()
 {
     if (Response.Any())
     {
         var responseString = Response.Single();
         var status         = factory.FromStatusPacket(responseString);
         HardwareStatus = status;
     }
     base.OnCompleted();
 }
 /*
  * Transactions don't _have_ to override OnCompleted, but it can be a useful
  * way of transforming the raw response data into something more useful to
  * application. In this case, we'll parse the status response into a data
  * transfer object and store that in the HardwareStatus property.
  */
 protected override void OnCompleted()
 {
     if (Response.Any())
     {
         var responseString = Response.Single();
         var status         = factory.FromStatusPacket(responseString);
         HardwareStatus = status;
     }
     // it is super important that the base class OnCompleted gets called!
     // This is what marks the transaction as completed.
     base.OnCompleted();
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     Update state machine properties from a <see cref="IHardwareStatus" /> record.
 ///     By definition, when a status report is received, all movement has ceased.
 /// </summary>
 /// <param name="status">The status report received from the hardware.</param>
 internal void UpdateStatus(IHardwareStatus status)
 {
     AzimuthEncoderPosition   = status.CurrentAzimuth;
     AzimuthMotorActive       = false;
     AzimuthDirection         = RotationDirection.None;
     ShutterMotorActive       = false;
     ShutterMovementDirection = ShutterDirection.None;
     ShutterMotorCurrent      = 0;
     ShutterPosition          = SetInferredShutterPosition(status.ShutterSensor);
     AtHome   = status.AtHome;
     UserPins = status.UserPins;
 }
 private void StatusUpdateOnNext(IHardwareStatus statusNotification)
 {
     try
     {
         stateMachine.HardwareStatusReceived(statusNotification);
     }
     catch (Exception ex)
     {
         Log.Error()
         .Exception(ex)
         .Message($"Error while processing status notification: {statusNotification}")
         .Write();
     }
 }
Ejemplo n.º 6
0
        public void HardwareStatusReceived(IHardwareStatus status)
        {
            Log.Info()
            .Message("Status update {status}", status)
            .Write();

            /*
             * [TPL] update the status records first, before allowing the state machine to transition.
             * Otherwise there could be a race condition where a new state sees the old status data.
             */
            HardwareStatus = status;
            UpdateStatus(status);
            CurrentState.StatusUpdateReceived(status);
        }
 public override void StatusUpdateReceived(IHardwareStatus status)
 {
     machine.TransitionToState(new Ready(machine));
 }
Ejemplo n.º 8
0
 public override void StatusUpdateReceived(IHardwareStatus status)
 {
     base.StatusUpdateReceived(status);
     CancelTimeout();
     machine.TransitionToState(new Ready(machine));
 }
 public virtual void StatusUpdateReceived(IHardwareStatus status)
 {
 }
 public void StatusUpdateReceived(IHardwareStatus status)
 {
     throw uninitialized;
 }