コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: TTNMessage.cs プロジェクト: Wietse-0803/ALoRa
        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);
        }
コード例 #3
0
ファイル: TTNApplication.cs プロジェクト: hajo001/ALoRa
        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
            }
        }