@@ -29,6 +29,7 @@ other devices</li>
2929 <li><a href="#Profiles">Working with Profiles</a>
3030 <ol>
3131 <li><a href="#AT-Commands">Vendor-specific AT commands</a>
32+ <li><a href="#HDP">Health Device Profile</a>
3233 </ol></li>
3334 </ol>
3435
@@ -43,6 +44,7 @@ other devices</li>
4344 <h2>Related samples</h2>
4445 <ol>
4546 <li><a href="{@docRoot}resources/samples/BluetoothChat/index.html">Bluetooth Chat</a></li>
47+ <li><a href="{@docRoot}resources/samples/BluetoothHDP/index.html">Bluetooth HDP (Health Device Profile)</a></li>
4648 </ol>
4749
4850</div>
@@ -132,11 +134,27 @@ Headset and Hands-Free (v1.5) profiles.</dd>
132134audio can be streamed from one device to another over a Bluetooth connection.
133135"A2DP" stands for Advanced Audio Distribution Profile.</dd>
134136
135- <dt>{@link android.bluetooth.BluetoothProfile.ServiceListener}</dt>
137+ <dt>{@link android.bluetooth.BluetoothHealth}</dt>
138+ <dd> Represents a Health Device Profile proxy that controls the Bluetooth service.</dd>
139+
140+ <dt>{@link android.bluetooth.BluetoothHealthCallback}</dt>
141+
142+ <dd>An abstract class that you use to implement {@link
143+ android.bluetooth.BluetoothHealth} callbacks. You must extend this class and
144+ implement the callback methods to receive updates about changes in the
145+ application’s registration state and Bluetooth channel state.</dd>
146+
147+ <dt>{@link android.bluetooth.BluetoothHealthAppConfiguration}</dt>
148+
149+ <dd>Represents an application configuration that the Bluetooth Health third-party
150+ application registers to communicate with a remote Bluetooth health
151+ device.</dd>
152+
153+ <dt>{@link android.bluetooth.BluetoothProfile.ServiceListener}</dt>
136154
137155<dd>An interface that notifies {@link android.bluetooth.BluetoothProfile} IPC
138156clients when they have been connected to or disconnected from the service (that
139- is, the internal service that runs a particular profile). </dd>
157+ is, the internal service that runs a particular profile). </dd>
140158
141159</dl>
142160
@@ -889,14 +907,25 @@ Bluetooth Headset Service via interprocess communication (<a
889907href="{@docRoot}guide/topics/fundamentals/processes-and-threads.html#IPC">IPC</a
890908>). This includes both Bluetooth Headset and Hands-Free (v1.5) profiles. The
891909{@link android.bluetooth.BluetoothHeadset} class includes support for AT commands.
892- For more discussion of this topic, see <a href="#AT-Commands">Vendor-specific AT commands</a></li>
910+ For more discussion of this topic, see <a href="#AT-Commands">Vendor-specific AT commands</a></li>
893911
894912 <li><strong>A2DP</strong>. The Advanced Audio Distribution Profile (A2DP)
895913profile defines how high quality audio can be streamed from one device to
896914another over a Bluetooth connection. Android provides the {@link
897915android.bluetooth.BluetoothA2dp} class, which is a proxy for controlling
898916the Bluetooth A2DP Service via IPC.</li>
899917
918+ <li><strong>Health Device</strong>. Android 4.0 (API level 14) introduces
919+ support for the Bluetooth Health Device Profile (HDP). This lets you create
920+ applications that use Bluetooth to communicate with health devices that support
921+ Bluetooth, such as heart-rate monitors, blood meters, thermometers, scales, and
922+ so on. For a list of supported devices and their corresponding device data
923+ specialization codes, refer to <strong>Bluetooth Assigned Numbers</strong> at <a
924+ href="http://www.bluetooth.org">www.bluetooth.org</a>. Note that these values
925+ are also referenced in the ISO/IEEE 11073-20601 [7] specification as
926+ MDC_DEV_SPEC_PROFILE_* in the Nomenclature Codes Annex. For more discussion of
927+ HDP, see <a href="#HDP">Health Device Profile</a>.</li>
928+
900929</ul>
901930
902931<p>Here are the basic steps for working with a profile:</p>
@@ -926,7 +955,9 @@ to the profile proxy object.</li>
926955state of the connection and perform other operations that are relevant to that
927956profile.</li>
928957</ol>
929- <p> For example, this code snippet shows how to connect to a {@link android.bluetooth.BluetoothHeadset} proxy object so that you can control the
958+
959+ <p> For example, this code snippet shows how to connect to a {@link
960+ android.bluetooth.BluetoothHeadset} proxy object so that you can control the
930961Headset profile:</p>
931962
932963<pre>BluetoothHeadset mBluetoothHeadset;
@@ -956,6 +987,8 @@ private BluetoothProfile.ServiceListener mProfileListener = new BluetoothProfile
956987mBluetoothAdapter.closeProfileProxy(mBluetoothHeadset);
957988</pre>
958989
990+
991+
959992<h3 id="AT-Commands">Vendor-specific AT commands</h3>
960993
961994<p>Starting in Android 3.0, applications can register to receive system
@@ -965,3 +998,81 @@ broadcasts that indicate a connected device's battery level and could notify the
965998user or take other action as needed. Create a broadcast receiver for the {@link
966999android.bluetooth.BluetoothHeadset#ACTION_VENDOR_SPECIFIC_HEADSET_EVENT} intent
9671000to handle vendor-specific AT commands for the headset.</p>
1001+
1002+ <h3 id="HDP">Health Device Profile</h3>
1003+
1004+ <p>Android 4.0 (API level 14) introduces support for the Bluetooth Health Device
1005+ Profile (HDP). This lets you create applications that use Bluetooth to
1006+ communicate with health devices that support Bluetooth, such as heart-rate
1007+ monitors, blood meters, thermometers, and scales. The Bluetooth Health API
1008+ includes the classes {@link android.bluetooth.BluetoothHealth}, {@link
1009+ android.bluetooth.BluetoothHealthCallback}, and {@link
1010+ android.bluetooth.BluetoothHealthAppConfiguration}, which are described in <a
1011+ href="#TheBasics">The Basics</a>. </p>
1012+
1013+ <p>In using the Bluetooth Health API, it's helpful to understand these key HDP concepts:</p>
1014+ <table>
1015+ <tr>
1016+ <th>Concept</th>
1017+ <th>Description</th>
1018+ </tr>
1019+ <tr>
1020+ <td><strong>Source</strong></td>
1021+
1022+ <td>A role defined in HDP. A <em>source</em> is a health device that
1023+ transmits medical data (weight scale, glucose meter, thermometer, etc.) to a
1024+ smart device such as an Android phone or tablet. </td>
1025+ </tr>
1026+ <tr>
1027+ <td><strong>Sink</strong></td>
1028+
1029+ <td>A role defined in HDP. In HDP, a <em>sink</em> is the smart device that
1030+ receives the medical data. In an Android HDP application, the sink is
1031+ represented by a {@link android.bluetooth.BluetoothHealthAppConfiguration}
1032+ object.</td>
1033+ </tr>
1034+ <tr>
1035+ <td><strong>Registration</strong></td>
1036+ <td>Refers to registering a sink for a particular health device.</td>
1037+ </tr>
1038+ <tr>
1039+ <td><strong>Connection</strong></td>
1040+
1041+ <td>Refers to opening a channel between a health device and a smart device
1042+ such as an Android phone or tablet.</td>
1043+ </tr>
1044+ </table>
1045+
1046+ <h4>Creating an HDP Application</h4>
1047+
1048+ <p>Here are the basic steps involved in creating an Android HDP application:</p>
1049+ <ol>
1050+
1051+ <li>Get a reference to the {@link android.bluetooth.BluetoothHealth} proxy
1052+ object. <p>Similar to regular headset and A2DP profile devices, you must call
1053+ {@link android.bluetooth.BluetoothAdapter#getProfileProxy getProfileProxy()}
1054+ with a {@link android.bluetooth.BluetoothProfile.ServiceListener} and the {@link
1055+ android.bluetooth.BluetoothProfile.ServiceListener#HEALTH} profile type to
1056+ establish a connection with the profile proxy object.</p> </li>
1057+
1058+ <li>Create a {@link android.bluetooth.BluetoothHealthCallback} and register an
1059+ application configuration
1060+ ({@link android.bluetooth.BluetoothHealthAppConfiguration})
1061+ that acts as a health
1062+ sink.</li>
1063+
1064+ <li>Establish a connection to a health device. Some devices will initiate the
1065+ connection. It is unnecessary to carry out this step for those devices.</li>
1066+
1067+ <li>When connected successfully to a health device, read/write to the health
1068+ device using the file descriptor. <p>The received data needs to be interpreted
1069+ using a health manager which implements the IEEE 11073-xxxxx
1070+ specifications.</p></li>
1071+
1072+ <li>When done, close the health channel and unregister the application. The
1073+ channel also closes when there is extended inactivity.</li>
1074+ </ol>
1075+
1076+ <p>For a complete code sample that illustrates these steps, see <a
1077+ href="{@docRoot}resources/samples/BluetoothHDP/index.html">Bluetooth HDP (Health
1078+ Device Profile)</a>. </p>
0 commit comments