Handle invalid login attempts
This commit is contained in:
@ -55,7 +55,12 @@ namespace Test
|
||||
static async Task ConnectToUnit(ScreenLogicConnect.EasyTouchUnit server, string systemPassword = null)
|
||||
{
|
||||
var connection = new ScreenLogicConnect.UnitConnection();
|
||||
await connection.ConnectTo(server, systemPassword);
|
||||
if (!await connection.ConnectTo(server, systemPassword))
|
||||
{
|
||||
Console.WriteLine("Login failed");
|
||||
return;
|
||||
}
|
||||
|
||||
var status = await connection.GetPoolStatus();
|
||||
var config = await connection.GetControllerConfig();
|
||||
var degSymbol = config.m_DegC == 1 ? "C" : "F";
|
||||
|
@ -11,7 +11,7 @@ namespace ScreenLogicConnect
|
||||
{
|
||||
TcpClient client;
|
||||
|
||||
public async Task ConnectTo(EasyTouchUnit unit, string password = null)
|
||||
public async Task<bool> ConnectTo(EasyTouchUnit unit, string password = null)
|
||||
{
|
||||
if (client != null)
|
||||
{
|
||||
@ -46,6 +46,7 @@ namespace ScreenLogicConnect
|
||||
|
||||
readBytes = stream.Read(recvBuf, 0, recvBuf.Length);
|
||||
Debug.WriteLine("read {0}", readBytes);
|
||||
return recvBuf[2] == Messages.ClientLogin.HLM_CLIENT_LOGIN + 1;
|
||||
}
|
||||
|
||||
public async Task<Messages.GetPoolStatus> GetPoolStatus()
|
||||
|
Reference in New Issue
Block a user