Exemplo n.º 1
0
 protected override void LibUpadteThread(Object state)
 {
     try {
         if (this.mqtt.IsConnected)
         {
             if (state.GetType().HasInterface(typeof(IMqtt)))
             {
                 IMqtt sensor = state as IMqtt;
                 ((ADataBackend)this.mqtt).Send("lora/" + sensor.MqttTopic(), sensor.ToJson());
                 this.Update?.Invoke(this, new MqttEvent("lora/" + sensor.MqttTopic(), sensor.ToJson()));
             }
         }
     } catch (Exception e) {
         Helper.WriteError("Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls.Mqtt.LibUpadteThread: " + e.Message);
     }
 }