private static Certificate LoadCertificate(IMqttClientChannelOptions options) { if (options.TlsOptions.Certificates == null || !options.TlsOptions.Certificates.Any()) { return(null); } if (options.TlsOptions.Certificates.Count > 1) { throw new NotSupportedException("Only one client certificate is supported for UWP."); } return(new Certificate(options.TlsOptions.Certificates.First().AsBuffer())); }
public IMqttChannelAdapter CreateClientAdapter(IMqttClientChannelOptions options, IMqttNetLogger logger) { if (options == null) { throw new ArgumentNullException(nameof(options)); } switch (options) { case MqttClientTcpOptions tcpOptions: return(new MqttChannelAdapter(new MqttTcpChannel(tcpOptions), new MqttPacketSerializer(), logger)); case MqttClientWebSocketOptions webSocketOptions: return(new MqttChannelAdapter(new MqttWebSocketChannel(webSocketOptions), new MqttPacketSerializer(), logger)); default: throw new NotSupportedException(); } }
public IMqttCommunicationChannel CreateCommunicationChannel(IMqttClientChannelOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } switch (options) { case MqttClientTcpOptions tcpOptions: return(CreateTcpChannel(tcpOptions)); case MqttClientWebSocketOptions webSocketOptions: return(CreateWebSocketChannel(webSocketOptions)); default: throw new NotSupportedException(); } }
public IMqttChannelAdapter CreateClientAdapter(IMqttClientChannelOptions options, IMqttNetLogger logger) { return(_adapter); }