Skip to content

Commit

Permalink
chore: fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Payne committed Jul 25, 2023
2 parents 62cb38f + 13fa4dc commit 0d0c1ac
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 22 deletions.
5 changes: 5 additions & 0 deletions QscQsysDspPlugin/QscDsp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public void CreateDspObjects()
prefix = props.Prefix;
}

/*
AutoTrackingKey = string.Format("{0}-{1}", Key, "Auto-Tracking");
LevelControlPoints.Add(AutoTrackingKey, new QscDspLevelControl("Auto-Tracking", new QscDspLevelControlBlockConfig
Expand All @@ -231,6 +232,7 @@ public void CreateDspObjects()
Label = AutoTrackingKey,
MuteInstanceTag = "CAM_TRACK" //todo make configurable
}, this));
*/

if (props.LevelControlBlocks != null)
{
Expand Down Expand Up @@ -265,10 +267,13 @@ public void CreateDspObjects()

value.PanLeftTag = FormatTag(prefix, value.PanLeftTag);
value.PanRightTag = FormatTag(prefix, value.PanRightTag);
value.PanSpeedTag = FormatTag(prefix, value.PanSpeedTag);
value.TiltUpTag = FormatTag(prefix, value.TiltUpTag);
value.TiltDownTag = FormatTag(prefix, value.TiltDownTag);
value.TiltSpeedTag = FormatTag(prefix, value.TiltSpeedTag);
value.ZoomInTag = FormatTag(prefix, value.ZoomInTag);
value.ZoomOutTag = FormatTag(prefix, value.ZoomOutTag);
value.ZoomSpeedTag = FormatTag(prefix, value.ZoomSpeedTag);
value.PresetBankTag = FormatTag(prefix, value.PresetBankTag);
value.Privacy = FormatTag(prefix, value.Privacy);
value.OnlineStatus = FormatTag(prefix, value.OnlineStatus);
Expand Down
4 changes: 2 additions & 2 deletions QscQsysDspPlugin/QscDspBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public static void LinkToApiExt(this QscDsp DspDevice, BasicTriList trilist, uin
var presetNum = joinMap.Presets.JoinNumber + temp;
// from SiMPL > to Plugin
trilist.StringInput[presetNum].StringValue = preset.Label;
//trilist.SetSigTrueAction(presetNum, () => DspDevice.RunPresetNumber(temp));
trilist.SetSigHeldAction(presetNum, 5000, () => DspDevice.SavePresetNumber(temp), () => DspDevice.RunPresetNumber(temp));
trilist.SetSigTrueAction(presetNum, () => DspDevice.RunPresetNumber(temp));
// trilist.SetSigHeldAction(presetNum, 5000, () => DspDevice.SavePresetNumber(temp), () => DspDevice.RunPresetNumber(temp));
x++;
}

Expand Down
53 changes: 43 additions & 10 deletions QscQsysDspPlugin/QscDspCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace QscQsysDspPlugin
/// </summary>
public class QscDspCamera : Device, ICommunicationMonitor, IBridgeAdvanced, IOnline, IHasCameraPtzControl, IHasCameraPresets
{
readonly QscDsp _dsp;
readonly QscDsp _dsp;
public QscDspCameraConfig Config { get; private set; }
string _lastCmd;
private bool _online;
Expand Down Expand Up @@ -146,6 +146,28 @@ public void WritePresetName(string newLabel, ushort presetNumber)
OnPresetsListHasChanged();
}

public void SetPanSpeed(ushort speed)
{
var newSpeed = Scale(speed);
var cmdToSend = string.Format("csv \"{0}\" {1}", Config.PanSpeedTag, newSpeed);
_dsp.SendLine(cmdToSend);
}

public void SetTiltSpeed(ushort speed)
{
var newSpeed = Scale(speed);
var cmdToSend = string.Format("csv \"{0}\" {1}", Config.TiltSpeedTag, newSpeed);
_dsp.SendLine(cmdToSend);
}

public void SetZoomSpeed(ushort speed)
{
var newSpeed = Scale(speed);
var cmdToSend = string.Format("csv \"{0}\" {1}", Config.ZoomSpeedTag, newSpeed);
_dsp.SendLine(cmdToSend);
}


/// <summary>
/// Adds the command to the change group
/// </summary>
Expand Down Expand Up @@ -175,17 +197,28 @@ public void ParseSubscriptionMessage(string customName, string value, string abs
// Check for valid subscription response
Debug.Console(1, this, "CameraOnline {0} Response: '{1}'", customName, value);

switch (value)
{
case "true":
Online = true;
break;
case "false":
Online = false;
break;
}
if (value == "true" || value == "OK")
{
Online = true;

}
else if (value == "false")
{
Online = false;
}
}

double Scale(double input)
{
Debug.Console(1, this, "Scaling (double) input '{0}'", input);

var output = (input / 65535);

Debug.Console(1, this, "Scaled output '{0}'", output);

return output;
}


public BoolFeedback IsOnline { get; private set; }

Expand Down
66 changes: 63 additions & 3 deletions QscQsysDspPlugin/QscDspCameraBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,17 @@ public static void LinkToApiExt(this QscDspCamera camera, BasicTriList trilist,
// from SiMPL > to Plugin
trilist.SetSigTrueAction(joinMap.PresetRecallStart.JoinNumber + temp + 1, () => camera.RecallPreset(temp));
trilist.SetSigTrueAction(joinMap.PresetStoreStart.JoinNumber + temp + 1, () => camera.SavePreset(temp));
trilist.SetStringSigAction(joinMap.PresetNamesStart.JoinNumber + temp, (s) => camera.WritePresetName(s, (ushort)(temp + 1)));
trilist.SetStringSigAction(joinMap.PresetNamesStart.JoinNumber + temp + 1, (s) => camera.WritePresetName(s, (ushort)(temp + 1)));
// from Plugin > to SiMPL
preset.Value.LabelFeedback.LinkInputSig(trilist.StringInput[joinMap.PresetNamesStart.JoinNumber + temp + 1]);
trilist.SetString(joinMap.PresetNamesStart.JoinNumber + temp + 1, preset.Value.Label);
x++;
}

// from SiMPL > to Plugin
trilist.SetUShortSigAction(joinMap.PanSpeed.JoinNumber, (a) => camera.SetPanSpeed(a));
trilist.SetUShortSigAction(joinMap.TiltSpeed.JoinNumber, (a) => camera.SetTiltSpeed(a));
trilist.SetUShortSigAction(joinMap.ZoomSpeed.JoinNumber, (a) => camera.SetZoomSpeed(a));
trilist.SetSigTrueAction(joinMap.PrivacyOn.JoinNumber, camera.PrivacyOn);
trilist.SetSigTrueAction(joinMap.PrivacyOff.JoinNumber, camera.PrivacyOff);

Expand All @@ -77,7 +80,10 @@ public class QscDspCameraDeviceJoinMap : JoinMapBase
public uint PresetStoreStart { get; set; }
public uint PresetNamesStart { get; set; }
public uint PrivacyOn { get; set; }
public uint PrivacyOff { get; set; }
public uint PrivacyOff { get; set; }
public uint PanSpeed { get; set; }
public uint TiltSpeed { get; set; }
public uint ZoomSpeed { get; set; }

public QscDspCameraDeviceJoinMap()
{
Expand All @@ -94,6 +100,9 @@ public QscDspCameraDeviceJoinMap()
PresetNamesStart = 2;
PrivacyOn = 48;
PrivacyOff = 49;
PanSpeed = 1;
TiltSpeed = 2;
ZoomSpeed = 3;
}

public override void OffsetJoinNumbers(uint joinStart)
Expand All @@ -110,7 +119,10 @@ public override void OffsetJoinNumbers(uint joinStart)
PresetStoreStart = PresetStoreStart + joinOffset;
PrivacyOn = PrivacyOn + joinOffset;
PrivacyOff = PrivacyOff + joinOffset;
Online = Online + joinOffset;
Online = Online + joinOffset;
PanSpeed = PanSpeed + joinOffset;
TiltSpeed = TiltSpeed + joinOffset;
ZoomSpeed = ZoomSpeed + joinOffset;
}
}

