Example #1
0
        public void OnActiveViewChanging(object sender, EventArgs <string> e)
        {
            if (e.Data == ViewNames.TlfDa)
            {
                int page         = _Page;
                int firstBtPage  = int.Parse(_TlfPageFirstBT.Text) - 1;
                int secondBtPage = int.Parse(_TlfPageSecondBT.Text) - 1;

                TlfState pageState         = _StateManager.Tlf.GetTlfState(_Page * _NumPositionsByPage, _NumPositionsByPage);
                TlfState firstBtPageState  = _StateManager.Tlf.GetTlfState(firstBtPage * _NumPositionsByPage, _NumPositionsByPage);
                TlfState secondBtPageState = _StateManager.Tlf.GetTlfState(secondBtPage * _NumPositionsByPage, _NumPositionsByPage);

                if ((int)firstBtPageState > (int)pageState)
                {
                    pageState = firstBtPageState;
                    page      = firstBtPage;
                }
                if ((int)secondBtPageState > (int)pageState)
                {
                    page = secondBtPage;
                }

                if (page != _Page)
                {
                    _CmdManager.TlfLoadDaPage(page);
                }
            }
        }
Example #2
0
        private void ChangeState(TlfState st)
        {
            _PrevState = _State;

            if ((st != TlfState.UnChanged) && (st != _State))
            {
                _State = st;

                switch (_State)
                {
                case TlfState.Unavailable:
                case TlfState.PaPBusy:
                case TlfState.Idle:
                case TlfState.Mem:
                case TlfState.RemoteMem:
                case TlfState.In:
                case TlfState.InPrio:
                case TlfState.RemoteIn:
                case TlfState.NotAllowed:
                    _Digits = "";
                    break;
                }

                if (_MemNotifTimer != null)
                {
                    _MemNotifTimer.Enabled = (_State == TlfState.Mem) || (_State == TlfState.NotAllowed) || (_State == TlfState.RemoteMem);
                }
            }
        }
Example #3
0
        public TlfState GetTlfState(int from, int count)
        {
            Debug.Assert(from + count <= NumDestinations + NumIaDestinations);
            TlfState st = TlfState.Idle;

            if ((from == 0) && (count == NumDestinations + NumIaDestinations))
            {
                for (int i = _NumDstInState.Length - 1; i >= 0; i--)
                {
                    if (_NumDstInState[i] > 0)
                    {
                        st = (TlfState)i;
                        break;
                    }
                }
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    TlfDst dst = _Dst[i + from];
                    st = (TlfState)Math.Max((int)st, (int)dst.State);
                }
            }

            return(st);
        }
        private void ResetTlfViewBt(string text)
        {
            if (_TlfViewBT.Text == text)
            {
                if (_FastBlinkList.Remove(_TlfViewBT) && (_FastBlinkList.Count == 0))
                {
                    _FastBlinkTimer.Enabled = false;
                    _FastBlinkOn            = true;
                }
                if (_SlowBlinkList.Remove(_TlfViewBT) && (_SlowBlinkList.Count == 0))
                {
                    _SlowBlinkTimer.Enabled = false;
                    _SlowBlinkOn            = true;
                }

                if (text == _AD)
                {
                    TlfState st = _StateManager.Tlf.GetTlfState(0, Tlf.NumDestinations);

                    if (_StateManager.Tlf.Unhang.AssociatePosition != Tlf.IaMappedPosition)
                    {
                        st = (TlfState)Math.Max((int)st, (int)_StateManager.Tlf[Tlf.IaMappedPosition].State);
                    }

                    _TlfViewBT.ButtonColor = GetStateColor(_TlfViewBT, st);
                }
                else
                {
                    _TlfViewBT.ButtonColor = VisualStyle.ButtonColor;
                }
            }
        }
Example #5
0
 public TlfIaDestination(string alias, string number, TlfState state, bool isTop = true, bool allowsForward = true)
 {
     Alias          = alias;
     Number         = number;
     State          = state;
     _IsTop         = isTop;
     _AllowsForward = allowsForward;
 }
Example #6
0
        public readonly bool _AllowsForward; //Point to point telephony destination CGW

        public TlfInfo(string dst, TlfState st, bool priorityAllowed, TlfType type, bool isTop, bool allowsForward)
        {
            Dst = dst;
            St  = st;
            _PriorityAllowed = priorityAllowed;
            _Type            = type;
            _IsTop           = isTop;
            _AllowsForward   = allowsForward;
        }
 public void EndTlfCall(int id, TlfState st)
 {
     if (_Comm.AllowTlf())
     {
         if (st == TlfState.Hold)
         {
             SetHold(id, false);
         }
         EndTlfCall(id);
     }
 }
