Code generator for bluetooth low energy services - Oliveira, Pedro Filipe (2018)
The Bluetooth Low Energy (BLE) is an important part of the revolution that started around the internet of things, namely to connect smartphones to all kind of devices, like watches. The BLE is a service--oriented architecture, where one of the devices assumes the role of server (also designated by central) and the other assumes the role of slave (also designated by central). The server is the device that contains the data and the slave, the one that requests data to the server. The smartphones typically play the central role, motorizing and controlling one or more peripheral devices. The BLE standard includes a set of profiles, each one defining a service, and the idea was to promote a normalize set of services, that should be supplied by the hardware manufacturers, to promote the fast adoption of the BLE technology by the software developers community, namely the developers of the Android, iOS, Windows Phone and others mobile devices operating systems. As consequence, it was quite fast to the market be invaded by a significant number of software applications, even when most of the smartphones, tablets and computers available on the market are not yet prepared for this technology. But the expectations are very high and the number of profiles included on the standard is restricted and, of course, does not cover all the necessities. The implementation of new services is not a simple task. The technology is too fresh (there are few examples, documentation, support and experts available on the market); the implementation is very dependent of the chip characteristics and resources; the BLE specification is not very accessible and uses a wide range of technologies; the available implementations of the BLE stack use very distinct architectures, implying distinct ways of implement the services; and all the code is implemented at a very low level, with all the natural constrains and difficulties common to this level. Confronted with all these problems, the authors of the paper implemented a code generator to assist on the development of BLE services. Presently, the generator, which is a prototype, produces C code for only one family of chips, the nRF51 -- one of the most used BLE chips of the market. But the code generator architecture, based on the builder design pattern, ensures that the expansion of the generator, to produce code for other chips, is possible and not difficult to do. The implementation details of this generator are explained along this paper.