Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

CT1

Member Since 17 Dec 2011
Offline Last Active Private
-----

#63571 M2Mqtt Library

Posted by CT1 on 17 July 2015 - 10:57 PM



public static void mqttSubscriber()
(   
    // create client instance
    MqttClient client = new MqttClient(IPAddress.Parse(MQTT_BROKER_ADDRESS));

    // register to message received
   client.MqttMsgPublishReceived += client_MqttMsgPublishReceived;
   string clientId = Guid.NewGuid().ToString();
   client.Connect(clientId);

   // subscribe to the topic "/home/temperature" with QoS 2
   client.Subscribe(new string[] { "/home/temperature" }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
}

   static void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
   {
     // handle message received
   }

I am trying to use the M2Mqtt Library written by Paolo which I downloaded from codeplex.

I extracted the library and added M2Mqtt as a Project to Solution Explorer.

 

In my main project I have added the code listed above.

I am getting an error saying MqttClient not found am I missing a directive or a reference?

 

This is the first time I have tried adding a library and I'm guessing I'm not doing it right, can someone point me in the right direction?

Thanks

 

 




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.