April 2017
Intermediate to advanced
280 pages
6h 18m
English
Now, we will take advantage of the last will and testament feature. We will create the main class named Main that uses the asynchronous API of the Paho Java Client, the previously coded SecurityHelper class to establish an encrypted connection with an MQTT server, and the SensorsManager class to process the received messages with commands. The code will configure a message to be sent as the last will when the connection is lost. In addition, the Main class will call the loop method for a SensorsManager instance to publish messages with data retrieved from the sensors when they are turned on with the appropriate commands.
We will split the code for the Main class into many code snippets to make it easier ...
Read now
Unlock full access