private void M_client_MqttMsgPublishReceived(object sender, uPLibrary.Networking.M2Mqtt.Messages.MqttMsgPublishEventArgs e) { var msg = TTNMessage.DeserialiseMessage(e); if (m_msgReceived != null) { m_msgReceived(msg); } }
public static TTNMessage DeserialiseMessage(MqttMsgPublishEventArgs evt) { var text = Encoding.ASCII.GetString(evt.Message); var lora = JsonConvert.DeserializeObject <LoRaMessage>(text); var msg = new TTNMessage(lora, evt.Topic); return(msg); }
private void M_client_MqttMsgPublishReceived(object sender, uPLibrary.Networking.M2Mqtt.Messages.MqttMsgPublishEventArgs e) { try { var msg = TTNMessage.DeserialiseMessage(e); if (m_msgReceived != null) { m_msgReceived(msg); } } catch { // Swallow any exceptions during message receive } }