mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-16 13:14:49 +00:00
refactor: move some files around and rename things
* renamed comm -> net to better match with standard .NET stuff * moved all comm interfaces to single files * moved all net interfaces to net/interfaces folder and adjusted namespaces accordingly
This commit is contained in:
@@ -1,240 +0,0 @@
|
|||||||
|
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
|
||||||
using PepperDash.Core.Interfaces;
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace PepperDash.Core.Comm
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// An incoming communication stream
|
|
||||||
/// </summary>
|
|
||||||
public interface ICommunicationReceiver : IKeyed
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Notifies of bytes received
|
|
||||||
/// </summary>
|
|
||||||
event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
|
||||||
/// <summary>
|
|
||||||
/// Notifies of text received
|
|
||||||
/// </summary>
|
|
||||||
event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates connection status
|
|
||||||
/// </summary>
|
|
||||||
bool IsConnected { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Connect to the device
|
|
||||||
/// </summary>
|
|
||||||
void Connect();
|
|
||||||
/// <summary>
|
|
||||||
/// Disconnect from the device
|
|
||||||
/// </summary>
|
|
||||||
void Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a device that uses basic connection
|
|
||||||
/// </summary>
|
|
||||||
public interface IBasicCommunication : ICommunicationReceiver
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Send text to the device
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
void SendText(string text);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Send bytes to the device
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytes"></param>
|
|
||||||
void SendBytes(byte[] bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a device that implements IBasicCommunication and IStreamDebugging
|
|
||||||
/// </summary>
|
|
||||||
public interface IBasicCommunicationWithStreamDebugging : IBasicCommunication, IStreamDebugging
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a device with stream debugging capablities
|
|
||||||
/// </summary>
|
|
||||||
public interface IStreamDebugging
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Object to enable stream debugging
|
|
||||||
/// </summary>
|
|
||||||
CommunicationStreamDebugging StreamDebugging { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// For IBasicCommunication classes that have SocketStatus. GenericSshClient,
|
|
||||||
/// GenericTcpIpClient
|
|
||||||
/// </summary>
|
|
||||||
public interface ISocketStatus : IBasicCommunication
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Notifies of socket status changes
|
|
||||||
/// </summary>
|
|
||||||
event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The current socket status of the client
|
|
||||||
/// </summary>
|
|
||||||
SocketStatus ClientStatus { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Describes a device that implements ISocketStatus and IStreamDebugging
|
|
||||||
/// </summary>
|
|
||||||
public interface ISocketStatusWithStreamDebugging : ISocketStatus, IStreamDebugging
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Describes a device that can automatically attempt to reconnect
|
|
||||||
/// </summary>
|
|
||||||
public interface IAutoReconnect
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Enable automatic recconnect
|
|
||||||
/// </summary>
|
|
||||||
bool AutoReconnect { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Interval in ms to attempt automatic recconnections
|
|
||||||
/// </summary>
|
|
||||||
int AutoReconnectIntervalMs { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public enum eGenericCommMethodStatusChangeType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Connected
|
|
||||||
/// </summary>
|
|
||||||
Connected,
|
|
||||||
/// <summary>
|
|
||||||
/// Disconnected
|
|
||||||
/// </summary>
|
|
||||||
Disconnected
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This delegate defines handler for IBasicCommunication status changes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="comm">Device firing the status change</param>
|
|
||||||
/// <param name="status"></param>
|
|
||||||
public delegate void GenericCommMethodStatusHandler(IBasicCommunication comm, eGenericCommMethodStatusChangeType status);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class GenericCommMethodReceiveBytesArgs : EventArgs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public byte[] Bytes { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytes"></param>
|
|
||||||
public GenericCommMethodReceiveBytesArgs(byte[] bytes)
|
|
||||||
{
|
|
||||||
Bytes = bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// S+ Constructor
|
|
||||||
/// </summary>
|
|
||||||
public GenericCommMethodReceiveBytesArgs() { }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class GenericCommMethodReceiveTextArgs : EventArgs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Text { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Delimiter { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
public GenericCommMethodReceiveTextArgs(string text)
|
|
||||||
{
|
|
||||||
Text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
/// <param name="delimiter"></param>
|
|
||||||
public GenericCommMethodReceiveTextArgs(string text, string delimiter)
|
|
||||||
: this(text)
|
|
||||||
{
|
|
||||||
Delimiter = delimiter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// S+ Constructor
|
|
||||||
/// </summary>
|
|
||||||
public GenericCommMethodReceiveTextArgs() { }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class ComTextHelper
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets escaped text for a byte array
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytes"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetEscapedText(byte[] bytes)
|
|
||||||
{
|
|
||||||
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets escaped text for a string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetEscapedText(string text)
|
|
||||||
{
|
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
|
||||||
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets debug text for a string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetDebugText(string text)
|
|
||||||
{
|
|
||||||
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
44
src/Pepperdash Core/Net/ComTextHelper.cs
Normal file
44
src/Pepperdash Core/Net/ComTextHelper.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
|
|
||||||
|
namespace PepperDash.Core.Net
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class ComTextHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets escaped text for a byte array
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetEscapedText(byte[] bytes)
|
||||||
|
{
|
||||||
|
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets escaped text for a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetEscapedText(string text)
|
||||||
|
{
|
||||||
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
return string.Concat(bytes.Select(b => string.Format(@"[{0:X2}]", (int)b)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets debug text for a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetDebugText(string text)
|
||||||
|
{
|
||||||
|
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
|
|
||||||
namespace PepperDash.Core.Comm
|
namespace PepperDash.Core.Comm
|
||||||
{
|
{
|
||||||
@@ -9,6 +9,7 @@ of this material by another party without the express written permission of Pepp
|
|||||||
PepperDash Technology Corporation reserves all rights under applicable laws.
|
PepperDash Technology Corporation reserves all rights under applicable laws.
|
||||||
------------------------------------ */
|
------------------------------------ */
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Core.Comm
|
namespace PepperDash.Core.Comm
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
29
src/Pepperdash Core/Net/GenericCommMethodReceiveBytesArgs.cs
Normal file
29
src/Pepperdash Core/Net/GenericCommMethodReceiveBytesArgs.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Core.Net
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class GenericCommMethodReceiveBytesArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public byte[] Bytes { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
|
public GenericCommMethodReceiveBytesArgs(byte[] bytes)
|
||||||
|
{
|
||||||
|
Bytes = bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericCommMethodReceiveBytesArgs() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/Pepperdash Core/Net/GenericCommMethodReceiveTextArgs.cs
Normal file
43
src/Pepperdash Core/Net/GenericCommMethodReceiveTextArgs.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Core.Net.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class GenericCommMethodReceiveTextArgs : EventArgs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Text { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Delimiter { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
public GenericCommMethodReceiveTextArgs(string text)
|
||||||
|
{
|
||||||
|
Text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="delimiter"></param>
|
||||||
|
public GenericCommMethodReceiveTextArgs(string text, string delimiter)
|
||||||
|
: this(text)
|
||||||
|
{
|
||||||
|
Delimiter = delimiter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// S+ Constructor
|
||||||
|
/// </summary>
|
||||||
|
public GenericCommMethodReceiveTextArgs() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharp.Net.Http;
|
using Crestron.SimplSharp.Net.Http;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
|
using PepperDash.Core.Net;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
|
using PepperDash.Core.Net;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -13,6 +13,7 @@ PepperDash Technology Corporation reserves all rights under applicable laws.
|
|||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -3,6 +3,8 @@ using Crestron.SimplSharp.CrestronSockets;
|
|||||||
using Crestron.SimplSharp.Ssh;
|
using Crestron.SimplSharp.Ssh;
|
||||||
using Crestron.SimplSharp.Ssh.Common;
|
using Crestron.SimplSharp.Ssh.Common;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
|
using PepperDash.Core.Net;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -3,6 +3,8 @@ using Crestron.SimplSharp;
|
|||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
|
using PepperDash.Core.Net;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -13,6 +13,7 @@ PepperDash Technology Corporation reserves all rights under applicable laws.
|
|||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -3,6 +3,8 @@ using Crestron.SimplSharp;
|
|||||||
using Crestron.SimplSharp.CrestronSockets;
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
|
using PepperDash.Core.Net;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
17
src/Pepperdash Core/Net/Interfaces/IAutoReconnect.cs
Normal file
17
src/Pepperdash Core/Net/Interfaces/IAutoReconnect.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace PepperDash.Core.Net.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a device that can automatically attempt to reconnect
|
||||||
|
/// </summary>
|
||||||
|
public interface IAutoReconnect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Enable automatic recconnect
|
||||||
|
/// </summary>
|
||||||
|
bool AutoReconnect { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Interval in ms to attempt automatic recconnections
|
||||||
|
/// </summary>
|
||||||
|
int AutoReconnectIntervalMs { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
27
src/Pepperdash Core/Net/Interfaces/IBasicCommunication.cs
Normal file
27
src/Pepperdash Core/Net/Interfaces/IBasicCommunication.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
namespace PepperDash.Core.Net.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This delegate defines handler for IBasicCommunication status changes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comm">Device firing the status change</param>
|
||||||
|
/// <param name="status"></param>
|
||||||
|
public delegate void GenericCommMethodStatusHandler(IBasicCommunication comm, eGenericCommMethodStatusChangeType status);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a device that uses basic connection
|
||||||
|
/// </summary>
|
||||||
|
public interface IBasicCommunication : ICommunicationReceiver
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Send text to the device
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
void SendText(string text);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send bytes to the device
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
|
void SendBytes(byte[] bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PepperDash.Core.Net.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a device that implements IBasicCommunication and IStreamDebugging
|
||||||
|
/// </summary>
|
||||||
|
public interface IBasicCommunicationWithStreamDebugging : IBasicCommunication, IStreamDebugging
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
33
src/Pepperdash Core/Net/Interfaces/ICommunicationReceiver.cs
Normal file
33
src/Pepperdash Core/Net/Interfaces/ICommunicationReceiver.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using PepperDash.Core.Interfaces;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Core.Net.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An incoming communication stream
|
||||||
|
/// </summary>
|
||||||
|
public interface ICommunicationReceiver : IKeyed
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies of bytes received
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies of text received
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates connection status
|
||||||
|
/// </summary>
|
||||||
|
bool IsConnected { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Connect to the device
|
||||||
|
/// </summary>
|
||||||
|
void Connect();
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect from the device
|
||||||
|
/// </summary>
|
||||||
|
void Disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/Pepperdash Core/Net/Interfaces/ISocketStatus.cs
Normal file
24
src/Pepperdash Core/Net/Interfaces/ISocketStatus.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
using Crestron.SimplSharp.CrestronSockets;
|
||||||
|
using PepperDash.Core.Comm;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PepperDash.Core.Net.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// For IBasicCommunication classes that have SocketStatus. GenericSshClient,
|
||||||
|
/// GenericTcpIpClient
|
||||||
|
/// </summary>
|
||||||
|
public interface ISocketStatus : IBasicCommunication
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies of socket status changes
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current socket status of the client
|
||||||
|
/// </summary>
|
||||||
|
SocketStatus ClientStatus { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PepperDash.Core.Net.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a device that implements ISocketStatus and IStreamDebugging
|
||||||
|
/// </summary>
|
||||||
|
public interface ISocketStatusWithStreamDebugging : ISocketStatus, IStreamDebugging
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/Pepperdash Core/Net/Interfaces/IStreamDebugging.cs
Normal file
15
src/Pepperdash Core/Net/Interfaces/IStreamDebugging.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using PepperDash.Core.Comm;
|
||||||
|
|
||||||
|
namespace PepperDash.Core.Net.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a device with stream debugging capablities
|
||||||
|
/// </summary>
|
||||||
|
public interface IStreamDebugging
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Object to enable stream debugging
|
||||||
|
/// </summary>
|
||||||
|
CommunicationStreamDebugging StreamDebugging { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace PepperDash.Core.Net.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public enum eGenericCommMethodStatusChangeType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Connected
|
||||||
|
/// </summary>
|
||||||
|
Connected,
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnected
|
||||||
|
/// </summary>
|
||||||
|
Disconnected
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using PepperDash.Core.Interfaces;
|
using PepperDash.Core.Interfaces;
|
||||||
using PepperDash.Core.Logging;
|
using PepperDash.Core.Logging;
|
||||||
|
using PepperDash.Core.Net.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PepperDash.Core.Comm
|
namespace PepperDash.Core.Comm
|
||||||
@@ -36,9 +36,9 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="Comm\._GenericSshClient.cs" />
|
<Compile Remove="Net\._GenericSshClient.cs" />
|
||||||
<Compile Remove="Comm\._GenericTcpIpClient.cs" />
|
<Compile Remove="Net\._GenericTcpIpClient.cs" />
|
||||||
<Compile Remove="Comm\DynamicTCPServer.cs" />
|
<Compile Remove="Net\DynamicTCPServer.cs" />
|
||||||
<Compile Remove="PasswordManagement\OLD-ARRAY-Config.cs" />
|
<Compile Remove="PasswordManagement\OLD-ARRAY-Config.cs" />
|
||||||
<Compile Remove="PasswordManagement\OLD-ARRAY-PasswordClient.cs" />
|
<Compile Remove="PasswordManagement\OLD-ARRAY-PasswordClient.cs" />
|
||||||
<Compile Remove="PasswordManagement\OLD-ARRAY-PasswordManager.cs" />
|
<Compile Remove="PasswordManagement\OLD-ARRAY-PasswordManager.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user