private void Handle(PushDataPacket packet, IEndPointBinding deviceBinding) { _logger.Info($"PushData packet received from {deviceBinding.ToString()}", GetType().Name); _logger.Info($"Sending PushAck packet to {deviceBinding.ToString()}", GetType().Name); _gatewayChannels .AddOrUpdate(Direction.Upstream, new GatewayChannel(deviceBinding, _logger), (key, channel) => { //Update binding with new values eg. ports. channel.Binding = deviceBinding; return(channel); }) .Binding .SendAsync(new PushAckPacket { ProtocolVersion = packet.ProtocolVersion, Token = packet.Token, }); _logger.Info($"Sending PushData packet to {_cloudBinding.ToString()}", GetType().Name); _cloudBinding.SendAsync(packet); }
private void Handle(PullRespPacket packet, IEndPointBinding cloudBinding) { _logger.Info($"PullResp packet received from {cloudBinding.ToString()}", GetType().Name); if (!_gatewayChannels.TryGetValue(Direction.Downstream, out var channel)) { return; } _logger.Info($"Sending PullResp packet to {_gatewayChannels[Direction.Downstream].Binding.ToString()}", GetType().Name); _gatewayChannels[Direction.Downstream] .Binding .SendAsync(packet); }