Export to GitHub

looci - GettingStartedSunSPOT.wiki


As a User

Configuring the SunSPOT SDK to support LooCI

As a user you can easily develop LooCI components without having to worry about the internals of the LooCI runtime.

  1. Download the current LooCI jar-file and store it in the /lib directory of your SunSPOT SDK installation
  2. In your home folder, adapt the .sunspot.properties file to include the following line (check the real name of the LooCI jar-file): spot.library.addin.jars=${sunspot.lib}/multihop_common.jar${path.separator}${sunspot.lib}/transducer_device.jar${path.separator}${sunspot.lib}/LooCI_1.0.0.jar

    (Alternatively, if you have multiple SunSPOT SDK's installed and want to use LooCI in only one of them, include the last line in the default.properties file in the respective SunSPOT SDK home folder.)

  3. Rebuild the library by executing the following command in a SunSPOT directory (containing a SunSPOT build.xml file): $ ant library
  4. Deploy the new library to your SunSPOTs using: $ ant flashlibrary

Getting the LooCI examples

See below.

Setting up the deployment environment

See below.

As a Developer

In addition to developing LooCI components, as a developer you can also take a look at and change the internals of the LooCI runtime.

The first step is to clone the looci-sunspot repository using Mercurial. This is achieved by executing the following command in your local LooCI directory:

hg clone https://sunspot.looci.googlecode.com/hg looci-sunspot

This will create 3 folders in your LooCI directory: 1. /examples: this contains a number of LooCI components ready to use. 1. /gateway: this contains the gateway application which can be used to deploy LooCI components, perform wirings between LooCI components, etc. 1. /runtime: this contains the LooCI core runtime.

Configuring the SunSPOT SDK to support LooCI

The LooCI runtime code should now be present in the /runtime directory of your LooCI directory. To alter the source code, you can create a new SunSPOT project in you IDE of choice and include the /runtime folder.

To build the LooCI runtime code, perform the following steps:

  1. In your home folder, adapt the .sunspot.properties file to include the following line (check the real name of the LooCI jar-file): spot.library.addin.jars=${sunspot.lib}/multihop_common.jar${path.separator}${sunspot.lib}/transducer_device.jar${path.separator}${sunspot.lib}/LooCI_1.0.0.jar

    (Alternatively, if you have multiple SunSPOT SDK's installed and want to use LooCI in only one of them, include the last line in the default.properties file in the respective SunSPOT SDK home folder.)

  2. Build the code either in your IDE or by executing the following in your looci-sunspot/runtime directory: $ ant jar-app
  3. Copy the newly created LooCI jar file from your project's /suite directory to the /lib directory of your SunSPOT SDK installation.
  4. Rebuild the library by executing the following command in a SunSPOT directory (containing a SunSPOT build.xml file): $ ant library
  5. Deploy the new library to your SunSPOTs using: $ ant flashlibrary

Note that every time you change the LooCI runtime code, steps 2 up to 5 need to be repeated for the changes to take effect.

Using the LooCI examples

Some examples of LooCI components are provided in the /examples folder of your local LooCI repository. These are: * BlinkBlue: blinks a blue led * BlinkRed: blinks a red led * LightSensor: periodically senses the light intensity and publishes a LIGHT_READING event * LightFilter: subscribes to LIGHT_READING events and publishes LIGHT_READING events when a threshold is violated * TempSensor: periodically senses the temperature and publishes a TEMPERATURE_READING event * TempFilter: subscribes to TEMPERATURE_READING events and publishes TEMPERATURE_READING events when a threshold is violated * TempGraph: a LooCI host application which visualizes the values of incoming TEMPERATURE_READING events on a graph.

To build these examples, execute the following command in their directories: $ ant jar-app

The .jar-files of the examples can be used for deployment of the examples by the provided gateway application explained in the following section.

The TempGraph example can be used by executing ant host-run in its directory.

Setting up the deployment environment

A SunSPOT Host application, called LooCI Manager, that allows the deployment, control and introspection of LooCI components is provided in the /gateway folder of your local LooCI repository.

To use this utility, perform the following step:

  1. Edit the build.properties file in the /gateway folder so that the user.classpath property points to your local copy of the LooCI jar-file:
  2. Make sure the SunSPOT basestation can be used as a shared basestation. Therefore, in your home folder, adapt the .sunspot.properties file to include the following lines: basestation.shared=true basestation.not.required=true

    (Alternatively you can include these lines in the build.properties file in the /gateway folder.)

  3. The host application can then be started by executing the following command in its directory. ant host-run