diff --git a/PanasonicCameraEpi/HttpCommandQueue.cs b/PanasonicCameraEpi/HttpCommandQueue.cs index 529e97d..093dbbc 100644 --- a/PanasonicCameraEpi/HttpCommandQueue.cs +++ b/PanasonicCameraEpi/HttpCommandQueue.cs @@ -9,12 +9,18 @@ namespace PanasonicCameraEpi public class HttpCommandQueue : CommandQueue { public event EventHandler ResponseReceived; + int _Pacing = 130; public HttpCommandQueue(IBasicCommunication coms) : base(coms) { } + public HttpCommandQueue(IBasicCommunication coms, int pacing) + : base(coms) + { + _Pacing = pacing; + } protected override object ProcessQueue(object obj) { @@ -48,7 +54,7 @@ protected override object ProcessQueue(object obj) Debug.Console(1, client, "Dispatching request: {0}", request.Url.PathAndParams); client.Client.DispatchAsync(request, OnResponseReceived); - Thread.Sleep(130); //command gap of 130 recommended by documentation + Thread.Sleep(_Pacing); //command gap of 130 recommended by documentation } catch (Exception ex) { diff --git a/PanasonicCameraEpi/PanasonicCamera.cs b/PanasonicCameraEpi/PanasonicCamera.cs index 4bd4fcd..fa8c183 100644 --- a/PanasonicCameraEpi/PanasonicCamera.cs +++ b/PanasonicCameraEpi/PanasonicCamera.cs @@ -74,7 +74,15 @@ public PanasonicCamera(IBasicCommunication comms, DeviceConfig config) throw new NotImplementedException("Need to create a command queue for serial"); } _monitor = new PanasonicHttpCameraMonitor(this, tempClient, cameraConfig.CommunicationMonitor); - var queue = new HttpCommandQueue(comms); + HttpCommandQueue queue; + if (cameraConfig.pacing > 0) + { + queue = new HttpCommandQueue(comms, cameraConfig.pacing); + } + else + { + queue = new HttpCommandQueue(comms); + } queue.ResponseReceived += _responseHandler.HandleResponseReceived; _queue = queue; diff --git a/PanasonicCameraEpi/PanasonicCameraPropsConfig.cs b/PanasonicCameraEpi/PanasonicCameraPropsConfig.cs index c65aaf4..a9bd61a 100644 --- a/PanasonicCameraEpi/PanasonicCameraPropsConfig.cs +++ b/PanasonicCameraEpi/PanasonicCameraPropsConfig.cs @@ -31,6 +31,8 @@ public PanasonicCameraPropsConfig() public int TiltSpeed { get; set; } public string HomeCommand { get; set; } public string PrivacyCommand { get; set; } + public int pacing { get; set; } + } public class PanasonicControlPropertiesConfig