Minor changes to client and gather in response to wharton/portalsync debugging

This commit is contained in:
Heath Volmer
2017-01-06 13:39:53 -07:00
parent 5fb4150d21
commit e9f4917c55
15 changed files with 170 additions and 4 deletions

Binary file not shown.

View File

@@ -92,6 +92,13 @@ namespace PepperDash.Core
var handler = LineReceived;
if (handler != null)
{
if (Debug.Level >= 2)
{
var output = Regex.Replace(args.Text,
@"\p{Cc}",
a => string.Format("[{0:X2}]", (byte)a.Value[0]));
Debug.Console(2, Port, "RX: '{0}]", output);
}
ReceiveBuffer.Append(args.Text);
var str = ReceiveBuffer.ToString();
var lines = str.Split(Delimiter);
@@ -123,7 +130,13 @@ namespace PepperDash.Core
{
// Receive buffer should either be empty or not contain the delimiter
// If the line does not have a delimiter, append the
if (Debug.Level >= 2)
{
var output = Regex.Replace(args.Text,
@"\p{Cc}",
a => string.Format("[{0:X2}]", (byte)a.Value[0]));
Debug.Console(2, Port, "RX: '{0}]", output);
}
ReceiveBuffer.Append(args.Text);
var str = ReceiveBuffer.ToString();
var lines = Regex.Split(str, StringDelimiter);

View File

@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core
{
/// <summary>
/// Background class that manages debug features for sockets
/// </summary>
public static class CommStatic
{
static List<ISocketStatus> Sockets = new List<ISocketStatus>();
/// <summary>
/// Sets up the backing class. Adds console commands for S#Pro programs
/// </summary>
static CommStatic()
{
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
{
CrestronConsole.AddNewConsoleCommand(SocketCommand, "socket", "socket commands: list, send, connect, disco",
ConsoleAccessLevelEnum.AccessOperator);
}
}
static void SocketCommand(string s)
{
// 0 1 2
//socket command number/key/all param
//socket list
//socket send 4 ver -v\n
if (string.IsNullOrEmpty(s))
return;
var tokens = s.Split(' ');
if (tokens.Length == 0)
return;
var command = tokens[0].ToLower();
if(command == "connect")
{
}
else if(command == "disco")
{
}
else if(command =="list")
{
CrestronConsole.ConsoleCommandResponse("{0} sockets", Sockets.Count);
if(Sockets.Count == 0)
return;
// get the longest key name, for formatting
var longestLength = Sockets.Aggregate("",
(max, cur) => max.Length > cur.Key.Length ? max : cur.Key).Length;
for(int i = 0; i < Sockets.Count; i++)
{
var sock = Sockets[i];
CrestronConsole.ConsoleCommandResponse("{0} {1} {2} {3}",
i, sock.Key, GetSocketType(sock), sock.ClientStatus);
}
}
else if(command == "send")
{
}
}
/// <summary>
/// Helper for socket list, to show types
/// </summary>
static string GetSocketType(ISocketStatus sock)
{
if (sock is GenericSshClient)
return "SSH";
else if (sock is GenericTcpIpClient)
return "TCP-IP";
else
return "?";
}
/// <summary>
///
/// </summary>
/// <param name="socket"></param>
public static void AddSocket(ISocketStatus socket)
{
if(!Sockets.Contains(socket))
Sockets.Add(socket);
}
/// <summary>
///
/// </summary>
/// <param name="socket"></param>
public static void RemoveSocket(ISocketStatus socket)
{
if (Sockets.Contains(socket))
Sockets.Remove(socket);
}
}
}

View File

@@ -63,6 +63,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CommunicationExtras.cs" />
<Compile Include="Comm\FINISH CommStatic.cs" />
<Compile Include="Comm\CommunicationGather.cs" />
<Compile Include="Comm\GenericSocketStatusChangeEventArgs.cs" />
<Compile Include="Comm\GenericSshClient.cs" />

View File

@@ -0,0 +1,3 @@
1/5/2017 3:16:49 PM, Info: Initializing SIMPLSharp Services...
1/5/2017 3:16:49 PM, Info: ProjectInfo successfully initialized.
1/5/2017 4:00:40 PM, Info: Terminating SIMPLSharp Services

View File

@@ -0,0 +1,45 @@
1/6/2017 7:51:29 AM, Info: Initializing SIMPLSharp Services...
1/6/2017 7:51:29 AM, Info: ProjectInfo successfully initialized.
1/6/2017 7:56:04 AM, Info: Saving project information...
1/6/2017 7:56:04 AM, Info: Saving project information...
1/6/2017 8:01:04 AM, Info: Saving project information...
1/6/2017 8:01:04 AM, Info: Saving project information...
1/6/2017 8:06:04 AM, Info: Saving project information...
1/6/2017 8:06:04 AM, Info: Saving project information...
1/6/2017 8:11:04 AM, Info: Saving project information...
1/6/2017 8:11:04 AM, Info: Saving project information...
1/6/2017 8:16:04 AM, Info: Saving project information...
1/6/2017 8:16:04 AM, Info: Saving project information...
1/6/2017 8:21:04 AM, Info: Saving project information...
1/6/2017 8:21:04 AM, Info: Saving project information...
1/6/2017 8:26:04 AM, Info: Saving project information...
1/6/2017 8:26:04 AM, Info: Saving project information...
1/6/2017 8:31:04 AM, Info: Saving project information...
1/6/2017 8:31:04 AM, Info: Saving project information...
1/6/2017 8:36:04 AM, Info: Saving project information...
1/6/2017 8:36:04 AM, Info: Saving project information...
1/6/2017 8:41:04 AM, Info: Saving project information...
1/6/2017 8:41:04 AM, Info: Saving project information...
1/6/2017 8:42:25 AM, Info: Saving project information...
1/6/2017 8:42:25 AM, Info: Saving project information...
1/6/2017 8:42:25 AM, Info: Saving project information...
1/6/2017 8:42:25 AM, Info: Saving project information...
1/6/2017 8:42:37 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll...
1/6/2017 8:42:38 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll
1/6/2017 8:42:38 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.clz...
1/6/2017 8:42:38 AM, Info: Saving project information...
1/6/2017 8:43:40 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll...
1/6/2017 8:43:41 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll
1/6/2017 8:43:41 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.clz...
1/6/2017 8:43:41 AM, Info: Saving project information...
1/6/2017 8:51:04 AM, Info: Saving project information...
1/6/2017 8:51:04 AM, Info: Saving project information...
1/6/2017 8:53:45 AM, Info: Saving project information...
1/6/2017 8:53:45 AM, Info: Saving project information...
1/6/2017 8:53:45 AM, Info: Saving project information...
1/6/2017 8:53:45 AM, Info: Saving project information...
1/6/2017 8:53:46 AM, Info: Validating assembly C:\Users\hvolmer\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll...
1/6/2017 8:53:46 AM, Info: Verifying assembly C:\Users\hvolmer\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll
1/6/2017 8:53:46 AM, Info: Creating Archive C:\Users\hvolmer\Desktop\working\pepperdash-simplsharp-core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.clz...
1/6/2017 8:53:47 AM, Info: Saving project information...
1/6/2017 12:09:25 PM, Info: Terminating SIMPLSharp Services

View File

@@ -10,8 +10,8 @@
<ArchiveName />
</RequiredInfo>
<OptionalInfo>
<CompiledOn>1/4/2017 2:31:43 PM</CompiledOn>
<CompilerRev>1.0.6213.26151</CompilerRev>
<CompiledOn>1/6/2017 8:53:46 AM</CompiledOn>
<CompilerRev>1.0.6215.16012</CompilerRev>
</OptionalInfo>
<Plugin>
<Version>Crestron.SIMPLSharp, Version=2.0.48.0, Culture=neutral, PublicKeyToken=812d080f93e2de10</Version>

View File

@@ -1,4 +1,4 @@
MainAssembly=PepperDash_Core.dll:e116822f63c3419f6399d53e084bd358
MainAssembly=PepperDash_Core.dll:5310f2702bb23a35bd60cde6a14b55ba
MainAssemblyMinFirmwareVersion=1.007.0017
MainAssemblyResource=SimplSharpData.dat:315526abf906cded47fb0c7510266a7e
ü