Skip to content

Commit

Permalink
Merge pull request #37 from PepperDash/feature/CI+PresetSaved
Browse files Browse the repository at this point in the history
Add PresetSaved  and update CI workflows
  • Loading branch information
ngenovese11 authored Apr 5, 2023
2 parents 8ddfceb + 8cde992 commit ed8a945
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
$exclusions = "packages"
# Trying to get any .json schema files (not currently working)
# Gets any files with the listed extensions.
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.nuspec" | ForEach-Object {
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.nuspec", "*.md" | ForEach-Object {
$allowed = $true;
# Exclude any files in submodules
foreach ($exclude in $exclusions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
$exclusions = "packages"
# Trying to get any .json schema files (not currently working)
# Gets any files with the listed extensions.
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.nuspec" | ForEach-Object {
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.nuspec", "*.md" | ForEach-Object {
$allowed = $true;
# Exclude any files in submodules
foreach ($exclude in $exclusions) {
Expand Down
Binary file added HDIntegratedCamera_InterfaceSpecifications-E.pdf
Binary file not shown.
4 changes: 0 additions & 4 deletions PanasonicCameraEpi/CommandQueue.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.CrestronThread;
using PepperDash.Core;
using PepperDash.Essentials.Core;

namespace PanasonicCameraEpi
{
Expand Down
4 changes: 0 additions & 4 deletions PanasonicCameraEpi/HttpCommandQueue.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Net.Http;
using Crestron.SimplSharpPro.CrestronThread;
using PepperDash.Core;
Expand Down
65 changes: 43 additions & 22 deletions PanasonicCameraEpi/PanasonicCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
using System.Linq;
using Crestron.SimplSharpPro.DeviceSupport;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Bridges;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Core;
using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco;
using Crestron.SimplSharp;


namespace PanasonicCameraEpi
{
Expand All @@ -30,7 +30,23 @@ public class PanasonicCamera : ReconfigurableDevice, IBridgeAdvanced, IHasCamera
public BoolFeedback IsOnlineFeedback { get { return _monitor.IsOnlineFeedback; } }
public IntFeedback PanSpeedFeedback { get; private set; }
public IntFeedback ZoomSpeedFeedback { get; private set; }
public IntFeedback TiltSpeedFeedback { get; private set; }
public IntFeedback TiltSpeedFeedback { get; private set; }
public BoolFeedback PresetSavedFeedback { get; private set; }
public bool PresetSavedBool
{
get
{
return _PresetSavedBool;
}
set
{
_PresetSavedBool = value;
PresetSavedFeedback.FireUpdate();
}


}
private bool _PresetSavedBool { get; set; }

public PanasonicCamera(IBasicCommunication comms, DeviceConfig config)
: base(config)
Expand All @@ -42,7 +58,7 @@ public PanasonicCamera(IBasicCommunication comms, DeviceConfig config)
_responseHandler = new PanasonicResponseHandler();

if (cameraConfig.CommunicationMonitor == null)
cameraConfig.CommunicationMonitor = new CommunicationMonitorConfig()
cameraConfig.CommunicationMonitor = new CommunicationMonitorConfig
{
PollInterval = 60000,
TimeToWarning = 180000,
Expand All @@ -57,13 +73,10 @@ public PanasonicCamera(IBasicCommunication comms, DeviceConfig config)
comms.TextReceived += _responseHandler.HandleResponseReceeved;
throw new NotImplementedException("Need to create a command queue for serial");
}
else
{
_monitor = new PanasonicHttpCameraMonitor(this, tempClient, cameraConfig.CommunicationMonitor);
var queue = new HttpCommandQueue(comms);
queue.ResponseReceived += _responseHandler.HandleResponseReceived;
_queue = queue;
}
_monitor = new PanasonicHttpCameraMonitor(this, tempClient, cameraConfig.CommunicationMonitor);
var queue = new HttpCommandQueue(comms);
queue.ResponseReceived += _responseHandler.HandleResponseReceived;
_queue = queue;

_cmd = new PanasonicCmdBuilder(12, 25, 12, cameraConfig.HomeCommand, cameraConfig.PrivacyCommand);
_presets = cameraConfig.Presets.ToDictionary(x => (uint)x.Id);
Expand Down Expand Up @@ -129,7 +142,7 @@ private void SetupFeedbacks()
if (_presets.ContainsKey(index))
continue;

_presets.Add(index, new PanasonicCameraPreset() {Id = (int) index, Name = String.Empty});
_presets.Add(index, new PanasonicCameraPreset {Id = (int) index, Name = String.Empty});
}

NumberOfPresetsFeedback = new IntFeedback(() => _presets.Values.Count(x => !String.IsNullOrEmpty(x.Name)));
Expand All @@ -138,6 +151,7 @@ private void SetupFeedbacks()
PanSpeedFeedback = new IntFeedback(() => PanSpeed);
TiltSpeedFeedback = new IntFeedback(() => TiltSpeed);
ZoomSpeedFeedback = new IntFeedback(() => ZoomSpeed);
PresetSavedFeedback = new BoolFeedback(() => PresetSavedBool);

PanSpeedFeedback.FireUpdate();
TiltSpeedFeedback.FireUpdate();
Expand Down Expand Up @@ -285,6 +299,8 @@ public void RecallPreset(int preset)
public void SavePreset(int preset)
{
_queue.EnqueueCmd(_cmd.PresetSaveCommand(preset));
PresetSavedBool = true;
new CTimer( (o) => PresetSavedBool = false, 5000);
}

/// <summary>
Expand All @@ -295,16 +311,19 @@ public void SetIpAddress(string address)
{
try
{
if (address.Length > 2 & Config.Properties["control"]["tcpSshProperties"]["address"].ToString() != address)
{
Debug.Console(2, this, "Changing IPAddress: {0}", address);

Config.Properties["control"]["tcpSshProperties"]["address"] = address;
Debug.Console(2, this, "{0}", Config.Properties.ToString());
SetConfig(Config);
var tempClient = DeviceManager.GetDeviceForKey(string.Format("{0}-httpClient", this.Key)) as GenericHttpClient;
tempClient.Client.HostName = address;
}
if (!(address.Length > 2 & Config.Properties["control"]["tcpSshProperties"]["address"].ToString() != address))
return;
Debug.Console(2, this, "Changing IPAddress: {0}", address);

Config.Properties["control"]["tcpSshProperties"]["address"] = address;
Debug.Console(2, this, "{0}", Config.Properties.ToString());
SetConfig(Config);
var tempClient = DeviceManager.GetDeviceForKey(string.Format("{0}-httpClient", Key)) as GenericHttpClient;
if (tempClient == null)
{
throw new Exception("Error - No Valid TCP Client!");
}
tempClient.Client.HostName = address;
}
catch (Exception e)
{
Expand Down Expand Up @@ -373,6 +392,8 @@ public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, E
NameFeedback.LinkInputSig(trilist.StringInput[joinMap.DeviceName.JoinNumber]);

NumberOfPresetsFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfPresets.JoinNumber]);

PresetSavedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PresetSavedFeedback.JoinNumber]);

CameraIsOffFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
CameraIsOffFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
Expand Down
24 changes: 18 additions & 6 deletions PanasonicCameraEpi/PanasonicCameraBridgeJoinMap.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core;

namespace PanasonicCameraEpi
{
Expand Down Expand Up @@ -198,6 +193,23 @@ public class PanasonicCameraBridgeJoinMap : JoinMapBaseAdvanced
JoinType = eJoinType.Digital
});

