mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
#584 Implements GenericQueue in place of queue and thread in CiscoSparkCodec
This commit is contained in:
@@ -18,6 +18,7 @@ using PepperDash.Essentials.Core.Routing;
|
|||||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||||
using PepperDash.Essentials.Devices.Common.Codec;
|
using PepperDash.Essentials.Devices.Common.Codec;
|
||||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
|
using PepperDash_Essentials_Core.Queues;
|
||||||
using PepperDash_Essentials_Core.DeviceTypeInterfaces;
|
using PepperDash_Essentials_Core.DeviceTypeInterfaces;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||||
@@ -38,9 +39,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
|
|
||||||
private CrestronQueue<string> ReceiveQueue;
|
private GenericQueue ReceiveQueue;
|
||||||
|
|
||||||
private Thread ReceiveThread;
|
|
||||||
|
|
||||||
public BoolFeedback PresentationViewMaximizedFeedback { get; private set; }
|
public BoolFeedback PresentationViewMaximizedFeedback { get; private set; }
|
||||||
|
|
||||||
@@ -302,12 +301,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The queue that will collect the repsonses in the order they are received
|
// The queue that will collect the repsonses in the order they are received
|
||||||
ReceiveQueue = new CrestronQueue<string>(25);
|
ReceiveQueue = new GenericQueue(this.Key + "-rxQueue", 25);
|
||||||
|
|
||||||
// The thread responsible for dequeuing and processing the messages
|
|
||||||
ReceiveThread = new Thread((o) => ProcessQueue(), null);
|
|
||||||
ReceiveThread.Priority = Thread.eThreadPriority.MediumPriority;
|
|
||||||
|
|
||||||
|
|
||||||
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
|
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
|
||||||
PeopleCountFeedback = new IntFeedback(PeopleCountFeedbackFunc);
|
PeopleCountFeedback = new IntFeedback(PeopleCountFeedbackFunc);
|
||||||
@@ -421,29 +415,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
_brandingUrl = props.UiBranding.BrandingUrl;
|
_brandingUrl = props.UiBranding.BrandingUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs in it's own thread to dequeue messages in the order they were received to be processed
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
object ProcessQueue()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
var message = ReceiveQueue.Dequeue();
|
|
||||||
|
|
||||||
DeserializeResponse(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, "Error Processing Queue: {0}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the fake OSD source, and connects it's AudioVideo output to the CodecOsdIn input
|
/// Creates the fake OSD source, and connects it's AudioVideo output to the CodecOsdIn input
|
||||||
/// to enable routing
|
/// to enable routing
|
||||||
@@ -687,11 +658,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
// Enqueue the complete message to be deserialized
|
// Enqueue the complete message to be deserialized
|
||||||
|
|
||||||
ReceiveQueue.Enqueue(JsonMessage.ToString());
|
ReceiveQueue.Enqueue(new ProcessStringMessage(JsonMessage.ToString(), DeserializeResponse));
|
||||||
//DeserializeResponse(JsonMessage.ToString());
|
|
||||||
|
|
||||||
if (ReceiveThread.ThreadState != Thread.eThreadStates.ThreadRunning)
|
|
||||||
ReceiveThread.Start();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user