diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index 2501bf22..b885674c 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -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 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(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 - /// - /// - 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; - } - - /// /// 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; }