Difference between revisions of "How to develop a new Protocol"

From AGILE IoT Wiki
Jump to: navigation, search
m (Add "Work in Progress" icon)
(Customize you agile-stack by adding your new container)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[File:Work-in-progress.png|50px]]
 
[[File:Work-in-progress.png|50px]]
  
# Create a repo with agile-<yourprotocolname>
+
== Create a repo with agile-<yourprotocolname> ==
# Implement the protocol API (obviously, you can base this on existing protocol implementations)
+
# Add the .travis template
+
The easiest way to develop an AGILE protocol is to take one of the examples. We recommend using [https://github.com/Agile-IoT/agile-ble agile-ble] or [https://github.com/Agile-IoT/agile-dummy agile-dummy].
# Have the travis CI + DockerHub integration enabled
+
 
# Test it in agile-stack (branch agile stack; add your new container to it; test)
+
These two repositories both use the Java implementation of the AGILE protocol API called [https://github.com/Agile-IoT/agile-dbus-java-interface agile-dbus-java-interface]. Alternatively, you can also implement the same API in your own service.
# Make a pull request.
+
 
 +
== 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 [https://github.com/Agile-IoT/agile-stack/blob/master/docker-compose.yml 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.
 +
 
 +
if you use the Agile CLI, build your code with
 +
 
 +
Build you code using
 +
  agile compose build
 +
or directly with compose:
 +
  docker-compose build

Latest revision as of 14:26, 3 September 2018

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.

if you use the Agile CLI, build your code with

Build you code using

 agile compose build

or directly with compose:

 docker-compose build