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

From AGILE IoT Wiki
Jump to: navigation, search
Line 3: Line 3:
 
== Create a repo with agile-<yourprotocolname> ==
 
== Create a repo with agile-<yourprotocolname> ==
 
   
 
   
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]. These two repositories both use the Java implementation of the AGILE protocol API. Alternatively, you can also implement the same API. in other langauages.
+
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].  
 +
 
 +
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.
  
 
== Customize you agile-stack by adding your new container ==
 
== Customize you agile-stack by adding your new container ==
  
Make sure a proper Dockerfile is created as well (see examples in the above repositories), and add your protocol to the AGILE stack. For this, edit docker-compose.yml, and add a new block with the agile-<yourprotocolname> service. Make sure it connects to the Agile DBus as the example services above.
+
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.

Revision as of 13:17, 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.