/// <summary>
            /// Получить результат обработки события
            /// </summary>
            /// <param name="state">Событие для получения результата</param>
            /// <param name="error">Признак ошибки при получении результата</param>
            /// <param name="outobj">Результат запроса</param>
            /// <returns>Признак получения результата</returns>
            protected override int StateCheckResponse(int state, out bool error, out object outobj)
            {
                int iRes = 0;

                error  = false;
                outobj = new DataTable();

                StatesMachine statesMachine = (StatesMachine)state;

                switch (statesMachine)
                {
                case StatesMachine.ServerTime:
                case StatesMachine.ProcCheckedFilter:
                case StatesMachine.ProcCheckedState:
                case StatesMachine.ListMessageToUserByDate:
                case StatesMachine.ListDateByUser:
                case StatesMachine.CounterToTypeMessageByDate:
                    iRes = response(m_IdListenerCurrent, out error, out outobj);
                    break;

                default:
                    error  = true;
                    outobj = null;
                    break;
                }

                return(iRes);
            }
Exemple #2
0
        protected override int StateRequest(int /*StatesMachine*/ state)
        {
            int result = 0;

            string        msg          = string.Empty;
            StatesMachine stateMachine = (StatesMachine)state;

            switch (stateMachine)
            {
            case StatesMachine.PPBRValues:
                ActionReport("Получение данных плана.");
                if (indxTECComponents < allTECComponents.Count)
                {
                    getPPBRValuesRequest(allTECComponents[indxTECComponents].tec, allTECComponents[indxTECComponents], m_curDate.Date /*, AdminTS.TYPE_FIELDS.COUNT_TYPE_FIELDS*/);
                }
                else
                {
                    result = -1;
                }
                break;

            default:
                break;
            }

            //Logging.Logg().Debug(@"AdminMT::StateRequest () - state=" + state.ToString() + @" - вЫход...", Logging.INDEX_MESSAGE.NOT_SET);

            return(result);
        }
Exemple #3
0
        public MarkupParser()
        {
            machine = new StatesMachine();

            machine.Add("INIT", "<", "OPEN_TAG");
            machine.Add("OPEN_TAG", "!", "DECLARATION");
        }
Exemple #4
0
        protected override INDEX_WAITHANDLE_REASON StateErrors(int /*StatesMachine*/ state, int request, int result)
        {
            INDEX_WAITHANDLE_REASON reasonRes = INDEX_WAITHANDLE_REASON.SUCCESS;

            bool bClear = false;

            StatesMachine stateMachine = (StatesMachine)state;

            delegateStopWait();

            switch (stateMachine)
            {
            case StatesMachine.PPBRValues:
                if (request == 0)
                {
                    ErrorReport("Ошибка разбора данных плана. Переход в ожидание.");
                }
                else
                {
                    ErrorReport("Ошибка получения данных плана. Переход в ожидание.");

                    bClear = true;
                }
                break;

            case StatesMachine.PPBRDates:
                if (request == 0)
                {
                    ErrorReport("Ошибка разбора сохранённых часовых значений (PPBR). Переход в ожидание.");
                    //saveResult = Errors.ParseError;
                }
                else
                {
                    ErrorReport("Ошибка получения сохранённых часовых значений (PPBR). Переход в ожидание.");
                    //saveResult = Errors.NoAccess;
                }
                try
                {
                    //semaDBAccess.Release(1);
                }
                catch
                {
                }
                break;

            default:
                break;
            }

            if (bClear)
            {
                ClearValues();
            }


            errorData?.Invoke();

            return(reasonRes);
        }
Exemple #5
0
 public StatesAttack(StatesMachine sm, Animator anim, Transform myTransform, Transform target, float rotSpeed, float distance) : base(sm)
 {
     _myTransform     = myTransform;
     _target          = target;
     _anim            = anim;
     rotationSpeed    = rotSpeed;
     distanceToFollow = distance;
 }
 public StatesFollow(StatesMachine sm, Transform trans, Rigidbody rb, Transform target, Animator anim, float rotSpeed, float distance, float speed) : base(sm)
 {
     _myTransform  = trans;
     _rb           = rb;
     _target       = target;
     _anim         = anim;
     rotationSpeed = rotSpeed;
     distanceStop  = distance;
     _speed        = speed;
 }
Exemple #7
0
 void SetStateMachine()
 {
     sm = new StatesMachine();
     sm.Addstate(new StatesWander(sm));
     followState = new StatesFollow(sm, transform, _rb, FindObjectOfType <TrueDummyEnemy>().transform, animator, _rotSpeed, _distance, _speedMovement);
     sm.Addstate(followState);
     attackState = new StatesAttack(sm, animator, transform, FindObjectOfType <TrueDummyEnemy>().transform, _rotSpeed, _distance);
     sm.Addstate(attackState);
     sm.Addstate(new StatesPetrified(sm, _petrifiedTime));
     sm.ChangeState <StatesWander>();
 }
Exemple #8
0
        protected override int StateResponse(int /*StatesMachine*/ state, object table)
        {
            int result = -1;

            StatesMachine stateMachine = (StatesMachine)state;

            switch (stateMachine)
            {
            case StatesMachine.PPBRValues:
                delegateStopWait();

                result = getPPBRValuesResponse(table as DataTable, m_curDate);
                if (result == 0)
                {
                    readyData(m_curDate, true);
                }
                else
                {
                    ;
                }
                break;

            case StatesMachine.PPBRDates:
                clearPPBRDates();
                result = getPPBRDatesResponse(table as DataTable, m_curDate);
                if (result == 0)
                {
                }
                else
                {
                    ;
                }
                break;

            default:
                break;
            }

            if (result == 0)
            {
                ReportClear(false);
            }
            else
            {
                ;
            }

            //Logging.Logg().Debug(@"AdminMC::StateResponse () - state=" + state.ToString() + @", result=" + result.ToString() + @" - вЫход...", Logging.INDEX_MESSAGE.NOT_SET);
            //tPBR.InsertData();
            return(result);
        }
Exemple #9
0
        protected override INDEX_WAITHANDLE_REASON StateErrors(int /*StatesMachine*/ state, int request, int result)
        {
            INDEX_WAITHANDLE_REASON reasonRes = INDEX_WAITHANDLE_REASON.SUCCESS;

            bool bClear = false;

            StatesMachine stateMachine = (StatesMachine)state;

            delegateStopWait();

            switch (stateMachine)
            {
            case StatesMachine.PPBRValues:
                if (request == 0)
                {
                    ErrorReport("Ошибка разбора данных плана. Переход в ожидание.");
                }
                else
                {
                    ErrorReport("Ошибка получения данных плана. Переход в ожидание.");

                    bClear = true;
                }
                break;

            default:
                break;
            }

            if (bClear)
            {
                ClearValues();
                //ClearTables();
            }
            else
            {
                ;
            }

            if (!(errorData == null))
            {
                errorData();
            }
            else
            {
                ;
            }

            return(reasonRes);
        }
