public Gateway(IGatewayConnectionPort connectionPort, IMySensorsRepository db = null, IMySensorsMessagesRepository hisotryDb = null) { this.db = db; this.hisotryDb = hisotryDb; nodes = db?.GetNodes() ?? new List <Node>(); gatewayAliveChecker = new GatewayAliveChecker(this); this.connectionPort = connectionPort; this.connectionPort.OnDataReceived += RecieveMessage; this.connectionPort.OnDisconnected += OnConnectionPortDisconnected; this.connectionPort.OnConnected += TryToCommunicateWithGateway; this.connectionPort.OnLogError += LogError; this.connectionPort.OnLogInfo += LogInfo; this.connectionPort.OnLogMessage += LogMessage; }
public Gateway(IGatewayConnectionPort connectionPort, IMySensorsRepository db = null, IMySensorsMessagesRepository hisotryDb = null) { this.db = db; this.hisotryDb = hisotryDb; nodes = db?.GetNodes() ?? new List<Node>(); gatewayAliveChecker = new GatewayAliveChecker(this); this.connectionPort = connectionPort; this.connectionPort.OnDataReceived += RecieveMessage; this.connectionPort.OnDisconnected += OnConnectionPortDisconnected; this.connectionPort.OnConnected += TryToCommunicateWithGateway; this.connectionPort.OnLogError += LogError; this.connectionPort.OnLogInfo += LogInfo; this.connectionPort.OnLogMessage += LogMessage; }