Java Reference
In-Depth Information
Chapter 9. Advanced Application: Blood Sugar Log
IN THIS CHAPTER
Requirement Analysis
Day Log
Persistent Storage: The LogStorage Class
The User Interface
This chapter demonstrates building integrated software that utilizes various CLDC APIs and
provides interfaces for both MIDP and PDAP while using identical classes for data handling.
Further, the application demonstrates the combination of the low-level and high-level MIDP API.
Here, we use blood sugar logging as an example application. People suffering from diabetes often
keep a daily log of their blood sugar level in order to keep track of their blood sugar values and
adjust the amount of insulin for their daily injection accordingly. They keep a record of their blood
sugar levels at several times every day. Our application can help those people by enabling them to
use their PDA or MID for keeping their daily log.
The purpose of this application is to log blood sugar values and graphically display the blood
sugar measurement values that have been taken during one day. However, the main purpose of
this application is to demonstrate the separation of the application logic from the user interface
and combine various CLDC APIs in a single program. Parts of the program can be reused for
building your own applications. For example, the graphics display could be used for building a
stock quotes display.
We will also utilize the example to show efficient binary search on record stores.
Requirement Analysis
The first step in building our application is to do a requirement analysis. What functionality will
the application perform? Here, we want to provide the following functionality to the user:
Display the blood sugar values of the current day as a diagram, as shown in Figure 9.1 .
The x-axis is the time, ranging from 6 to 22 o'clock. The y-axis is the blood sugar level in
mg/dl ranging from 40 to 280.
Figure 9.1. The running BloodSugarMidp application showing the logged
blood sugar values of the current day.
Track hypoglycemic values that are lower than 80 mg/dl and hyperglycemic values that
are higher than 160 by drawing red lines on the chart at 80 and 160 mg/dl.
 
 
 
Search WWH ::




Custom Search