Exemple #10
0
            protected override int StateRequest(int state)
            {
                int iRes = 0;

                StatesMachine stateMachine = (StatesMachine)state;

                switch (stateMachine)
                {
                case StatesMachine.AddControl:
                    addPanels();
                    break;
                }
                return(iRes);
            }
Exemple #11
0
            protected override INDEX_WAITHANDLE_REASON StateErrors(int state, int request, int result)
            {
                INDEX_WAITHANDLE_REASON reasonRes = INDEX_WAITHANDLE_REASON.SUCCESS;

                string error   = string.Empty,
                       reason  = string.Empty,
                       waiting = string.Empty;

                StatesMachine stateMachine = (StatesMachine)state;

                switch (stateMachine)
                {
                case StatesMachine.CurrentTime:
                    if (request == 0)
                    {
                        reason = @"разбора";
                    }
                    else
                    {
                        reason = @"получения";
                    }

                    reason += @" текущего времени сервера";
                    waiting = @"Переход в ожидание";
                    break;

                default:
                    break;
                }

                error = "Ошибка " + reason + ".";

                if (waiting.Equals(string.Empty) == false)
                {
                    error += " " + waiting + ".";
                }
                else
                {
                    ;
                }

                ErrorReport(error);

                //if (! (errorData == null)) errorData (); else ;

                Logging.Logg().Error(@"HGetDate::StateErrors () - error=" + error + @" - вЫход...", Logging.INDEX_MESSAGE.NOT_SET);

                return(reasonRes);
            }
Exemple #12
0
        protected override int StateRequest(int /*StatesMachine*/ state)
        {
            int result = 0;

            string        msg          = string.Empty;
            StatesMachine stateMachine = StatesMachine.Unknown;
            TECComponent  comp;

            stateMachine = (StatesMachine)state;

            switch (stateMachine)
            {
            case StatesMachine.PPBRValues:
                comp = CurrentDevice as TECComponent;

                ActionReport("Получение данных плана.");
                getPPBRValuesRequest(comp.tec, comp, m_curDate.Date /*, AdminTS.TYPE_FIELDS.COUNT_TYPE_FIELDS*/);
                break;

            case StatesMachine.PPBRDates:
                if ((serverTime.Date > m_curDate.Date) &&
                    (m_ignore_date == false))
                {
                    result = -1;
                    break;
                }
                else
                {
                    ;
                }
                ActionReport("Получение списка сохранённых часовых значений.");
                //GetPPBRDatesRequest(m_curDate);
                break;

            case StatesMachine.MaketEquipment:
                ActionReport("Получение заголовков макетов.");
                getMaketEquipmentRequest(_maketIdentifiers, m_curDate.Date);
                break;

            default:
                break;
            }

            //Logging.Logg().Debug(@"AdminMC::StateRequest () - state=" + state.ToString() + @" - вЫход...", Logging.INDEX_MESSAGE.NOT_SET);

            return(result);
        }
Exemple #13
0
            protected override int StateRequest(int state)
            {
                int iRes = 0;

                StatesMachine stateMachine = (StatesMachine)state;

                switch (stateMachine)
                {
                case StatesMachine.CurrentTime:
                    getDate();
                    break;

                default:
                    break;
                }

                return(iRes);
            }
Exemple #14
0
            protected override int StateResponse(int state, object table)
            {
                int iRes = 0;

                StatesMachine stateMachine = (StatesMachine)state;

                switch (stateMachine)
                {
                case StatesMachine.CurrentTime:
                    iRes = GetCurrentTimeResponse(table as DataTable);
                    break;

                default:
                    break;
                }

                return(0);
            }
            public void Command(StatesMachine state, object args, bool bNewState)
            {
                lock (m_lockState) {
                    if (bNewState == true)
                    {
                        ClearStates();
                        AddState((int)StatesMachine.ServerTime);
                    }
                    else
                    {
                        ;
                    }
                    AddState((int)state);

                    _requests.Add(new REQUEST(state, args));

                    Run(@"PanelAnalyzer.HLoggingReadHandlerDb::Command () - run...");
                }
            }
Exemple #16
0
        protected override int StateRequest(int /*StatesMachine*/ state)
        {
            int result = 0;

            string        msg          = string.Empty;
            StatesMachine stateMachine = (StatesMachine)state;

            switch (stateMachine)
            {
            case StatesMachine.InitIGO:
                msg = @"Инициализация объектов Modes-Centre";
                ActionReport(msg);
                Logging.Logg().Debug(@"AdminMC::StateResponse () - " + msg, Logging.INDEX_MESSAGE.NOT_SET);
                break;

            case StatesMachine.PPBRValues:
                ActionReport("Получение данных плана.");
                getPPBRValuesRequest(allTECComponents[indxTECComponents].tec, allTECComponents[indxTECComponents], m_curDate.Date /*, AdminTS.TYPE_FIELDS.COUNT_TYPE_FIELDS*/);
                break;

            case StatesMachine.PPBRDates:
                if ((serverTime.Date > m_curDate.Date) && (m_ignore_date == false))
                {
                    result = -1;
                    break;
                }
                else
                {
                    ;
                }
                ActionReport("Получение списка сохранённых часовых значений.");
                //GetPPBRDatesRequest(m_curDate);
                break;

            default:
                break;
            }

            //Logging.Logg().Debug(@"AdminMC::StateRequest () - state=" + state.ToString() + @" - вЫход...", Logging.INDEX_MESSAGE.NOT_SET);

            return(result);
        }
Exemple #17
0
            protected override int StateCheckResponse(int state, out bool error, out object table)
            {
                int iRes = 0;

                error = true;
                table = null;

                StatesMachine stateMachine = (StatesMachine)state;

                switch (stateMachine)
                {
                case StatesMachine.CurrentTime:
                    iRes = response(m_IdListenerCurrent, out error, out table);
                    break;

                default:
                    break;
                }

                return(iRes);
            }
            private REQUEST getFirstRequst(StatesMachine state)
            {
                REQUEST reqRes;

                if (_requests.Select(h => h.Key).Contains <StatesMachine> (state) == true)
                {
                    try {
                        reqRes = _requests.First(h => { return((h.Key == state) &&
                                                               (h.State == REQUEST.STATE.Ready)
                                                               ); });
                    } catch (Exception e) {
                        reqRes = new REQUEST(state, null);
                    }
                }
                else
                {
                    reqRes = new REQUEST(state, null);
                }

                return(reqRes);
            }
