mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-30 12:54:54 +00:00
Merge with o/f/cisco-spark
This commit is contained in:
@@ -27,6 +27,52 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines minimum volume controls for a codec device with dialing capabilities
|
||||
/// </summary>
|
||||
public interface ICodecAudio : IBasicVolumeWithFeedback, ICodecPrivacy
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds control of codec receive volume
|
||||
/// </summary>
|
||||
public interface ICodecReceiveVolume
|
||||
{
|
||||
// Break this out into 3 interfaces
|
||||
void SetReceiveVolume(ushort level);
|
||||
void ReceiveMuteOn();
|
||||
void ReceiveMuteOff();
|
||||
void ReceiveMuteToggle();
|
||||
IntFeedback ReceiveLevelFeedback { get; }
|
||||
BoolFeedback ReceiveMuteIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds control of codec transmit volume
|
||||
/// </summary>
|
||||
public interface ICodecTransmitVolume
|
||||
{
|
||||
void SetTransmitVolume(ushort level);
|
||||
void TransmitMuteOn();
|
||||
void TransmitMuteOff();
|
||||
void TransmitMuteToggle();
|
||||
IntFeedback TransmitLevelFeedback { get; }
|
||||
BoolFeedback TransmitMuteIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds control of codec privacy function (microphone mute)
|
||||
/// </summary>
|
||||
public interface ICodecPrivacy
|
||||
{
|
||||
void PrivacyModeOn();
|
||||
void PrivacyModeOff();
|
||||
void PrivacyModeToggle();
|
||||
BoolFeedback PrivacyModeIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
public interface IHasCallHistory
|
||||
{
|
||||
// Add recent calls list
|
||||
|
||||
@@ -68,37 +68,6 @@ namespace PepperDash.Essentials.Core
|
||||
IntFeedback DefaultVolumeFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines minimum volume controls for a codec device with dialing capabilities
|
||||
/// </summary>
|
||||
public interface ICodecAudio
|
||||
{
|
||||
// ICodecReceiveVolume
|
||||
// Break this out into 3 interfaces
|
||||
void SetReceiveVolume(ushort level);
|
||||
void ReceiveMuteOn();
|
||||
void ReceiveMuteOff();
|
||||
void ReceiveMuteToggle();
|
||||
IntFeedback ReceiveLevelFeedback { get; }
|
||||
BoolFeedback ReceiveMuteIsOnFeedback { get; }
|
||||
|
||||
// ICodecTransmitVolume
|
||||
void SetTransmitVolume(ushort level);
|
||||
void TransmitMuteOn();
|
||||
void TransmitMuteOff();
|
||||
void TransmitMuteToggle();
|
||||
IntFeedback TransmitLevelFeedback { get; }
|
||||
BoolFeedback TransmitMuteIsOnFeedback { get; }
|
||||
|
||||
// ICodecPrivacy
|
||||
void PrivacyModeOn();
|
||||
void PrivacyModeOff();
|
||||
void PrivacyModeToggle();
|
||||
BoolFeedback PrivacyModeIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A class that implements this, contains a reference to an IBasicVolumeControls device.
|
||||
/// For example, speakers attached to an audio zone. The speakers can provide reference
|
||||
|
||||
Binary file not shown.
@@ -26,6 +26,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||
|
||||
public BoolFeedback StandbyIsOnFeedback { get; private set; }
|
||||
|
||||
private CiscoOneButtonToPush CodecObtp;
|
||||
|
||||
private Corporate_Phone_Book PhoneBook;
|
||||
@@ -92,15 +94,20 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
int PresentationSource;
|
||||
|
||||
public bool CommDebuggingIsOn;
|
||||
|
||||
// Constructor for IBasicCommunication
|
||||
public CiscoCodec(string key, string name, IBasicCommunication comm, int serverPort)
|
||||
: base(key, name)
|
||||
{
|
||||
StandbyIsOnFeedback = new BoolFeedback(StandbyStateFeedbackFunc);
|
||||
|
||||
Communication = comm;
|
||||
|
||||
SyncState = new CodecSyncState(key + "--sync");
|
||||
|
||||
PortGather = new CommunicationGather(Communication, Delimiter);
|
||||
PortGather.IncludeDelimiter = true;
|
||||
PortGather.LineReceived += this.Port_LineReceived;
|
||||
|
||||
//ServerPort = serverPort;
|
||||
@@ -116,6 +123,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
CodecEvent = new CiscoCodecEvents.RootObject();
|
||||
|
||||
CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate;
|
||||
CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate;
|
||||
CodecStatus.Status.Audio.Microphones.Mute.ValueChangedAction = PrivacyModeIsOnFeedback.FireUpdate;
|
||||
CodecStatus.Status.Standby.State.ValueChangedAction = StandbyIsOnFeedback.FireUpdate;
|
||||
|
||||
//Client = new HttpsClient();
|
||||
|
||||
@@ -129,6 +139,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
public override bool CustomActivate()
|
||||
{
|
||||
CrestronConsole.AddNewConsoleCommand(SendText, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
|
||||
CrestronConsole.AddNewConsoleCommand(SetCommDebug, "SetCiscoCommDebug", "0 for Off, 1 for on", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
|
||||
|
||||
Communication.Connect();
|
||||
var socket = Communication as ISocketStatus;
|
||||
@@ -137,8 +150,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
socket.ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
|
||||
}
|
||||
|
||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, new Action(SelectPresentationSource(1)), this));
|
||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, new Action(SelectPresentationSource(2)), this));
|
||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, new Action(SelectPresentationSource1), this));
|
||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, new Action(SelectPresentationSource2), this));
|
||||
|
||||
//Debug.Console(1, this, "Starting Cisco API Server");
|
||||
|
||||
@@ -193,6 +206,20 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
public void SetCommDebug(string s)
|
||||
{
|
||||
if (s == "1")
|
||||
{
|
||||
CommDebuggingIsOn = true;
|
||||
Debug.Console(0, this, "Comm Debug Enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
CommDebuggingIsOn = false;
|
||||
Debug.Console(0, this, "Comm Debug Disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
|
||||
{
|
||||
// Reset sync status on disconnect
|
||||
@@ -208,7 +235,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
/// <param name="args"></param>
|
||||
void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args)
|
||||
{
|
||||
if (Debug.Level == 1)
|
||||
if (CommDebuggingIsOn)
|
||||
{
|
||||
if(!JsonFeedbackMessageIsIncoming)
|
||||
Debug.Console(1, this, "RX: '{0}'", args.Text);
|
||||
@@ -218,7 +245,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
JsonFeedbackMessageIsIncoming = true;
|
||||
|
||||
Debug.Console(1, this, "Incoming JSON message...");
|
||||
if (CommDebuggingIsOn)
|
||||
Debug.Console(1, this, "Incoming JSON message...");
|
||||
|
||||
JsonMessage = new StringBuilder();
|
||||
}
|
||||
@@ -228,7 +256,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
JsonMessage.Append(args.Text);
|
||||
|
||||
Debug.Console(1, this, "Complete JSON Received:\n{0}", JsonMessage.ToString());
|
||||
if (CommDebuggingIsOn)
|
||||
Debug.Console(1, this, "Complete JSON Received:\n{0}", JsonMessage.ToString());
|
||||
|
||||
// Forward the complete message to be deserialized
|
||||
DeserializeResponse(JsonMessage.ToString());
|
||||
@@ -269,7 +298,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
public void SendText(string command)
|
||||
{
|
||||
Debug.Console(1, this, "Sending: '{0}'", command);
|
||||
if (CommDebuggingIsOn)
|
||||
Debug.Console(1, this, "Sending: '{0}'", command);
|
||||
|
||||
Communication.SendText(command + Delimiter);
|
||||
}
|
||||
|
||||
@@ -490,12 +521,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
protected override Func<bool> IncomingCallFeedbackFunc { get { return () => false; } }
|
||||
|
||||
protected override Func<bool> TransmitMuteFeedbackFunc { get { return () => false; } }
|
||||
|
||||
protected override Func<bool> ReceiveMuteFeedbackFunc { get { return () => false; } }
|
||||
|
||||
protected override Func<bool> PrivacyModeFeedbackFunc { get { return () => false; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the first CallId or returns null
|
||||
/// </summary>
|
||||
@@ -548,8 +573,31 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
StartSharing();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select source 1 as the presetnation source
|
||||
/// </summary>
|
||||
public void SelectPresentationSource1()
|
||||
{
|
||||
SelectPresentationSource(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select source 2 as the presetnation source
|
||||
/// </summary>
|
||||
public void SelectPresentationSource2()
|
||||
{
|
||||
SelectPresentationSource(2);
|
||||
}
|
||||
|
||||
public override void StartSharing()
|
||||
{
|
||||
string sendingMode = string.Empty;
|
||||
|
||||
if (InCallFeedback.BoolValue)
|
||||
sendingMode = "LocalRemote";
|
||||
else
|
||||
sendingMode = "LocalOnly";
|
||||
|
||||
SendText(string.Format("xCommand Presentation Start PresentationSource: {0}", PresentationSource));
|
||||
}
|
||||
|
||||
@@ -558,46 +606,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
SendText(string.Format("xCommand Presentation Stop PresentationSource: {0}", PresentationSource));
|
||||
}
|
||||
|
||||
public override void ReceiveMuteOff()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ReceiveMuteOn()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ReceiveMuteToggle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SetReceiveVolume(ushort level)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void TransmitMuteOff()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void TransmitMuteOn()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void TransmitMuteToggle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SetTransmitVolume(ushort level)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void PrivacyModeOn()
|
||||
{
|
||||
SendText("xCommand Audio Microphones Mute");
|
||||
@@ -687,22 +695,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
SendText("xCommand SystemUnit Boot Action: Restart");
|
||||
}
|
||||
|
||||
public override void MuteOff()
|
||||
{
|
||||
}
|
||||
|
||||
public override void MuteOn()
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetVolume(ushort level)
|
||||
{
|
||||
}
|
||||
|
||||
public override void MuteToggle()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1524,26 +1524,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class DisplayName
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Duration
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Type
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Encryption
|
||||
{
|
||||
public string id { get; set; }
|
||||
public Type Type { get; set; }
|
||||
}
|
||||
|
||||
public class FacilityServiceId
|
||||
{
|
||||
@@ -1575,11 +1560,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Status2
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class TransmitCallRate
|
||||
{
|
||||
public string Value { get; set; }
|
||||
|
||||
@@ -255,14 +255,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
|
||||
public override void TransmitMuteToggle()
|
||||
{
|
||||
_TransmitMute = !_TransmitMute;
|
||||
Debug.Console(1, this, "TransmitMuteToggle: {0}", _TransmitMute);
|
||||
TransmitMuteIsOnFeedback.FireUpdate();
|
||||
|
||||
}
|
||||
|
||||
public override void SetTransmitVolume(ushort level)
|
||||
public override void VolumeUp(bool pressRelease)
|
||||
{
|
||||
Debug.Console(1, this, "SetTransmitVolume: {0}", level);
|
||||
|
||||
}
|
||||
|
||||
public override void PrivacyModeOn()
|
||||
|
||||
@@ -9,7 +9,7 @@ using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
public abstract class VideoCodecBase : Device, IRoutingSinkWithSwitching, IUsageTracking, IHasDialer, IHasSharing, IBasicVolumeWithFeedback //, ICodecAudio
|
||||
public abstract class VideoCodecBase : Device, IRoutingSinkWithSwitching, IUsageTracking, IHasDialer, IHasSharing, ICodecAudio
|
||||
{
|
||||
#region IUsageTracking Members
|
||||
|
||||
@@ -84,8 +84,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
InCallFeedback,
|
||||
IncomingCallFeedback,
|
||||
ReceiveMuteIsOnFeedback,
|
||||
TransmitMuteIsOnFeedback,
|
||||
PrivacyModeIsOnFeedback
|
||||
};
|
||||
}
|
||||
@@ -95,25 +93,29 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
|
||||
#region ICodecAudio Members
|
||||
|
||||
public IntFeedback ReceiveLevelFeedback { get; private set; }
|
||||
public BoolFeedback ReceiveMuteIsOnFeedback { get; private set; }
|
||||
public abstract void ReceiveMuteOff();
|
||||
public abstract void ReceiveMuteOn();
|
||||
public abstract void ReceiveMuteToggle();
|
||||
public abstract void SetReceiveVolume(ushort level);
|
||||
|
||||
public IntFeedback TransmitLevelFeedback { get; private set; }
|
||||
public BoolFeedback TransmitMuteIsOnFeedback { get; private set; }
|
||||
public abstract void TransmitMuteOff();
|
||||
public abstract void TransmitMuteOn();
|
||||
public abstract void TransmitMuteToggle();
|
||||
public abstract void SetTransmitVolume(ushort level);
|
||||
|
||||
public abstract void PrivacyModeOn();
|
||||
public abstract void PrivacyModeOff();
|
||||
public abstract void PrivacyModeToggle();
|
||||
public BoolFeedback PrivacyModeIsOnFeedback { get; private set; }
|
||||
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
public abstract void MuteOff();
|
||||
|
||||
public abstract void MuteOn();
|
||||
|
||||
public abstract void SetVolume(ushort level);
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public abstract void MuteToggle();
|
||||
|
||||
public abstract void VolumeDown(bool pressRelease);
|
||||
|
||||
|
||||
public abstract void VolumeUp(bool pressRelease);
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasSharing Members
|
||||
@@ -125,30 +127,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeWithFeedback Members
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
public abstract void MuteOff();
|
||||
|
||||
public abstract void MuteOn();
|
||||
|
||||
public abstract void SetVolume(ushort level);
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
public abstract void MuteToggle();
|
||||
|
||||
public abstract void VolumeDown(bool pressRelease);
|
||||
|
||||
|
||||
public abstract void VolumeUp(bool pressRelease);
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -128,12 +128,14 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
|
||||
// CODEC TESTING
|
||||
//GenericSshClient TestCodecClient = new GenericSshClient("TestCodec-1--SshClient", "10.11.50.135", 22, "crestron", "2H3Zu&OvgXp6");
|
||||
GenericSshClient TestCodecClient = new GenericSshClient("TestCodec-1--SshClient", "10.11.50.135", 22, "crestron", "2H3Zu&OvgXp6");
|
||||
|
||||
//PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodec TestCodec =
|
||||
// new PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodec("TestCodec-1", "Cisco Spark Room Kit", TestCodecClient, 8080);
|
||||
PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodec TestCodec =
|
||||
new PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodec("TestCodec-1", "Cisco Spark Room Kit", TestCodecClient, 8080);
|
||||
|
||||
//TestCodec.CustomActivate();
|
||||
TestCodec.CommDebuggingIsOn = true;
|
||||
|
||||
TestCodec.CustomActivate();
|
||||
|
||||
// CODEC TESTING
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user