mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 21:24:54 +00:00
Fusion working again for Huddle room types
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,23 +1,23 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Devices.Common.DSP
|
namespace PepperDash.Essentials.Devices.Common.DSP
|
||||||
{
|
{
|
||||||
|
|
||||||
// QUESTIONS:
|
// QUESTIONS:
|
||||||
//
|
//
|
||||||
// When subscribing, just use the Instance ID for Custom Name?
|
// When subscribing, just use the Instance ID for Custom Name?
|
||||||
|
|
||||||
// Verbose on subscriptions?
|
// Verbose on subscriptions?
|
||||||
|
|
||||||
// ! "publishToken":"name" "value":-77.0
|
// ! "publishToken":"name" "value":-77.0
|
||||||
// ! "myLevelName" -77
|
// ! "myLevelName" -77
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,210 +1,210 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Devices.Common.DSP
|
namespace PepperDash.Essentials.Devices.Common.DSP
|
||||||
{
|
{
|
||||||
|
|
||||||
// QUESTIONS:
|
// QUESTIONS:
|
||||||
//
|
//
|
||||||
// When subscribing, just use the Instance ID for Custom Name?
|
// When subscribing, just use the Instance ID for Custom Name?
|
||||||
|
|
||||||
// Verbose on subscriptions?
|
// Verbose on subscriptions?
|
||||||
|
|
||||||
// ! "publishToken":"name" "value":-77.0
|
// ! "publishToken":"name" "value":-77.0
|
||||||
// ! "myLevelName" -77
|
// ! "myLevelName" -77
|
||||||
|
|
||||||
#warning Working here when set aside for config editor work
|
#warning Working here when set aside for config editor work
|
||||||
|
|
||||||
public class TesiraForteLevelControl : TesiraForteControlPoint, IDspLevelControl, IKeyed
|
public class TesiraForteLevelControl : TesiraForteControlPoint, IDspLevelControl, IKeyed
|
||||||
{
|
{
|
||||||
bool _IsMuted;
|
bool _IsMuted;
|
||||||
ushort _VolumeLevel;
|
ushort _VolumeLevel;
|
||||||
|
|
||||||
public BoolFeedback MuteFeedback { get; private set; }
|
public BoolFeedback MuteFeedback { get; private set; }
|
||||||
|
|
||||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public string ControlPointTag { get { return base.InstanceTag; } }
|
public string ControlPointTag { get { return base.InstanceTag; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for to identify level subscription values
|
/// Used for to identify level subscription values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string LevelCustomName { get; private set; }
|
public string LevelCustomName { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for to identify mute subscription values
|
/// Used for to identify mute subscription values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MuteCustomName { get; private set; }
|
public string MuteCustomName { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimum fader level
|
/// Minimum fader level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double MinLevel;
|
double MinLevel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum fader level
|
/// Maximum fader level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double MaxLevel;
|
double MaxLevel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if a valid subscription string has been recieved for all subscriptions
|
/// Checks if a valid subscription string has been recieved for all subscriptions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsSubsribed
|
public bool IsSubsribed
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
bool isSubscribed = false;
|
bool isSubscribed = false;
|
||||||
|
|
||||||
if (HasMute && MuteIsSubscribed)
|
if (HasMute && MuteIsSubscribed)
|
||||||
isSubscribed = true;
|
isSubscribed = true;
|
||||||
|
|
||||||
if (HasLevel && LevelIsSubscribed)
|
if (HasLevel && LevelIsSubscribed)
|
||||||
isSubscribed = true;
|
isSubscribed = true;
|
||||||
|
|
||||||
return isSubscribed;
|
return isSubscribed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AutomaticUnmuteOnVolumeUp { get; private set; }
|
public bool AutomaticUnmuteOnVolumeUp { get; private set; }
|
||||||
|
|
||||||
public bool HasMute { get; private set; }
|
public bool HasMute { get; private set; }
|
||||||
|
|
||||||
public bool HasLevel { get; private set; }
|
public bool HasLevel { get; private set; }
|
||||||
|
|
||||||
bool MuteIsSubscribed;
|
bool MuteIsSubscribed;
|
||||||
|
|
||||||
bool LevelIsSubscribed;
|
bool LevelIsSubscribed;
|
||||||
|
|
||||||
//public TesiraForteLevelControl(string label, string id, int index1, int index2, bool hasMute, bool hasLevel, BiampTesiraForteDsp parent)
|
//public TesiraForteLevelControl(string label, string id, int index1, int index2, bool hasMute, bool hasLevel, BiampTesiraForteDsp parent)
|
||||||
// : base(id, index1, index2, parent)
|
// : base(id, index1, index2, parent)
|
||||||
//{
|
//{
|
||||||
// Initialize(label, hasMute, hasLevel);
|
// Initialize(label, hasMute, hasLevel);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public TesiraForteLevelControl(string key, BiampTesiraForteLevelControlBlockConfig config, BiampTesiraForteDsp parent)
|
public TesiraForteLevelControl(string key, BiampTesiraForteLevelControlBlockConfig config, BiampTesiraForteDsp parent)
|
||||||
: base(config.InstanceTag, config.Index1, config.Index2, parent)
|
: base(config.InstanceTag, config.Index1, config.Index2, parent)
|
||||||
{
|
{
|
||||||
Initialize(key, config.Label, config.HasMute, config.HasLevel);
|
Initialize(key, config.Label, config.HasMute, config.HasLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes this attribute based on config values and generates subscriptions commands and adds commands to the parent's queue.
|
/// Initializes this attribute based on config values and generates subscriptions commands and adds commands to the parent's queue.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize(string key, string label, bool hasMute, bool hasLevel)
|
public void Initialize(string key, string label, bool hasMute, bool hasLevel)
|
||||||
{
|
{
|
||||||
Key = string.Format("{0}--{1}", Parent.Key, key);
|
Key = string.Format("{0}--{1}", Parent.Key, key);
|
||||||
|
|
||||||
DeviceManager.AddDevice(this);
|
DeviceManager.AddDevice(this);
|
||||||
|
|
||||||
Debug.Console(2, this, "Adding LevelControl '{0}'", Key);
|
Debug.Console(2, this, "Adding LevelControl '{0}'", Key);
|
||||||
|
|
||||||
this.IsSubscribed = false;
|
this.IsSubscribed = false;
|
||||||
|
|
||||||
MuteFeedback = new BoolFeedback(() => _IsMuted);
|
MuteFeedback = new BoolFeedback(() => _IsMuted);
|
||||||
|
|
||||||
VolumeLevelFeedback = new IntFeedback(() => _VolumeLevel);
|
VolumeLevelFeedback = new IntFeedback(() => _VolumeLevel);
|
||||||
|
|
||||||
HasMute = hasMute;
|
HasMute = hasMute;
|
||||||
HasLevel = hasLevel;
|
HasLevel = hasLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Subscribe()
|
public void Subscribe()
|
||||||
{
|
{
|
||||||
// Do subscriptions and blah blah
|
// Do subscriptions and blah blah
|
||||||
|
|
||||||
// Subscribe to mute
|
// Subscribe to mute
|
||||||
if (this.HasMute)
|
if (this.HasMute)
|
||||||
{
|
{
|
||||||
MuteCustomName = string.Format("{0}~mute{1}", this.InstanceTag, this.Index1);
|
MuteCustomName = string.Format("{0}~mute{1}", this.InstanceTag, this.Index1);
|
||||||
|
|
||||||
SendSubscriptionCommand(MuteCustomName, "mute", 500);
|
SendSubscriptionCommand(MuteCustomName, "mute", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe to level
|
// Subscribe to level
|
||||||
if (this.HasLevel)
|
if (this.HasLevel)
|
||||||
{
|
{
|
||||||
LevelCustomName = string.Format("{0}~level{1}", this.InstanceTag, this.Index1);
|
LevelCustomName = string.Format("{0}~level{1}", this.InstanceTag, this.Index1);
|
||||||
|
|
||||||
SendSubscriptionCommand(LevelCustomName, "level", 250);
|
SendSubscriptionCommand(LevelCustomName, "level", 250);
|
||||||
|
|
||||||
SendFullCommand("get", "minLevel", null);
|
SendFullCommand("get", "minLevel", null);
|
||||||
|
|
||||||
SendFullCommand("get", "maxLevel", null);
|
SendFullCommand("get", "maxLevel", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the response from the DspBase
|
/// Parses the response from the DspBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="customName"></param>
|
/// <param name="customName"></param>
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
public void ParseSubscriptionMessage(string customName, string value)
|
public void ParseSubscriptionMessage(string customName, string value)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Check for valid subscription response
|
// Check for valid subscription response
|
||||||
|
|
||||||
if (this.HasMute && customName == MuteCustomName)
|
if (this.HasMute && customName == MuteCustomName)
|
||||||
{
|
{
|
||||||
//if (value.IndexOf("+OK") > -1)
|
//if (value.IndexOf("+OK") > -1)
|
||||||
//{
|
//{
|
||||||
// int pointer = value.IndexOf(" +OK");
|
// int pointer = value.IndexOf(" +OK");
|
||||||
|
|
||||||
// MuteIsSubscribed = true;
|
// MuteIsSubscribed = true;
|
||||||
|
|
||||||
// // Removes the +OK
|
// // Removes the +OK
|
||||||
// value = value.Substring(0, value.Length - (value.Length - (pointer - 1)));
|
// value = value.Substring(0, value.Length - (value.Length - (pointer - 1)));
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (value.IndexOf("true") > -1)
|
if (value.IndexOf("true") > -1)
|
||||||
{
|
{
|
||||||
_IsMuted = true;
|
_IsMuted = true;
|
||||||
MuteIsSubscribed = true;
|
MuteIsSubscribed = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (value.IndexOf("false") > -1)
|
else if (value.IndexOf("false") > -1)
|
||||||
{
|
{
|
||||||
_IsMuted = false;
|
_IsMuted = false;
|
||||||
MuteIsSubscribed = true;
|
MuteIsSubscribed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MuteFeedback.FireUpdate();
|
MuteFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
else if (this.HasLevel && customName == LevelCustomName)
|
else if (this.HasLevel && customName == LevelCustomName)
|
||||||
{
|
{
|
||||||
//if (value.IndexOf("+OK") > -1)
|
//if (value.IndexOf("+OK") > -1)
|
||||||
//{
|
//{
|
||||||
// int pointer = value.IndexOf(" +OK");
|
// int pointer = value.IndexOf(" +OK");
|
||||||
|
|
||||||
// LevelIsSubscribed = true;
|
// LevelIsSubscribed = true;
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
var _value = Double.Parse(value);
|
var _value = Double.Parse(value);
|
||||||
|
|
||||||
_VolumeLevel = (ushort)Scale(_value, MinLevel, MaxLevel, 0, 65535);
|
_VolumeLevel = (ushort)Scale(_value, MinLevel, MaxLevel, 0, 65535);
|
||||||
|
|
||||||
LevelIsSubscribed = true;
|
LevelIsSubscribed = true;
|
||||||
|
|
||||||
VolumeLevelFeedback.FireUpdate();
|
VolumeLevelFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses a non subscription response
|
/// Parses a non subscription response
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="attributeCode">The attribute code of the command</param>
|
/// <param name="attributeCode">The attribute code of the command</param>
|
||||||
/// <param name="message">The message to parse</param>
|
/// <param name="message">The message to parse</param>
|
||||||
public override void ParseGetMessage(string attributeCode, string message)
|
public override void ParseGetMessage(string attributeCode, string message)
|
||||||
{
|
{
|
||||||
@@ -257,122 +257,122 @@ namespace PepperDash.Essentials.Devices.Common.DSP
|
|||||||
Debug.Console(2, "Unable to parse message: '{0}'\n{1}", message, e);
|
Debug.Console(2, "Unable to parse message: '{0}'\n{1}", message, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Turns the mute off
|
/// Turns the mute off
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void MuteOff()
|
public void MuteOff()
|
||||||
{
|
|
||||||
SendFullCommand("set", "mute", "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Turns the mute on
|
|
||||||
/// </summary>
|
|
||||||
public void MuteOn()
|
|
||||||
{
|
|
||||||
SendFullCommand("set", "mute", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the volume to a specified level
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="level"></param>
|
|
||||||
public void SetVolume(ushort level)
|
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "volume: {0}", level);
|
SendFullCommand("set", "mute", "false");
|
||||||
// Unmute volume if new level is higher than existing
|
}
|
||||||
if (level > _VolumeLevel && AutomaticUnmuteOnVolumeUp)
|
|
||||||
if(!_IsMuted)
|
/// <summary>
|
||||||
MuteOff();
|
/// Turns the mute on
|
||||||
|
/// </summary>
|
||||||
|
public void MuteOn()
|
||||||
|
{
|
||||||
|
SendFullCommand("set", "mute", "true");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the volume to a specified level
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="level"></param>
|
||||||
|
public void SetVolume(ushort level)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "volume: {0}", level);
|
||||||
|
// Unmute volume if new level is higher than existing
|
||||||
|
if (level > _VolumeLevel && AutomaticUnmuteOnVolumeUp)
|
||||||
|
if(!_IsMuted)
|
||||||
|
MuteOff();
|
||||||
|
|
||||||
double volumeLevel = Scale(level, 0, 65535, MinLevel, MaxLevel);
|
double volumeLevel = Scale(level, 0, 65535, MinLevel, MaxLevel);
|
||||||
|
|
||||||
SendFullCommand("set", "level", string.Format("{0:0.000000}", volumeLevel));
|
SendFullCommand("set", "level", string.Format("{0:0.000000}", volumeLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Toggles mute status
|
/// Toggles mute status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void MuteToggle()
|
public void MuteToggle()
|
||||||
{
|
{
|
||||||
SendFullCommand("toggle", "mute", "");
|
SendFullCommand("toggle", "mute", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Decrements volume level
|
/// Decrements volume level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pressRelease"></param>
|
/// <param name="pressRelease"></param>
|
||||||
public void VolumeDown(bool pressRelease)
|
public void VolumeDown(bool pressRelease)
|
||||||
{
|
{
|
||||||
SendFullCommand("decrement", "level", "");
|
SendFullCommand("decrement", "level", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Increments volume level
|
/// Increments volume level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pressRelease"></param>
|
/// <param name="pressRelease"></param>
|
||||||
public void VolumeUp(bool pressRelease)
|
public void VolumeUp(bool pressRelease)
|
||||||
{
|
{
|
||||||
SendFullCommand("increment", "level", "");
|
SendFullCommand("increment", "level", "");
|
||||||
|
|
||||||
if (AutomaticUnmuteOnVolumeUp)
|
if (AutomaticUnmuteOnVolumeUp)
|
||||||
if (!_IsMuted)
|
if (!_IsMuted)
|
||||||
MuteOff();
|
MuteOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
///// <summary>
|
///// <summary>
|
||||||
///// Scales the input from the input range to the output range
|
///// Scales the input from the input range to the output range
|
||||||
///// </summary>
|
///// </summary>
|
||||||
///// <param name="input"></param>
|
///// <param name="input"></param>
|
||||||
///// <param name="inMin"></param>
|
///// <param name="inMin"></param>
|
||||||
///// <param name="inMax"></param>
|
///// <param name="inMax"></param>
|
||||||
///// <param name="outMin"></param>
|
///// <param name="outMin"></param>
|
||||||
///// <param name="outMax"></param>
|
///// <param name="outMax"></param>
|
||||||
///// <returns></returns>
|
///// <returns></returns>
|
||||||
//int Scale(int input, int inMin, int inMax, int outMin, int outMax)
|
//int Scale(int input, int inMin, int inMax, int outMin, int outMax)
|
||||||
//{
|
//{
|
||||||
// Debug.Console(1, this, "Scaling (int) input '{0}' with min '{1}'/max '{2}' to output range min '{3}'/max '{4}'", input, inMin, inMax, outMin, outMax);
|
// Debug.Console(1, this, "Scaling (int) input '{0}' with min '{1}'/max '{2}' to output range min '{3}'/max '{4}'", input, inMin, inMax, outMin, outMax);
|
||||||
|
|
||||||
// int inputRange = inMax - inMin;
|
// int inputRange = inMax - inMin;
|
||||||
|
|
||||||
// int outputRange = outMax - outMin;
|
// int outputRange = outMax - outMin;
|
||||||
|
|
||||||
// var output = (((input-inMin) * outputRange) / inputRange ) - outMin;
|
// var output = (((input-inMin) * outputRange) / inputRange ) - outMin;
|
||||||
|
|
||||||
// Debug.Console(1, this, "Scaled output '{0}'", output);
|
// Debug.Console(1, this, "Scaled output '{0}'", output);
|
||||||
|
|
||||||
// return output;
|
// return output;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scales the input from the input range to the output range
|
/// Scales the input from the input range to the output range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <param name="inMin"></param>
|
/// <param name="inMin"></param>
|
||||||
/// <param name="inMax"></param>
|
/// <param name="inMax"></param>
|
||||||
/// <param name="outMin"></param>
|
/// <param name="outMin"></param>
|
||||||
/// <param name="outMax"></param>
|
/// <param name="outMax"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
double Scale(double input, double inMin, double inMax, double outMin, double outMax)
|
double Scale(double input, double inMin, double inMax, double outMin, double outMax)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Scaling (double) input '{0}' with min '{1}'/max '{2}' to output range min '{3}'/max '{4}'",input ,inMin ,inMax ,outMin, outMax);
|
Debug.Console(1, this, "Scaling (double) input '{0}' with min '{1}'/max '{2}' to output range min '{3}'/max '{4}'",input ,inMin ,inMax ,outMin, outMax);
|
||||||
|
|
||||||
double inputRange = inMax - inMin;
|
double inputRange = inMax - inMin;
|
||||||
|
|
||||||
if (inputRange <= 0)
|
if (inputRange <= 0)
|
||||||
{
|
{
|
||||||
throw new ArithmeticException(string.Format("Invalid Input Range '{0}' for Scaling. Min '{1}' Max '{2}'.", inputRange, inMin, inMax));
|
throw new ArithmeticException(string.Format("Invalid Input Range '{0}' for Scaling. Min '{1}' Max '{2}'.", inputRange, inMin, inMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
double outputRange = outMax - outMin;
|
double outputRange = outMax - outMin;
|
||||||
|
|
||||||
var output = (((input - inMin) * outputRange) / inputRange) + outMin;
|
var output = (((input - inMin) * outputRange) / inputRange) + outMin;
|
||||||
|
|
||||||
Debug.Console(1, this, "Scaled output '{0}'", output);
|
Debug.Console(1, this, "Scaled output '{0}'", output);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,75 +1,75 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Devices.Common.DSP
|
namespace PepperDash.Essentials.Devices.Common.DSP
|
||||||
{
|
{
|
||||||
public abstract class TesiraForteControlPoint : DspControlPoint
|
public abstract class TesiraForteControlPoint : DspControlPoint
|
||||||
{
|
{
|
||||||
public string Key { get; protected set; }
|
public string Key { get; protected set; }
|
||||||
|
|
||||||
public string InstanceTag { get; set; }
|
public string InstanceTag { get; set; }
|
||||||
public int Index1 { get; private set; }
|
public int Index1 { get; private set; }
|
||||||
public int Index2 { get; private set; }
|
public int Index2 { get; private set; }
|
||||||
public BiampTesiraForteDsp Parent { get; private set; }
|
public BiampTesiraForteDsp Parent { get; private set; }
|
||||||
|
|
||||||
public bool IsSubscribed { get; protected set; }
|
public bool IsSubscribed { get; protected set; }
|
||||||
|
|
||||||
protected TesiraForteControlPoint(string id, int index1, int index2, BiampTesiraForteDsp parent)
|
protected TesiraForteControlPoint(string id, int index1, int index2, BiampTesiraForteDsp parent)
|
||||||
{
|
{
|
||||||
InstanceTag = id;
|
InstanceTag = id;
|
||||||
Index1 = index1;
|
Index1 = index1;
|
||||||
Index2 = index2;
|
Index2 = index2;
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual public void Initialize()
|
virtual public void Initialize()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a command to the DSP
|
/// Sends a command to the DSP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="command">command</param>
|
/// <param name="command">command</param>
|
||||||
/// <param name="attribute">attribute code</param>
|
/// <param name="attribute">attribute code</param>
|
||||||
/// <param name="value">value (use "" if not applicable)</param>
|
/// <param name="value">value (use "" if not applicable)</param>
|
||||||
public virtual void SendFullCommand(string command, string attributeCode, string value)
|
public virtual void SendFullCommand(string command, string attributeCode, string value)
|
||||||
{
|
{
|
||||||
// Command Format: InstanceTag get/set/toggle/increment/decrement/subscribe/unsubscribe attributeCode [index] [value]
|
// Command Format: InstanceTag get/set/toggle/increment/decrement/subscribe/unsubscribe attributeCode [index] [value]
|
||||||
// Ex: "RoomLevel set level 1.00"
|
// Ex: "RoomLevel set level 1.00"
|
||||||
|
|
||||||
string cmd;
|
string cmd;
|
||||||
|
|
||||||
if (attributeCode == "level" || attributeCode == "mute" || attributeCode == "minLevel" || attributeCode == "maxLevel" || attributeCode == "label" || attributeCode == "rampInterval" || attributeCode == "rampStep")
|
if (attributeCode == "level" || attributeCode == "mute" || attributeCode == "minLevel" || attributeCode == "maxLevel" || attributeCode == "label" || attributeCode == "rampInterval" || attributeCode == "rampStep")
|
||||||
{
|
{
|
||||||
//Command requires Index
|
//Command requires Index
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(value))
|
if (String.IsNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
// format command without value
|
// format command without value
|
||||||
cmd = string.Format("{0} {1} {2} {3}", InstanceTag, command, attributeCode, Index1);
|
cmd = string.Format("{0} {1} {2} {3}", InstanceTag, command, attributeCode, Index1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// format commadn with value
|
// format commadn with value
|
||||||
cmd = string.Format("{0} {1} {2} {3} {4}", InstanceTag, command, attributeCode, Index1, value);
|
cmd = string.Format("{0} {1} {2} {3} {4}", InstanceTag, command, attributeCode, Index1, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Command does not require Index
|
//Command does not require Index
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(value))
|
if (String.IsNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
cmd = string.Format("{0} {1} {2} {3}", InstanceTag, command, attributeCode, value);
|
cmd = string.Format("{0} {1} {2} {3}", InstanceTag, command, attributeCode, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd = string.Format("{0} {1} {2}", InstanceTag, command, attributeCode);
|
cmd = string.Format("{0} {1} {2}", InstanceTag, command, attributeCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command == "get")
|
if (command == "get")
|
||||||
@@ -81,35 +81,35 @@ namespace PepperDash.Essentials.Devices.Common.DSP
|
|||||||
{
|
{
|
||||||
// This command will generate a simple "+OK" response and doesn't need to be queued
|
// This command will generate a simple "+OK" response and doesn't need to be queued
|
||||||
Parent.SendLine(cmd);
|
Parent.SendLine(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual public void ParseGetMessage(string attributeCode, string message)
|
virtual public void ParseGetMessage(string attributeCode, string message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public virtual void SendSubscriptionCommand(string customName, string attributeCode, int responseRate)
|
public virtual void SendSubscriptionCommand(string customName, string attributeCode, int responseRate)
|
||||||
{
|
{
|
||||||
// Subscription string format: InstanceTag subscribe attributeCode Index1 customName responseRate
|
// Subscription string format: InstanceTag subscribe attributeCode Index1 customName responseRate
|
||||||
// Ex: "RoomLevel subscribe level 1 MyRoomLevel 500"
|
// Ex: "RoomLevel subscribe level 1 MyRoomLevel 500"
|
||||||
|
|
||||||
string cmd;
|
string cmd;
|
||||||
|
|
||||||
if (responseRate > 0)
|
if (responseRate > 0)
|
||||||
{
|
{
|
||||||
cmd = string.Format("{0} subscribe {1} {2} {3} {4}", InstanceTag, attributeCode, Index1, customName, responseRate);
|
cmd = string.Format("{0} subscribe {1} {2} {3} {4}", InstanceTag, attributeCode, Index1, customName, responseRate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd = string.Format("{0} subscribe {1} {2} {3}", InstanceTag, attributeCode, Index1, customName);
|
cmd = string.Format("{0} subscribe {1} {2} {3}", InstanceTag, attributeCode, Index1, customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Parent.SendLine(cmd);
|
Parent.SendLine(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -57,6 +57,11 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
//PortalSync = new PepperDashPortalSyncClient();
|
//PortalSync = new PepperDashPortalSyncClient();
|
||||||
|
|
||||||
|
//Temp Cotija testing
|
||||||
|
//CotijaInterfaceController CotijaInterface = new CotijaInterfaceController("WebClient1");
|
||||||
|
|
||||||
|
//CotijaInterface.InitializeClient("http://192.168.1.105");
|
||||||
|
|
||||||
Debug.Console(0, "Starting Essentials load from configuration");
|
Debug.Console(0, "Starting Essentials load from configuration");
|
||||||
ConfigReader.LoadConfig2();
|
ConfigReader.LoadConfig2();
|
||||||
LoadDevices();
|
LoadDevices();
|
||||||
@@ -154,9 +159,18 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
var room = roomConfig.GetRoomObject();
|
var room = roomConfig.GetRoomObject();
|
||||||
if (room != null)
|
if (room != null)
|
||||||
{
|
{
|
||||||
DeviceManager.AddDevice(room);
|
if (room is EssentialsHuddleSpaceRoom)
|
||||||
//DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemController(room, 0xf1));
|
{
|
||||||
|
Debug.Console(1, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
|
||||||
|
DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemController((EssentialsHuddleSpaceRoom)room, 0xf1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Room is NOT EssentialsHuddleSpaceRoom, attempting to add to DeviceManager w/o Fusion");
|
||||||
|
DeviceManager.AddDevice(room);
|
||||||
|
}
|
||||||
|
|
||||||
#warning Add Fusion connector to room factory?
|
#warning Add Fusion connector to room factory?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ namespace PepperDash.Essentials.Fusion
|
|||||||
|
|
||||||
StatusMonitorCollection ErrorMessageRollUp;
|
StatusMonitorCollection ErrorMessageRollUp;
|
||||||
|
|
||||||
StringSigData SourceNameSig;
|
StringSigData SourceNameSig;
|
||||||
|
|
||||||
public EssentialsHuddleSpaceFusionSystemController(EssentialsHuddleSpaceRoom room, uint ipId)
|
public EssentialsHuddleSpaceFusionSystemController(EssentialsHuddleSpaceRoom room, uint ipId)
|
||||||
: base(room.Key + "-fusion")
|
: base(room.Key + "-fusion")
|
||||||
{
|
{
|
||||||
Room = room;
|
Room = room;
|
||||||
|
|||||||
@@ -163,6 +163,7 @@
|
|||||||
<Compile Include="UI Drivers\SingleSubpageModalAndBackDriver.cs" />
|
<Compile Include="UI Drivers\SingleSubpageModalAndBackDriver.cs" />
|
||||||
<Compile Include="UI Drivers\SmartObjectRoomsList.cs" />
|
<Compile Include="UI Drivers\SmartObjectRoomsList.cs" />
|
||||||
<Compile Include="UI Drivers\UIBoolJoin.cs" />
|
<Compile Include="UI Drivers\UIBoolJoin.cs" />
|
||||||
|
<Compile Include="UI\CotijaInterfaceController.cs" />
|
||||||
<Compile Include="UI\DualDisplaySourceSRLController.cs" />
|
<Compile Include="UI\DualDisplaySourceSRLController.cs" />
|
||||||
<Compile Include="UI\SubpageReferenceListActivityItem.cs" />
|
<Compile Include="UI\SubpageReferenceListActivityItem.cs" />
|
||||||
<Compile Include="UI\CrestronTouchpanelPropertiesConfig.cs" />
|
<Compile Include="UI\CrestronTouchpanelPropertiesConfig.cs" />
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharp.Net.Http;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.PageManagers;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials
|
||||||
|
{
|
||||||
|
public class CotijaInterfaceController : Device
|
||||||
|
{
|
||||||
|
public CotijaInterfaceController(string key) : base(key)
|
||||||
|
{
|
||||||
|
CrestronConsole.AddNewConsoleCommand(InitializeClient, "InitializeHttpClient", "Initializes a new HTTP client connection to a specified URL", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeClient(string url)
|
||||||
|
{
|
||||||
|
HttpClient webClient = new HttpClient();
|
||||||
|
webClient.Verbose = true;
|
||||||
|
HttpClientRequest request = new HttpClientRequest();
|
||||||
|
request.Url.Parse(url);
|
||||||
|
request.Header.AddHeader(new HttpHeader("accept", "text/event-stream"));
|
||||||
|
request.Header.SetHeaderValue("Expect", "");
|
||||||
|
webClient.DispatchAsync(request, (resp, err) =>
|
||||||
|
{
|
||||||
|
CrestronConsole.PrintLine(resp.ContentString);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user