Exemple #19
0
        protected override int StateCheckResponse(int /*StatesMachine*/ state, out bool error, out object table)
        {
            int iRes = -1;

            error = true;
            table = null;

            StatesMachine stateMachine = (StatesMachine)state;

            switch (stateMachine)
            {
            case StatesMachine.PPBRValues:
                //bRes = GetResponse(m_indxDbInterfaceCurrent, m_listListenerIdCurrent[m_indxDbInterfaceCurrent], out error, out table/*, false*/);
                iRes = response(m_IdListenerCurrent, out error, out table /*, false*/);
                break;

            default:
                break;
            }

            return(iRes);
        }
            private void func_Completed(string nameFunc, StatesMachine state, object obj, int err)
            {
                REQUEST req =
                    getFirstRequst(state)
                    //_handlers.Pop()
                ;

                if (req.IsEmpty == false)
                {
                    req.State = err == 0 ? REQUEST.STATE.Ok : REQUEST.STATE.Error;

                    //handler.Function.Invoke(obj, err);
                    EventCommandCompleted?.Invoke(req, obj as DataTable);

                    //Logging.Logg ().Debug ($"PanelAnalyzer.HLoggingReadHandlerDb::Command () - удалено {state}...", Logging.INDEX_MESSAGE.NOT_SET);
                    //_requests.Remove (req);
                }
                else
                {
                    ;
                }
            }
            protected override int StateRequest(int state)
            {
                int iRes = 0;

                REQUEST       req;
                StatesMachine stateMachine = (StatesMachine)state;

                switch (stateMachine)
                {
                case StatesMachine.ServerTime:
                    GetCurrentTimeRequest(DbInterface.DB_TSQL_INTERFACE_TYPE.MSSQL, ListenerIdMainDb);
                    actionReport(@"Получение времени с сервера БД - состояние: " + ((StatesMachine)state).ToString());
                    break;

                case StatesMachine.ProcCheckedFilter:
                case StatesMachine.ProcCheckedState:
                case StatesMachine.ListMessageToUserByDate:
                case StatesMachine.ListDateByUser:
                case StatesMachine.CounterToTypeMessageByDate:
                    req = getFirstRequst(stateMachine);
                    if (req.IsEmpty == false)
                    {
                        Request(ListenerIdMainDb, req.Query);
                        actionReport(@"Получение значений из БД - состояние: " + ((StatesMachine)state).ToString());
                    }
                    else
                    {
                        iRes = 1;

                        Logging.Logg().Error($"PanelAnalyzer_DB.HLoggingReadHandlerDb::StateRequest (state={stateMachine}) - аргумент не валиден...", Logging.INDEX_MESSAGE.NOT_SET);
                    }
                    break;

                default:
                    break;
                }

                return(iRes);
            }
            /// <summary>
            /// Обработка УСПЕШНО полученного результата
            /// </summary>
            /// <param name="state">Состояние для результата</param>
            /// <param name="table">Значение результата</param>
            /// <returns>Признак обработки результата</returns>
            protected override int StateResponse(int state, object table)
            {
                int iRes = 0;

                StatesMachine stateMachine = (StatesMachine)state;

                switch (stateMachine)
                {
                case (int)StatesMachine.ServerTime:
                    m_serverTime = ((DateTime)(table as DataTable).Rows [0] [0]);
                    break;

                case StatesMachine.ProcCheckedFilter:
                case StatesMachine.ProcCheckedState:
                case StatesMachine.ListMessageToUserByDate:
                case StatesMachine.ListDateByUser:
                case StatesMachine.CounterToTypeMessageByDate:
                    func_Completed("StateResponse", (StatesMachine)state, table, iRes);
                    break;

                default:
                    break;
                }

                //Проверить признак крайнего в наборе состояний для обработки
                if (isLastState(state) == true)
                {
                    //Удалить все сообщения в строке статуса
                    ReportClear(true);
                }
                else
                {
                    ;
                }

                return(iRes);
            }
Exemple #23
0
        /// <summary>
        /// Обработчик события - регистрация события сигнализации от 'TecView'
        /// </summary>
        /// <param name="obj">Объект, зарегистрировавший событие сигнализации</param>
        /// <param name="ev">Аргумент события сигнализации</param>
        private void onEventReg(TecViewAlarm.AlarmTecViewEventArgs ev)
        {
            INDEX_ACTION  iAction = m_dictAlarmObject.Registred(ref ev);
            StatesMachine state   = StatesMachine.Unknown;

            if (iAction == INDEX_ACTION.ERROR)
            {
                throw new Exception(@"AdminAlarm::OnEventReg_TecView () - ...");
            }
            else
            {
                switch (iAction)
                {
                case INDEX_ACTION.NEW:
                    state = StatesMachine.Insert;
                    break;

                case INDEX_ACTION.RETRY:
                    state = StatesMachine.Retry;
                    break;

                default:     // неизвестное/необрабатываемое днйствие
                    break;
                }

                push(new object[]
                {
                    new object []
                    {
                        state
                        , ev
                    }
                }
                     );
            }
        }
