This application demonstrates a spatio temporal search through stored data and
reliable data transfer in the a security monitoring application. We need to configure
PC side and standalone motes. The application needs libjpeg. 

1) Pre-compile step
   
   a) Download jpegsrc.v6b.tar.gz from www.ijg.org/files. 
   b) Decompress sources and change directory to the directory which was created. 
   c) cp makefile.ansi Makefile 
   d) Run following commands 
      export AR=/usr/local/arm/bin/arm-linux-ar 
      export AS=/usr/local/arm/bin/arm-linux-as 
      export CC=/usr/local/arm/bin/arm-linux-gcc 
      export CXX=/usr/local/arm/bin/arm-linux-c++ 
      export LD=/usr/local/arm/bin/arm-linux-ld 
      export NM=/usr/local/arm/bin/arm-linux-nm 
      export RANLIB=/usr/local/arm/bin/arm-linux-ranlib 
      export STRIP=/usr/local/arm/bin/arm-linux-strip 
   e) ./configure
   f) make 
   g) libjpeg.a has been compiled for ARM architecture. Copy it to the lib directory of 
      arm-linux compiler.
   h) Edit camera_demo/Makefile.am and change the line 
      private_area_LDADD     = $(top_srcdir)/lib/libdiff_lib.la <path to libjpeg.>/libjpeg.a 

2) Configuring standalone motes.

   Each mote has to be programmed with the program which interfaces it with the PIR sensor.
   The program has been tested with Radioshack Passive Infrared motion sensors in normally open 
   mode. 
   
   a) Extract SensorInterface.tar.gz file in tos-contrib/s-mac/apps directory of CENS CVS

   b) Each standalone mote is associated with a particular PC device. For each mote edit 
      SensorInterfaceM.nc and change the parameter of the unicast function to the S-MAC
      address of the mote on the corressponding PC device. Save it and program using
      make mica2 install.

   c) Connect each mote with the sensor and place it near the associated PC device.

3) Configuring PC side

a) Compile the camera_demo application which ships with diffusion. Note that libjpeg.a
   is required. Two executables will be created sink and private area.

b) Synchronize the clocks of all the PC devices. This can be done using rdate or ntp.

c) Place the PC devices approximately 1m apart (This restriction will be removed in coming 
   versions.) In environment variables x and y provide the location where each device is placed.
   For eg. if you want the location of a PC to be (100,100), in bash type.
  
   export x=100
   export y=100. 

   At device which camera is connected type

   export c=1.

   (In the future the camera will be autodetected.)

d) On sink node make a directoy /imgr. This is where the received
   image will be stored once it is received.

e) On camera node, mae a directory /imgs. This is where the images
   taken by camera will be stored.

f) On all devices start filter_core, one_phase_pull, two_phase_pull and rmst.

g) On the sink node start the sink executable. 

h) On all other devices start private_area.

3) Running the demo

a) After allowing enough time for the sink's interest to spread throughout the network and for 
   the local interest of each device to register (around 10 seconds after you start private_area on all 
   devices) walk at normal speed triggering the motion sensors.

b) At the node at which you want to start the search simply press enter. 

c) At the initiating node you will see x and y cordinates of locations which you visited and the 
   times at which you visited them. The demo concludes with a picture sent from the camera device to the 
   sink node.




