예제 #1
0
 public RuntimeStateMachine()
 {
     _runtimeState = (int)RuntimeState.NotAvailable;
     _stateActions = new Dictionary <RuntimeState, Action>(10)
     {
         {
             RuntimeState.Idle, () => { StateIdle?.Invoke(); }
         },
         {
             RuntimeState.Running, () => { StateRunning?.Invoke(); }
         },
         {
             RuntimeState.Error, () => { StateError?.Invoke(); }
         },
         {
             RuntimeState.Over, () => { StateOver?.Invoke(); }
         },
         {
             RuntimeState.AbortRequested, () => { StateAbortRequested?.Invoke(); }
         },
         {
             RuntimeState.Abort, () => { StateAbort?.Invoke(); }
         },
         {
             RuntimeState.Collapsed, () => { StateCollapsed?.Invoke(); }
         },
         {
             RuntimeState.Timeout, () => { TimeOut?.Invoke(); }
         }
     };
 }
예제 #2
0
        private static string GetStateError(StateError stateError)
        {
            switch (stateError)
            {
            case StateError.ServiceNotAllowed:
                return("Service not allowed");

            case StateError.ServiceUnknown:
                return("Service unknown");
            }
            return(string.Empty);
        }
예제 #3
0
 /// <summary>
 /// Constructor for AARE error.
 /// </summary>
 internal GXDLMSException(StateError stateError, ServiceError serviceError)
     : base("Meter returns " + GetStateError(stateError) + " exception. " + GetServiceError(serviceError))
 {
     StateError   = stateError;
     ServiceError = serviceError;
 }