Example #8
0
        private void OnMemNotifTimerElapsed(object sender, ElapsedEventArgs e)
        {
            if ((_State == TlfState.Mem) || (_State == TlfState.NotAllowed) || (_State == TlfState.RemoteMem))
            {
                _PrevState = _State;
                PreviusStateDescription = StateDescription;

                _State = TlfState.Idle;

                General.SafeLaunchEvent(StChanged, this);
            }
        }
Example #9
0
 public void ResetMem()
 {
     if ((_State == TlfState.Mem) || (_State == TlfState.NotAllowed) || (_State == TlfState.RemoteMem))
     {
         ChangeState(TlfState.Idle);
         ChangeStateDescription();
     }
     else
     {
         _PrevState = _State;
         PreviusStateDescription = StateDescription;
     }
 }
Example #10
0
        private void ResetBtPage(HMIButton bt, TlfState st)
        {
            if (_FastBlinkList.Remove(bt) && (_FastBlinkList.Count == 0))
            {
                _FastBlinkTimer.Enabled = false;
                _FastBlinkOn            = true;
            }
            if (_SlowBlinkList.Remove(bt) && (_SlowBlinkList.Count == 0))
            {
                _SlowBlinkTimer.Enabled = false;
                _SlowBlinkOn            = true;
            }

            bt.ButtonColor = GetStateColor(bt, st);
        }
Example #11
0
 public void Reset(TlfState st)
 {
     if ((st != TlfState.Idle) ||
         ((_State != TlfState.Mem) && (_State != TlfState.RemoteMem)) ||
         (st == TlfState.Idle && _State == TlfState.NotAllowed && _PrevState == TlfState.NotAllowed))
     {
         ChangeState(st);
         ChangeStateDescription();
     }
     else
     {
         _PrevState = _State;
         PreviusStateDescription = StateDescription;
     }
 }
Example #12
0
        private void ResetBtPage(HMIButton bt)
        {
            if (_FastBlinkList.Remove(bt) && (_FastBlinkList.Count == 0))
            {
                _FastBlinkTimer.Enabled = false;
                _FastBlinkOn            = true;
            }
            if (_SlowBlinkList.Remove(bt) && (_SlowBlinkList.Count == 0))
            {
                _SlowBlinkTimer.Enabled = false;
                _SlowBlinkOn            = true;
            }

            int      page = int.Parse(bt.Text) - 1;
            TlfState st   = _StateManager.Tlf.GetTlfState(page * _NumPositionsByPage, _NumPositionsByPage);

            bt.ButtonColor = GetStateColor(bt, st);
        }
Example #13
0
 public void Reset(TlfDestination dst)
 {
     if (dst.Dst == "")
     {
         Reset();
     }
     else if (dst.Dst != _Dst)
     {
         _Dst = dst.Dst;
         ChangeState(TlfState.Idle);
         ChangeStateDescription();
     }
     else
     {
         // Después de llamarse a esta función se va a notificar el cambio
         // por lo que hay que actualizar _PreviusStateDescription
         _PrevState = _State;
         PreviusStateDescription = StateDescription;
     }
 }
Example #14
0
        public void Reset()
        {
            if (_MemNotifTimer != null)
            {
                _MemNotifTimer.Enabled = false;
            }
            if (_IaTimer != null)
            {
                _IaTimer.Enabled = false;
            }

            _Dst       = "";
            _Number    = "";
            _Digits    = "";
            _PrevState = _State;
            ResetDescription();
            _State         = TlfState.Idle;
            _Type          = TlfType.Unknown;
            _IsTop         = true;
            _AllowsForward = false;
        }
Example #15
0
        public override void Reset(CfgEnlaceInterno cfg)
        {
            _Cfg      = cfg;
            _Literal  = cfg.Literal;
            _Priority = (CORESIP_Priority)cfg.Prioridad;
            _Channels.Clear();
            TlfFocusChannel ch = null;

            ch           = new TlfFocusChannel(cfg.OrigenR2, cfg.Literal);
            _ActiveState = true;
            _Member      = false;
            foreach (CfgRecursoEnlaceInterno dst in cfg.ListaRecursos)
            {
                if (Top.Cfg.GetMainUser(Top.HostId) == dst.NombreRecurso)
                {
                    //Soy miembro del grupo
                    _Member      = true;
                    _ActiveState = false;
                    ch.ImMember  = true;
                }
                else
                {
                    ch.AddFinalDestination(dst.NombreRecurso, dst.NumeroAbonado, dst.Prefijo);
                }
            }
            ch.RsChanged += OnRsChanged;
            _Channels.Add(ch);
            if ((_SipCall != null) && !_SipCall.IsValid(_Channels))
            {
                MakeHangUp(0);  // Cortamos llamadas y quitamos busy y congestion
            }

            if (_SipCall == null)
            {
                State = GetReachableState();
            }
        }
