| |
| Problem Statement |
To design an address book containing
the names/aliases, phone numbers and addresses of contacts. The
address book application is to be developed for the PocketPC platform
using MFC and WinCE API on the embedded Visual C++ platform. The
application is to be finally deployed on the Ipaq handhelds provided. |
|
| Front-End Implementation Details |
|
| |
User Interface |
To be designed using MFC classes. Application should have a menubar
with a single menuitem - the "File" menu. This menu should give the
user four options - "Open", "Save As", "Sync" and "Exit". The "Open"
option is to enable the application to import a text file as the
current database. The "Save As" option would save the current database
as a normal text file. The "Sync" option will initiate a
client-initiated (ipaq initiated) sync operation, to synchronize the
database on the ipaq with the one on the desktop. An SDI view is to be
implemented (shown below). |
|
| |
|
|
|
|
 |
|
| |
|
Contact Management |
The user should be able to tap in
(stylus input) the name/alias, phone number and address of a person.
After doing so, the user taps either the "Add" or the "Search" or the
"Delete" button. |
|
| |
|
|
Add |
To enter a contact into the database,
at least the name and the phone number must have been entered. A name
that is already in the database cannot be entered into the database
again. In case of the above two errors, an errorbox should show up,
showing the appropriate error message; on clicking "OK" to this
errorbox, the focus should return to the application - no need to
erase any of the text in any of the three edit boxes. If the record
doesn't exist in the database, only then add it. Look at "Database
Structure" section for error-handling when database is full. |
|
| |
|
|
Search |
Should initiate a search query on the
database, indexed by the case-insensitive form of the name string. In
case the name is found, show the record, else show and errorbox
telling that the desired contact wasnt found; on returning to the
application, do not erase the data already entered in any of the text
boxes. |
|
| |
|
|
Delete |
This query requires only the name
string. Search the database for the desired contact. If found, display
it, and show a confirmation box, confirming that the record is to be
deleted, and then proceed to delete it; then erase the text in all the
edit boxes and then return to the application. If the record was not
found then show an errorbox, with the appropriate error message; donot
erase any of the text in the text boxes on returning. |
|
|
|
|
|
|
|
|
| Back End Details |
|
| |
|
Database Structure |
Each contact should be stored as a
fixed length struct - struct contact{
char name[25];
char phone[10];
char address[125];
} The database is to be maintained as a binary file(the standard
binary file that is supported by C, when using stdio.h). Use file
handling API like open(), seek(), read(), write() and close() - the
standard file handling API. Pad up the empty characters in any
field(name or address) using empty spaces). When given a record to be
written/read/searched, take the name field of the record, apply a hash
function to it. The number that you get will give you a page number in
the database file. Each page shall consist of 10 contact structs. The
hash function should generate numbers in the range 0 to 99 only.
This hence, ensures a fixed file size for the database. This also
makes collision handling very simple. Populate your database initially
with empty records - any record with a phone number of 0000000000(ten
zeroes) is an empty record that can be filled in with a "real" record.
So, in case, we are searching for a person called "Sara". If that
hashes to the number 45, then we know that we are looking at the 45th
page. So we seek 45 times 10(number of records in a page) times
160(the size of a "contact" struct). And from that offset onwards, we
read the next one page (ten "contact" structs) into an array. We then
sequentially search the array for the desired name. In case the
desired operation was an add, we write to the first empty array
slot(will have a phone number of 0000000000), and then write back the
whole array to "disk". In case no empty slot is found, an errorbox
should be thrown up saying that database is full. Make sure that all
adds/deletes are committed instantly "to disk". |
|
| |
|
|
|
|
For sync-ing the database with the
database on the desktop, take a look at the StockPor example and
Visual Studio Documentation(Help Menu in VC++, go to the "Contents"
tab -> MS Win CE -> Connectivity Services -> Programming ActiveSync ->
The Sample StockPor application). The eVT should provide you
sufficient code (look in the "Contents" tab -> PocketPC 2002 SDK->
Supported Win CE API Reference; MFC - sample projects etc) to complete
the whole project without having to write much code- it should be a
cut copy paste exercise. |
|
| |
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|