Expand Down Expand Up @@ -276,6 +288,54 @@ public class QscDspCameraDeviceJoinMapAdvanced : JoinMapBaseAdvanced
JoinType = eJoinType.Serial
});

[JoinName("PanSpeed")]
public JoinDataComplete PanSpeed = new JoinDataComplete(
new JoinData
{
JoinNumber = 1,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Camera pan speed",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Analog
});

/// <summary>
/// Camera tilt speed
/// </summary>
[JoinName("TiltSpeed")]
public JoinDataComplete TiltSpeed = new JoinDataComplete(
new JoinData
{
JoinNumber = 2,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Camera tilt speed",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Analog
});

/// <summary>
/// Camera zoom speed
/// </summary>
[JoinName("ZoomSpeed")]
public JoinDataComplete ZoomSpeed = new JoinDataComplete(
new JoinData
{
JoinNumber = 3,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Camera zoom speed",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Analog
});


public QscDspCameraDeviceJoinMapAdvanced(uint joinStart)
: base(joinStart, typeof(QscDspCameraDeviceJoinMapAdvanced))
Expand Down
27 changes: 20 additions & 7 deletions QscQsysDspPlugin/QscDspPropertiesConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public string Label
{
get
{
return this._label;
return _label;
}
set
{
this._label = value;
_label = value;
LabelFeedback.FireUpdate();
}
}
Expand All @@ -116,7 +116,7 @@ public string Label
/// </summary>
public QscDspPresets()
{
LabelFeedback = new StringFeedback(() => { return Label; });
LabelFeedback = new StringFeedback(() => Label);
}
}

