private void OnHangupCallsTimerElapsed(object sender, ElapsedEventArgs e)
        {
            if (!_StateManager.Jacks.SomeJack && _StateManager.Engine.Connected)
            {
                for (int i = 0; i < Tlf.NumDestinations + Tlf.NumIaDestinations; i++)
                {
                    TlfDst dst = _StateManager.Tlf[i];

                    switch (dst.State)
                    {
                    case TlfState.Hold:
                        _EngineCmdManager.EndTlfCall(i, TlfState.Hold);
                        break;

                    case TlfState.Conf:
                        _EngineCmdManager.EndTlfConfCall(i);
                        break;

                    case TlfState.OutOfService:
                    case TlfState.Congestion:
                    case TlfState.Busy:
                    case TlfState.Out:
                    case TlfState.Set:
                    case TlfState.RemoteHold:
                        _EngineCmdManager.EndTlfCall(i);
                        break;
                    }
                }

                for (int i = 0; i < Radio.NumDestinations; i++)
                {
                    RdDst dst = _StateManager.Radio[i];

                    if (dst.Rx)
                    {
                        _EngineCmdManager.ResetRdPosition(i);
                        //_EngineCmdManager.SetRdRx(i, false);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void TlfClick(int id)
        {
            switch (_StateManager.Tlf[id].State)
            {
            case TlfState.Idle:
            case TlfState.PaPBusy:
                if (id < Tlf.NumDestinations)
                {
                    if (_StateManager.Tlf.Listen.State == FunctionState.Ready)
                    {
                        _EngineCmdManager.ListenTo(id);
                    }
                    else if (_StateManager.Tlf.Transfer.State == FunctionState.Ready)
                    {
                        _EngineCmdManager.TransferTo(id, true);
                    }
                    else if (_StateManager.Tlf.PickUp.State == FunctionState.Ready)
                    {
                        _EngineCmdManager.PreparePickUp(id);
                    }
                    else if (_StateManager.Tlf.PickUp.State == FunctionState.Executing)
                    {
                        _EngineCmdManager.CancelPickUp();
                        _EngineCmdManager.PreparePickUp(id);
                    }
                    else if (_StateManager.Tlf.Forward.State == FunctionState.Ready)
                    {
                        _EngineCmdManager.PrepareForward(id);
                    }
                    else
                    {
                        if (_StateManager.Tlf.PickUp.State == FunctionState.Error)
                        {
                            _EngineCmdManager.CancelPickUp();
                        }
                        _EngineCmdManager.BeginTlfCall(id, _StateManager.Tlf.Priority.NewCall(id));
                    }
                }
                else
                {
                    TlfClick(_StateManager.Tlf[id].Number, false, null, id);
                }
                break;

            case TlfState.In:
            case TlfState.InPrio:
            case TlfState.RemoteIn:
                if (_StateManager.Tlf.PickUp.State == FunctionState.Ready)
                {
                    _StateManager.Tlf.PickUp.Reset();
                }
                _EngineCmdManager.AnswerTlfCall(id);
                break;

            case TlfState.Out:
            case TlfState.Set:
            case TlfState.RemoteHold:
            case TlfState.Busy:
            case TlfState.Congestion:
            case TlfState.OutOfService:
            case TlfState.NotAllowed:
                _EngineCmdManager.EndTlfCall(id);
                if (_StateManager.Tlf.Priority.AssociatePosition == id)
                {
                    _StateManager.Tlf.Priority.Reset();
                }
                break;

            case TlfState.Conf:
                _EngineCmdManager.EndTlfConfCall(id);
                break;

            case TlfState.Mem:
            case TlfState.RemoteMem:
                _StateManager.Tlf.ResetMem(id);
                break;

            case TlfState.Hold:
                if (_StateManager.Tlf.Transfer.State == FunctionState.Ready)
                {
                    _EngineCmdManager.TransferTo(id, false);
                }
                else if (_EngineCmdManager.HayConferencia())
                {
                    _EngineCmdManager.SetHold(false);
                }
                else
                {
                    _EngineCmdManager.SetHold(id, false);
                }
                break;

            case TlfState.InProcess:
                //Do nothing
                break;
            }
        }