mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-31 05:14:51 +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.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
using PepperDash_Essentials_Core.Queues;
|
||||
using PepperDash_Essentials_Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
@@ -38,9 +39,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||
|
||||
private CrestronQueue<string> ReceiveQueue;
|
||||
|
||||
private Thread ReceiveThread;
|
||||
private GenericQueue ReceiveQueue;
|
||||
|
||||
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
|
||||
ReceiveQueue = new CrestronQueue<string>(25);
|
||||
|
||||
// The thread responsible for dequeuing and processing the messages
|
||||
ReceiveThread = new Thread((o) => ProcessQueue(), null);
|
||||
ReceiveThread.Priority = Thread.eThreadPriority.MediumPriority;
|
||||
|
||||
ReceiveQueue = new GenericQueue(this.Key + "-rxQueue", 25);
|
||||
|
||||
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
|
||||
PeopleCountFeedback = new IntFeedback(PeopleCountFeedbackFunc);
|
||||
@@ -421,29 +415,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
_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>
|
||||
/// Creates the fake OSD source, and connects it's AudioVideo output to the CodecOsdIn input
|
||||
/// to enable routing
|
||||
@@ -687,11 +658,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
// Enqueue the complete message to be deserialized
|
||||
|
||||
ReceiveQueue.Enqueue(JsonMessage.ToString());
|
||||
//DeserializeResponse(JsonMessage.ToString());
|
||||
|
||||
if (ReceiveThread.ThreadState != Thread.eThreadStates.ThreadRunning)
|
||||
ReceiveThread.Start();
|
||||
ReceiveQueue.Enqueue(new ProcessStringMessage(JsonMessage.ToString(), DeserializeResponse));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user