Expand Down Expand Up @@ -282,10 +282,13 @@ public class QscDialerConfig
/// "camera-1": {
/// "panLeftTag": "CAM01_LEFT",
/// "panRightTag": "CAM01_RIGHT",
/// "panSpeedTag": "CAM01_PANSPEED",
/// "tiltUpTag": "CAM01_UP",
/// "tiltDownTag": "CAM01_DOWN",
/// "tiltDownTag": "CAM01_DOWN",
/// "tiltSpeedTag": "CAM01_TILTSPEED",
/// "zoomInTag": "CAM01_ZOOMIN",
/// "zoomOutTag": "CAM01_ZOOMOUT",
/// "zoomOutTag": "CAM01_ZOOMOUT",
/// "zoomSpeedTag": "CAM01_ZOOMSPEED",
/// "privacy": "CAM01_PRIVACY",
/// "onlineStatus": "CAM01_STATUS",
/// "presets": {
Expand Down Expand Up @@ -319,22 +322,32 @@ public class QscDspCameraConfig
public string PanLeftTag { get; set; }

[JsonProperty("panRightTag")]
public string PanRightTag { get; set; }
public string PanRightTag { get; set; }

[JsonProperty("panSpeedTag")]
public string PanSpeedTag { get; set; }

[JsonProperty("tiltUpTag")]
public string TiltUpTag { get; set; }

[JsonProperty("tiltDownTag")]
public string TiltDownTag { get; set; }
public string TiltDownTag { get; set; }

[JsonProperty("tiltSpeedTag")]
public string TiltSpeedTag { get; set; }

[JsonProperty("zoomInTag")]
public string ZoomInTag { get; set; }

[JsonProperty("zoomOutTag")]
public string ZoomOutTag { get; set; }

[JsonProperty("homeTag")]
public string HomeTag { get; set; }

[JsonProperty("zoomSpeedTag")]
public string ZoomSpeedTag { get; set; }

[JsonProperty("presetBankTag")]
public string PresetBankTag { get; set; }

Expand Down

0 comments on commit 0d0c1ac

Please sign in to comment.