mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
Updates to CiscoSparkCodec queue
This commit is contained in:
@@ -359,7 +359,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, "xStatus SystemUnit Software Version\r");
|
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, "xStatus SystemUnit Software Version\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.Sharing != null)
|
if (props.Sharing != null)
|
||||||
@@ -662,6 +662,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
{
|
{
|
||||||
var cameraInfo = new List<CameraInfo>();
|
var cameraInfo = new List<CameraInfo>();
|
||||||
|
|
||||||
|
Debug.Console(0, this, "Codec reports {0} cameras", CodecStatus.Status.Cameras.Camera.Count);
|
||||||
|
|
||||||
foreach (var camera in CodecStatus.Status.Cameras.Camera)
|
foreach (var camera in CodecStatus.Status.Cameras.Camera)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this,
|
Debug.Console(0, this,
|
||||||
@@ -766,12 +768,12 @@ ConnectorID: {2}"
|
|||||||
if (CommDebuggingIsOn)
|
if (CommDebuggingIsOn)
|
||||||
{
|
{
|
||||||
if (!_jsonFeedbackMessageIsIncoming)
|
if (!_jsonFeedbackMessageIsIncoming)
|
||||||
Debug.Console(1, this, "RX: '{0}'", args.Text);
|
Debug.Console(1, this, "RX: '{0}'", ComTextHelper.GetDebugText(args.Text));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.Text.Contains("xCommand"))
|
if(args.Text.ToLower().Contains("xcommand"))
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "Received command echo response. Ignoring");
|
Debug.Console(1, this, "Received command echo response. Ignoring");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -819,12 +821,17 @@ ConnectorID: {2}"
|
|||||||
if(_loginMessageReceivedTimer != null)
|
if(_loginMessageReceivedTimer != null)
|
||||||
_loginMessageReceivedTimer.Stop();
|
_loginMessageReceivedTimer.Stop();
|
||||||
|
|
||||||
SendText("echo off");
|
//SendText("echo off");
|
||||||
SendText("xPreferences outputmode json");
|
SendText("xPreferences outputmode json");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "xpreferences outputmode json":
|
case "xpreferences outputmode json":
|
||||||
{
|
{
|
||||||
|
if (_syncState.JsonResponseModeSet)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_syncState.JsonResponseModeMessageReceived();
|
||||||
|
|
||||||
if (!_syncState.InitialStatusMessageWasReceived)
|
if (!_syncState.InitialStatusMessageWasReceived)
|
||||||
SendText("xStatus");
|
SendText("xStatus");
|
||||||
break;
|
break;
|
||||||
@@ -844,7 +851,7 @@ ConnectorID: {2}"
|
|||||||
/// <param name="command"></param>
|
/// <param name="command"></param>
|
||||||
public void EnqueueCommand(string command)
|
public void EnqueueCommand(string command)
|
||||||
{
|
{
|
||||||
_syncState.AddCommandToQueue(command + Delimiter);
|
_syncState.AddCommandToQueue(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -856,7 +863,7 @@ ConnectorID: {2}"
|
|||||||
public void SendText(string command)
|
public void SendText(string command)
|
||||||
{
|
{
|
||||||
if (CommDebuggingIsOn)
|
if (CommDebuggingIsOn)
|
||||||
Debug.Console(1, this, "Sending: '{0}'", command);
|
Debug.Console(1, this, "Sending: '{0}'", ComTextHelper.GetDebugText(command + Delimiter));
|
||||||
|
|
||||||
Communication.SendText(command + Delimiter);
|
Communication.SendText(command + Delimiter);
|
||||||
}
|
}
|
||||||
@@ -2002,9 +2009,6 @@ ConnectorID: {2}"
|
|||||||
|
|
||||||
var camCount = CodecStatus.Status.Cameras.Camera.Count;
|
var camCount = CodecStatus.Status.Cameras.Camera.Count;
|
||||||
|
|
||||||
Debug.Console(0, this, "Codec reports {0} cameras", camCount);
|
|
||||||
|
|
||||||
|
|
||||||
// Deal with the case of 1 or no reported cameras
|
// Deal with the case of 1 or no reported cameras
|
||||||
if (camCount <= 1)
|
if (camCount <= 1)
|
||||||
{
|
{
|
||||||
@@ -2505,6 +2509,8 @@ ConnectorID: {2}"
|
|||||||
|
|
||||||
public bool LoginMessageWasReceived { get; private set; }
|
public bool LoginMessageWasReceived { get; private set; }
|
||||||
|
|
||||||
|
public bool JsonResponseModeSet { get; private set; }
|
||||||
|
|
||||||
public bool InitialStatusMessageWasReceived { get; private set; }
|
public bool InitialStatusMessageWasReceived { get; private set; }
|
||||||
|
|
||||||
public bool InitialConfigurationMessageWasReceived { get; private set; }
|
public bool InitialConfigurationMessageWasReceived { get; private set; }
|
||||||
@@ -2515,35 +2521,22 @@ ConnectorID: {2}"
|
|||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
_commandQueue = new CrestronQueue<string>(25);
|
_commandQueue = new CrestronQueue<string>(50);
|
||||||
CodecDisconnected();
|
CodecDisconnected();
|
||||||
|
|
||||||
|
|
||||||
while (InitialSyncComplete && !_commandQueue.IsEmpty)
|
|
||||||
{
|
|
||||||
var query = _commandQueue.Dequeue();
|
|
||||||
|
|
||||||
_parent.SendText(query);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//public void StartSync()
|
private void ProcessQueuedCommands()
|
||||||
//{
|
{
|
||||||
// DequeueQueries();
|
while (InitialSyncComplete)
|
||||||
//}
|
{
|
||||||
|
if (!_commandQueue.IsEmpty)
|
||||||
|
{
|
||||||
|
var query = _commandQueue.Dequeue();
|
||||||
|
|
||||||
//private void DequeueQueries()
|
_parent.SendText(query);
|
||||||
//{
|
}
|
||||||
|
}
|
||||||
// while (!_commandQueue.IsEmpty)
|
}
|
||||||
// {
|
|
||||||
// var query = _commandQueue.Dequeue();
|
|
||||||
|
|
||||||
// _parent.SendText(query);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// InitialQueryMessagesSent();
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void AddCommandToQueue(string query)
|
public void AddCommandToQueue(string query)
|
||||||
{
|
{
|
||||||
@@ -2557,6 +2550,13 @@ ConnectorID: {2}"
|
|||||||
CheckSyncStatus();
|
CheckSyncStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void JsonResponseModeMessageReceived()
|
||||||
|
{
|
||||||
|
JsonResponseModeSet = true;
|
||||||
|
Debug.Console(1, this, "Json Response Mode Message Received.");
|
||||||
|
CheckSyncStatus();
|
||||||
|
}
|
||||||
|
|
||||||
public void InitialStatusMessageReceived()
|
public void InitialStatusMessageReceived()
|
||||||
{
|
{
|
||||||
InitialStatusMessageWasReceived = true;
|
InitialStatusMessageWasReceived = true;
|
||||||
@@ -2582,6 +2582,7 @@ ConnectorID: {2}"
|
|||||||
{
|
{
|
||||||
_commandQueue.Clear();
|
_commandQueue.Clear();
|
||||||
LoginMessageWasReceived = false;
|
LoginMessageWasReceived = false;
|
||||||
|
JsonResponseModeSet = false;
|
||||||
InitialConfigurationMessageWasReceived = false;
|
InitialConfigurationMessageWasReceived = false;
|
||||||
InitialStatusMessageWasReceived = false;
|
InitialStatusMessageWasReceived = false;
|
||||||
FeedbackWasRegistered = false;
|
FeedbackWasRegistered = false;
|
||||||
@@ -2590,10 +2591,12 @@ ConnectorID: {2}"
|
|||||||
|
|
||||||
void CheckSyncStatus()
|
void CheckSyncStatus()
|
||||||
{
|
{
|
||||||
if (LoginMessageWasReceived && InitialConfigurationMessageWasReceived && InitialStatusMessageWasReceived && FeedbackWasRegistered)
|
if (LoginMessageWasReceived && JsonResponseModeSet && InitialConfigurationMessageWasReceived && InitialStatusMessageWasReceived && FeedbackWasRegistered)
|
||||||
{
|
{
|
||||||
InitialSyncComplete = true;
|
InitialSyncComplete = true;
|
||||||
Debug.Console(1, this, "Initial Codec Sync Complete!");
|
Debug.Console(1, this, "Initial Codec Sync Complete!");
|
||||||
|
Debug.Console(1, this, "{0} Command queued. Processing now...", _commandQueue.Count);
|
||||||
|
ProcessQueuedCommands();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
InitialSyncComplete = false;
|
InitialSyncComplete = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user