MobiChat is a communication and entertainment center for use on the nation’s highways. As families drive long distances for vacation, they form groups of cars traveling in the same direction. Using MobiChat, the passengers in one car can communicate, share files, exchange pictures, and play games with passengers in another car. Thus, MobiChat is actually a collection of several applications including instant messaging, file sharing, chat rooms, and game rooms. Instant messaging allows passengers to exchange text messages and photos in real-time. File sharing allows a passenger to share and exchange files. MobiChat allows passengers to create chat rooms. Chat rooms differ from instant messaging in that they offer n-to-n communication, whereas instant messaging is just 1-to-1. When a passenger types a message in a chat room, all other passengers in the chat room receive the message. Chat rooms are named and may be public or private. Any user can join a public chat room, but a user can only join a private chat room if invited by a user already in it (the user that creates it is automatically in it). MobiChat allows a user to take a picture and send the picture to another user, who can then save the image locally. Finally, MobiChat allows passengers to play games with each other. The two games offered by MobiChat are checkers and jumble. Checkers offers a team style of game play. When a passenger creates or joins a checker game, he must choose which color to be (either red or black). All players that are of the same color form a team that must coordinate their next move. Any member may perform the move. Once a move has been made, the turn goes to the other team. Jumble is a word-search game consisting of a two-dimensional array of letters with words hidden within it. When a word is found, the position of the word is distributed to all players. Thus, all of the participants cooperate in solving the jumble game.
How to use MobiChat
First compile the code using the included Makefile. In addition to the standard LIME packages (lime, groupmgmt, lights, comm, mucode, and location), MobiChat requires the additional packages:
com.sun.jimi- This is used by the picture taker to save images to the hard drive. It is provided in
examples/MobiChat/jars/jimi.jarand is also downloadable from http://java.sun.com/products/jimi/.
com.robix.qcam- This is used by the picture taker to take pictures that can then be sent to another user. It is provided in
examples/MobiChat/jars/Robix_QCam.jar and is also downloadable from http://www.robix.com/qcam_api.html.
To use the picture taker, be sure to install a Logitech QuickCam and install the QuickCam software available from http://www.logitech.com.
You can compile MobiChat by typing "make" in examples/MobiChat
This will create the class files in
examples/MobiChat/bin. To make the jar
file, type "make jar." This will create a jar file in
examples/MobiChat/jars. To run the
mobiChat.jar to your
change into the
To launch MobiChat, make sure the classpath is properly set and
This will launch the MobiChat program. The first thing the application will ask you is to enter your name. This name must be unique to each user. Upon entering your name, the following main screen will appear:
The main screen consists of a list of users, chat rooms, checker rooms, and jumble rooms that are currently available. In the figure above, it shows that there are currently currently two people running MobiChat (Liang Fok and Octav Chipara) and that there are no rooms available. right-clicking on the name of the user allows you to interact with that user. This is shown below:
If you double click on a user's name, an instant messaging screen will appear. Using this screen, you can exchange messages with another user. This is shown in the following image:
If you right-click and choose "Send a photo," MobiChat will display the following window that allows you to take a picture:
Once you are ready to take a picture, hit the "Take Picture button". You will be asked to enter a caption. Upon typing in a caption, MobiChat will deliver the photo to the recipient. The recipient will be given an option to accept or reject the photo. If he or she accepts the photo, the following will be displayed:
The user can then go to
File -> Save to
save the image to the local hard drive as a JPEG file.
The following three buttons are located below the list of users and chat rooms in the main screen:
The left button allows you to create a chat room. If you click on it, the following screen will appear:
This allows you to specify the name of the chat room and whether it is public. The name identifies the topic of the chat room. It should be unique to each chat room. Below the name is an option that allows you to choose whether the chat room is public or private. If the chat room is public, other MobiChat users can join the chat room. If it is private, you must invite other people to join it. Once done, hit continue. Once you hit continue, the following screen will appear.
The window on the right is the chat room that you have created. Notice that the list of available and participating chat rooms in the left window has been updated to reflect new chat room. This list is updated on all other users, which allows them to join the chat room at a later point in time.
Going back to the three buttons below the list of users and chat rooms in
the main screen, the center button allows you to create a checker room. Here
you can play checkers with another MobiChat user. Once a checker room is
created, other users can join it provided it is public. If it is private,
then a user can only join it if invited. A user is invited by going to
File -> Invite Buddy. A
checker room's interface is shown below.
The state of the game on on the left half of the window, while the right half allows you to chat with other people on your team, chat with your opponents, view the history of moves, and the statistics of the game. When you start the checker game, you are given a choice as to which color you want to be. Multiple people can be the same color. Those that share the same color are on the same team and must coordinate with each other when determining where to move. There is no team leader, instead, the first team member that makes a move is the move the entire team makes. A move is made by left-clicking on the piece you want to move, then right-clicking or double clicking on the destination position.
Going back to the three buttons below the list of users and chat rooms in the main screen, the right button allows you to create a jumble room where you can cooperate with remote MobiChat users in finding all of the words. It's interface is shown below.
Here there are words hidden in the two-dimensional array of letters. The goal
is to find the words. When a jumble room is created, other users can join it
provided it is public. If it is private, then a user can only join it if invited.
A user is invited by going to
-> Invite Buddy. Anyone in the jumble room can find a word. To find
a word, left click on the start of the word, and drag the mouse to the end
of the word. When a word is found, all other users are notified of the find,
and update their screens accordingly. Notice the tab at the top allows you
to chat with the other people trying to solve the jumble puzzle.
A file sharing button is located at the bottom of the main screen. If you click on it, the following will appear:
This screen shows you what files you are sharing and what files other users are sharing. It enables you to modify which files you want to share, and to download files from remote users. To download a file, simply double click on the file.
How MobiChat uses LIME
The main program in MobiChat is ChatUser. ChatUser is an agent that maintains
the main window showing the users and available chat and game rooms. It registers
to discover other users
game rooms have been
created. When MobiChat is started, the user creates a special user tuple space
that is named after the user. The creation of this tuple space results in a
being added to the
The presence of the new user is detected using reactions sensitive to this
tuple. The same general mechanism is used to detect for the presence of chat
rooms, checker rooms, and game rooms. That is, when a room is created, a tuple
space for it is formed. The name of the tuple space is the same as the name
of the room. The presence of this tuple space triggers a reaction informing
the ChatUser of
When a room
is closed, the tuple space for it is destroyed, which sets of another reaction
The InstantMessaging functionality is handled by the ChatUser agent. In addition to creating a chat user tuple space, it also creates a univeral tuple space. This tuple space is created and shared by all agents, forming a federated tuple space when they engage. Each user registers a reaction sensitive to instant message and picture tuples. These reactions are localized, allowing each ChatUser to only react to instant messaging and picture tuples that are destined for it. When a user sends another user an instant message, the sender creates an instant messaging tuple and OUTs it into the portion of the tuple space that belongs to the destination agent. The destination agent reacts to this tuple, removes it, and displays the message on the user's screen.
The ChatRoom subprogram is handled by its own agent. The chat room agent creates and shares a tuple space named after the chat room. It registers a weak reaction sensitive to message tuples within this tuple space. When a user types a message, a message tuple is inserted into the tuple space. The weak reactions of all agents react to this message and display the message. Each time a user types a new message, the old message is removed prior to the new message being inserted. Thus, the federated tuple space contains at most one message per user.
The CheckerRoom subprogram allows players to face off in a game of checkers. Each CheckerRoom instance has an attached ChatRoom that allows players to exchange messages while playing. Each move in the CheckerRoom is represented as a tuple and placed in the tuple space via an out operation. These tuples are ordered and remain in the tuple space till the end of the game. This allows new users who join the game in the middle of the game to reconstruct the sequence of moves that have been executed since the beginning of the game. When a new move is OUTed, the other users react to it and update their board accordingly.
The JumbleRoom allows players to compete in a jumble game. When a new game is initiated, the game board is represented as a tuple and placed in the tuple space via an OUT operation. Any player who connects can download the game. The JumbleRoom subprogram fosters disconnected operation because, after downloading the game, a player can disconnect (disengage) from the other players and continue to work on the puzzle. When the players re-engage, their agents exchange information about the words found using reactions sensitive to the word tuples..
The FileSharing subprogram uses LIME tuple spaces to transfer data between
connected parties. When a user shares a file, the file
sharing agent inserts an advertisement tuple into the tuple space. This advertisement
contains the name of the file
and is accessible by all other file sharing agents within the group. If another
user is interested in this file, double-clicks on the file causing his file-sharing
agent to insert a
into the tuple space. The advertising agent reacts to this and responds by
FilePacket tuples into the
tuple space. Each
contains a sequence number and a portion of the file. This was done to avoid
transferring large files over
an unreliable, low-bandwidth, wireless communication link. By splitting the
file into numerous pieces, the agent that requested the file can gradually
download the file and re-assemble it once all of the pieces are obtained.