Ejemplo n.º 1
0
        internal QSysSoftPhone(QSys device, int id, string idOffHookLED, string idRingingLED, string idConnect, string idDisconnect,
                               string idDialString, string idDND, string idProgress, string idKeypadBaseName, int changeGroupID)
        {
            this.QSys         = device;
            KeypadControls    = new Dictionary <string, QSysControl>();
            OffHookLEDControl = this.QSys.Controls.Register(idOffHookLED, QSysControlType.Other, changeGroupID);
            ConnectControl    = this.QSys.Controls.Register(idConnect, QSysControlType.Other);
            DisconnectControl = this.QSys.Controls.Register(idDisconnect, QSysControlType.Other);
            DialStringControl = this.QSys.Controls.Register(idDialString, QSysControlType.Other, changeGroupID);
            RingingLEDControl = this.QSys.Controls.Register(idRingingLED, QSysControlType.Other, changeGroupID);
            DNDControl        = this.QSys.Controls.Register(idDND, QSysControlType.Other, changeGroupID);
            ProgressControl   = this.QSys.Controls.Register(idProgress, QSysControlType.Other, changeGroupID);

            for (int digit = 0; digit <= 9; digit++)
            {
                KeypadControls.Add(digit.ToString(), this.QSys.Controls.Register(
                                       string.Format("{0}{1}", idKeypadBaseName, digit.ToString()), QSysControlType.Other));
            }

            KeypadControls.Add("*", this.QSys.Controls.Register(string.Format("{0}*", idKeypadBaseName), QSysControlType.Other));
            KeypadControls.Add("#", this.QSys.Controls.Register(string.Format("{0}#", idKeypadBaseName), QSysControlType.Other));

            OffHookLEDControl.ValueChanged += new QSysControlChangeEventHandler(OnValueChange);
            DialStringControl.ValueChanged += new QSysControlChangeEventHandler(OnValueChange);
            RingingLEDControl.ValueChanged += new QSysControlChangeEventHandler(OnValueChange);
            DNDControl.ValueChanged        += new QSysControlChangeEventHandler(OnValueChange);
            ProgressControl.ValueChanged   += new QSysControlChangeEventHandler(OnValueChange);
        }
Ejemplo n.º 2
0
 internal QSysControlCollection(QSys device)
 {
     Controls           = new Dictionary <string, QSysControl>();
     ChangeGroups       = new List <int>();
     QSys               = device;
     QSys.HasConnected += new QSysConnectedEventHandler(QSys_HasConnected);
 }
Ejemplo n.º 3
0
        internal QSysControl(QSys device, string controlId, QSysControlType type, int changeGroupID)
            : this(device, controlId, type)
        {
            ChangeGroupID = changeGroupID;

            if (QSys.Connected && ChangeGroupID > 0)
            {
                Send(string.Format("cga {0} \"{1}\"", ChangeGroupID, Name));
            }
        }
Ejemplo n.º 4
0
        void QSys_DataReceived(QSys device, QSysReceivedDataEventArgs args)
        {
            if (args.ResponseType == "cv" && args.Arguments.First() == this.ControlID)
            {
#if DEBUG
                CrestronConsole.PrintLine("{0} Value = {1}", args.Arguments[0], args.Arguments[1]);
#endif

                try
                {
                    _StringValue     = args.Arguments[1];
                    _ControlPosition = float.Parse(args.Arguments[3]);
                    float newValue = float.Parse(args.Arguments[2]);

                    if (_Value != newValue)
                    {
                        _Value = newValue;

                        if (VolumeChanged != null)
                        {
                            if (this.SupportsVolumeLevel)
                            {
                                VolumeChanged(this, new VolumeChangeEventArgs(VolumeLevelChangeEventType.LevelChanged));
                            }
                            else if (this.SupportsVolumeMute)
                            {
                                VolumeChanged(this, new VolumeChangeEventArgs(VolumeLevelChangeEventType.MuteChanged));
                            }
                        }
                    }

                    if (ValueChanged != null)
                    {
                        ValueChanged(this);
                    }

                    if (Waiting)
                    {
                        Waiting = false;
                    }

                    if (this.Initialized == false)
                    {
                        this.Initialized = true;
                    }
                }
                catch
                {
                    ErrorLog.Error("Error in QSysControl Rx: \"{0}\", args Count = {1}", args.DataString, args.Arguments.Count);
                }
            }
        }
Ejemplo n.º 5
0
        void QSys_HasConnected(QSys device)
        {
            foreach (int group in ChangeGroups)
            {
                this.QSys.Send(string.Format("cgc {0}", group));
                this.QSys.Send(string.Format("cgs {0} {1}", group, 100));
            }

            foreach (QSysControl control in this)
            {
                control.RegisterOnConnect();
            }
        }
Ejemplo n.º 6
0
        internal QSysControl(QSys device, string controlId, QSysControlType type)
        {
            QSys               = device;
            ControlID          = controlId;
            ControlType        = type;
            ChangeGroupID      = 0;
            Initialized        = false;
            QSys.DataReceived += new QSysReceivedDataEventHandler(QSys_DataReceived);

            if (QSys.Connected)
            {
                Poll();
            }
        }
Ejemplo n.º 7
0
 internal QSysPhoneCollection(QSys device)
 {
     QSys   = device;
     Phones = new Dictionary <int, QSysSoftPhone>();
 }