Skip to content

Commit

Permalink
Merge branch 'feature/make-privacy-position-configurable' of https://…
Browse files Browse the repository at this point in the history
  • Loading branch information
ngenovese11 committed Jan 13, 2022
2 parents 326f009 + 8abacc6 commit b457f2b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 210 deletions.
2 changes: 2 additions & 0 deletions PanasonicCameraEpi/HttpCommandQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,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
}
catch (Exception ex)
{
Expand Down Expand Up @@ -82,6 +83,7 @@ private void OnResponseReceived(HttpClientResponse response, HTTP_CALLBACK_ERROR

if (ResponseReceived == null)
return;

ResponseReceived.Invoke(this, new GenericHttpClientEventArgs(response.ContentString, response.ResponseUrl, HTTP_CALLBACK_ERROR.COMPLETED));

}
Expand Down
15 changes: 8 additions & 7 deletions PanasonicCameraEpi/PanasonicCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ public PanasonicCamera(IBasicCommunication comms, DeviceConfig config)
PollString = "cgi-bin/aw_ptz?cmd=%23O&res=1"
};

var tempClient = comms as GenericHttpClient;

var tempClient = comms as GenericHttpClient;
if(tempClient == null)
{
_monitor = new GenericCommunicationMonitor(this, tempClient, cameraConfig.CommunicationMonitor);
tempClient.TextReceived += _responseHandler.HandleResponseReceeved;
_monitor = new GenericCommunicationMonitor(this, comms, cameraConfig.CommunicationMonitor);
comms.TextReceived += _responseHandler.HandleResponseReceeved;
throw new NotImplementedException("Need to create a command queue for serial");
}
else
Expand All @@ -84,8 +83,7 @@ public PanasonicCamera(IBasicCommunication comms, DeviceConfig config)
_queue = queue;
}

_cmd = new PanasonicCmdBuilder(12, 25, 12);

_cmd = new PanasonicCmdBuilder(12, 25, 12, cameraConfig.HomeCommand, cameraConfig.PrivacyCommand);
_presets = cameraConfig.Presets.ToDictionary(x => (uint)x.Id);

AddPostActivationAction(() =>
Expand Down Expand Up @@ -296,6 +294,9 @@ public void SendCustomCommand(string cmd)

public void RecallPreset(int preset)
{
if (!IsPoweredOn)
_queue.EnqueueCmd(_cmd.PowerOnCommand);

_queue.EnqueueCmd(_cmd.PresetRecallCommand(preset));
}

Expand All @@ -318,7 +319,7 @@ public void SetIpAddress(string address)

Config.Properties["control"]["tcpSshProperties"]["address"] = address;
Debug.Console(2, this, "{0}", Config.Properties.ToString());
CustomSetConfig(Config);
SetConfig(Config);
var tempClient = DeviceManager.GetDeviceForKey(string.Format("{0}-httpClient", this.Key)) as GenericHttpClient;
tempClient.Client.HostName = address;
}
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 PanSpeed { get; set; }
public int ZoomSpeed { get; set; }
public int TiltSpeed { get; set; }
public string HomeCommand { get; set; }
public string PrivacyCommand { get; set; }
}

public class PanasonicControlPropertiesConfig
Expand Down
15 changes: 15 additions & 0 deletions PanasonicCameraEpi/PanasonicCmdBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ public PanasonicCmdBuilder(int panSpeed, int zoomSpeed, int tiltSpeed)
TiltSpeed = tiltSpeed == 0 ? 25 : tiltSpeed;
}

public PanasonicCmdBuilder(int panSpeed, int zoomSpeed, int tiltSpeed, string homeCommand, string privacyCommand)
{
PanStopCommand = BuildCmd("P50");
TiltStopCommand = BuildCmd("T50");
ZoomStopCommand = BuildCmd("Z50");
PowerOnCommand = BuildCmd("O1");
PowerOffCommand = BuildCmd("O0");
HomeCommand = string.IsNullOrEmpty(homeCommand) ? BuildCmd("APC80008000") : BuildCmd(homeCommand);
PrivacyCommand = string.IsNullOrEmpty(privacyCommand) ? BuildCmd("APC00000000") : BuildCmd(privacyCommand);

PanSpeed = panSpeed == 0 ? 25 : panSpeed;
ZoomSpeed = zoomSpeed == 0 ? 25 : zoomSpeed;
TiltSpeed = tiltSpeed == 0 ? 25 : tiltSpeed;
}

private int _panSpeed;
public int PanSpeed
{
Expand Down
203 changes: 0 additions & 203 deletions essentialsplugins-releasebuilds-v2.yml

This file was deleted.

0 comments on commit b457f2b

Please sign in to comment.