Lab 2
Due Friday 2/5 - 11:59pm
The goal of this lab is to expose to you network programming using the SPOTs.
Step 1
Step 1
- Run the TelemetryDemo.
- In the TelemetryDemo directory you will find two subdirectories. First, deploy the TelemeteryDemo-onSpot project to one of your SPOTs.
- Next, attach your basestation and run the TelemetryDemo-onDesktop program.
- With the basestation attached, you can open a terminal window, cd into the TelemetryDemo-onDesktop directory, and type "ant host-run".
- Alternatively, you can create a new SunSPOT Host Application and import the appropriate code.
- A Sun SPOT Host Application is a standard Java application that can use the standard Java libraries and can also access the radio and other components of the attached basestation. It is a bridge between the sensor network and the Internet.
- Run the HTTPDemo.
- Make sure to read the README for this application.
- You will need to first deploy the code to the SPOT, then you will need to attach a basestation and run the socket-proxy-gui. The socket-proxy is a program that receives packets from the SPOT network and forwards them over the Internet to the intended receiver.
Step 2
Step 2
For step 2, you will implement two components:
- Create a project called SPOTTempReporter. Implement a program that runs on a SPOT. Every 1 second, the program will read its temperature and send its reading, along with the current Date/Time, to a program running on a host computer/basestation.
- The SPOT will broadcast its packets. See the RadiogramConnection documentation for an example of how to broadcast a Datagram packet.
- The packet payload will contain the temperature and date.
- Use the sleep method of the Utils class to enable the SPOT to pause for 1 second between readings.
- Your program will run indefinitely.
- Create a project called TempCollector. This should be a "SunSPOT Host Application" project. Implement a program that creates a DatagramConnection that listens for broadcast packets.
- When a packet is received, record the address of the sender, the temperature, and the date/time of the reading. This data should be appended to the end of a text file on the host computer.
- Listen indefinitely for newly arriving data.
Submission
Submission
- For full credit, you must upload your code to your SVN repository. Upload your code into directories using the following naming convention. Failure to use this exact naming scheme may result in deduction of points.
- <username>/cs685/lab2/SPOTTempReporter
- <username>/cs685/lab2/TempCollector
- See this SVN How-to for more information on using SVN.