-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoteConnect.cs
More file actions
25 lines (20 loc) · 820 Bytes
/
RemoteConnect.cs
File metadata and controls
25 lines (20 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System.Net.Sockets;
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, short senderId = 0)
{
using var client = new TcpClient();
await client.ConnectAsync(ServerDispatcherURL, ServerDispatcherPort);
var ns = client.GetStream();
ns.SendHLMessage(new Messages.GetGatewayData(senderId) { GatewayName = systemName });
var msg = await UnitConnection.BuildMessageFromStream<Messages.GetGatewayData>(ns);
if (msg == null)
{
return null;
}
return EasyTouchUnit.Create(new Messages.GetGatewayData(msg));
}
}