====== Content :

This folder contains the collect application "sensevid_collect.c"
adapted to be used with a traffic trace file produced by senseVid.

- collect4NodesSink1Source2.csc : already configured cooja simulation
with 4 sky motes where node 2 sends the video packets to the node 1
(the sink).

- hall_qcif.avi : the original video

- hall_qcif-sim : is the output directory of the following 
  		sensevid hall_qcif.avi -f 1 -g 18 -w 88 -h 72

  This produces trace files with frames having half size of the
  original qcif video. Only 1 frame per second is captured. -g option
  allows to produce some S-frames.
	

- client.py : a python script that allows to transmit transmission
  commands to the sender mote (sensor)

   ./client.py -h to get the list of arguments 

====== Cooja simulation :

~/contiki-3.0/tools/cooja$ ant run
Open simulation collect4NodesSink1Source2.csc
Start simulation and wait until the message "READY TO SEND"
In a terminal :
     	      nc localhost 60001 > rt
In another terminal  :
   	     ./client.py localhost 60002 hall_qcif-sim/st-packet
for real time transmission or :
    	     ./client.py localhost 60002 hall_qcif-sim/st-packet 0.2
where 0.2 seconds  is the inter packet delay

At the end of the simulation, rebuild rt-packet to get same structure as
st-packet, using :

awk 'FNR==NR{seq[$1]=$1;next}{ if ($2==seq[$2]) print $0}' rt hall_qcif-sim/st-packet > rt-packet

Then, to decode the received frames and get statistics on them :
      	 	sensevid hall_qcif.avi -r rt-packet

=======How to produce collect4NodesSink1Source2.csc :

- Open a new simulation
- Create Motes (choose the type of motes)
- Browse and load sensevid_collect.c
- Compile
- Create, choose the number of motes you want, minimum 2 (sender+sink)
- Right click mote 1 (sink) --> Mote tools for ... --> Serial socket (server) and start the socket server
- Do the same thing for mote 2 (source)
- You can also open a small window to show serial mote activity by right click on motes 1 and 2.
- You can save the simulation or proceed by starting the simulation by following the steps (above)