Example #16
0
        private Color GetStateColor(HMIButton bt, TlfState st)
        {
            Color backColor = VisualStyle.ButtonColor;

            switch (st)
            {
            case TlfState.Idle:
            case TlfState.PaPBusy:
                break;

            case TlfState.In:
                backColor               = _SlowBlinkOn ? VisualStyle.Colors.Orange : VisualStyle.ButtonColor;
                _SlowBlinkList[bt]      = VisualStyle.Colors.Orange;
                _SlowBlinkTimer.Enabled = true;
                break;

            case TlfState.Out:
                backColor = VisualStyle.Colors.Blue;
                break;

            case TlfState.Set:
            case TlfState.Conf:
                backColor = VisualStyle.Colors.Green;
                break;

            case TlfState.Busy:
                backColor = VisualStyle.Colors.Red;
                break;

            case TlfState.Mem:
                backColor = VisualStyle.Colors.Orange;
                break;

            case TlfState.RemoteMem:
                backColor = VisualStyle.Colors.DarkGray;
                break;

            case TlfState.Hold:
            case TlfState.RemoteHold:
                backColor               = _SlowBlinkOn ? VisualStyle.Colors.Green : VisualStyle.ButtonColor;
                _SlowBlinkList[bt]      = VisualStyle.Colors.Green;
                _SlowBlinkTimer.Enabled = true;
                break;

            case TlfState.RemoteIn:
                backColor               = _SlowBlinkOn ? VisualStyle.Colors.DarkGray : VisualStyle.ButtonColor;
                _SlowBlinkList[bt]      = VisualStyle.Colors.DarkGray;
                _SlowBlinkTimer.Enabled = true;
                break;

            case TlfState.Congestion:
                backColor               = _SlowBlinkOn ? VisualStyle.Colors.Red : VisualStyle.ButtonColor;
                _SlowBlinkList[bt]      = VisualStyle.Colors.Red;
                _SlowBlinkTimer.Enabled = true;
                break;

            case TlfState.InPrio:
                backColor               = _FastBlinkOn ? VisualStyle.Colors.Orange : VisualStyle.ButtonColor;
                _FastBlinkList[bt]      = VisualStyle.Colors.Orange;
                _FastBlinkTimer.Enabled = true;
                break;

            case TlfState.NotAllowed:
                backColor               = _FastBlinkOn ? VisualStyle.Colors.Yellow : VisualStyle.ButtonColor;
                _FastBlinkList[bt]      = VisualStyle.Colors.Yellow;
                _FastBlinkTimer.Enabled = true;
                break;
            }

            return(backColor);
        }
Example #17
0
        private void SetBtnCloseColor()
        {
            if (_StateManager.Tlf.HangTone.On)
            {
                _BackColor = VisualStyle.Colors.Yellow;
            }
            else
            {
                TlfState st = _StateManager.Tlf.GetTlfState(0, Tlf.NumDestinations);

                switch (st)
                {
                case TlfState.Idle:
                case TlfState.PaPBusy:
                    _BackColor = VisualStyle.ButtonColor;
                    break;

                case TlfState.In:
                    _BackColor = VisualStyle.Colors.Orange;
                    _SlowBlinkTimer.Enabled = true;
                    break;

                case TlfState.Out:
                    _BackColor = VisualStyle.Colors.Blue;
                    _SlowBlinkTimer.Enabled = false;
                    break;

                case TlfState.Set:
                case TlfState.Conf:
                    _BackColor = VisualStyle.Colors.Green;
                    _SlowBlinkTimer.Enabled = false;
                    break;

                case TlfState.Busy:
                    _BackColor = VisualStyle.Colors.Red;
                    _SlowBlinkTimer.Enabled = false;
                    break;

                case TlfState.Mem:
                    _BackColor = VisualStyle.Colors.Orange;
                    _SlowBlinkTimer.Enabled = false;
                    break;

                case TlfState.RemoteMem:
                    _BackColor = VisualStyle.Colors.DarkGray;
                    _SlowBlinkTimer.Enabled = false;
                    break;

                case TlfState.Hold:
                case TlfState.RemoteHold:
                    _BackColor = VisualStyle.Colors.Green;
                    _SlowBlinkTimer.Enabled = true;
                    break;

                case TlfState.RemoteIn:
                    _BackColor = VisualStyle.Colors.DarkGray;
                    _SlowBlinkTimer.Enabled = true;
                    break;

                case TlfState.Congestion:
                    _BackColor = VisualStyle.Colors.Red;
                    _SlowBlinkTimer.Enabled = true;
                    break;

                case TlfState.InPrio:
                    _BackColor = VisualStyle.Colors.Orange;
                    _FastBlinkTimer.Enabled = true;
                    break;

                case TlfState.NotAllowed:
                    _BackColor = VisualStyle.Colors.Yellow;
                    _FastBlinkTimer.Enabled = true;
                    break;
                }
            }

            _BtnClose.ButtonColor = _BackColor;
        }
Example #18
0
 public int this[TlfState st]
 {
     get { return(_NumDstInState[(int)st]); }
 }