예제 #1
0
 void Device_VoipInfoReceived(ISoundstructureItem item, SoundstructureVoipInfoReceivedEventArgs args)
 {
     if (item == this)
     {
         OnVoipInfoReceived(args.Command, args.Info);
     }
 }
예제 #2
0
        void OnValueChange(string name, SoundstructureCommandType commandType, string commandModifier, double value)
        {
            ISoundstructureItem item = GetItemForName(name);

            if (ValueChange != null && item != null)
            {
                ValueChange(item, new SoundstructureValueChangeEventArgs(commandType, commandModifier, value));
            }
        }
예제 #3
0
 bool ChannelIsGrouped(ISoundstructureItem channel)
 {
     foreach (VirtualChannelGroup group in VirtualChannelGroups)
     {
         if (group.Contains(channel))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #4
0
        public bool Set(ISoundstructureItem channel, SoundstructureCommandType type)
        {
            string str = string.Format("set {0} \"{1}\"", type.ToString().ToLower(),
                                       channel.Name);

            if (this.Connected)
            {
                this.Send(str);
                return(true);
            }
            return(false);
        }
예제 #5
0
        public bool Set(ISoundstructureItem rowChannel, ISoundstructureItem colChannel, SoundstructureCommandType type, bool value)
        {
            string str = string.Format("set {0} \"{1}\" \"{2}\" {3}", type.ToString().ToLower(),
                                       rowChannel.Name, colChannel.Name, value ? 1 : 0);

            if (this.Connected)
            {
                this.Send(str);
                return(true);
            }
            return(false);
        }
예제 #6
0
        public bool Set(ISoundstructureItem channel, SoundstructureCommandType type, string value)
        {
            var str = string.Format("set {0} \"{1}\" \"{2}\"", type.ToString().ToLower(),
                                    channel.Name, value);

            if (!Connected)
            {
                return(false);
            }
            Send(str);
            return(true);
        }
예제 #7
0
 void Device_ValueChange(ISoundstructureItem item, SoundstructureValueChangeEventArgs args)
 {
     try
     {
         if (item == this)
         {
             OnFeedbackReceived(args.CommandType, args.CommandModifier, args.Value);
         }
     }
     catch (Exception e)
     {
         ErrorLog.Error("{0} Error in Device_ValueChange(): {1}", this.GetType().ToString().Split('.').Last(), e.Message);
     }
 }
예제 #8
0
        public void Get(ISoundstructureItem channel, SoundstructureCommandType type)
        {
            string str = string.Format("get {0} \"{1}\"", type.ToString().ToLower(), channel.Name);

            this.Send(str);

            if (type == SoundstructureCommandType.FADER)
            {
                str = string.Format("get fader min \"{0}\"", channel.Name);
                this.Send(str);

                str = string.Format("get fader max \"{0}\"", channel.Name);
                this.Send(str);
            }
        }
예제 #9
0
        void VoipInfoReceived(ISoundstructureItem item, SoundstructureVoipInfoReceivedEventArgs args)
        {
            if (item == this.VoipOutChannel)
            {
                List <string> elements = SoundstructureSocket.ElementsFromString(args.Info);
                if (elements.Count > 1)
                {
                    uint lineNumber = uint.Parse(elements[0]);
                    if (lineNumber == this.Number)
                    {
                        try
                        {
                            switch (args.Command)
                            {
                            case "voip_line_state":
                                try
                                {
                                    this.State = (VoipLineState)Enum.Parse(typeof(VoipLineState), elements[1], true);
                                    if (StateChanged != null)
                                    {
                                        StateChanged(this, this.State);
                                    }
                                }
                                catch (Exception e)
                                {
                                    ErrorLog.Error("Could not parse VoipLineState \"{2}\" for Line {0}, {1}",
                                                   lineNumber, e.Message, elements[1]);
                                }
                                break;

                            case "voip_line_label":
                                this.Label = elements[1];
                                break;

                            case "voip_call_appearance_line":
                                this.CallAppearance = uint.Parse(elements[1]);
                                break;

                            case "voip_call_appearance_state":
                                try
                                {
                                    VoipCallAppearanceState state = (VoipCallAppearanceState)Enum.Parse(typeof(VoipCallAppearanceState), elements[1], true);
                                    if (this.CallAppearanceState != state)
                                    {
                                        this.CallAppearanceState = state;
                                        if (CallAppearanceState == VoipCallAppearanceState.Connected)
                                        {
                                            _CallConnectedTime = DateTime.Now;
                                        }
                                    }
                                    try
                                    {
                                        if (CallAppearanceStateChanged != null)
                                        {
                                            CallAppearanceStateChanged(this, new VoipLineCallAppearanceStateEventArgs(this.CallAppearance, this.CallAppearanceState));
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                        ErrorLog.Exception(string.Format("Error calling event {0}.CallAppearanceStateChanged", this.GetType().Name), e);
                                    }
                                }
                                catch (Exception e)
                                {
                                    ErrorLog.Error("Could not parse VoipCallAppearanceState \"{0}\" for Line {1}, {2}", elements[1], lineNumber, e.Message);
                                }
                                break;

                            case "voip_call_appearance_info":
                                if (elements.Count > 3)
                                {
                                    uint lineIndex = uint.Parse(elements[1]);
                                    _CallInfoLine[lineIndex] = elements[2];
                                    if (CallInfoLineChanged != null)
                                    {
                                        CallInfoLineChanged(this, new VoipLineCallInfoLineEventArgs(lineIndex, elements[2]));
                                    }
                                }
                                break;
                            }
                        }
                        catch (Exception e)
                        {
                            ErrorLog.Error("Error parsing Voip feedback info in VoipLine[{0}], {1}", this.Number, e.Message);
                            ErrorLog.Error("VoipInfoReceived() args.Command = \"{0}\" args.Info = \"{1}\"", args.Command, args.Info);
                        }
                    }
                }
            }
        }
예제 #10
0
 public void SetMatrixMute(ISoundstructureItem rowChannel, ISoundstructureItem colChannel, bool muteValue)
 {
     this.Socket.Set(rowChannel, colChannel, SoundstructureCommandType.MATRIX_MUTE, muteValue);
 }