Compare commits

..

9 Commits

Author SHA1 Message Date
Andrew Knous
fe0363ed8c feat: updates core version with latest updates to genericTcpSocket 2025-12-12 14:29:41 -05:00
AECohn
e92fe5cf2c Merge pull request #1316 from PepperDash/hotfix/generic-comm-monitor-bug
fix: removes condition that blocked BeginPolling method call if using…
2025-08-21 11:44:30 -04:00
Neil Dorin
a673122e00 fix: removes condition that blocked BeginPolling method call if using socket connection method 2025-08-18 13:49:04 -06:00
Neil Dorin
4854018d7b Merge pull request #1311 from PepperDash/cen-io-com-issues 2025-08-15 09:01:31 -06:00
Andrew Welker
078f35a91d fix: check EISC for null prior to using 2025-08-15 09:47:56 -05:00
Andrew Welker
dba07dced8 fix: PD Core 1.4.2 and comm factory update 2025-08-14 14:25:36 -05:00
Andrew Welker
5ad232135c feat: CommBridge communication method implementation
In some scenarios, it becomes necessary to have a plugin in Essentials use a Communications method that's defined in
SIMPL and bridged the opposite from what normally happens. The CommBridge method facilitates that sort of operation.

To use it: set the method in the Control configuration for the device to 'comBridge'. The bridge will be built with a key of "{deviceKey}-simpl", so it can be added to a bridge using that key.
2025-08-14 14:22:22 -05:00
Andrew Welker
3f8e72f366 wip: reverse genericcomm 2025-08-14 12:20:03 -05:00
Andrew Welker
307b2f54a7 fix: update Crestron databases 2025-08-13 13:55:24 -05:00
9 changed files with 129 additions and 10 deletions

View File

@@ -1,3 +1,3 @@
<packages>
<package id="PepperDashCore" version="1.4.1" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
<package id="PepperDashCore" version="1.4.3" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
</packages>

View File

@@ -71,7 +71,7 @@
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.3.3.32940, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="PepperDash_Core, Version=1.4.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
</Reference>

View File

@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp.CrestronSockets;
using Crestron.SimplSharpPro.DeviceSupport;
using Newtonsoft.Json;
using System.Text;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Implements IBasicCommunication and sends all communication through an EISC
/// </summary>
[Description("Generic communication wrapper class for any IBasicCommunication type")]
public class CommBridge : EssentialsBridgeableDevice, IBasicCommunication
{
private EiscApiAdvanced eisc;
private IBasicCommunicationJoinMap joinMap;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public bool IsConnected { get; private set; }
public CommBridge(string key, string name)
: base(key, name)
{
}
public void SendBytes(byte[] bytes)
{
if (eisc == null)
{
Debug.Console(0, this, "EISC not linked. Call LinkToApi before sending bytes.");
return;
}
eisc.Eisc.SetString(joinMap.SendText.JoinNumber, Encoding.ASCII.GetString(bytes, 0, bytes.Length));
}
public void SendText(string text)
{
if (eisc == null)
{
Debug.Console(0, this, "EISC not linked. Call LinkToApi before sending text.");
return;
}
eisc.Eisc.SetString(joinMap.SendText.JoinNumber, text);
}
public void Connect() {
if (eisc == null)
{
Debug.Console(0, this, "EISC not linked. Call LinkToApi before connecting.");
return;
}
eisc.Eisc.SetBool(joinMap.Connect.JoinNumber, true);
}
public void Disconnect() {
if (eisc == null)
{
Debug.Console(0, this, "EISC not linked. Call LinkToApi before disconnecting.");
return;
}
eisc.Eisc.SetBool(joinMap.Connect.JoinNumber, false);
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
joinMap = new IBasicCommunicationJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IBasicCommunicationJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
eisc = bridge;
trilist.SetBoolSigAction(joinMap.Connected.JoinNumber, (b) => IsConnected = b);
trilist.SetStringSigAction(joinMap.TextReceived.JoinNumber, (s) => {
var textHandler = TextReceived;
if (textHandler != null)
{
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
}
var bytesHandler = BytesReceived;
if(bytesHandler != null)
{
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(Encoding.ASCII.GetBytes(s)));
}
});
}
}
}

View File

@@ -50,6 +50,9 @@ namespace PepperDash.Essentials.Core
case eControlMethod.Com:
comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams, controlConfig);
break;
case eControlMethod.ComBridge:
comm = new CommBridge(deviceConfig.Key + "-simpl", deviceConfig.Name + " Simpl");
break;
case eControlMethod.Cec:
comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig);
break;

View File

@@ -158,10 +158,8 @@ namespace PepperDash.Essentials.Core
Client.TextReceived += Client_TextReceived;
}
if (!IsSocket)
{
BeginPolling();
}
BeginPolling();
}
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)

View File

@@ -83,7 +83,7 @@
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.3.3.32940, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="PepperDash_Core, Version=1.4.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
</Reference>
@@ -165,6 +165,7 @@
<Compile Include="Comm and IR\ComSpecJsonConverter.cs" />
<Compile Include="Comm and IR\ConsoleCommMockDevice.cs" />
<Compile Include="Comm and IR\GenericComm.cs" />
<Compile Include="Comm and IR\CommBridge.cs" />
<Compile Include="Comm and IR\GenericHttpClient.cs" />
<Compile Include="Comm and IR\IRPortHelper.cs" />
<Compile Include="Config\Essentials\ConfigUpdater.cs" />

View File

@@ -59,7 +59,7 @@
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.3.3.32940, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="PepperDash_Core, Version=1.4.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
</Reference>

View File

@@ -63,7 +63,7 @@
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Lighting.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.3.3.32940, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="PepperDash_Core, Version=1.4.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\PepperDashCore\lib\net35\PepperDash_Core.dll</HintPath>
</Reference>

View File

@@ -71,7 +71,7 @@
<HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.0.3.27452, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="PepperDash_Core, Version=1.4.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Release Package\PepperDash_Core.dll</HintPath>
</Reference>