How to develop a new Protocol

From AGILE IoT Wiki
Revision as of 13:17, 3 September 2018 by Cskiraly (talk | contribs)
Jump to: navigation, search

Work-in-progress.png

Create a repo with agile-<yourprotocolname>

The easiest way to develop an AGILE protocol is to take one of the examples. We recommend using agile-ble or agile-dummy.

These two repositories both use the Java implementation of the AGILE protocol API called agile-dbus-java-interface. Alternatively, you can also implement the same API in your own service.

Customize you agile-stack by adding your new container

Make sure a proper Dockerfile is created as well (see examples in the above repositories).

Then, add your protocol to the AGILE stack. For this, edit docker-compose.yml of agile-stack, and add a new block with the agile-<yourprotocolname> service. Make sure it connects to the Agile DBus as the example services above. The following is an example of what should be added.

 agile-<yourprotocolname>:
   container_name: agile-<yourprotocolname>
   image: agileiot/agile-<yourprotocolname>-$AGILE_ARCH
   build: <path to yourprotocolname code>
   depends_on:
     - agile-dbus
   volumes:
     - $DBUS_SESSION_SOCKET_DIR:/usr/src/app/.agile_bus
   environment:
     - DBUS_SESSION_BUS_ADDRESS=unix:path=/usr/src/app/.agile_bus/agile_bus_socket
   restart: always

Note that the build line should be anabled and point to the folder containing your code.