Exemple #24
0
    /// <summary>
    /// Builds and configures the default states in the states machine
    /// </summary>
    private void BuildStates()
    {
        // add states
        statesMachine = new StatesMachine <FighterState>(FighterState.Idling);
        List <FighterState> stateNames = Enum.GetValues(typeof(FighterState)).OfType <FighterState>().ToList <FighterState>();

        stateNames.Remove(FighterState.Idling);
        states.Add(FighterState.Idling, statesMachine.Find(FighterState.Idling));
        foreach (FighterState state in stateNames)
        {
            statesMachine.AddState(state);
            states.Add(state, statesMachine.Find(state));
        }
        // StateName.Idling
        states[FighterState.Idling].Triggerer = IdlingTriggerer;
        states[FighterState.Idling].OnEnter   = IdlingOnEnter;
        states[FighterState.Idling].AddNeighbor(states[FighterState.Crouching]);
        states[FighterState.Idling].AddNeighbor(states[FighterState.Covering]);
        states[FighterState.Idling].AddNeighbor(states[FighterState.Launching]);
        states[FighterState.Idling].AddNeighbor(states[FighterState.Attacking]);
        states[FighterState.Idling].AddNeighbor(states[FighterState.FlippingLeft]);
        states[FighterState.Idling].AddNeighbor(states[FighterState.FlippingRight]);
        states[FighterState.Idling].AddNeighbor(states[FighterState.Throwing]);
        // StateName.Crouching
        states[FighterState.Crouching].Triggerer = CrouchingTriggerer;
        states[FighterState.Crouching].OnEnter   = CrouchingOnEnter;
        states[FighterState.Crouching].AddNeighbor(states[FighterState.Standing]);
        // StateName.Standing
        states[FighterState.Standing].Triggerer = StandingTriggerer;
        states[FighterState.Standing].OnEnter   = StandingOnEnter;
        states[FighterState.Standing].AddNeighbor(states[FighterState.Idling]);
        // StateName.Covering
        states[FighterState.Covering].Triggerer = CoveringTriggerer;
        states[FighterState.Covering].OnEnter   = CoveringOnEnter;
        states[FighterState.Covering].AddNeighbor(states[FighterState.Uncovering]);
        // StateName.Uncovering
        states[FighterState.Uncovering].Triggerer = UncoveringTriggerer;
        states[FighterState.Uncovering].OnEnter   = UncoveringOnEnter;
        states[FighterState.Uncovering].AddNeighbor(states[FighterState.Idling]);
        // StateName.Launching
        states[FighterState.Launching].Triggerer = LaunchingTriggerer;
        states[FighterState.Launching].OnEnter   = LaunchingOnEnter;
        states[FighterState.Launching].AddNeighbor(states[FighterState.Falling]);
        // StateName.Falling
        states[FighterState.Falling].Triggerer = FallingTriggerer;
        states[FighterState.Falling].OnEnter   = FallingOnEnter;
        states[FighterState.Falling].AddNeighbor(states[FighterState.Landing]);
        // StateName.Landing
        states[FighterState.Landing].Triggerer = LandingTriggerer;
        states[FighterState.Landing].OnEnter   = LandingOnEnter;
        states[FighterState.Landing].AddNeighbor(states[FighterState.Idling]);
        states[FighterState.Landing].AddNeighbor(states[FighterState.FlippingLeft]);
        states[FighterState.Landing].AddNeighbor(states[FighterState.FlippingRight]);
        // StateName.Attacking
        states[FighterState.Attacking].Triggerer = AttackingTriggerer;
        states[FighterState.Attacking].OnEnter   = AttackingOnEnter;
        states[FighterState.Attacking].AddNeighbor(states[FighterState.Idling]);
        // StateName.FlippingLeft
        states[FighterState.FlippingLeft].Triggerer = FlippingLeftTriggerer;
        states[FighterState.FlippingLeft].OnEnter   = FlippingLeftOnEnter;
        states[FighterState.FlippingLeft].AddNeighbor(states[FighterState.Running]);
        // StateName.FlippingRight
        states[FighterState.FlippingRight].Triggerer = FlippingRightTrigger;
        states[FighterState.FlippingRight].OnEnter   = FlippingRightOnEnter;
        states[FighterState.FlippingRight].AddNeighbor(states[FighterState.Running]);
        // StateName.Running
        states[FighterState.Running].Triggerer       = RunningTriggerer;
        states[FighterState.Running].OnEnter         = RunningOnEnter;
        states[FighterState.Running].Action          = RunningAction;
        states[FighterState.Running].SelfDeactivates = true;
        states[FighterState.Running].AddNeighbor(states[FighterState.FlippingLeft]);
        states[FighterState.Running].AddNeighbor(states[FighterState.FlippingRight]);
        states[FighterState.Running].AddNeighbor(states[FighterState.Running]);
        states[FighterState.Running].AddNeighbor(states[FighterState.Idling]);
        states[FighterState.Running].AddNeighbor(states[FighterState.Launching]);
        states[FighterState.Running].AddNeighbor(states[FighterState.Attacking]);
        states[FighterState.Running].AddNeighbor(states[FighterState.Throwing]);
        // StateName.Throwing
        states[FighterState.Throwing].Triggerer = ThrowingTriggerer;
        states[FighterState.Throwing].OnEnter   = ThrowingOnEnter;
        states[FighterState.Throwing].AddNeighbor(states[FighterState.Idling]);
        // Event
        statesMachine.AddStateChangedListener(HandleStateChangedEvent);
    }
