Added support for remote connection by name via Pentair servers

This brings along proper password encryption and validation for the login process (which is still not needed for local connections).

You can run the remote connection tests by passing a system name and password as 2 arguments (so the system name needs to be quoted, e.g.: `test "Pentair: xx-xx-xx" 1234`)

Also updated to latest .NET Core and C# versions while I was at it.
This commit is contained in:
2019-02-20 15:19:42 -06:00
parent 810342ecc9
commit d6dfcb14a9
8 changed files with 211 additions and 56 deletions

22
RemoteConnect.cs Normal file
View File

@ -0,0 +1,22 @@
using System.Net.Sockets;
using System.Threading.Tasks;
namespace ScreenLogicConnect
{
public class RemoteConnect
{
public const int ServerDispatcherPort = 500;
public const string ServerDispatcherURL = "screenlogicserver.pentair.com";
public static async Task<EasyTouchUnit> GetGatewayInfo(string systemName)
{
using (var client = new TcpClient())
{
client.Connect(ServerDispatcherURL, ServerDispatcherPort);
var ns = client.GetStream();
ns.SendHLMessage(Messages.GetGatewayData.QUERY(systemName));
return new EasyTouchUnit(new Messages.GetGatewayData(await UnitConnection.GetMessage(ns)));
}
}
}
}