Export to GitHub

looci - FirstDeployment.wiki


Introduction

In this section we explain how to deploy LooCI components and wire them to the event bus using LooCI-SunSPOT. We deploy two components; a TempSensor and a TempFilter component, and wire the two together so that the filter component receives the temperature events of the sensor component.

To deploy, wire and introspect LooCI components we developed a SunSPOT host application, called the LooCI Manager, which provides a telnet interface via which a user can interact with a LooCI deployment on a SunSPOT network.

Prerequisites: * Make sure that you have .jar files of the TempSensor and TempFilter components at hand. You can build them as explained here. * Make sure your SunSPOT environment is set up with a shared basestation as described here. * Make sure you have flashed the SunSPOT(s) in your setup with the LooCI library as described here. * Make sure the LooCI runtime is up and running at the targeted SunSPOT. Reset the SunSPOT after it was flashed. Led 8 should turn red to indicate the LooCI runtime was started and then turn orange to indicate no LooCI component is deployed.

Tip! To see what is actually happening on the SunSPOT themselves you can execute the ant echo command in a console window. Make sure though that you are in a SunSPOT directory (containing a build.xml file) to be able to execute this command!

The LooCI Manager can be started by executing ant host-run in the /gateway directory in your LooCI directory.

Once the LooCI Manager is running, the output should include the following line. [LooCIManager] listening to the network on port 6666

You should then be able to setup a telnet session to it using the following command. $ telnet localhost 6666

The output should be similar to: $ telnet localhost 6666 Trying ::1... Connected to localhost. Escape character is '^]'.

Note that the telnet client doesn't have to run on the same machine as the LooCI Manager. In case these are separate machines replace the localhost parameter in the previous command with the IP address of the machine running the LooCI Manager.

With the telnet session successfully started, we can now begin with the deployment of the LooCI components.

Deployment

To deploy a component to a SunSPOT, the 'deploy' command needs to be performed using the appropriate .jar file and the SunSPOT's IEEE address as parameters. In the telnet session perform a deploy action similar to the following in order to deploy the TempSensor component. deploy /YourPathToTheComponent/TempSensor_1.0.0.jar 0014.4F01.0000.55E5 => 3 The returned value of 3 is the component ID that was attributed to the component on the respective SunSPOT by the Reconfiguration Engine. Led 8 on the SunSPOT should now turn blue to show that at least one component is deployed on the SunSPOT.

Once the component is deployed, it needs to be activated. activate 3 0014.4F01.0000.55E5 => true Led 8 on the SunSPOT should now turn green, indicating at least one component is active on the SunSPOT.

These same actions need to be repeated for the TempFilter component as follows. deploy /YourPathToTheComponent/TempFilter_1.0.0.jar 0014.4F01.0000.55E5 => 4 activate 4 0014.4F01.0000.55E5 => true

Wiring

Wiring the two components together is realized by executing the following command in the telnet client. wireLocal 101 3 101 4 0014.4F01.0000.55E5 => true This command will result in the fact that on the SunSPOT with address 0014.4F01.0000.55E5, all events of type 101 (or EventTypes.TEMP_READING) published by component 3 will be delivered to component 4.

When successful, the echo output of the targeted SunSPOT will look like the following. ... [java] [LooCI-RE] Sending DEPLOYED event for component 3 [java] [LooCI-CP] Activating component 3 of type TempSensor [java] [TempSensor] Sending temperature reading with value 29 [java] [LooCI-RE] Sending ACTIVATED event to 0A09.204D.0000.ED37 [java] [TempSensor] Sending temperature reading with value 30 ... [java] [LooCI-RE] Sending DEPLOYED event for component 4 [java] [LooCI-CP] Activating component 4 of type TempFilter [java] [LooCI-RE] Sending ACTIVATED event to 0A09.204D.0000.ED37 [java] [TempSensor] Sending temperature reading with value 29 ... [java] [TempSensor] Sending temperature reading with value 29 [java] [LooCI-EM] New local subscription: event type: 101, source component ID: 3 - destination component: be.kuleuven.cs.distrinet.wsn.looci.application.LooCIComponentProxy@ab [java] [LooCI-RE] Sending WIRED event to 0A09.204D.0000.ED37 [java] [TempSensor] Sending temperature reading with value 29 [java] [TempFilter] Received a temperature reading: 29 [java] [TempSensor] Sending temperature reading with value 29 [java] [TempFilter] Received a temperature reading: 29 ...

Further explanations of the telnet commands can be found here.

Tip: A configuration file can be created in which all deployment, wire and introspection commands can be called. This file can then be called for execution in the telnet session to save time and effort in repeatedly having to enter the same commands. Once the telnet client is up and running you can execute this file by calling the following command as the first command entered: file path-to-file