Exemple #25
0
        protected override int StateCheckResponse(int s, out bool error, out object outobj)
        {
            int           iRes  = -1;
            StatesMachine state = (StatesMachine)s;

            error  = true;
            outobj = null;

            ItemQueue itemQueue = null;

            try
            {
                switch (state)
                {
                case (int)StatesMachine.LIST_GROUP_SOURCES:
                    error  = false;
                    outobj = new object [] {
                        m_fileINI.ListSrcGroupSources
                        , m_fileINI.ListDestGroupSources
                    };

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SOURCE_ITEMS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    =
                        //m_fileINI.GetListItemsOfGroupSource(itemQueue.Pars.ToArray())
                        m_fileINI.GetListItemsOfGroupSource(itemQueue.Pars.ToArray())
                    ;

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SOURCE_PARS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListParsOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SOURCE_PROP:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemPropOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_GROUP_SIGNALS:
                    error  = false;
                    outobj = new object[] {
                        m_fileINI.ListSrcGroupSignals
                        , m_fileINI.ListDestGroupSignals
                    };

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SIGNAL_ITEMS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemsOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SIGNAL_PARS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListParsOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SIGNAL_PROP:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemPropOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SOURCE_ITEMS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemsOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SOURCE_PARS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListParsOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SOURCE_PROP:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemPropOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SIGNAL_ITEMS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemsOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SIGNAL_PARS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListParsOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SIGNAL_PROP:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemPropOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_SRC_GROUP_SOURCES:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр строковый идентификатор "выбранноой" группы источников
                    outobj = m_fileINI.GetObjectSrcGroupSources((string)itemQueue.Pars[0]);

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_DEST_GROUP_SOURCES:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр индекс "выбранноой" группы источников
                    outobj = m_fileINI.GetObjectDestGroupSources((string)itemQueue.Pars[0]);

                    iRes = 0;
                    break;

                case StatesMachine.TIMER_WORK_UPDATE:
                    error  = false;
                    outobj = m_fileINI.SecondWorkUpdate;

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_SRC_GROUP_SIGNALS_PARS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр идентификатор "выбранноой" группы сигналов
                    outobj = m_fileINI.GetObjectGroupSignalsPars(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_SRC_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр идентификатор "выбранноой" группы сигналов
                    outobj = m_fileINI.GetObjectGroupSignals(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_DEST_GROUP_SIGNALS_PARS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр идентификатор "выбранноой" группы сигналов
                    outobj = m_fileINI.GetObjectGroupSignalsPars(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_DEST_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр идентификатор "выбранноой" группы сигналов
                    outobj = m_fileINI.GetObjectGroupSignals(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.STATE_GROUP_SOURCES:
                    error  = false;
                    outobj = new object[(int)INDEX_SRC.COUNT_INDEX_SRC];
                    for (INDEX_SRC indxSrc = INDEX_SRC.SOURCE; indxSrc < INDEX_SRC.COUNT_INDEX_SRC; indxSrc++)
                    {
                        (outobj as object[])[(int)indxSrc] = new GroupSources.STATE[m_listGroupSources[(int)indxSrc].Count];

                        foreach (GroupSources grpSrc in m_listGroupSources[(int)indxSrc])
                        {
                            ((outobj as object[])[(int)indxSrc] as GroupSources.STATE[])[m_listGroupSources[(int)indxSrc].IndexOf(grpSrc)] = grpSrc.State;
                        }
                    }

                    iRes = 0;
                    break;

                case StatesMachine.STATE_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр индекс "выбранноой" группы сигналов
                    outobj = new object[(int)INDEX_SRC.COUNT_INDEX_SRC];
                    for (INDEX_SRC indxSrc = INDEX_SRC.SOURCE; indxSrc < INDEX_SRC.COUNT_INDEX_SRC; indxSrc++)
                    {
                        if (!((int)itemQueue.Pars[(int)indxSrc] < 0))
                        {
                            (outobj as object[])[(int)indxSrc] = m_listGroupSources[(int)indxSrc][(int)itemQueue.Pars[(int)indxSrc]].GetArgGroupSignals();
                        }
                        else
                        {
                            (outobj as object[])[(int)indxSrc] = new object [] { }
                        }
                    }
                    ;

                    iRes = 0;
                    break;

                case StatesMachine.STATE_CHANGED_GROUP_SOURCES:
                    error     = false;
                    itemQueue = Peek;

                    iRes = m_listGroupSources[(int)((INDEX_SRC)itemQueue.Pars[0])][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])].StateChange();
                    break;

                case StatesMachine.STATE_CHANGED_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;

                    iRes = m_listGroupSources[(int)((INDEX_SRC)itemQueue.Pars[0])][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])].StateChange((string)itemQueue.Pars[2]);
                    break;

                case StatesMachine.CLEARVALUES_DEST_GROUP_SIGNALS:
                    //[1] - идентификаторы
                    //[2] = дата/время / продолжительность
                    error     = false;
                    itemQueue = Peek;

                    int idGrpSrc         = FormMain.FileINI.GetIDIndex((string)(itemQueue.Pars[1] as object [])[0])
                    , idGrpSgnls         = FormMain.FileINI.GetIDIndex((string)(itemQueue.Pars[1] as object[])[1]);
                    DateTime dtStartDate = (DateTime)(itemQueue.Pars[2] as object[])[0];
                    TimeSpan tsStartTime = (TimeSpan)(itemQueue.Pars[2] as object[])[1]
                    , tsPeriodMain       = (TimeSpan)(itemQueue.Pars[2] as object[])[2];

                    iRes = 0;
                    break;

                case StatesMachine.DATA_SRC_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;

                    outobj = m_listGroupSources[(int)INDEX_SRC.SOURCE][(int)itemQueue.Pars[0]].GetDataToPanel(itemQueue.Pars[1] as string, out error);

                    iRes = 0;
                    break;

                case StatesMachine.DATA_DEST_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;

                    if (!((int)itemQueue.Pars[0] < 0))
                    {
                        outobj = m_listGroupSources[(int)INDEX_SRC.DEST][(int)itemQueue.Pars[0]].GetDataToPanel(itemQueue.Pars[1] as string, out error);
                    }
                    else
                    {
                        ;
                    }

                    iRes = 0;
                    break;

                case StatesMachine.SET_IDCUR_SOURCE_OF_GROUP:
                    error     = false;
                    itemQueue = Peek;

                    m_listGroupSources[(int)itemQueue.Pars[0]][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])].m_IDCurrentConnSett = (string)itemQueue.Pars[2];
                    m_fileINI.UpdateParameter((int)itemQueue.Pars[0], (string)itemQueue.Pars[1], @"SCUR", (string)itemQueue.Pars[2]);

                    iRes = 0;
                    break;

                case StatesMachine.SET_TEXT_ADDING:
                    error     = false;
                    itemQueue = Peek;

                    (m_listGroupSources[(int)itemQueue.Pars[0]][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])] as GroupSources).SetAdding(((string)itemQueue.Pars[2]).Split(new char[] { FileINI.s_chSecDelimeters[(int)FileINI.INDEX_DELIMETER.PAIR_VAL] }));
                    m_fileINI.UpdateParameter((int)itemQueue.Pars[0], (string)itemQueue.Pars[1], @"ADDING", (string)itemQueue.Pars[2]);

                    iRes = 0;
                    break;

                case StatesMachine.SET_GROUP_SIGNALS_PARS:
                    error     = false;
                    itemQueue = Peek;

                    int          indxGroupSgnls = -1;
                    GroupSources grpSrcs        = (m_listGroupSources[(int)itemQueue.Pars[0]][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])] as GroupSources);
                    indxGroupSgnls = grpSrcs.SetGroupSignalsPars(/*(string)itemQueue.Pars[2],*/ itemQueue.Pars[2] as GROUP_SIGNALS_PARS);
                    //indxGroupSgnls = grpSrcs.getIndexGroupSignalsPars((string)itemQueue.Pars[2]);
                    m_fileINI.UpdateParameter((int)itemQueue.Pars[0], (string)itemQueue.Pars[1], indxGroupSgnls, itemQueue.Pars[2] as GROUP_SIGNALS_PARS);

                    iRes = 0;
                    break;

                case StatesMachine.GET_GROUP_SIGNALS_DATETIME_PARS:
                    error     = false;
                    itemQueue = Peek;

                    GROUP_SIGNALS_SRC_PARS grpSgnlsPars = m_listGroupSources[(int)INDEX_SRC.SOURCE][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])].GetGroupSignalsPars((string)itemQueue.Pars[2]);
                    outobj = grpSgnlsPars.m_arWorkIntervals[(int)itemQueue.Pars[3]];

                    iRes = 0;
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                Logging.Logg().Exception(e, @"HHandlerQueue::StateCheckResponse (state=" + state.ToString() + @") - ...", Logging.INDEX_MESSAGE.NOT_SET);

                error = true;
                iRes  = -1 * (int)state;
            }

            return(iRes);
        }
