@@ -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>
@@ -925,7 +954,9 @@ to the profile proxy object.</li>
925954state of the connection and perform other operations that are relevant to that
926955profile.</li>
927956</ol>
928- <p> For example, this code snippet shows how to connect to a {@link android.bluetooth.BluetoothHeadset} proxy object so that you can control the
957+
958+ <p> For example, this code snippet shows how to connect to a {@link
959+ android.bluetooth.BluetoothHeadset} proxy object so that you can control the
929960Headset profile:</p>
930961
931962<pre>BluetoothHeadset mBluetoothHeadset;
@@ -955,6 +986,8 @@ private BluetoothProfile.ServiceListener mProfileListener = new BluetoothProfile
955986mBluetoothAdapter.closeProfileProxy(mBluetoothHeadset);
956987</pre>
957988
989+
990+
958991<h3 id="AT-Commands">Vendor-specific AT commands</h3>
959992
960993<p>Starting in Android 3.0, applications can register to receive system
@@ -964,3 +997,81 @@ broadcasts that indicate a connected device's battery level and could notify the
964997user or take other action as needed. Create a broadcast receiver for the {@link
965998android.bluetooth.BluetoothHeadset#ACTION_VENDOR_SPECIFIC_HEADSET_EVENT} intent
966999to handle vendor-specific AT commands for the headset.</p>
1000+
1001+ <h3 id="HDP">Health Device Profile</h3>
1002+
1003+ <p>Android 4.0 (API level 14) introduces support for the Bluetooth Health Device
1004+ Profile (HDP). This lets you create applications that use Bluetooth to
1005+ communicate with health devices that support Bluetooth, such as heart-rate
1006+ monitors, blood meters, thermometers, and scales. The Bluetooth Health API
1007+ includes the classes {@link android.bluetooth.BluetoothHealth}, {@link
1008+ android.bluetooth.BluetoothHealthCallback}, and {@link
1009+ android.bluetooth.BluetoothHealthAppConfiguration}, which are described in <a
1010+ href="#TheBasics">The Basics</a>. </p>
1011+
1012+ <p>In using the Bluetooth Health API, it's helpful to understand these key HDP concepts:</p>
1013+ <table>
1014+ <tr>
1015+ <th>Concept</th>
1016+ <th>Description</th>
1017+ </tr>
1018+ <tr>
1019+ <td><strong>Source</strong></td>
1020+
1021+ <td>A role defined in HDP. A <em>source</em> is a health device that
1022+ transmits medical data (weight scale, glucose meter, thermometer, etc.) to a
1023+ smart device such as an Android phone or tablet. </td>
1024+ </tr>
1025+ <tr>
1026+ <td><strong>Sink</strong></td>
1027+
1028+ <td>A role defined in HDP. In HDP, a <em>sink</em> is the smart device that
1029+ receives the medical data. In an Android HDP application, the sink is
1030+ represented by a {@link android.bluetooth.BluetoothHealthAppConfiguration}
1031+ object.</td>
1032+ </tr>
1033+ <tr>
1034+ <td><strong>Registration</strong></td>
1035+ <td>Refers to registering a sink for a particular health device.</td>
1036+ </tr>
1037+ <tr>
1038+ <td><strong>Connection</strong></td>
1039+
1040+ <td>Refers to opening a channel between a health device and a smart device
1041+ such as an Android phone or tablet.</td>
1042+ </tr>
1043+ </table>
1044+
1045+ <h4>Creating an HDP Application</h4>
1046+
1047+ <p>Here are the basic steps involved in creating an Android HDP application:</p>
1048+ <ol>
1049+
1050+ <li>Get a reference to the {@link android.bluetooth.BluetoothHealth} proxy
1051+ object. <p>Similar to regular headset and A2DP profile devices, you must call
1052+ {@link android.bluetooth.BluetoothAdapter#getProfileProxy getProfileProxy()}
1053+ with a {@link android.bluetooth.BluetoothProfile.ServiceListener} and the {@link
1054+ android.bluetooth.BluetoothProfile.ServiceListener#HEALTH} profile type to
1055+ establish a connection with the profile proxy object.</p> </li>
1056+
1057+ <li>Create a {@link android.bluetooth.BluetoothHealthCallback} and register an
1058+ application configuration
1059+ ({@link android.bluetooth.BluetoothHealthAppConfiguration})
1060+ that acts as a health
1061+ sink.</li>
1062+
1063+ <li>Establish a connection to a health device. Some devices will initiate the
1064+ connection. It is unnecessary to carry out this step for those devices.</li>
1065+
1066+ <li>When connected successfully to a health device, read/write to the health
1067+ device using the file descriptor. <p>The received data needs to be interpreted
1068+ using a health manager which implements the IEEE 11073-xxxxx
1069+ specifications.</p></li>
1070+
1071+ <li>When done, close the health channel and unregister the application. The
1072+ channel also closes when there is extended inactivity.</li>
1073+ </ol>
1074+
1075+ <p>For a complete code sample that illustrates these steps, see <a
1076+ href="{@docRoot}resources/samples/BluetoothHDP/index.html">Bluetooth HDP (Health
1077+ Device Profile)</a>. </p>
0 commit comments