|
@@ -1,15 +1,10 @@
|
|
using RTCommunicatorBase;
|
|
using RTCommunicatorBase;
|
|
-using System;
|
|
|
|
-using System.Collections.Generic;
|
|
|
|
-using System.Linq;
|
|
|
|
-using System.Text;
|
|
|
|
-using System.Threading.Tasks;
|
|
|
|
using TLVProtocal;
|
|
using TLVProtocal;
|
|
using UniversalNetFrame451.IO;
|
|
using UniversalNetFrame451.IO;
|
|
|
|
|
|
namespace AlarmInfoServerSim.Services
|
|
namespace AlarmInfoServerSim.Services
|
|
{
|
|
{
|
|
- public class SendInfoService : ISendInfoService, ITlvProvider, IDisposable
|
|
|
|
|
|
+ public class InfoSendingService : IInfoSendingService, ITlvProvider, IDisposable
|
|
{
|
|
{
|
|
private readonly ISharedConfig _sharedConfig;
|
|
private readonly ISharedConfig _sharedConfig;
|
|
private readonly ITlvCommunicatorServer _server;
|
|
private readonly ITlvCommunicatorServer _server;
|
|
@@ -17,15 +12,18 @@ namespace AlarmInfoServerSim.Services
|
|
private bool _isConnected = false;
|
|
private bool _isConnected = false;
|
|
private bool disposedValue;
|
|
private bool disposedValue;
|
|
|
|
|
|
- public SendInfoService(ISharedConfig sharedConfig)
|
|
|
|
|
|
+ public InfoSendingService(ISharedConfig sharedConfig)
|
|
{
|
|
{
|
|
_sharedConfig= sharedConfig;
|
|
_sharedConfig= sharedConfig;
|
|
|
|
|
|
_server = TlvFactory.GetTlvServer();
|
|
_server = TlvFactory.GetTlvServer();
|
|
_server.Initialize(this);
|
|
_server.Initialize(this);
|
|
|
|
+
|
|
|
|
+ Open();
|
|
}
|
|
}
|
|
|
|
|
|
- public event EventHandler<bool>? ConnectionChanged;
|
|
|
|
|
|
+ public event EventHandler<bool>? ConnectionStatusChanged;
|
|
|
|
+ public event EventHandler<TcpConnection>? TcpConnectionChanged;
|
|
|
|
|
|
public bool Open()
|
|
public bool Open()
|
|
{
|
|
{
|
|
@@ -48,13 +46,15 @@ namespace AlarmInfoServerSim.Services
|
|
public void Connected(TcpConnection connection)
|
|
public void Connected(TcpConnection connection)
|
|
{
|
|
{
|
|
_isConnected = true;
|
|
_isConnected = true;
|
|
- ConnectionChanged?.Invoke(null, _isConnected);
|
|
|
|
|
|
+ ConnectionStatusChanged?.Invoke(null, _isConnected);
|
|
|
|
+ TcpConnectionChanged?.Invoke(null, connection);
|
|
}
|
|
}
|
|
|
|
|
|
public void Disconnected(TcpConnection connection)
|
|
public void Disconnected(TcpConnection connection)
|
|
{
|
|
{
|
|
_isConnected = false;
|
|
_isConnected = false;
|
|
- ConnectionChanged?.Invoke(null, _isConnected);
|
|
|
|
|
|
+ ConnectionStatusChanged?.Invoke(null, _isConnected);
|
|
|
|
+ TcpConnectionChanged?.Invoke(null, connection);
|
|
}
|
|
}
|
|
|
|
|
|
public void Received(TlvData data)
|
|
public void Received(TlvData data)
|