Backend Logic BLO – Server-side code for IoT apps

Table of Contents

The measurement data is available on the platform. You want to make the data available to the users in a smartphone app. Before you forward the data to the existing third-party system, you combine the data from several measurement points and aggregate it with data from another provider. This and much more can be realised easily with Backend Logic (BLO for short).

What is a BLO?

A BLO (Backend Logic) is a process that is executed in the context of the application and can take over a wide range of functions. Because the code is executed on the server side, it can handle both very simple and very performance-intensive operations. This makes a BLO a very flexible component of a rapidM2M-Studio application.

What is a BLO needed for?

The classic areas of application for a BLO are the processing of measurement data and the connection of external systems. Communication with various APIs of ERP systems, cloud storage or monitoring systems can be realised easily and individually.

While comparatively little work/data memory is available on the device and the applications often have to work in an energy-saving way, this hardly plays a role on the server side. In this way, more computationally intensive processes can also be realised in the BLO.

Which technologies does a BLO use?

The backend logic is programmed in the rapidM2M Studio. NodeJS, an open source runtime environment that allows JavaScript code to be executed on the server side, forms the basis of a backend logic. A great advantage of this technology is the associated “Node Package Manager” – npm – which makes thousands of libraries freely available. Every single one of these packages can be integrated into a BLO with little effort.

Backend Logic in the rapidM2M Studio

What is the BAPI?

The Backend API is the heart of every Backend Logic. This extensive library enables easy access to customers, measurement points, measurement data and much more. All endpoints of the myDatanet API can be used with it.

BAPI.subscribe()

The subscribe() function, which makes it possible to react to various database events, should be emphasised. To do this, you first have to subscribe to the required area – for example, measurement data – and from this point on you are automatically notified of every create, update or delete event. If new measurement data are delivered by a device, they can be immediately forwarded to an external system.

BAPI Subscribe

BAPI.extend()

Another very useful feature of the BAPI is the extend() function. With this function, the myDatanet API can be extended with additional endpoints. This is very useful, for example, to implement specific data formatting and then display it in aportal view (POV). It can also be an endpoint that offers ahealth status that is queried by a monitoring system at regular intervals.

Summary

A Backend Logic (BLO) is a NodeJS process that runs on the appliance. The BLOs are developed with JavaScript, whereby it is also possible to use prefabricated packages from NPM to achieve the desired goal even faster.

The backend API (BAPI) is the interface between myDatanet and BLO. On the one hand, this allows the extensive myDatanet API endpoints to be used and, on the other hand, it allows you to react to a wide variety of database events.

The broad field of application of BLOs can range from simple measurement data forwarding, to individually adapted alarming, to the complete connection of external systems.

Would you like to learn more about Microtronics?

T32x rapidM2M Studio
Blog

IoT App development in the rapidM2M Studio

From the creation of a project in the rapidM2M Studio development environment to the release of the IoT App, several steps are necessary. The rapidM2M Studio supports you with convenient functions and a structured design of the IoT App. This is particularly useful with regard to maintenance and reusability of the code. Below we show you a best practices example and give you valuable tips.