EoT control mode java - EyesOfThings/Software GitHub Wiki

Index

  1. Introduction
  2. Use of the Application
  3. Limitations
  4. Dependencies
  5. Additional information

Introduction

The MQTT application only requires an MQTT library that connects the client with the broker through a network connection in order to send and receive small messages. There are many open-source MQTT client libraries available for a variety of programming languages such as Java, JavaScript, C, C++, C#, Go, iOS, .NET, Android, or Arduino.

Here, the EoT Desktop MQTT client has been developed in Java using the Paho Java Client library. That way, the same code base can be used for both desktop and Android applications.

Clases

The EoT MQTT application is divided into two clases:

  • EoT_MainFrame. Contains the code of the graphical user interface.
  • EoT_MQTT_Client. Manages the Paho client and provides all the functionalities needed.

Use of the Application

The application is divided into three tabbed panels:

  1. MQTT Client panel. Contains the functionalities of a typical MQTT client.
  2. Configuration panel. Allows the user to configure the EoT device and manage the files stored in the SD card.
  3. Snapshot panel. Where the user can request a snapshot from the EoT device camera.

Before connecting the EoT Control Mode Desktop application to the EoT device the computer should be connected to the EoT device AP. Once the computer is connected to the EoT device AP, the MQTT client can be connected to the Pulga broker using the correct IP address and Port. After that, it is possible to use the application as a common MQTT client, performing topic subscriptions and publishing messages to topics.

In the Configuration panel there are options that allow the user to configure WiFi and time and manage Flash and SD card memories. The EoT device WiFi configuration includes options to:

  • Create an AP with new parameters.
  • Connect the device with an existing AP.
  • Reset the device AP settings to the default profile.

images/configurationPanel.png

If the device's WiFi configuration is changed, the desktop application is restarted and the user needs to connect the computer to the new device AP or the same wireless network the device is connected to. Then, the client-broker connection should be established again.

In order to set the current time values in the EoT device it is possible to use the Date & Time settings provided in the desktop application. This allows the user to get the current time of the computer and set them in the device. In addition, it is possible to check the current time of the EoT device.

Finally, the SD card management options are divided into two parts. The first part shows the directory tree of the SD card. Through the mouse right click the user can delete the content of a directory (including the root directory), delete a directory and its content, delete a file and create new directories. On the other hand, the second part allows to upload and download files to and from the SD card.

Note that when the EoT device is in AP mode (by default) only one client can be connected to it. This is considered a desiarable feature in terms of security. On the other hand, the Java application was tested with up to three clients. In order to do this, a device (Android smartphone) was used to generate a Wifi AP, and then the EoT device plus other two devices connected to that same Wifi and exchanged messages that were brokered by the EoT device.

Limitations

In some cases, the MQTT client sends the unsubscribe message through a different socket than the socket used during connection. Since the broker uses the socket number to identify each client, an unsubscribe message through a different socket cannot be managed by it.

This behaviour only occurs when the client tries to send the unsubscribe message to a reserved topic. Therefore, the broker unsubscribes a client from a reserved topic when the operation is completed. This is not considered a problem in practice but still it is reflected here for the sake of providing a more comprehensive description.

Dependencies

In order to configure an IDE for help with the development and compiling process you need import those folders:

  • EoT_MQTT: this folder contains the user interface of the program.
  • images: this folder contains the images used by the user interface.
  • paho: placed on ../../libs. This folder contains the mqtt library used on this app.

Additional information

Additional information can be checked in following links: