Skip to content

Commit

Permalink
faeture: add the ability to set the pacing time via config
Browse files Browse the repository at this point in the history
  • Loading branch information
jtalborough committed Jun 1, 2023
1 parent a6ecc81 commit 70d38d7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion PanasonicCameraEpi/HttpCommandQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ namespace PanasonicCameraEpi
public class HttpCommandQueue : CommandQueue
{
public event EventHandler<GenericHttpClientEventArgs> 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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
10 changes: 9 additions & 1 deletion PanasonicCameraEpi/PanasonicCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions PanasonicCameraEpi/PanasonicCameraPropsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 70d38d7

Please sign in to comment.