/// <summary>
/// Camera preset saved
/// </summary>
[JoinName("PresetSavedFeedback")]
public JoinDataComplete PresetSavedFeedback = new JoinDataComplete(
new JoinData
{
JoinNumber = 30,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Camera preset saved Feedback",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});

/// <summary>
/// Camera preset save
/// </summary>
Expand Down
4 changes: 1 addition & 3 deletions PanasonicCameraEpi/PanasonicCameraExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace PanasonicCameraEpi
namespace PanasonicCameraEpi
{
public static class ScalingExtensions
{
Expand Down
4 changes: 0 additions & 4 deletions PanasonicCameraEpi/PanasonicCameraFactory.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;

namespace PanasonicCameraEpi
{
Expand Down
7 changes: 1 addition & 6 deletions PanasonicCameraEpi/PanasonicCameraMonitor.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Net.Http;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;

namespace PanasonicCameraEpi
{
Expand Down
2 changes: 0 additions & 2 deletions PanasonicCameraEpi/PanasonicCameraPropsConfig.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.Generic;
using PepperDash.Core;
using PepperDash.Core.WebApi.Presets;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using Newtonsoft.Json;
Expand Down
4 changes: 2 additions & 2 deletions PanasonicCameraEpi/PanasonicCmdBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace PanasonicCameraEpi
{
public class PanasonicCmdBuilder
{
private static readonly string CmdHeader = "cgi-bin/aw_ptz?cmd=%23";
private static readonly string CmdSuffix = "&res=1";
private const string CmdHeader = "cgi-bin/aw_ptz?cmd=%23";
private const string CmdSuffix = "&res=1";

public string PanStopCommand { get; private set; }
public string TiltStopCommand { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
<!-- Update ID with a plugin ID representative of the plugin being built-->
<id>PepperDash.Essentials.Plugin.EpiPanasonicCamera</id>
<readme>docs\README.md</readme>
<version>1.1.0</version>
<!-- Update Title with the plugin name that users will see-->
<title>Epi Panasonic Camera</title>
<authors>PepperDash Technologies</authors>
<owners>pepperdash</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<!-- Update projectUrl with the actual URL of the plugin repo-->
<projectUrl>https://github.com/PepperDash-Engineering/epi-panasonic-camera-http</projectUrl>
<copyright>Copyright 2021</copyright>
<!-- Update description-->
<copyright>Copyright 2022</copyright>
<description>Essentials Plugin for Panasonic Cameras used with PepperDash Essentials to expose functionality in SIMPL Windows programs using Bridges.</description>
<tags>crestron 3series 4series</tags>
<!-- Update repository url with the actual URL of the plugin repo-->
<repository type="git" url="https://github.com/PepperDash-Engineering/epi-panasonic-camera-http"/>
</metadata>
<files>
<file src="**" target="lib\net35"/>
<file src="**" target="lib\net47"/>
<file src="README.md" target="docs\"/>
</files>
</package>
2 changes: 1 addition & 1 deletion packages.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<packages>
<package id="PepperDashEssentials" version="1.8.5-pr701-1363" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
<package id="PepperDashEssentials" version="1.9.0" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
</packages>

0 comments on commit ed8a945

Please sign in to comment.