Exemple #26
0
        /// <summary>
        /// Подготовить объект для отправки адресату по его запросу
        /// </summary>
        /// <param name="s">Событие - идентификатор запрашиваемой информации/операции,действия</param>
        /// <param name="error">Признак выполнения операции/действия по запросу</param>
        /// <param name="outobj">Объект для отправления адресату как результат запроса</param>
        /// <returns>Признак выполнения метода (дополнительный)</returns>
        protected override int StateCheckResponse(int s, out bool error, out object outobj)
        {
            int           iRes     = -1;
            StatesMachine state    = (StatesMachine)s;
            string        debugMsg = string.Empty;

            error  = true;
            outobj = null;

            ItemQueue itemQueue = null;

            try {
                switch (state)
                {
                case StatesMachine.UDP_CONNECTED_CHANGE:     // запрос-команда на изменение состояния (от формы)
                case StatesMachine.WRITER_READY_CHANGE:
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    outobj = itemQueue.Pars[0];
                    break;

                case StatesMachine.UDP_CONNECTED_CHANGED:     // событие - факт изменения состояния (от объекта - прослушивателя UDP)
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    EvtToFormMain?.Invoke(new object[] { state, itemQueue.Pars[0] });
                    break;

                case StatesMachine.UDP_LISTENER_PACKAGE_RECIEVED:     // получен очередной XML-пакет
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    EvtToFormMain?.Invoke(new object[] { state, itemQueue.Pars[0], itemQueue.Pars[1] });

                    debugMsg = @"получен XML-пакет, добавлен в очередь для обработки";
                    Logging.Logg().Debug(MethodBase.GetCurrentMethod(), debugMsg, Logging.INDEX_MESSAGE.NOT_SET);
                    Debug.WriteLine(string.Format(@"{0}: {1}", DateTime.Now.ToString(), debugMsg));
                    break;

                case StatesMachine.XML_PACKAGE_VERSION:     // версия(строка) шаблон XML-пакета
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    outobj = m_fileINI.XMLPackageVersion;
                    break;

                case StatesMachine.XML_PACKAGE_TEMPLATE:     // шаблон XML-пакета
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    outobj = m_fileINI.GetXMLPackageTemplate((string)itemQueue.Pars[0]);
                    break;

                case StatesMachine.NUDP_LISTENER:     // номер порта прослушивателя
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    outobj = m_fileINI.NUDPListener;
                    break;

                case StatesMachine.LIST_DEST:     // cписок источников данных (назначение - сохранение полученных значений)
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    EvtToFormMain?.Invoke(new object[] { state, m_fileINI.ListDest });
                    break;

                default:
                    break;
                }
            } catch (Exception e) {
                Logging.Logg().Exception(e, @"HHandlerQueue::StateCheckResponse (state=" + state.ToString() + @") - ...", Logging.INDEX_MESSAGE.NOT_SET);

                error = true;
                iRes  = -1 * (int)state;
            }

            return(iRes);
        }
 public REQUEST(StatesMachine key, object arg)
     : base(key, arg)
 {
 }
Exemple #28
0
        protected override INDEX_WAITHANDLE_REASON StateErrors(int /*StatesMachine*/ state, int request, int result)
        {
            INDEX_WAITHANDLE_REASON reasonRes = INDEX_WAITHANDLE_REASON.SUCCESS;

            bool bClear = false;

            StatesMachine stateMachine = (StatesMachine)state;
            string        mesError     = string.Empty;

            delegateStopWait();

            switch (stateMachine)
            {
            case StatesMachine.PPBRValues:
                if (request == 0)
                {
                    mesError = "Ошибка разбора данных плана. Переход в ожидание.";
                }
                else
                {
                    mesError = "Ошибка получения данных плана. Переход в ожидание.";

                    bClear = true;
                }
                break;

            case StatesMachine.PPBRDates:
                try
                {
                    if (request == 0)
                    {
                        mesError = "Ошибка разбора сохранённых часовых значений (PPBR). Переход в ожидание.";
                        //saveResult = Errors.ParseError;
                    }
                    else
                    {
                        mesError = "Ошибка получения сохранённых часовых значений (PPBR). Переход в ожидание.";
                        //saveResult = Errors.NoAccess;
                    }

                    //semaDBAccess.Release(1);
                }
                catch
                {
                }
                break;

            case StatesMachine.MaketEquipment:
                if (request == 0)
                {
                    mesError = "Ошибка разбора содержания макетов. Переход в ожидание.";
                }
                else
                {
                    mesError = "Ошибка получения содержания макетов. Переход в ожидание.";
                }
                break;

            default:
                break;
            }

            if (string.IsNullOrEmpty(mesError) == false)
            {
                ErrorReport(mesError);
            }

            if (bClear)
            {
                ClearValues();
            }

            errorData?.Invoke((int)stateMachine);

            return(reasonRes);
        }
