This demo shows how to use MQTT data of an IMU to set an object's orientation.
The following steps have already been performed in this project but are documented here for future reference:
The MQTT Client uses this library since it supports UWP apps which run on the HoloLens.
- Downlod the source code from https://github.com/eclipse/paho.mqtt.m2mqtt
- Open its Visual Studio solution. There should be five projects but only the .NET and .WinRT projects are relevant.
The other projects might display warnings for missing components and references but there is no need to install additional components for them since they are not used.
- Open the Properties of the .NET Project and under Application set the Target Framework to 3.5
- Build the two projects
You might encounter errors concerning the TLS versions in a switch-case block of the file
MqttNetworkChannel.cs. Since it is not needed, comment out the two cases which show errors.
- Open a file browser and navigate to the subfolder
obj/Debug. It contains the dll-filesM2Mqtt.Net.dllandM2Mqtt.WinRT.dllwhich need to be integrated into the Unity project.
The DLLs are imported as Plugins. Plugins need to be placed in the folder Assets/Plugins. Additionally, the folder structure indicates for which platform the plugin works.
For the final UWP app, the M2Mqtt.Net.dll file not required. It is only added to the project in order to debug the MQTT functionality in the editor.
- Create the folder
Assets/Pluginsin the Unity project. - Copy the file
M2Mqtt.Net.dllinto the created folder. - Open the Unity Editor, navigate to the copied file and change its settings in Unity's Inspector to Editor.
4. In the Plugins folder, create a subfolder named WSA.
5. Copy the file M2Mqtt.WinRT.dll to this new subfolder.
6. In Unity's Editor change the settings of the dll in the Inspector to WSAPlayer.

