protected override void ReceivedNotification(TesiraAttributeCode attributeCode, JToken data)
        {
            switch (attributeCode)
            {
            case TesiraAttributeCode.Levels:
            {
                var  values  = data["value"] as JArray;
                uint channel = 0;
                foreach (var value in values)
                {
                    channel++;
                    Channels[channel].UpdateValue(TesiraAttributeCode.Level, value);
                }
            }
            break;

            case TesiraAttributeCode.Mutes:
            {
                var  values  = data["value"] as JArray;
                uint channel = 0;
                foreach (var value in values)
                {
                    channel++;
                    Channels[channel].UpdateValue(TesiraAttributeCode.Mute, value);
                }
            }
            break;
            }
        }
 protected override void ReceivedNotification(TesiraAttributeCode attributeCode, JToken data)
 {
     if (attributeCode == TesiraAttributeCode.SourceSelection)
     {
         _sourceSelection = data["value"].Value <uint>();
     }
 }
Exemple #3
0
        private void SendSubscribe(string publishToken, TesiraAttributeCode attributeCode)
        {
            var message = Tesira.FormatBaseMessage(InstanceTag, TesiraCommand.Subscribe, attributeCode) + " \"" +
                          publishToken + "\" " + 200;

            Device.Send(message);
        }
Exemple #4
0
        public void Send(string instanceTag, TesiraCommand command, TesiraAttributeCode attributeCode, uint[] indexes)
        {
            var message = FormatBaseMessage(instanceTag, command, attributeCode);

            message = indexes.Aggregate(message, (current, index) => current + " " + index);
            _client.Send(message);
        }
 protected override void UpdateAttribute(TesiraAttributeCode code, JToken data)
 {
     switch (code)
     {
     case TesiraAttributeCode.Ganged:
         Ganged = data["value"].Value <bool>();
         break;
     }
 }
Exemple #6
0
        protected void Subscribe(TesiraAttributeCode attributeCode)
        {
            var token = InstanceTag + "_" + attributeCode.ToCommandString();

            Subscriptions[token] = attributeCode;
            if (!Device.DeviceCommunicating)
            {
                return;
            }
            SendSubscribe(token, attributeCode);
        }
Exemple #7
0
        internal override void UpdateValue(TesiraAttributeCode attributeCode, JToken value)
        {
            switch (attributeCode)
            {
                case TesiraAttributeCode.Gain:
                    var gain = value.ToObject<double>();
#if DEBUG
                    Debug.WriteSuccess(Name + " new level value = " + _level.ToString("F1"));
#endif
                    if (Math.Abs(_level - gain) >= 0.1)
                    {
                        _level = gain;
                        LevelString = _level.ToString("F1") + " dB";
                        OnLevelChange(this, Level);
                    }
                    break;
                case TesiraAttributeCode.Level:
                    var level = value.ToObject<double>();
#if DEBUG
                    Debug.WriteSuccess(Name + " new level value = " + _level.ToString("F1"));
#endif
                    if (Math.Abs(_level - level) >= 0.1)
                    {
                        _level = level;
                        LevelString = _level.ToString("F1") + " dB";
                        OnLevelChange(this, Level);
                    }
                    break;
                case TesiraAttributeCode.Mute:
                    var mute = value.ToObject<bool>();
#if DEBUG
                    Debug.WriteSuccess(Name + " " + (mute ? "Muted" : "Unmuted"));
#endif
                    if (mute != _mute)
                    {
                        _mute = mute;
                        OnMuteChange(_mute);
                    }
                    break;
            }
        }
Exemple #8
0
        protected override void ReceivedNotification(TesiraAttributeCode attributeCode, JToken data)
        {
            switch (attributeCode)
            {
            case TesiraAttributeCode.CallState:
            {
                var callStates = data["value"]["callState"].ToObject <List <CallState> >();
                foreach (var line in _channels)
                {
                    var statesForLine = callStates.Where(c => c.LineId == (line.Key - 1));
                    line.Value.UpdateCallStates(statesForLine);
                }
            }
            break;

            case TesiraAttributeCode.DisplayNameLabel:
            {
            }
            break;
            }
        }
Exemple #9
0
 public void Send(string instanceTag, TesiraCommand command, TesiraAttributeCode attributeCode)
 {
     _client.Send(FormatBaseMessage(instanceTag, command, attributeCode));
 }
Exemple #10
0
 internal static string FormatBaseMessage(string instanceTag, TesiraCommand command, TesiraAttributeCode attributeCode)
 {
     return(string.Format("{0} {1} {2}", instanceTag, command.ToString().ToLower(), attributeCode.ToCommandString()));
 }
 internal override void UpdateValue(TesiraAttributeCode attributeCode, JToken value)
 {
 }
Exemple #12
0
 protected override void ReceivedNotification(TesiraAttributeCode attributeCode, JToken data)
 {
 }
 protected abstract void UpdateAttribute(TesiraAttributeCode code, JToken data);
Exemple #14
0
 internal abstract void UpdateValue(TesiraAttributeCode attributeCode, JToken value);
Exemple #15
0
 protected abstract void ReceivedNotification(TesiraAttributeCode attributeCode, JToken data);
Exemple #16
0
        public static string ToCommandString(this TesiraAttributeCode attribute)
        {
            var str = attribute.ToString();

            return(str.Substring(0, 1).ToLower() + str.Substring(1, str.Length - 1));
        }
Exemple #17
0
 protected override void UpdateAttribute(TesiraAttributeCode code, JToken data)
 {
 }