Exemple #29
0
        protected override int StateCheckResponse(int s, out bool error, out object outobj)
        {
            int           iRes  = -1;
            StatesMachine state = (StatesMachine)s;

            error  = true;
            outobj = null;

            ItemQueue itemQueue = null;

            try
            {
                switch (state)
                {
                    #region LIST_GROUP_SOURCES
                case (int)StatesMachine.LIST_GROUP_SOURCES:
                    error  = false;
                    outobj = new object [] {
                        m_fileINI.ListSrcGroupSources
                        , m_fileINI.ListDestGroupSources
                    };

                    iRes = 0;
                    break;
                    #endregion

                    #region LIST_GROUP_SIGNALS
                case StatesMachine.LIST_GROUP_SIGNALS:
                    error  = false;
                    outobj = new object[] {
                        m_fileINI.ListSrcGroupSignals
                        , m_fileINI.ListDestGroupSignals
                    };

                    iRes = 0;
                    break;
                    #endregion

                    #region LIST_SRC_GROUP_SOURCE_ITEMS, LIST_SRC_GROUP_SOURCE_PARS, LIST_SRC_GROUP_SOURCE_PROP, LIST_SRC_GROUP_SIGNAL_ITEMS, LIST_SRC_GROUP_SIGNAL_PARS, LIST_SRC_GROUP_SIGNAL_PROP
                case StatesMachine.LIST_SRC_GROUP_SOURCE_ITEMS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    =
                        //m_fileINI.GetListItemsOfGroupSource(itemQueue.Pars.ToArray())
                        m_fileINI.GetListItemsOfGroupSource(itemQueue.Pars.ToArray())
                    ;

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SOURCE_PARS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListParsOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SOURCE_PROP:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemPropOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SIGNAL_ITEMS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemsOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SIGNAL_PARS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListParsOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_SRC_GROUP_SIGNAL_PROP:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemPropOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;
                    #endregion

                    #region LIST_DEST_GROUP_SOURCE_ITEMS, LIST_DEST_GROUP_SOURCE_PARS, LIST_DEST_GROUP_SOURCE_PROP, LIST_DEST_GROUP_SIGNAL_ITEMS, LIST_DEST_GROUP_SIGNAL_PARS, LIST_DEST_GROUP_SIGNAL_PROP
                case StatesMachine.LIST_DEST_GROUP_SOURCE_ITEMS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemsOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SOURCE_PARS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListParsOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SOURCE_PROP:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemPropOfGroupSource(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SIGNAL_ITEMS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemsOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SIGNAL_PARS:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListParsOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.LIST_DEST_GROUP_SIGNAL_PROP:
                    error     = false;
                    itemQueue = Peek;
                    outobj    = m_fileINI.GetListItemPropOfGroupSignal(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;
                    #endregion

                    #region OBJ_SRC_GROUP_SOURCES, OBJ_DEST_GROUP_SOURCES
                case StatesMachine.OBJ_SRC_GROUP_SOURCES:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр строковый идентификатор "выбранноой" группы источников
                    outobj = m_fileINI.GetObjectSrcGroupSources((string)itemQueue.Pars[0]);

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_DEST_GROUP_SOURCES:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр индекс "выбранноой" группы источников
                    outobj = m_fileINI.GetObjectDestGroupSources((string)itemQueue.Pars[0]);

                    iRes = 0;
                    break;
                    #endregion

                    #region TIMER_WORK_UPDATE
                case StatesMachine.TIMER_WORK_UPDATE:
                    error  = false;
                    outobj = m_fileINI.SecondWorkUpdate;

                    iRes = 0;
                    break;
                    #endregion

                    #region OBJ_SRC_GROUP_SIGNALS_PARS, OBJ_SRC_GROUP_SIGNALS, OBJ_DEST_GROUP_SIGNALS_PARS, OBJ_DEST_GROUP_SIGNALS
                case StatesMachine.OBJ_SRC_GROUP_SIGNALS_PARS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр идентификатор "выбранноой" группы сигналов
                    outobj = m_fileINI.GetObjectGroupSignalsPars(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_SRC_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр идентификатор "выбранноой" группы сигналов
                    outobj = m_fileINI.GetObjectGroupSignals(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_DEST_GROUP_SIGNALS_PARS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр идентификатор "выбранноой" группы сигналов
                    outobj = m_fileINI.GetObjectGroupSignalsPars(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;

                case StatesMachine.OBJ_DEST_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр идентификатор "выбранноой" группы сигналов
                    outobj = m_fileINI.GetObjectGroupSignals(itemQueue.Pars.ToArray());

                    iRes = 0;
                    break;
                    #endregion

                    #region STATE_GROUP_SOURCES, STATE_GROUP_SIGNALS
                case StatesMachine.STATE_GROUP_SOURCES:
                    error  = false;
                    outobj = new object[(int)INDEX_SRC.COUNT_INDEX_SRC];
                    for (INDEX_SRC indxSrc = INDEX_SRC.SOURCE; indxSrc < INDEX_SRC.COUNT_INDEX_SRC; indxSrc++)
                    {
                        (outobj as object[])[(int)indxSrc] = new GroupSources.STATE[m_listGroupSources[(int)indxSrc].Count];

                        foreach (GroupSources grpSrc in m_listGroupSources[(int)indxSrc])
                        {
                            ((outobj as object[])[(int)indxSrc] as GroupSources.STATE[])[m_listGroupSources[(int)indxSrc].IndexOf(grpSrc)] = grpSrc.State;
                        }
                    }

                    iRes = 0;
                    break;

                case StatesMachine.STATE_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;
                    //??? 0-й параметр индекс "выбранноой" группы сигналов
                    outobj = new object[(int)INDEX_SRC.COUNT_INDEX_SRC];
                    for (INDEX_SRC indxSrc = INDEX_SRC.SOURCE; indxSrc < INDEX_SRC.COUNT_INDEX_SRC; indxSrc++)
                    {
                        if (!((int)itemQueue.Pars[(int)indxSrc] < 0))
                        {
                            (outobj as object[])[(int)indxSrc] = m_listGroupSources[(int)indxSrc][(int)itemQueue.Pars[(int)indxSrc]].GetArgGroupSignals();
                        }
                        else
                        {
                            (outobj as object[])[(int)indxSrc] = new object [] { }
                        }
                    }
                    ;

                    iRes = 0;
                    break;
                    #endregion

                    #region STATE_CHANGED_GROUP_SOURCES, STATE_CHANGED_GROUP_SIGNALS
                case StatesMachine.STATE_CHANGED_GROUP_SOURCES:
                    error     = false;
                    itemQueue = Peek;

                    iRes = m_listGroupSources[(int)((INDEX_SRC)itemQueue.Pars[0])][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])].StateChange();
                    break;

                case StatesMachine.STATE_CHANGED_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;

                    iRes = m_listGroupSources[(int)((INDEX_SRC)itemQueue.Pars[0])][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])].StateChange((string)itemQueue.Pars[2]);
                    break;
                    #endregion

                    #region COMMAND_RELAOD_GROUP_SOURCES
                case StatesMachine.COMMAND_RELAOD_GROUP_SOURCES:
                    error     = false;
                    itemQueue = Peek;

                    iRes = m_listGroupSources[(int)((INDEX_SRC)itemQueue.Pars[0])][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])].Reload();
                    break;
                    #endregion

                    #region CLEARVALUES_DEST_GROUP_SIGNALS
                case StatesMachine.CLEARVALUES_DEST_GROUP_SIGNALS:
                    //[1] - идентификаторы
                    //[2] = дата/время / продолжительность
                    error     = false;
                    itemQueue = Peek;

                    int idGrpSrc         = FormMain.FileINI.GetIDIndex((string)(itemQueue.Pars[1] as object [])[0])
                    , idGrpSgnls         = FormMain.FileINI.GetIDIndex((string)(itemQueue.Pars[1] as object[])[1]);
                    DateTime dtStartDate = (DateTime)(itemQueue.Pars[2] as object[])[0];
                    TimeSpan tsStartTime = (TimeSpan)(itemQueue.Pars[2] as object[])[1]
                    , tsPeriodMain       = (TimeSpan)(itemQueue.Pars[2] as object[])[2];

                    iRes = 0;
                    break;
                    #endregion

                    #region DATA_SRC_GROUP_SIGNALS, DATA_DEST_GROUP_SIGNALS
                case StatesMachine.DATA_SRC_GROUP_SIGNALS:
                case StatesMachine.DATA_DEST_GROUP_SIGNALS:
                    error     = false;
                    itemQueue = Peek;

                    INDEX_SRC indxGroupSrc = state == StatesMachine.DATA_SRC_GROUP_SIGNALS ? INDEX_SRC.SOURCE :
                                             state == StatesMachine.DATA_DEST_GROUP_SIGNALS ? INDEX_SRC.DEST :
                                             INDEX_SRC.COUNT_INDEX_SRC;
                    //??? зачем проверка индекса группы источников, как это значение м.б. отрицательным (в элементе управления не выделена ни одна строка!!!)
                    // см. 'PanelWork::fTimerUpdate ()' - из-за того, что при старте /minimize элемент управления не отображается и в нем не назначается выделенная строка
                    if (!((int)itemQueue.Pars[0] < 0))
                    {
                        outobj = m_listGroupSources[(int)indxGroupSrc][(int)itemQueue.Pars[0]].GetDataToPanel(itemQueue.Pars[1] as string, out error);
                    }
                    else
                    {
                        ;
                    }

                    iRes = 0;
                    break;
                    #endregion

                    #region SET_IDCUR_SOURCE_OF_GROUP, SET_TEXT_ADDING, SET_GROUP_SIGNALS_PARS
                case StatesMachine.SET_IDCUR_SOURCE_OF_GROUP:
                    error     = false;
                    itemQueue = Peek;

                    m_listGroupSources[(int)itemQueue.Pars[0]][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])].m_IDCurrentConnSett = (string)itemQueue.Pars[2];
                    m_fileINI.UpdateParameter((int)itemQueue.Pars[0], (string)itemQueue.Pars[1], @"SCUR", (string)itemQueue.Pars[2]);

                    iRes = 0;
                    break;

                case StatesMachine.SET_TEXT_ADDING:
                    error     = false;
                    itemQueue = Peek;

                    (m_listGroupSources[(int)itemQueue.Pars[0]][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])] as GroupSources).SetAdding(((string)itemQueue.Pars[2]).Split(new char[] { FileINI.s_chSecDelimeters[(int)FileINI.INDEX_DELIMETER.PAIR_VAL] }));
                    m_fileINI.UpdateParameter((int)itemQueue.Pars[0], (string)itemQueue.Pars[1], @"ADDING", (string)itemQueue.Pars[2]);

                    iRes = 0;
                    break;

                case StatesMachine.SET_GROUP_SIGNALS_PARS:
                    error     = false;
                    itemQueue = Peek;

                    int          indxGroupSgnls = -1;
                    GroupSources grpSrcs        = (m_listGroupSources[(int)itemQueue.Pars[0]][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])] as GroupSources);
                    indxGroupSgnls = grpSrcs.SetGroupSignalsPars(/*(string)itemQueue.Pars[2],*/ itemQueue.Pars[2] as GROUP_SIGNALS_PARS);
                    //indxGroupSgnls = grpSrcs.getIndexGroupSignalsPars((string)itemQueue.Pars[2]);
                    m_fileINI.UpdateParameter((int)itemQueue.Pars[0], (string)itemQueue.Pars[1], indxGroupSgnls, itemQueue.Pars[2] as GROUP_SIGNALS_PARS);

                    iRes = 0;
                    break;
                    #endregion

                    #region GET_GROUP_SIGNALS_DATETIME_PARS
                case StatesMachine.GET_GROUP_SIGNALS_DATETIME_PARS:
                    error     = false;
                    itemQueue = Peek;

                    GROUP_SIGNALS_SRC_PARS grpSgnlsPars = m_listGroupSources[(int)INDEX_SRC.SOURCE][FormMain.FileINI.GetIDIndex((string)itemQueue.Pars[1])].GetGroupSignalsPars((string)itemQueue.Pars[2]);
                    outobj = grpSgnlsPars.m_arWorkIntervals[(int)itemQueue.Pars[3]];

                    iRes = 0;
                    break;
                    #endregion

                    #region GET_INTERACTION_PARAMETERS
                case StatesMachine.GET_INTERACTION_PARAMETERS:
                    error     = false;
                    itemQueue = Peek;

                    outobj = m_fileINI.m_InteractionPars;

                    iRes = 0;
                    break;
                    #endregion

                    #region INTERACTION_EVENT
                case StatesMachine.INTERACTION_EVENT:
                    error     = false;
                    itemQueue = Peek;

                    if (itemQueue.Pars.Length > 1)
                    {
                        EventInteraction(new object [] { itemQueue.Pars[0], itemQueue.Pars[1] });
                    }
                    else
                    {
                        EventInteraction(new object[] { itemQueue.Pars[0] });
                    }

                    iRes = 0;
                    break;
                    #endregion

