public MqttIotHubAdapter( string deviceId, string iotHubHostName, IAuthorizationProvider passwordProvider, MqttTransportSettings mqttTransportSettings, IWillMessage willMessage, IMqttIotHubEventHandler mqttIotHubEventHandler, ProductInfo productInfo) { Contract.Requires(deviceId != null); Contract.Requires(iotHubHostName != null); Contract.Requires(passwordProvider != null); Contract.Requires(mqttTransportSettings != null); Contract.Requires(!mqttTransportSettings.HasWill || willMessage != null); Contract.Requires(productInfo != null); this.deviceId = deviceId; this.iotHubHostName = iotHubHostName; this.passwordProvider = passwordProvider; this.mqttTransportSettings = mqttTransportSettings; this.willMessage = willMessage; this.mqttIotHubEventHandler = mqttIotHubEventHandler; this.pingRequestInterval = this.mqttTransportSettings.KeepAliveInSeconds > 0 ? TimeSpan.FromSeconds(this.mqttTransportSettings.KeepAliveInSeconds / 4d) : TimeSpan.MaxValue; this.productInfo = productInfo; this.deviceBoundOneWayProcessor = new SimpleWorkQueue <PublishPacket>(this.AcceptMessageAsync); this.deviceBoundTwoWayProcessor = new OrderedTwoPhaseWorkQueue <int, PublishPacket>(this.AcceptMessageAsync, p => p.PacketId, this.SendAckAsync); this.serviceBoundOneWayProcessor = new SimpleWorkQueue <PublishWorkItem>(this.SendMessageToServerAsync); this.serviceBoundTwoWayProcessor = new OrderedTwoPhaseWorkQueue <int, PublishWorkItem>(this.SendMessageToServerAsync, p => p.Value.PacketId, this.ProcessAckAsync); }
public MqttIotHubAdapter Create( IMqttIotHubEventHandler mqttIotHubEventHandler, IotHubConnectionString iotHubConnectionString, MqttTransportSettings mqttTransportSettings) { IWillMessage willMessage = mqttTransportSettings.HasWill ? this.settings.WillMessage : null; return(new MqttIotHubAdapter( iotHubConnectionString.DeviceId, iotHubConnectionString.HostName, mqttTransportSettings.ClientCertificate != null ? null : iotHubConnectionString.GetPassword(), mqttTransportSettings, willMessage, mqttIotHubEventHandler)); }
public MqttIotHubAdapter Create( IMqttIotHubEventHandler mqttIotHubEventHandler, IotHubConnectionString iotHubConnectionString, MqttTransportSettings mqttTransportSettings, ProductInfo productInfo, ClientOptions options) { IWillMessage willMessage = mqttTransportSettings.HasWill ? _settings.WillMessage : null; return(new MqttIotHubAdapter( iotHubConnectionString.DeviceId, iotHubConnectionString.ModuleId, iotHubConnectionString.HostName, mqttTransportSettings.ClientCertificate != null ? null : iotHubConnectionString, mqttTransportSettings, willMessage, mqttIotHubEventHandler, productInfo, options)); }