Esempio n. 1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MessageLogger" /> class.
 /// </summary>
 /// <param name="connectionHandler">The connection handler.</param>
 public MessageLogger(MqttConnectionHandler connectionHandler) {
     if (Settings.Default.EnableMessageLogging) {
         this.connectionHandler = connectionHandler;
         // subscribe to ALL events received.
         foreach (MqttMessageType msgType in Enum.GetValues(typeof (MqttMessageType))) {
             connectionHandler.RegisterForMessage(msgType, MessageLoggerCallback);
         }
         connectionHandler.RegisterForAllSentMessages(MessageSentCallback);
     }
 }
Esempio n. 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MessageLogger" /> class.
 /// </summary>
 /// <param name="connectionHandler">The connection handler.</param>
 public MessageLogger(MqttConnectionHandler connectionHandler)
 {
     if (Settings.Default.EnableMessageLogging)
     {
         this.connectionHandler = connectionHandler;
         // subscribe to ALL events received.
         foreach (MqttMessageType msgType in Enum.GetValues(typeof(MqttMessageType)))
         {
             connectionHandler.RegisterForMessage(msgType, MessageLoggerCallback);
         }
         connectionHandler.RegisterForAllSentMessages(MessageSentCallback);
     }
 }