#if _STATE_MANAGER
                    #region OMANAGEMENT_ADD, OMANAGEMENT_REMOVE, OMANAGEMENT_CONFIRM, OMANAGEMENT_UPDATE, OMANAGEMENT_CONTROL
                case StatesMachine.OMANAGEMENT_ADD:
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    add((ID)itemQueue.Pars[0], (TimeSpan)itemQueue.Pars[1]);
                    break;

                case StatesMachine.OMANAGEMENT_REMOVE:
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    remove((ID)itemQueue.Pars[0]);
                    break;

                case StatesMachine.OMANAGEMENT_CONFIRM:
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    confirm((ID)itemQueue.Pars[0]);
                    break;

                case StatesMachine.OMANAGEMENT_UPDATE:
                    iRes  = 0;
                    error = false;

                    itemQueue = Peek;

                    update((ID)itemQueue.Pars[0]);
                    break;

                case StatesMachine.OMANAGEMENT_CONTROL:
                    iRes  = 0;
                    error = false;

                    targetFunc();
                    break;

                    #endregion
#endif
                default:
                    break;
                }
            }
            catch (Exception e)
            {
                Logging.Logg().Exception(e, @"HHandlerQueue::StateCheckResponse (state=" + state.ToString() + @") - ...", Logging.INDEX_MESSAGE.NOT_SET);

                error = true;
                iRes  = -1 * (int)state;
            }

            return(iRes);
        }
Exemple #30
0
 // Use this for initialization
 void Awake()
 {
     visionControl      = GetComponent <VisionControl>();
     statesMachine      = GetComponent <StatesMachine>();
     controladorNavMesh = GetComponent <ControladorNavMesh>();
 }