Beispiel #1
0
            protected override int StateRequest(int state)
            {
                int       iRes      = 0;
                ItemQueue itemQueue = Peek;

                CONN_SETT_TYPE type = CONN_SETT_TYPE.UNKNOWN;

                switch ((EVENT)state)
                {
                case EVENT.LIST_SIGNAL:
                    type = (CONN_SETT_TYPE)itemQueue.Pars[1];

                    _handlerDb.GetListSignals((int)itemQueue.Pars[0],type);
                    break;

                case EVENT.CUR_VALUES:
                case EVENT.CHECK_VALUES:
                    type = (CONN_SETT_TYPE)itemQueue.Pars[0];

                    _handlerDb.Request(type,Signals[type].ElementAt((int)itemQueue.Pars[1]).kks_code);
                    break;

                default:
                    Logging.Logg().Error(string.Format(@"HandlerSignalQueue::StateRequest (CONN_SETT_TYPE={0}, event={1}) - необработанное событие...",type,(EVENT)state),Logging.INDEX_MESSAGE.NOT_SET);

                    iRes = -1;
                    break;
                }

                return(iRes);
            }
Beispiel #2
0
            protected override int StateRequest(int state)
            {
                int       iRes      = 0;
                ItemQueue itemQueue = Peek;

                CONN_SETT_TYPE type = CONN_SETT_TYPE.UNKNOWN;

                switch ((EVENT)state)
                {
                case EVENT.LIST_SIGNAL:
                    type = (CONN_SETT_TYPE)itemQueue.Pars[1];

                    _handlerDb.GetListSignals((int)itemQueue.Pars[0],type);
                    break;

                case EVENT.CUR_VALUES:
                case EVENT.CHECK_VALUES:
                    type = (CONN_SETT_TYPE)itemQueue.Pars[0];

                    iRes = (Signals.ContainsKey(type) == false) ? -4
                            : !((int)itemQueue.Pars [1] < Signals [type].Count) ? -3
                                : (string.IsNullOrEmpty(Signals [type].ElementAt((int)itemQueue.Pars [1]).kks_code) == true) ? -2
                                    : 0;
                    if (!(iRes < 0))
                    {
                        _handlerDb.Request(type,Signals [type].ElementAt((int)itemQueue.Pars [1]).kks_code);
                    }
                    else
                    {
                        Logging.Logg().Error($"HandlerSignalQueue::StateRequest (CONN_SETT_TYPE={type}, event={(EVENT)state}) - запрос не отправлен..."
                                             ,Logging.INDEX_MESSAGE.NOT_SET);
                    }
                    break;

                default:
                    Logging.Logg().Error(string.Format(@"HandlerSignalQueue::StateRequest (CONN_SETT_TYPE={0}, event={1}) - необработанное событие...",type,(EVENT)state)
                                         ,Logging.INDEX_MESSAGE.NOT_SET);

                    iRes = -1;
                    break;
                }

                return(iRes);
            }