|
|
@ -40,7 +40,7 @@ namespace SlnMesnac.Rfid.Factory
|
|
|
|
public class RflyFactory:RfidAbsractFactory
|
|
|
|
public class RflyFactory:RfidAbsractFactory
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private ILogger<RflyFactory> _logger;
|
|
|
|
private ILogger<RflyFactory> _logger;
|
|
|
|
private readonly TcpClient _tcpClient = new TcpClient();
|
|
|
|
public readonly TcpClient _tcpClient = new TcpClient();
|
|
|
|
private readonly StringChange _stringChange;
|
|
|
|
private readonly StringChange _stringChange;
|
|
|
|
|
|
|
|
|
|
|
|
public RflyFactory(ILogger<RflyFactory> logger,StringChange stringChange)
|
|
|
|
public RflyFactory(ILogger<RflyFactory> logger,StringChange stringChange)
|
|
|
@ -49,6 +49,10 @@ namespace SlnMesnac.Rfid.Factory
|
|
|
|
_stringChange = stringChange;
|
|
|
|
_stringChange = stringChange;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 建立连接
|
|
|
|
/// 建立连接
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -66,7 +70,8 @@ namespace SlnMesnac.Rfid.Factory
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new InvalidOperationException($"设备连接异常:{e.Message}");
|
|
|
|
_logger.LogError($"RFID设备{ip}连接异常:{e.Message}");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -534,6 +539,18 @@ namespace SlnMesnac.Rfid.Factory
|
|
|
|
return epcLength;
|
|
|
|
return epcLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void RefreshStatus()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (_tcpClient != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this.IsConnected = _tcpClient.Online;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this.IsConnected = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|