Air Analyzer v3.0.0

Introduction

After talking about, a dear friend suggested me a major change of this project: use a middleware for all the transactions between the database and the device, like the Android application.

Middleware is a type of computer software that provides services to software applications beyond those available from the operating system. It can be described as “software glue”. […] An IETF workshop in 2000 defined middleware as “those services found above the transport (i.e. over TCP/IP) layer set of services but below the application environment” (i.e. below application-level APIs). […] Middleware includes web servers, application servers, content management systems, and similar tools that support application development and delivery.

Wikipedia2022

Fortunately, I have been utilizing Lumen like a middleware but only for the Android application. In this post I want to share the changes both for device and the Android application.

Device

In previously version the device was the directly responsible to update the database with the new measures, through a MySQL Connector. It was the only one that check the measures and send to the database only if are corrects. But what happens if the measures are incorrect for one hour or more? What happens if the device is offline for some reason? For the principle of Separation of Concerns on Software Engineering, the measures must be checked by the middleware: specifically, by Lumen.

UML Deployment Diagram of system

With this new update, Lumen checks if the measures are correct or not. In this last case, will be generated a record into the new table Notification. Moreover, every hour check if the last measure dates back less than one hour; otherwise, will be generated a record into the same table. This new table will be utilized for the purposes of the Android application, to notify the user about the status of the sensor.

In addition, the device will be updated thanks to the static method update() of ESPhttpUpdate class. The update will happen with the OTA method: the device connects to the server, transmit the actual version and retrieve the new version if exist.

Finally, I’ve decided to change the color of case, like the photo below.

Restyling of device

Mobile application

Android Application has had several improvements. Firstly, I have decided to add the BottomNavigationView where the user can select if to see the last measures of all rooms, the trend of a specific room on specific date, the last notifications or to manage the settings.

Android App

I want to spend a few words about the notification functionality: was not implemented the push notification but has been utilized a WorkManager where requests the last notifications after specific time, set by the user from the settings. This WorkManager works in background when the application is closed, too. In my case, I spent several hours to understand why my Xiaomi Note 8 Pro did not allow this. The reason was related to the limitation of MIUI. Don’t kill my app! explains the reason and a possible solution.

Conclusion

This is the last major version of this project. The reason is that is a experiment about System and Integration, User-Centered Interface and Mobile Development. I have several ideas, but most likely will be not implemented:

  • recovery of password;
  • add secondary account;
  • indicators of air quality;
  • for the device;
  • the Lumen framework.

My desire has been to let this project sufficiently exploitable. Now, I would like to work to another projects. If you want, you can see two dedicated repositories from my GitHub account:

Thank you for reading this article!