Xiaojia Jiang
Final Report
Xiaojia Jiang
Student ID:830127
Supervisor:Dr. S. I. Woolley
I
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Final Report
Xiaojia Jiang
Student ID:830127
Supervisor:Dr. S. I. Woolley
II
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Acknowledgements
I would like to extend my sincere thanks and gratitude to the following people who
had supported me throughout the duration of this project.
Firstly I would like to thank Dr. Sandra Woolley for her advices and guidance. She
spent her valuable time for helping me in every crucial stage of my project, and she
also gave her strongest encouragement to me.
I am particularly grateful for the comments and suggestions my assessors gave to me
during the bench inspections. Prof. Bob Stone and Dr. Shiraz gave their best
feedbacks to improve my project.
Last but not the least, I would like to thank all the people who gave me support during
the development of hardware and who tried my application, answered the
questionnaires.
III
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Table of Contents
1. INTRODUCTION ---------------------------------------------------------------------------------1
3 INNOVATIONS -------------------------------------------------------------------------------------- 8
5 HARDWARE ---------------------------------------------------------------------------------------- 10
IV
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
V
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
10 TESTING ------------------------------------------------------------------------------------------- 37
12 CONCLUSION ------------------------------------------------------------------------------------ 41
13 REFERENCE -------------------------------------------------------------------------------------- 42
VI
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
List of Figures
Figure 16: the RS-232 signal from PC’S COM Port -----------------------------------------------24
VII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
List of Tables
Table 1: Meter’s port settings -------------------------------------------------------------------------10
List of Abbreviations:
VIII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
1 Introduction
1.1 Design Brief
For nearly two decades, electronic and communication technologies have been
proposed as means of supporting medical applications. This project is concerned with
using these technologies to create a personal health device which can benefit children
with diabetes.
This application combines multifunction from simple information-giving to
sophisticated real-time monitoring. The information-giving function serves as a
convenient way for professionals to track the medical history and personal
information of the child; the insulin-injection-reminder function is an alert tool to
assist children and their parents best control the daily injection; The education
function can greatly help children know about diabetes through interesting books and
games; The function of emergency contact gives the quickest way to contact a family
member in the event of an incident; As for the sophisticated function of real-time
monitoring, it integrates data transmission by Bluetooth and data analyzing by the
computing power within the phone. Bluetooth technology offers a technically
attractive solution to establish data transfer between a Glucose Meter and the mobile
phone. The aim of the real-time meter reading lets the patients monitor their real-time
blood glucose level, which can support the required frequency of insulin dose
adjustment for better diabetic management.
The innovative personal health
device is based on mobile platform
and Bluetooth technology. Further
details will be discussed in this
report.
-1-
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
-2-
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
-3-
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
medical system. And “telemedicine system has been proposed for nearly two decades
as a means of supporting people with diabetes to achieve improved outcomes.”[3]
Mobile phones with wireless communication offer a technically attractive solution to
data transmission. “Smart phone’s emerging capabilities are fueling a rise in the use of
mobile phones as input devices to such resources as situated displays, vending
machines, and home appliance. Mobile phone’s prevalence gives them great potential
to be the default physical interface for ubiquitous computing appliance.”[4]
In a word, telemedicine is an ideal system for the management of people with chronic
disease. “Integration of management between primary and secondary care,
encouragement of self-management of disease, and systematic monitoring of
measures of disease progression and control are complex issues and may lead to
problems that are difficult to resolve. Telemedicine system can incorporate innovative
approaches that may address these problems.” [3]
-4-
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
monitoring. The real-time data transmission and immediate data analysis can greatly
support the self-management of the diabetes.
-5-
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Figure 4: AwareMedia
AwareMedia is an application that
shows information about the work
in the different operating rooms. “A
video stream provides overall
awareness of a given operation’s
state, a progress bar shows more
detailed information about the
progress, a chat area lets people communicate in a less intrusive manner”
-6-
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
-7-
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
3. Innovations
A deep research of the related papers and projects reveals the potential further
improvements in the telemedicine system for diabetic management. Real application
of the mobile diabetic management should consider different user age group,
constrained mobile platform interface as well as special communication protocol
required by the meter. However, neither of the existent project nor the products can
combine all the considered characteristics to fit for all the potential users and mobile
platforms.
The project Smartphone for Children with Diabetes has such innovations with the fact
that it joins the functions of Diabetic Information Appliance, OneTouch Diabetes
software and Mobile Diabetes Management System as mentioned previously with
other useful features. It can not only download data from a glucose meter, provide
-8-
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
patient profile but also serves as a medical alert and education tool.
This project targets at a unique age group and unique mobile phone, more specifically,
the children and Vodafone V1240. Technical innovations should be made to enable the
neither USB-host nor serial port supported Vodafone V1240. As a result, substitutable
communication should be designed. As a solution, a wireless communication was
developed in this project. Bluetooth connection substitutes the conventional cable
connection to achieve the most effect of real-time data transmission.
Further more, technical challenge for establishing communication between two DCE
devices requires the innovation in this prototype. The DCE-DCE connection expels
the possibility of the simple and standard pin connection and requires indirect and
interrupted pin connection. Detailed description of the challenge and its solution can
be seen in sector 7.4.2.
-9-
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
5 Hardware
5.1 Blood Glucose Meter System
5.1.1 Aim
This meter system is used to test patients’ blood glucose level. This system
should support easy testing and data transmission. It also requires large memory to
store the test results and information about test dates.
- 10 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
b. Command
The command text file should be prepared using a HEX Editor and saved. All
command should be preceded by HEX values 11, 0d, 0a, (Meter Acknowledgement
Command) and followed by the Data Management Command (DM command).
To run the DM command it will have to be in the form of a “.txt” file.
RS-232 Data Management Command Summary
These are the text commands that follow the meter acknowledgement command
z DM?-send the Meter’s software version and date
z DM@-send the Meter’s serial number
z DMF-send date and time from the Meter’s clock
z DMP-upload blood and control records from the Meter’s memory
z DMSU?-display the glucose units
RS-232 Data Management Commands
- 11 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
- 12 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Specifications
General:
Specification Description
Baud Rate Supports 4.8/9.6/19.2/38.4/57.6/115.2/230.4 Kbps
Coverage Up to 100m
Connection Point-to-point (pico net)
Signal TxD, RxD, GND, CTS, and RTS
RS-232 Interface D_SUB 9-pin female
Standard Bluetooth specification version 2.0+EDR
Power Supply +5 to +9V DC
Modulation GFSK-1 Mbps, DQPSK-2 Mbps, and 8-DPSK-3
Mbps
Table 3: Adapter’s general specification
- 13 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
5.3 Smartphone
5.3.1 Aim
This smartphone is the kernel of this telemedicine system, it is in charge of collecting
data transmitted from the meter; it has the computational power to draw graphics ,
analyze the test data and other information to adjust the insulin dose; it also has to
handle other useful medical assistant functions like information giving and emergency
contact.
- 14 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
- 15 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Steps:
1. Enter the same personal identification number on both devices, set the adapter’s
PIN by HyperTerminal
2. On the mobile phone, search for other Bluetooth-enabled devices, select the
desired device and enter the adapter’s PIN to establish the secure connection.
3. If the two devices are paired, a virtual port will be available on the mobile phone.
It is a virtual serial port generated by Bluetooth. The virtual port used in this
system is COM6.
- 16 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
- 17 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
7.2 Components
This part of interface includes:
z Two DCE devices: blood glucose meter and the adapter
z OneTouch Interface Cable (9-pin serial)
z Self soldered board
z +5V power supplied by batteries
- 18 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
http://pinouts.ru/SerialPorts/RS232_pinout.shtml
The figure above represents an asynchronous RS-232 data transfer. The data stream is
characterized with one start bit, 8 bits, one parity bit and a final 2 stop bits. The data
stream in the designed prototype is 8-N-1, which means a start bit, 8 bits, none parity
and 1 stop bit.
- 19 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
In the standard RS-232 communication, two devices can be connected directly and
handshaking signal can be used to negotiate the communication. A handshaking signal
from the receiving device (DCE) tells the transmitter (DTE) whether it is ready for
data. Usually, “RTS and CTS are the handshake signals. A DTE device asserts the
"request to send" (RTS) signal when it is ready to receive data and disapproves it
when it cannot accept data. Likewise, a DCE device asserts "clear to send" (CTS)
when it is ready to receive data. The RTS and CTS signals form a handshaking pair,
and their use constitutes RTS/CTS handshaking. ”
DCE- DTE
Table 5: Standard signal connection
TXD - RXD
However, in this designed telemedicine system, communication
RXD - TXD
RTS - CTS should be established between two DCE devices- the meter and
CTS- RTS the adapter. There are two reasons to call it a technical challenge
GND-GND to negotiate the DCE-DCE communication. First, the two DCE
devices can not be connected directly because both of them use 9-Pin female
connector. Second, neither of the two DCE devices can initiate the first step of
handshake, which means “open their mouth to speak first”. They both wait for other’s
CTS signal to “open their mouth to speak”. Neither of the devices can gain access to
transmit data through the standard pin connection.
- 20 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
- 21 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
7.4.3 Method
z Power supply: to make it portable, batteries are used to supply the positive
voltage. 3 batteries with 3.3V capacity can reach the positive voltage requirement
of the RS232 signal.
z Male-to-male cable: use a chip as an extension of the connection between meter
and the adapter. Solder the necessary pins from male converter to an extension
board with lead. Designed pin connection can be established in the extension
board.
8. Data transmission
8.1 Aim
The flow of data in the real communication system can be seen in Figure 13
Send
HEX
Command Command
Meter
Meter Data
Data
To view the data transmission process more clearly, a flow chart show was listed
below. Figure 14 summarizes the data transmission process.
- 22 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
- 23 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
8.2 Result
8.2.1 Mobile-Adapter Interface
Once the two devices are paired with secure password, connection can be used by
opening the virtually generated serial port. In the serial port setting user interface,
choose “open port” and these two devices will be connected by default port settings.
Turn the adapter’s switch to the mode of DCE (towards RS232 connector). When it
is not connected, the link LED will be blinking. When the user chooses the submenu
“open port” in the mobile phone form, the link LED will be steadily on which means
the connection is established.
Figure 16: the RS-232 signal from PC’s COM Port, detected by the oscilloscope (the
first 20 bits)
- 24 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Further test was carried out using CommPort. In this test, normal connection between
meter and PC was interrupted; instead, the connection was extended by a self-soldered
board. The method is used to test the output of pins. The indirect pin connection uses
five pins: RXD-TXD, TXD-RXD, GND-GND, RTS-CTS, and CTS-RTS. The test
result shows that the handshake signal RTS-CTS is not fully functional. RTS and CTS
should be set to logic ‘0’ either by hardware control or software code.
Combine the above two consideration, improvement are made in the code- omit OA
and set the CTS high. With all the effort, communication between PC and the meter is
- 25 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
successful.
For example, when the meter receive the command of DMF, it will send back the
current time “SAT”, “03/03/07”, “12:58:50” 0606.
Using the serial port to transmit data between meter and the mobile
It is a final and whole interface test. The test result was satisfactory and it permitted to
add incrementally all the functionality. The diagram below shows the completed
program implemented on the mobile phone to carry out the task of interfacing. The
code can be found on Appendix.
- 26 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
9 Smartphone Platform
9.1 Aim:
This part of the project is a data processing terminal with different functions. The
platform provides medical assistance for diabetics with its superb wireless
communication, powerful calculate capacity, SMS function and user friendly interface.
Sending commands or collecting data is only part of its function as it has been
explained before. It also has to turn data into more readable graphics, provide personal
information and emergency contact, and even educate children with basic ideas about
diabetes.
The code is written on Visual Basic .NET on the Windows Mobile 5.0 Platform.
Special usability and interface consideration will be discussed in following sections.
- 27 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
potential users. Vivid pictures, interesting games and little bonus can be crucial to
attract the users and achieve the most effect of elementary education.
- 28 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
9.3 Implementations
This section details how the program functions and the method used when the
program was developed and implemented from the design. During the design process,
many changes are made to improve the usability and functionality.
The whole program and user interface are shown in following sections sorted by
different functions
- 29 -
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Time
setting
format
: 09:00
Three
different
time can
be set
30
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
31
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
The screen shots (Figure 21 and Figure 22) are some pages of the children diabetic
education book.
The book was downloaded from website http://www.grandmasandy.com/
32
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
33
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
To interpret the collected data into report format or graphic show is for following
considerations. First, the screen size limits the total word number which can be shown
on the screen. Narrow word and paragraph space would be a reading obstacle for the
users, adults may take time to read these information and children may lose interest to
knowing their test result.
Second, minimizing user’s memory load could benefit their understanding. Colors and
graphics are visual tools to help them gain the direct perception of data. In order to
learn the meaningful blood glucose test result, the visual attraction is indispensable for
children.
The collected data from meter are in the .txt format, which uses Lifescan’s specific
data communication protocol. Without the technical specification sheet explaining the
protocol, the received data could be meaningless. If the collected data are directly
shown on the textbox on the screen, user can neither see nor understand clearly. The
figure below simulates the direct data show on the screen.
Figure 31: Direct received data show Figure 32: Visualized data show
P
005,"VVZ0C78BY","MMOL/
L" 0618
P
"WED","03/21/07","08:45:06
"," 108 ","N","00", 00
09AD
P
"TUE","03/20/07","19:06:35
"," 094 ","N","00", 00 09BF
P
For the consideration of all the factors, data interpretation should be carried out to
make it meaningful, readable and attractive. In this design, different showing format
can be chosen by the users. They can choose their favorite reading format to match
different reading habit and unique learning style. Different formats can be seen in the
format of datalist, barshow, trend, standard day
34
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Figure 29 shows the situation when received data are sorted out by different columns
with specific titles to describe their meanings. Pages can be shown in continuous order
to convenient the user to read all the recorded data. More professional time
classification (before meal or after meal) is given to satisfy the special need of
diabetics, because of the different blood glucose level standards for before-meal and
after-meal.
The next screens displayed a color-coded histogram of blood glucose values
transmitted from the meter. (See Figure 30,31,32). Different graphical display format
could be chosen by the user: Graphical Bars, Standard Day Data or Trend Show.
Figure 33: Graphical Bars Figure 34: Standard Day Figure 35: Trend
In the “graphical bar” show, by aiming to make data more readable, different colors of
the histogram bars could make the data more meaningful, with red representing high
levels, light coral representing low levels, blue and lime representing normal level.
Control threshold values are set to determine normal control target area. In this design,
5 mmol/L is the control lower limit while 10 mmol/L is the control upper limit. The
gray area in these screens means the target control area, which has the function to
remind user to keep control of their blood glucose level.
In the “Standard Day” display form, blood glucose data are displayed by different time
of the day, with the aim to show user the changes of daily glucose level.
In the “Trend” display form, the time-series displays of all blood glucose readings are
35
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
available to the user. This trend show supports the users in their attempts to improve
the blood glucose control.
9.3.3.2 Function 8: Smart Analysis
36
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
10 Testing
The primary goal of the system deployment is to implement all the specifications and
the ultimate goal is for the user community to accept it. To accomplish these two goals,
functionality testing and usability testing are two indispensable parts of the complete
project. They can improve the designed function and make it easier for users to accept.
37
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Part Testing Areas Testing Method Testing Result
Meter data 1.correct 1.compare the data in 1. data conversion
processing conversion from mmol/ml in the without errors
mg/dl to more smartphone with the 2. graph representation
commonly used reading from the meter without errors
mmol/ml 2.compare the graphs
2.correct graph with the changes of data
display
Insulin 1.Correct set proper alarm time 1. alarm arrives at the
Injection next-time show and wait for the alarm pre-set time
Reminder 2.correct alarm information show 2. can only be
information show implemented in this
application on the
smartphone, can not use as
a background-working
alarm
38
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
group. However, due to the constrained condition for trial and limited approaches to
the clinical resources, the first part of the usability test only carried out in small group.
It involves 10 students as users, which is not an indicative of the targeted diabetic
children, but which is requested to imitate the behaviors of children. During the whole
process of evaluation, they set themselves in the situation of children with diabetes and
were kept reminding this important fact. However, this short-term solution can not
replace a large-scaled real clinical test.
Figure shows the summation of user rating about the whole interface and the
multifunction. The average score for the whole interface is 4.3 out of 5.0 and the
average score for the system’s multifunction is 4.1 out of 5.0. More detailed graphic
analysis about each independent function and the questionnaire used are shown in
Appendix.
Together with the satisfactory overall rating, positive comments were received as the
user’s feedback. These comments include “Most functional controllers can be found in
menu easily”, “Quite useful to the certain kind of patient”, “The program has a strong
function in general” and “Graphics are easy to understand”; However, critics and
constructive suggestions were collected from the user evaluation. The feedback
includes “You’d better keep it always with you”, “Operating the hardware and
software together is difficult and setting the transmission parameter is difficult too”,
“Need several minutes to learn at the first time”. Further more, some software design
40
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
bugs were also detected in the usability test. Some user gave their opinions regarding
the more favorable and convenient key control.
By analyzing the test result, some improvement should be made to enhance the
usability. In fact, the system was tested and re-designed many times to maximize its
function.
12. Conclusion
In comparison with previous telemedicine systems described in the literature, this
system has its innovative approach to provide the user with personal health assistance.
Multifunction was implemented in this prototype with the aim to enhance
self-management of diabetes. The major functions include medical alert, emergency
contact, diabetic education and blood glucose data transmission. Technical challenges
of wireless communication and DCE-DCE connection were solved as described in this
paper. Usability issues have been studied with the aim to create easy user interface and
satisfactory control result. Some problems encountered in the usability test were
addressed, however, larger clinical trial is crucial to enhance its capacity for
commercial use.
41
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Reference
Papers:
[1] Nancy J. Wahl, Student –Run Usability Testing, Middle Tennessee State University,
Computer Science
[2] Kiran kanukurthy and Usha Viswanathan, Controller for a continuous near infrared glucose
sensor, Sensors for Industry Conference, Houston, Texas, USA, 8-10 February, 2005.
[3] Andrew Farmer, Oliver Gibson, Paul Hayton et al, a real-time, mobile phone-based
telemedicine system to support young adults with type 1 diabetes, Informatics in Primary
[WHO] Definition, Diagnosis and Classification of Diabetes Mellitus and its Complications of
[4] R. Ballaga, J. Borcher, M. Rohs, Jennifer G. Sheridan, The smart phone: A Ubiquitous Input
[5] Michael Setton, Regis Guignier, Wael labidi, Cyberfab, Bluetooth sensors for wireless
home and hospital healthcare monitoring, 452 rue des sources, France
[6] A. Milenkovic, C. Otto, E. Jovanov, Wireless Sensor Networks for Personal Health
Monitoring: Issues and Implementation, Computer Communication, Vol.29, No. 13 14, 2006,
pp. 2521-2533
[7] C.Otto, A. Milenkovic, C. Sanders, E. jovanov, System Architecture of a wireless body area
sensor network for ubiquitous health monitoring, Journal of Mobile Multimedia, Vol. 1, No. 4,
[8] Aziz, O.; B. King, Darzi, A; Guang-Zhong Yang, Pervasive body sensor network: an
Wearable and Implantable Body Sensor networks, April 2006 pages 13-18
[10] Mikael Drugge, Josef Hallberg, Peter Parnes and Kare Synnes, Wearable Systems in
42
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
[11] Thomas R. Hansen, Jakob E. Bardram, and Mads Soegaard, “Moving Out of the
2006
[12]. Karat, J., “Evolving the Scope of User-Centered Design,” Communications of ACM, 42,5,
[13] Yu.P, Yu.H, Lessons learned from the practice of mobile health application development,
[14] Hassanein, F.: Head, M.M., Ubiquitous Usability: Exploring Mobile Interfaces within the
Other Papers
Lucien Ngalamou, Harold Campbell, Diabetic Information Appliance, University of the West
Birmingham
Richard D. Beach, Senior Member, IEEE, Falko v. Kuster, and Francis Moussy, Member, IEEE,
Peter Leijdekker, Valerie Gay, Personal Heart Monitoring System Using Smart Phones to
Books
Burkherdt, Pervasive Computing- Technology and Architecture of Mobile Internet
Douglas Boling, Programming Microsoft Windows CE. Net, Third Edition, ISBN 0735618844
Thearon Wills, Bryan Newsome, Beginning Visual Basic 2005, ISBN: 0-7645-7401-9
43
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Useful Links:
Programming:
http://www. Znkfw.com/shoujiyuanma
http://msdn.microsoft.com/mobility
http://www.opennetcf.org
http://msdn.microsoft.com/vstudio
http://forums.devbuzz.com
https://www.thinkdiabetes.com/tpdiabetes/
http://www.welldoc-communications.com/index.html
http://my-symbian.com/s80/software/applications.php?faq=25&fldAuto=74
44
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
-Meter Reading-Download data from glucose meter and get immediate feedback.
During this part of the evaluation you are going to be guided through the basic use of the
Smartphone interface.
The first screen is the main interface. Functions like emergency and meter-reading can be
directly entered. Other functions can be shown when you click “Menu”.
In the SerialPort form, you can open the port as defaulted setting, no need to change the
Rate from 1 to 5 the following aspects about the GUI on the smartphone.
1. How easy to use did you find the program in general?
Very difficult OK Very easy
1 2 3 4 5
Comments:
Comments:
45
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
3. How would you rate the multifunction of the program?
Not useful at all OK Very useful
1 2 3 4 5
Comments:
4. How would you rate the function of Personal Information and Medical Records?
I don’t like it OK I like it very much
1 2 3 4 5
Comments:
5. How easy did you find to use the function of “Diabetic Reminder”?
Very difficult OK Very easy
1 2 3 4 5
Comments:
Comments:
46
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
7. How useful would you rate the “Emergency Contact”?
Not useful at all OK Very useful
1 2 3 4 5
Comments:
Comments:
9. How easy did you find to interpret graphics and tables about meter data?
Very difficult OK Very easy
1 2 3 4 5
Comments:
47
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
I
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
II
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
III
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
IV
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
V
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
PSRO_DEPERSONALIZATION <StructLayout(LayoutKind.Sequential)> _
End Enum 'PROVIDER_SPECIFIC_REPLACE_OPTION Public Structure ProviderDataSize
Public ProvDataSize As Int32
Private Structure TEXT_PROVIDER_SPECIFIC_DATA End Structure
Public dwMessageOptions As Long
Public psMessageClass As PROVIDER_SPECIFIC_MESSAGE_CLASS Public Shared Sub SendMessage(ByVal sPhoneNumber As String, ByVal
Public psReplaceOption As PROVIDER_SPECIFIC_REPLACE_OPTION sMessage As String)
End Structure 'TEXT_PROVIDER_SPECIFIC_DATA Dim retVal As IntPtr = IntPtr.Zero
Dim smsHandle As IntPtr = IntPtr.Zero
<System.Runtime.InteropServices.DllImport("sms.dll")> _ Dim smsProviderData As IntPtr = IntPtr.Zero
Private Shared Function SmsOpen(ByVal ptsMessageProtocol As [String], _ Dim smsMessage As IntPtr = IntPtr.Zero
End Function Dim ProvData(12) As Byte
<System.Runtime.InteropServices.DllImport("sms.dll")> _ Try
Private Shared Function SmsSendMessage(ByVal smshHandle As IntPtr, _ retVal = SmsOpen(SMS_MSGTYPE_TEXT, SMS_MODE_SEND, smsHandle,
End Function IntPtr.Zero)
If retVal.ToInt32 <> 0 Then
<System.Runtime.InteropServices.DllImport("sms.dll")> _ Throw New Exception("Could not open SMS.")
Private Shared Function SmsClose(ByVal smshHandle As IntPtr) As IntPtr End If
End Function
'Set address structure
<StructLayout(LayoutKind.Sequential)> _ Dim smsatAddressType As Byte() =
Public Structure MsgSize BitConverter.GetBytes(SMS_ADDRESS_TYPE.SMSAT_UNKNOWN)
Public MsgSz As Int32 Dim ptsAddress As Byte() =
End Structure System.Text.Encoding.Unicode.GetBytes(sPhoneNumber)
Dim smsAddressTag(smsatAddressType.Length + ptsAddress.Length)
VI
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
As Byte Try
Array.Copy(smsatAddressType, 0, smsAddressTag, 0, retVal = SmsClose(smsHandle)
smsatAddressType.Length) Catch ex As Exception
Array.Copy(ptsAddress, 0, smsAddressTag, MessageBox.Show(ex.Message)
smsatAddressType.Length, ptsAddress.Length) End Try
Dim smsAddress As IntPtr = End Sub
Marshal.AllocHLocal(smsAddressTag.Length) End Class
System.Runtime.InteropServices.Marshal.Copy(smsAddressTag, 0,
smsAddress, smsAddressTag.Length) Class Marsha
Imports System
'Set message Imports interopserv = System.Runtime.InteropServices
Dim smsMessageTag As Byte() = Imports System.ComponentModel
System.Text.Encoding.Unicode.GetBytes(sMessage)
smsMessage = Marshal.AllocHLocal(smsMessageTag.Length) 'Namespace NetCF.Runtime.InteropServices
System.Runtime.InteropServices.Marshal.Copy(smsMessageTag, 0,
smsMessage, smsMessageTag.Length) Public NotInheritable Class Marshal
VII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
VIII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
IX
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
End Function
Public Shared Function IntToHLocalUni(ByVal s As Int32) As IntPtr
'/ Copies the contents of a managed String into unmanaged memory. If s = 0 Then
'/ <param name="s">A managed string to be copied.</param> Return IntPtr.Zero
'/ <returns> Else
'/ The address, in unmanaged memory, to where the s was copied, or 0 if Dim nc As Integer = interopserv.Marshal.SizeOf(s)
a null reference Dim len As Integer = 2 * (1 + nc)
'/ (Nothing in Visual Basic) string was supplied. Dim hLocal As IntPtr = AllocHLocal(len)
'/ </returns> 'If hLocal = IntPtr.Zero Then
Public Shared Function StringToHLocalUni(ByVal s As String) As IntPtr If hLocal.ToInt32 = 0 Then
If s Is Nothing Then Throw New OutOfMemoryException
Return IntPtr.Zero Else
Else 'interopserv.Marshal.Copy(s.ToString, 0, hLocal, nc)
Dim nc As Integer = s.Length Return hLocal
Dim len As Integer = 2 * (1 + nc) End If
Dim hLocal As IntPtr = AllocHLocal(len) End If
'If hLocal = IntPtr.Zero Then End Function 'StringToHLocalUni
If hLocal.ToInt32 = 0 Then End Class 'Marshal
Throw New OutOfMemoryException 'End Namespace 'NetCF.Runtime.InteropServices
Else
interopserv.Marshal.Copy(s.ToCharArray(), 0, hLocal,
s.Length)
Return hLocal
End If
End If
End Function 'StringToHLocalUni
X
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XI
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XIII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Show Current Time and Next Shot Time & Show Alarm at the Set context2 = file2.ReadLine().Substring(0, 5)
Time context3 = file3.ReadLine().Substring(0, 5)
file1.Close()
Public Class Form4 file2.Close()
Inherits System.Windows.Forms.Form file3.Close()
Public Sub GetTime() If result = Windows.Forms.DialogResult.OK Then
msgbox1.Text = Convert.ToString(System.DateTime.Now.TimeOfDay) Timer1.Enabled = False
End Sub End If
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As If (hour > Convert.ToInt16(context3.Substring(0, 2))) Then
System.EventArgs) Handles MyBase.Load TextBox1.Text = context1
Timer1.Enabled = True ElseIf hour = Convert.ToInt16(context3.Substring(0, 2)) Then
Timer1.Interval = 1000 If minute > context3.Substring(3, 2) Then
End Sub TextBox1.Text = context1
ElseIf minute < Convert.ToInt16(context3.Substring(3, 2)) Then
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As TextBox1.Text = context3
System.EventArgs) Handles Timer1.Tick Else : TextBox1.Text = "Inject Now!!!"
GetTime() Dim mySound As New Sound("becauseimagirl.wav")
Dim file1 As New System.IO.StreamReader("my documents\time1.txt") mySound.Play()
Dim file2 As New System.IO.StreamReader("my documents\time2.txt") result = MessageBox.Show("time to inject insulin", "message
Dim file3 As New System.IO.StreamReader("my documents\time3.txt") from Medical Assistant", MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
Dim hour As Int16 = System.DateTime.Now.Hour MessageBoxDefaultButton.Button1)
Dim minute As Int16 = System.DateTime.Now.Minute If result = Windows.Forms.DialogResult.OK Then
Dim context1, context2, context3 As String Timer1.Enabled = False
Dim result As DialogResult Form1.Show()
context1 = file1.ReadLine().Substring(0, 5) End If
XIV
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
TextBox1.Text = context2
End If ElseIf hour = Convert.ToInt16(context1.Substring(0, 2)) Then
ElseIf hour < Convert.ToInt16(context3.Substring(0, 2)) Then If minute > Convert.ToInt16(context1.Substring(3, 2))
If hour > Convert.ToInt16(context2.Substring(0, 2)) Then Then
TextBox1.Text = context3 TextBox1.Text = context2
ElseIf hour = Convert.ToInt16(context2.Substring(0, 2)) Then ElseIf minute < Convert.ToInt16(context1.Substring(3,
If minute > Convert.ToInt16(context2.Substring(3, 2)) Then 2)) Then
TextBox1.Text = context3 TextBox1.Text = context1
ElseIf minute < Convert.ToInt16(context2.Substring(3, 2)) Else : TextBox1.Text = "Inject Now!!!"
Then Dim mySound As New Sound("becauseimagirl.wav")
TextBox1.Text = context2 mySound.Play()
Else : TextBox1.Text = "Inject Now!!!" result = MessageBox.Show("time to inject insulin",
Dim mySound As New Sound("becauseimagirl.wav") "message from Medical Assistant", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
mySound.Play() If result = Windows.Forms.DialogResult.OK Then
Timer1.Enabled = False
result = MessageBox.Show("time to inject insulin", Form1.Show()
"message from Medical Assistant", MessageBoxButtons.OK, End If
MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) End If
If result = Windows.Forms.DialogResult.OK Then ElseIf hour < Convert.ToInt16(context1.Substring(0, 2)) Then
Timer1.Enabled = False TextBox1.Text = context1
Form1.Show() End If
End If End If
End If End If
ElseIf hour < Convert.ToInt16(context2.Substring(0, 2)) Then ' compare the current time with the 3 set time, get the next time for
If hour > Convert.ToInt16(context1.Substring(0, 2)) Then insulin shot,
XV
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
'when comes the set time, alarm will sound and messagebox will pop SND_ALIAS = &H10000 ' name is a registry alias
up
SND_ALIAS_ID = &H110000 ' alias is a predefined ID
End Sub SND_FILENAME = &H20000 ' name is file name
Public Class Sound SND_RESOURCE = &H40004 ' name is resource name or atom
End Enum
Private m_soundBytes() As Byte
' Construct the Sound object to play sound data from the specified
Private m_fileName As String file.
Public Sub New(ByVal fileName As String)
Public Declare Function WCE_PlaySound Lib "CoreDll.dll" Alias m_fileName = fileName
"PlaySound" (ByVal szSound As String, ByVal hMod As IntPtr, ByVal flags As End Sub
Integer) As Integer
' Construct the Sound object to play sound data from the specified
Public Declare Function WCE_PlaySoundBytes Lib "CoreDll.dll" Alias stream.
"PlaySound" (ByVal szSound() As Byte, ByVal hMod As IntPtr, ByVal flags As Public Sub New(ByVal stream As System.IO.Stream)
Integer) As Integer ' read the data from the stream
m_soundBytes = New Byte(stream.Length) {}
Private Enum Flags stream.Read(m_soundBytes, 0, Fix(stream.Length))
SND_SYNC = &H0 ' play synchronously (default) End Sub 'New
SND_ASYNC = &H1 ' play asynchronously
SND_NODEFAULT = &H2 ' silence (!default) if sound not found ' Play the sound
SND_MEMORY = &H4 ' pszSound points to a memory file Public Sub Play()
SND_LOOP = &H8 ' loop the sound until next sndPlaySound ' If a file name has been registered, call WCE_PlaySound,
SND_NOSTOP = &H10 ' don't stop any currently playing sound ' otherwise call WCE_PlaySoundBytes.
SND_NOWAIT = &H2000 ' don't wait if the driver is busy If Not (m_fileName Is Nothing) Then
XVI
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XVII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XVIII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XIX
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
MenuItem_COM9.Click
Private Sub MenuItem11_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem_Command_Records.Click With Serialport
Dim DMP As New System.IO.StreamReader("My documents\Meter-DMP.txt") Select Case MenuItem_Ports.MenuItems.IndexOf(sender)
Dim Context As String Case 0
Context = DMP.ReadToEnd() .PortName = "COM1"
TextSend.Text = "Commands Sending:" + Context Case 1
Serialport.Write(Context) .PortName = "COM2"
' send command DMP Case 2
End Sub .PortName = "COM3"
Case 3
Private Sub MenuItem12_Click(ByVal sender As System.Object, ByVal e As .PortName = "COM4"
System.EventArgs) Handles MenuItem_Command_Units.Click Case 4
Dim DMSU As New System.IO.StreamReader("My .PortName = "COM5"
documents\Meter-DMSU.txt") Case 5
Dim Context As String .PortName = "COM6"
Context = DMSU.ReadToEnd() Case 6
TextSend.Text = "Commands Sending:" + Context .PortName = "COM7"
Serialport.Write(Context) Case 7
' send command DMSU .PortName = "COM8"
End Sub Case 8
.PortName = "COM9"
Private Sub MenuItem_Ports_Click(ByVal sender As Object, ByVal e As End Select
EventArgs) Handles MenuItem_COM1.Click, MenuItem_COM2.Click, End With
MenuItem_COM3.Click, MenuItem_COM4.Click, MenuItem_COM5.Click, 'Selecting the COM number
MenuItem_COM6.Click, MenuItem_COM7.Click, MenuItem_COM8.Click, End Sub
XX
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXI
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXIII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXIV
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXV
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXVI
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXVII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As Set the Time Slot
System.EventArgs) Handles MenuItem2.Click Imports System.IO
'only show the existed records in limited pages Public Class patient_setup
If (TextBox4.Text = "0" Or TextBox8.Text = "0" Or TextBox12.Text = Public bfbf As String
"0" Or TextBox16.Text = "0" Or TextBox20.Text = "0") Then Public afbf As String
MenuItem2.Enabled = False Public bfluc As String
Else Public afluc As String
m = m + 1 Public bfdin As String
ShowRecords5(m) Public afdin As String
End If Public Sub getdata()
End Sub Dim setup As New System.IO.StreamReader("my
documents\meterdata\setup.txt")
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As bfbf = setup.ReadLine()
System.EventArgs) Handles MenuItem1.Click afbf = setup.ReadLine()
example.Show() bfluc = setup.ReadLine()
End Sub afluc = setup.ReadLine()
End Class bfdin = setup.ReadLine()
afdin = setup.ReadLine()
setup.Close()
'get the already set data
End Sub
Public Sub savedata()
Dim setup As New System.IO.StreamWriter("my
documents\meterdata\setup.txt")
setup.WriteLine(Me.TextBox1.Text)
setup.WriteLine(Me.TextBox2.Text)
XXVIII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXIX
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXX
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
' draw the data point B.8.4 Graphical Data Show- Standard Day
Next
e.Graphics.DrawEllipse(RedPen, x(number - 1), y(number - 1), 5, 5) Public Class StandardDay
Dim line As String
End Sub Dim Max As New Single
Dim Min As New Single
Dim sum As New Single
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As Dim avg As New Single
System.EventArgs) Handles MenuItem1.Click Public number As Int64
SerialPort.Show() Dim Records As New System.IO.StreamReader("my
End Sub documents\meterdata\BGTest.txt")
Dim i As Int64 = 0
End Class Dim data(500) As Single
Dim hour(500) As Int16
Dim mint(500) As Int16
Private Sub getdata(ByVal records As System.IO.StreamReader)
line = records.ReadLine()
line = records.ReadLine()
Do While (line <> "")
data(i) = line.Substring(36, 3) / 18
' read each test data
hour(i) = Convert.ToInt16(line.Substring(20, 2))
'read each test hour
mint(i) = Convert.ToInt16(line.Substring(23, 2))
'read each test minute
i = i + 1
XXXI
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXXII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXXIII
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
If CheckBox3.CheckState Then
Dim record As New System.IO.StreamReader("my i1 = 2
documents\meterdata\BGTest.txt") End If
Dim BGdate As String If CheckBox4.CheckState Then
Dim value As Single i2 = 2
'read the Serial Number Information End If
record.ReadLine() If CheckBox6.CheckState Then
Dim line As String = record.ReadLine() i2 = 0.5
Dim data As String = (Convert.ToString(DateTime.Today.Date)) End If
BGdate = line.Substring(9, 8) i = i1 * i2 * i3
If i > 1 Then
If (data.Substring(0, 2) = BGdate.Substring(3, 2) And TextBox1.Text = "Suggestion:You need a little more insulin today"
data.Substring(3, 2) = BGdate.Substring(0, 2) And data.Substring(8, 2) = ElseIf i < 1 Then
BGdate.Substring(6, 2)) Then TextBox1.Text = "Suggestion: You need a little less insulin today"
value = line.Substring(36, 3) / 18 Else : TextBox1.Text = "You are perfect in control today!"
If value > 10 Then i3 = 2 End If
If value < 5 Then i3 = 0.5 ' combine the information of daily food consumption, activity and
Else : MessageBox.Show("No Blood Glucose Record Today", "No BG Test glucose level to adjust the insuline dose
Today?", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, End Sub
MessageBoxDefaultButton.Button1)
' if no blood glucose tested today, then messagebox shows Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As
End If System.EventArgs) Handles MenuItem1.Click
record.Close() lifeclinic.Show()
If CheckBox1.CheckState Then End Sub
i1 = 0.5
End If End Class
XXXIV
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXXV
Smartphone for Children with Diabetes University of Birmingham
Xiaojia Jiang
XXXVI