4.3 The M2Mqtt CodePlex Project
Created by sphung on 11/14/2013 1:16:46 AM

The M2Mqtt CodePlex Project

As already said, M2Mqtt library is available as open source project on CodePlex. If you connect to the project web site at http://m2mqtt.codeplex.com and click on “Source Code” tab, you can see all the source files inside the project itself.

Fig4.1

Figure 4.1 : MQTT source code on CodePlex

As you can see, there are three available solution files (.sln) : two of them are for Visual Studio 2010 and 2012 for Windows environment and the third is for Mono Project (http://www.mono-project.com) that provides support for .Net Framework on Linux using MonoDevelop (http://monodevelop.com/) as IDE. While the Mono solution provides only a C# project file (.csproj) because it supports only full .Net Framework for Linux, the solutions for Visual Studio provides more projects files : one for the full .Net Framework, two for .Net Micro Framework (4.2 and 4.3 version) and the third for .Net Compact Framework 3.9 that you can use with Windows Embedded Compact 2013.

The root folder contains two following main C# source code files :

  • MqttClient.cs : it contains the class that implement the MQTT client;
  • MqttNetworkChannel.cs : it contains a wrapper class for the underling Socket or SslStream used to communicate with the broker without or with SSL/TLS protocol;

The Messages folder contains all the classes that define the messages expected in the MQTT protocol each of which provides Parse() and GetBytes() methods for marshaling/unmarshaling messages between OO (Object Oriented) world and stream bytes on the network.

The Exceptions folder provides some files with specific exceptions related to MQTT client and problems that may occur during communication with the broker.

Due to different assemblies needed for .Net Micro Framework 4.2 and 4.3 projects (ex. Microsoft.SPOT.*) and not present in the full .Net Framework and vice versa, the compiler uses some symbol for conditional compilation. This symbols are defined in the projects properties and are respectively MF_FRAMEWORK_VERSION_V4_2 and MF_FRAMEWORK_VERSION_V4_2; they aren’t defined for the full .Net Framework project.

Fig4.2

Figure 4.2 : Symbol defined for conditional compilation on .Net Micro Framework projects

There is another symbol, SSL, that is used to compile source code that uses SSL/TLS features (it is defined by default in all project files but the .Net Compact Framework because it doesn’t support SslStream class). It is useful because some .Net Micro Framework boards (like Netduino Plus) don’t have enough memory (Flash and RAM) to load assemblies related to security (cryptography and SSL/TLS support). In this case, you can delete this symbol from project properties and remove assembly references needed like Microsoft.SPOT.Net.Security and System.Net.Security for .Net Micro Framework.

print
  Comments


Turkish porno izle video site in rokettubeporno izle