Open main menu

CDOT Wiki β

Changes

Phonegap Healthcare Adapter

100 bytes added, 09:04, 9 August 2012
m
no edit summary
[[category: NexJ Current Projects]]
[[category: NexJ Express PhoneGap]]
 
''''' NexJ Medical Peripheral Mobile Adapter '''''
Will be designed to enable NexJ's Mobile Healthcare solutions to interact with Bluetooth peripherals.
 
{{TOC limit}}
== Contributors ==
== Contributors ==
* [[User:Cwdesautels|Carl Desautels]]
* [[User:Wei.song | Wei Song]] 
== Problem ==
[[File:nexjMobile.png|right]]
[[File:NexjMobile.png|thumb|right]]
NexJ's mobile health solution requires its smartphone health coach application to have the ability to read medical measurement data from Bluetooth-capable devices, The devices included in the initial project proposal are as follows: blood pressure device, glucose level measuring device and a weight measuring device.
 
The health coach application will be designed to use PhoneGap, a rising technology that blurs the line between mobile operating systems. Implementing native Bluetooth adapters becomes only part of the solution. The health coach application will interact with a unified API in JavaScript to retrieve data from Bluetooth-capable medical peripherals.
 
The unified JavaScript API will be developed to utilize PhoneGap's JavaScript API to make native code calls. These native calls will focus on a medical Bluetooth device adapter which also must be implemented. This Bluetooth adapter will be extended for each supported measuring device and implemented on each supported mobile operating system.
== Supported Versions ==
== Supported Versions ==
* [http://phonegap.com/download PhoneGap] 2.0.0, released July 20, 2012
 
=== [http://docs.phonegap.com/en/2.0.0/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS OSX] ===
 
* Xcode 4.3 +
* OSX 10.7 +
* iOS 4.3 +
* Bluetooth SPP capable
 
=== [http://docs.phonegap.com/en/2.0.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android Android] ===
 
* Eclipse 3.6.2 +
* ADT Latest
* Bluetooth SPP capable
== Project Status ==
== Project Status==* '''Current Sprint''' : [[Phonegap_Healthcare_AdapterPhonegap Healthcare Adapter#Investigation | Investigation]]
== Project Backlog ==
== Project Backlog ==
=== Investigation ===
 
==== iOS ====
 
* Bluetooth can work on simulators.
* Deploy to devices, requiring enrollment in the [https://developer.apple.com/programs/ios/ developer program].
* Understand iOS best practice development.
* Understand iOS PhoneGap plugin best practices.
 
==== Android ====
 
* Bluetooth does '''not''' work on the emulator.
* Understand ADK best practice development.
* Understand ADK PhoneGap plugin best practices.
 
=== PhoneGap API ===
 
* Design a unified API in JavaScript that will allow the NexJ application to interact with Bluetooth devices.
* Define a project architecture that facilitates multiple device compatibility.
 
=== Blood Pressure Device ===
 
==== iOS ====
 
* Create native Bluetooth adapter for this device.
 
==== Android ====
 
* Create native Bluetooth adapter for this device.
 
=== Glucose Level Device ===
 
==== iOS ====
 
* Extend native Bluetooth adapter for this device.
 
==== Android ====
 
* Extend native Bluetooth adapter for this device.
 
=== Weight Scale Device ===
 
==== iOS ====
 
* Extend native Bluetooth adapter for this device.
 
==== Android ====
 
* Extend native Bluetooth adapter for this device.
== Process Description of Bluetooth Communication ==
== Process Description of Bluetooth Communication ==
[[File:NexjPhoneGap.png|right]]
 
=== Bluetooth Profile ===
 
Serial Port Profile (SPP).
 
=== Bluetooth protocols ===
 
RFCOMM and Service Discovery protocols.
 
=== Pairing ===
 
Secure Simple Pairing
 
=== Data transmission ===
 
Measurement date/time, measurement values, Bluetooth Id of remote unit, mode, and serial number of A&D PBT Series.
 
=== Master devices ===
 
A&D Bluetooth® devices PBT series, including blood pressure meter, blood glucose meter, and weight scale.
 
=== Slave devices/Access Points ===
 
mobile devices, including iOS and Android smartphones/tablets.
 === Communication Process Description for unpaired devices in brief:=== *Enable Bluetooth on the mobile device and set the device to discoverable mode (as slave device).*Make a measurement on selected A&D Bluetooth device such as weight scale. Upon the completion of measurement, the device (as master device) searches slave devices and initials Bluetooth communication.*The mobile device receives the signal of the A&D Bluetooth device and prompts user to enter a PIN/passkey.*Once the PIN is matched, the A&D Bluetooth device sends the measurement data to the mobile device using the specified format such as weight scale packet followed by the Confirmation Packet Response.*Upon the success of connection, the two devices are paired. Then PIN code is no longer needed afterward. 
=== Communication Process Description for paired devices in brief: ===
 *Enable Bluetooth on the mobile device and set the device to discoverable mode.*Make a measurement on selected A&D Bluetooth device. Upon the completion of measurement, the A&D Bluetooth device checks its memory for previously paired address of mobile device and directly sends the measurement data to the mobile device using the specified format, followed by the Confirmation Packet Response. 
=== Communication Packet ===
 
Communication packet consists of two sections: the dataheader section and the data section.
 
==== Header Section ====
 
{| class="wikitable sortable" border="1" cellpadding="2" width="800px"
! Offset!! Type!! Field
|-
|0|| Integer (2 byte) || Packet type (always equal to 2)
|-
|2 || Integer (4 byte) || Packet length (exclusive of 60 byte of data header)
|-
|6 || Integer (2 byte) || Device type – 767 or 02FF (Hex) for UA-767PBT, 321 or 0141 (Hex) for UC-321PBT
|-
|8 || Byte || Flag
|-
|9 || Integer (2 byte) || Year of measurement
|-
|11 || Byte || Month of measurement
|-
|12 || Byte || Day of measurement
|-
|13 || Byte || Hour of measurement
|-
|14 || Byte || Minute of measurement
|-
|15 || Byte || Second of measurement
|-
|16 || Integer (2 byte) || Year of transmission
|-
|18 || Byte || Month of transmission
|-
|19 || Byte || Day of transmission
|-
|20 || Byte || Hour of transmission
|-
|21 || Byte || Minute of transmission
|-
|22 || Byte || Second of transmission
|-
|23 || Byte (6) || Bluetooth ID of remote unit
|-
|29 || Byte (6) || Bluetooth ID of access point (null)
|-
|35 || Byte (12) || Serial Number of A&D PBT Series
|-
|47 || Byte (10) || Reserved
|-
|57 || Byte || Device Battery Status (Note 1)
|-
|58 || Byte || Reserved
|-
|59 || Byte || Device Firmware Revision and Hardware Revision (Note 2)
|}
 
==== Data Section ====
 
===== Blood Pressure Device Specification =====
 
{| class="wikitable sortable" border="1" cellpadding="2" width="500px"
! Offset!! Type!! Field
|-
|0-1 ||Printable Hex || Valid (= “80”) Non-“80” means invalid BP measurement.
|-
|2-3 ||Printable Hex || Systolic – Diastolic
|-
|4-5 ||Printable Hex || Diastolic
|-
|6-7 ||Printable Hex || Pulse rate per minute
|-
|8-9 ||Printable Hex || Mean Arterial Pressure (MAP)
|}
 
===== Glucose Device Specification =====
 
unknown
 
===== Weight Scale Specification =====
 
Kilogram Mode
 {|class="wikitable" border="1" cellpadding="2" width="500px"|S || T|| ,|| +|| 1 || 2 || 5 || . || 1 || 0 || k || g || <CR>|| <LF>
|}
 
Pound Mode
 {|class="wikitable" border="1" cellpadding="2" width="500px"|S || T|| ,|| +|| 0 ||4 ||0 ||5 ||. ||2 ||l|| b || <CR>|| <LF>
|}
== Project Repository ==
* https://bitbucket.org/cwdesautels/nexj-mobile-bluetooth-adapter
== Project Repository ==
* https://bitbucket.org/cwdesautels/nexj-mobile-bluetooth-adapter
=== Mercurical HowTo ===
 
* [https://developer.mozilla.org/en-US/docs/Mercurial Mozilla Mercurial Docs]
 
=== Branching Rules ===
 
* Nobody commits to ''default''.
** ''default'' is the master branch we will use to generate submissions back to NexJ
** A feature name, example: ''cryptography-bug''
== Resources ==
== Resources ==
* Dowloads:
** [http://docs.phonegap.com/en/2.0.0/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS PhoneGap: Getting Started with iOs]
** [http://docs.phonegap.com/en/2.0.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android PhoneGap: Getting Started with Android]
* Documentation:
** Bluetooth Developer Portal:
*** [http://developer.bluetooth.org/KnowledgeCenter/Pages/White-Papers.aspx Bluetooth White papers]
*** [http://developer.bluetooth.org/DevelopmentResources/Pages/Introduction-to-Bluetooth-Application-Development.aspx Development Resources]
** iOS Developer Resource
*** [http://developer.apple.com/library/ios/#technotes/tn2295/_index.html Bluetooth on Simulators]
*** [http://hiediutley.com/2011/03/30/phonegap-tutorial-series-4-using-a-third-party-plugin/ PhoneGap Tutorial]