# A Novel Software Architecture Solution with a Focus on Long-Term IoT Device Security Support
## 3 Software Architecture
Since it is necessary for the service and transport layer to communicate simultaneously with the mobile service application and the cloud over the Internet, it should be possible for the device to simultaneously be a WiFi client on the local network and provide a secure wireless access point service in the defined time frame upon booting. For these reasons, an ESP32 microcontroller is used as it supports simultaneous operation of the wireless network in client mode and access point mode. In case a different connectivity option is required in client mode, the device enables the usage of WiFi, or the direct connection to the GSM network through a serial connection. The dual-thread operation of the ESP23 microcontroller allows the operation and data processing layers to operate simultaneously with service and transport layers. The device can be used without network connectivity configured through an access point. Once configured, the device can also be used without telemetry or any other smart features if needed. However, with the telemetry option enabled, the device becomes part of a network that sends telemetry data to the cloud. The wireless client connection used to send data to the cloud does not allow inbound connections, and therefore reconfiguration via LAN is not possible. Figure 2: Proposed IoT architecture. The connection between the service and transport layer and the mobile device service application is achieved via direct connection access point. The connection between the cloud and service transport layer can be achieved via WiFi connection and GSM connection. Dual-thread operation additionally improves security in the event of an exploit running on the service and transport layer thread. A successful exploit blocks the thread, disabling the telemetry sending process in the worst case scenario (configuration time connectivity has likely expired). The operation and data processing layers continue to run as an independent thread, so the device is fully functional. The second thread is very similar to the performance of an edge layer, which allows the reconfiguration of devices and communication with the cloud at the defined frequency. The telemetry data were sent to the cloud over an insecure communication channel. The data are protected from tampering with digital signatures by providing a unique communication key to each device. The address of the cloud server is determined by the mobile service application. The address may vary depending on the location and client. For example, breweries being larger clients may require the installation of a separate telemetry cloud. When the device is manufactured, a factory programming application is used to initialise the microcontroller. Programming directly affects the first three layers of the architecture. The factory application is responsible for calibrating the sensor and verifying the device components. The specified application generates unique communication keys to ensure the security of the mobile service application. The security protocols are described in the next section in detail. The device can also be upgraded through a mobile service application during regular sanitation service or in case of emergency service caused by the device failure. Upgrades are not available through the cloud due to possible disruptions during the upgrade process. There is no indicator or display unit on the device to notify the user that an upgrade is in progress. Disruption of the device during the upgrade may result in the permanent failure of the device. The cloud as an application layer receives telemetry data over the Internet. Telemetry data can be inspected by the end user of the device, the owner of the device, and the manufacturer. From the telemetry data, data on beverage consumption, hygiene, regular service, and the energy consumption of the device at various specific locations can be obtained. The cloud analyses and forwards errors about the operation of the device and ensures timely service of the device.