mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-01-11 19:44:44 +00:00
@@ -15,7 +15,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
public class GenericUdpServer : Device, IBasicCommunication
|
public class GenericUdpServer : Device, IBasicCommunication, ISocketStatus
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -40,11 +40,16 @@ namespace PepperDash.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
|
|
||||||
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public event EventHandler<GenericUdpConnectedEventArgs> UpdateConnectionStatus;
|
public event EventHandler<GenericUdpConnectedEventArgs> UpdateConnectionStatus;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public SocketStatus ClientStatus
|
public SocketStatus ClientStatus
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -53,6 +58,9 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ushort UStatus
|
public ushort UStatus
|
||||||
{
|
{
|
||||||
get { return (ushort)Server.ServerStatus; }
|
get { return (ushort)Server.ServerStatus; }
|
||||||
@@ -120,6 +128,13 @@ namespace PepperDash.Core
|
|||||||
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="address"></param>
|
||||||
|
/// <param name="port"></param>
|
||||||
|
/// <param name="buffefSize"></param>
|
||||||
public GenericUdpServer(string key, string address, int port, int buffefSize)
|
public GenericUdpServer(string key, string address, int port, int buffefSize)
|
||||||
: base(key)
|
: base(key)
|
||||||
{
|
{
|
||||||
@@ -134,6 +149,12 @@ namespace PepperDash.Core
|
|||||||
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Call from S+ to initialize values
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="address"></param>
|
||||||
|
/// <param name="port"></param>
|
||||||
public void Initialize(string key, string address, ushort port)
|
public void Initialize(string key, string address, ushort port)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
@@ -141,6 +162,10 @@ namespace PepperDash.Core
|
|||||||
UPort = port;
|
UPort = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ethernetEventArgs"></param>
|
||||||
void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs ethernetEventArgs)
|
void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs ethernetEventArgs)
|
||||||
{
|
{
|
||||||
// Re-enable the server if the link comes back up and the status should be connected
|
// Re-enable the server if the link comes back up and the status should be connected
|
||||||
@@ -151,6 +176,10 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="programEventType"></param>
|
||||||
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
|
||||||
{
|
{
|
||||||
if (programEventType == eProgramStatusEventType.Stopping)
|
if (programEventType == eProgramStatusEventType.Stopping)
|
||||||
@@ -299,6 +328,10 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
//if (Debug.Level == 2)
|
//if (Debug.Level == 2)
|
||||||
@@ -309,13 +342,35 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Text { get; private set; }
|
public string Text { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string IpAddress { get; private set; }
|
public string IpAddress { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int Port { get; private set; }
|
public int Port { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public byte[] Bytes { get; private set; }
|
public byte[] Bytes { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="ipAddress"></param>
|
||||||
|
/// <param name="port"></param>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
public GenericUdpReceiveTextExtraArgs(string text, string ipAddress, int port, byte[] bytes)
|
public GenericUdpReceiveTextExtraArgs(string text, string ipAddress, int port, byte[] bytes)
|
||||||
{
|
{
|
||||||
Text = text;
|
Text = text;
|
||||||
@@ -330,11 +385,20 @@ namespace PepperDash.Core
|
|||||||
public GenericUdpReceiveTextExtraArgs() { }
|
public GenericUdpReceiveTextExtraArgs() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class UdpServerPropertiesConfig
|
public class UdpServerPropertiesConfig
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[JsonProperty(Required = Required.Always)]
|
[JsonProperty(Required = Required.Always)]
|
||||||
public string Address { get; set; }
|
public string Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[JsonProperty(Required = Required.Always)]
|
[JsonProperty(Required = Required.Always)]
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
@@ -343,6 +407,9 @@ namespace PepperDash.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public UdpServerPropertiesConfig()
|
public UdpServerPropertiesConfig()
|
||||||
{
|
{
|
||||||
BufferSize = 32768;
|
BufferSize = 32768;
|
||||||
|
|||||||
@@ -91,8 +91,7 @@ namespace PepperDash.Core
|
|||||||
Level = context.Level;
|
Level = context.Level;
|
||||||
DoNotLoadOnNextBoot = context.DoNotLoadOnNextBoot;
|
DoNotLoadOnNextBoot = context.DoNotLoadOnNextBoot;
|
||||||
|
|
||||||
if(DoNotLoadOnNextBoot)
|
CrestronConsole.PrintLine(string.Format("Program {0} will not load config after next boot. Use console command go:{0} to load the config manually", InitialParametersClass.ApplicationNumber));
|
||||||
CrestronConsole.PrintLine(string.Format("Program {0} will not load config after next boot. Use console command go:{0} to load the config manually", InitialParametersClass.ApplicationNumber));
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ PepperDash Core is an open source Crestron SIMPL# library that can be used in SI
|
|||||||
|
|
||||||
## Constituent Elements
|
## Constituent Elements
|
||||||
|
|
||||||
- JSON Configuration File reading writing
|
- JSON Configuration File reading/writing
|
||||||
- PortalConfigReader
|
- PortalConfigReader
|
||||||
- Generic config classes
|
- Generic config classes
|
||||||
- Communications
|
- Communications
|
||||||
- TCP/IP client and server
|
- TCP/IP client and server
|
||||||
- Secure TCP/IP clinet and server
|
- Secure TCP/IP client and server
|
||||||
- UDP server
|
- UDP server
|
||||||
- SSH client
|
- SSH client
|
||||||
- HTTP SSE client
|
- HTTP SSE client
|
||||||
@@ -22,7 +22,7 @@ PepperDash Core is an open source Crestron SIMPL# library that can be used in SI
|
|||||||
- Console debugging
|
- Console debugging
|
||||||
- Logging both to Crestron error log as well as a custom log file
|
- Logging both to Crestron error log as well as a custom log file
|
||||||
- System Info
|
- System Info
|
||||||
- Reports system and Ethernet information to SIMPL via S+
|
- Reports system and Ethernet information to SIMPL via SIMPL+
|
||||||
- Device Class, IKeyed and IKeyName Interfaces
|
- Device Class, IKeyed and IKeyName Interfaces
|
||||||
- Base level device class that most classes derive from
|
- Base level device class that most classes derive from
|
||||||
- Password Manager
|
- Password Manager
|
||||||
|
|||||||
Reference in New Issue
Block a user