15-446 Projects

Project 1 Final

This will take longer than the check point. So please start early.
Assignment 2 is part of the Final Project and is due sooner. Do not start the coding after the deadline of Assignment 2. Start earlier.
Project Document
All-inclusive tarball

Old ones
Project tarball
Checkpoint Solution and some update

FAQ

Running the emulator/eclipse on linux.andrew.

The emulator does not connect to the ruby server. What should I do?

If you see the message below, it means you did not update some of the files. strings.xml, FileSharereActivity.java, and FileShareService.java need to be updated with the ones included in Checkpoint Solution and some update.
V/CS446 FileShareWorkerThread( 157): Connecting to null:10001

What is the lasted version? What files should I use?

The best thing is to use All-inclusive tarball. This contains the most recent version for all files.

If you already have a working version (download from various sources) and just want to make sure if you have the latest, here is the list.
Checkpoint Solution and some update contains recent versions of the following files.

Project tarball contains recent versions of the following files.

The latest version for the ruby server was sent via email.

What are the four files we need to run?

control2.xml, control3.xml, control3-a.xml and control4.xml

Project 1

Project Document
Project tarball
Android Overview

Hand-in instruction

Hand-in directory is the AFS directory below.
/afs/cs.cmu.edu/project/cmcl-srini-4/15-446/handin/S09_project1
Use your own directory. Copy the entire directory tree for the project. I gave access to your andrew accounts

To facilitate grading, DO NOT close the CS446Sockets after you have established a single connection per every pair of connected nodes. At the time of advaceTime() call, I will check whether there are only one connection per each connected node. So only close the duplicates.

Additional information on project 1

Files to edit

For the checkpoint, you need to touch two files in edu.cmu.cs446.project1. You do not need to change the edu.cmu.cs446.ta package. Inside the project1 package, you need to add the part to send broadcast messages, and processes broadcast messages that are received through the call back function. The call back function is called by the Worker thread whose implementation is hidden. You need to implement(or rewrite) the BroadcastReceiveCallBack.BcastMsgReceived() method. All it does now is to log the message. So it has to be rewritten. Just edit the BroadcastReceiveCallBack file directly.
I would setup a singleton class that stores all the connectivity information so that both BroadcastReceiveCallBack and FileSynchronizerThread can access it. Keep track of the devices near-by (inside BroadcastReceiveCallBack), and make a connection using that information (in FileSynchronizerThread).

You may rewrite everything in cs446.project1 package, as long as you keep the structure in FileSynchronizerThread.run(). You can rename/rewrite functions in the middle part of run(). But keep the bottom and top part. See the comment in the code. AdvanceTime() is important as it advances time and changes the connectivity. For grading purposes, do not close all the sockets, but leave open a socket per each peer. Remember that you have to have a connection to every connected pair at the end of each 'time slot'. So leave them open in order to facilitate grading.

You may delete the TestThread inside FileSynchronizerThread as it was just provided as an example use of the socket API. Read the comments in the code.

What does the start up code do? Where do I start from?

FileShareWorker does mainly server communication, and it starts up the FileSynchronizerThread. When it starts up, it connects with the local server, sets up communication channels between android emulators. After connection setup, it receives the connectivity information from server and it directs to the local server all data communication between emulators using the communication channels.
To support broadcast, it spawns a thread that listens to broadcast messages sent by other emulators and calls the callback function whenever a broadcast message arrives.
To get started, in Broadcast receive callback function, I would record the information in a singleton class that acts like a global variable so that FileSynchronizerThread can access the information to connect to other emulators.

Accessing Logs

We do not have any UI for the application. That also means we can't tell what's going on, what the application is doing, etc. All information is logged using Log.*() API, which is part of the Android SDK. So we need to see the log to find out what's going on and if everything is fine. In order to access the log content, run logcat from the Android shell. (or adb -s emulator-\ shell logcat). It can be also accessed from eclipse if you run the application in debug mode, and change the perspective to 'Debug' from 'Java'. But if you want to get logs for multiple androids, I think the adb command is easier to manage. For details on adb commands, refer to \url{http://code.google.com/android/reference/adb.html}

Where do I find the API?

For the API to use for the project, refer to Android Overview for class defined APIs, and Android Documentation for APIs provided by Android SDK.

How to run servers with different configuration file.

./serv {filename}
By default it reads control.xml. You can specify the configuration file you want to use by giving the filename as a command line argument.

How many emulators should I run?

XML configuration file tells you the total number of androids (nodes attribute). With that you can specifiy or figure out how many emulators you should run. You have to bring up the specified number of emulators to make it running. The FileSynchronizer thread does not start until all applications have started on all emulators. On starting multiple emulators on Eclipse, refer to the lecture note.

I have two copies of FileSynchronizerThread. FileSynchronizerThread.java and FileSynchronizerThread_new.java

Sorry. Delete(ignore) FileSynchronizerThread_new.java. I updated the tarball. It shoudn't have FileSynchronizerThread_new.java now.

Project 2

Project 2 should be done in groups of three.

You should strongly consider using either Subversion or CVS to perform source code control for your project and your writeup describing it. I suggest Subversion.


Last updated: Thu Apr 09 13:21:13 -0400 2009 [validate xhtml]