At a high level the Contiki Argot project shows embedding a protocol meta data description in a small Contiki device. The meta data is used by a client to verify the definition of a protocol before sending a request to the device. Placing Argot meta data on the device allows each part of an interface to be versioned and allows clients to perform full protocol discovery on devices with only a few kb of read only memory. On the client side, a developer is able to use java interfaces which bind to the protocol description allowing fast development of clients. This form of protocol discovery allows tight binding between client and server while still maintaining loose coupling. For details of what the example shows you can read the details in the post from October.
If you're interested in trying out the example, I suggest downloading the instant contiki vmware development environment. From a command shell in Contiki get the project:
wget http://www.einet.com.au/files/ContikiArgot-1.0.0.zipTo build the server a small change needs to be made to the Contiki build system (applies to contiki-2.4). The following command will patch the makefile with the required changes:
unzip argot-contiki-1.0.0.zip
cd argot-contiki
patch -d /home/user/contiki-2.4In these instructions the server is being built to be run using the minimal-net configuration which is run on the unix host. This is useful for debugging and as a demonstration of the code. The Contiki minimal-net configuration uses the tap0 unix networking driver to put the host into a different network. This is configured in the “contiki-2.4/platform/minimal/contiki-main.c” file. I use ip 192.168.22.3, netmask 255.255.255.0, gateway 192.168.22.1. In the “contiki-2.4/cpu/native/net/tapdev.c” the tap0 configuration needs to be adjusted for your selected IP address. Around line 107, change the line “ifconfig tap0 inet 192.168.22.1” to match your configuration.
Following configuring the network components of the example you can build the server:
cd examples/testTo run the server:
make
sudo ./argot-server.minimal-netLeave the server running and open a different shell. To build the Java client code, two jar files need to be copied into the Apache Ant build libraries. This is a one off task:
cp lib/junit.jar /usr/share/ant/libYou can then build the java client by calling ant at the base of the project:
cp lib/ant-junit.jar /usr/share/ant/lib
antAfter the client has been successfully built, you can call the simple test code:
java -jar lib/contiki-argot-1.0.0.jar 192.168.22.3If everything is successful you should have an output that ends with “doSomething returned: 30”.
Obviously, this example is still quite rudimentary. However, it does demonstrate calling a Contiki based service which uses only a few kb of memory. It also shows a client which only requires a Java Interface to be coded to make the call. Next steps are to improve the functionality of the test and look further into the transport protocols used in this environment.