CPE 5009 Internet Devices and Services

Assignment One
Semester 1, 2005

Introduction

This assignment is the first of two, and deals with what devices might look like in Java programs, and how they might call methods on each other. This is simplified to the situation in which all devices already know about each other and exist as Java objects in the same Virtual Machine. Issues about how devices find each other and how they communicate is left to extensions and the second assignment.

This assignment looks at how home devices such as TVs, etc can be controlled by a simple wireless device using Java MIDP. This shows how dedicated infrared TV/video/CD/etc controllers can be replaced by a single programmable device, where you write the program.

This assignment has graded levels. The simplest version will be given a Pass if done satisfactorily, but to gain higher grades more features will have to be added.

Details

Assume all devices are Java objects running on a MIDP device. This assignment is about controlling these devices using a program written for a MIDP device. All devices will be "fake" devices, not actually controlling anything at all.

In the networked home of the future, all devices should be controllable from any of a number of control centres: your main PC, the TV, any remote control, the car, etc. This assignment is about controlling some common devices from a MIDP device. It will control the

The TV

The TV tuner can be switched on or off, or select channels (by up/down or channel number entry). If on, it can also be queried for current channel.

The CD player

The CD player can be switched on off, play a CD, skip tracks, restart, or eject the current CD. It can be queried to see if it contains a CD, is playing a CD and if so, which track

The amplifier

The amplifier can be switched on off, have its volume increased or decreased. It can also be switched between TV and CD input

Device specifications

You will need to define Java interfaces for the three classes of device

Dummy implementations of these will need to be written, which can just write requests to standard output - you don't have to play sounds or show movies. The messages can be of the form "TV: switching to ABC" for example.

Device controller

You will need to write a MIDP application that creates a TV, CD player and Amplifier object. It should display a menu of choices between the three devices. When one is selected, it should display the current status of the device and allow this to be changed.

Deliverables

You should hand in the following

You will be asked to demonstrate your system during your tutorial, in addition to handing in the above materials.

Assignment levels

The specification given above will gain a Pass grade if done satisfactorily. Higher grades will be given on completion of additional functionality. Each additional function will gain an extra grade. The additional levels will be added to, but at present are

HTTP devices
Assume each device is at a fixed IP address, and is running an HTTP server. The local dummy implementation should be replaced by a connection to the HTTP device (which is then a dummy). For example, a request to the TV for current channel could become an HTTP CGI request for url

      http://192.168.1.10?get_channel
      
TCP devices
As with HTTP, but using TCP sockets
SMS devices
As with HTTP, but using SMS
Telephone
The TV, CD player and amplifier are all synchronous devices which can be controlled but do not generate any events. Add a telephone as an asynchronous generator of events: the phone can ring, it can be answered and the phone call can finish. Add event handling so that
Push
Make some of the services into push services, which are awoken when telephone events arrive
Serial port
The Sun emulator has support for the serial port. This is only documented in the source code for api/src/com/sun/cldc/io/j2me/comm/Protocol.java in the CLDC package. This will probably not be portable to other KVMs. A Connection object to a serial port can be opened by e.g.

      Connector.open("comm:0;baudrate=9600;bitsperchar=7") 
      
The options are separated by semicolons ";" and are of the form option=value. The possible options are (with sample values) Connect a "thermometer" to the serial port which will write the value of the temperature to the port at intervals. Monitor this temperature and show it on a tickertape using the Ticker class. The thermometer can be implemented using a null-modem connection to another computer which writes values to the serial port.

Group size

This assignment (and the next one) may be done in groups of two. Requests to form a group of three or more will not be accepted, even if your partner disappears the day before the assignment is due, having done no work. While the assignment may be done individually, the same level of achievement of a two-person group will be expected.

Due date

The assignment is due at the lecture, Tuesday 26 April, the beginning of week 8.


Jan Newmarch (http://jan.newmarch.name)
jan@newmarch.name
Last modified: Sat Feb 19 12:07:12 EST 2005
Copyright ©Jan Newmarch
Copyright © Jan Newmarch, Monash University, 2007
Creative Commons License This work is licensed under a Creative Commons License
The moral right of Jan Newmarch to be identified as the author of this page has been asserted.