Refactor managed MQTT client

This commit is contained in:
Christian Kratky
2017-10-19 20:45:37 +02:00
parent bddfadaefa
commit fe88b7551c
14 changed files with 206 additions and 219 deletions
@@ -21,11 +21,6 @@ namespace MQTTnet.Implementations
return new MqttChannelCommunicationAdapter(new MqttWebSocketChannel(webSocketOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
}
if (options is MqttClientManagedOptions queuedOptions)
{
return new MqttChannelCommunicationAdapter(new MqttTcpChannel(queuedOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
}
throw new NotSupportedException();
}
}
@@ -1,4 +1,5 @@
using MQTTnet.Core.Client;
using MQTTnet.Core.ManagedClient;
using MQTTnet.Implementations;
namespace MQTTnet
@@ -10,9 +11,9 @@ namespace MQTTnet
return new MqttClient(new MqttCommunicationAdapterFactory());
}
public IMqttClientManaged CreateMqttManagedClient()
public ManagedMqttClient CreateManagedMqttClient()
{
return new MqttClientManaged(new MqttCommunicationAdapterFactory());
return new ManagedMqttClient(new MqttCommunicationAdapterFactory());
}
}
}
@@ -21,12 +21,6 @@ namespace MQTTnet.Implementations
return new MqttChannelCommunicationAdapter(new MqttWebSocketChannel(webSocketOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
}
if (options is MqttClientManagedOptions queuedOptions)
{
return new MqttChannelCommunicationAdapter(new MqttTcpChannel(queuedOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
}
throw new NotSupportedException();
}
}
@@ -1,4 +1,5 @@
using MQTTnet.Core.Client;
using MQTTnet.Core.ManagedClient;
using MQTTnet.Implementations;
namespace MQTTnet
@@ -10,9 +11,9 @@ namespace MQTTnet
return new MqttClient(new MqttCommunicationAdapterFactory());
}
public IMqttClientManaged CreateMqttManagedClient()
public ManagedMqttClient CreateManagedMqttClient()
{
return new MqttClientManaged(new MqttCommunicationAdapterFactory());
return new ManagedMqttClient(new MqttCommunicationAdapterFactory());
}
}
}