Add the description about gatt_connect()
authorTaejin Woo <tt.woo@samsung.com>
Thu, 5 Nov 2015 02:48:47 +0000 (11:48 +0900)
committerTaejin Woo <tt.woo@samsung.com>
Thu, 5 Nov 2015 02:48:47 +0000 (11:48 +0900)
Change-Id: Idecfd81d1015ef5e2a96c4847582f41787f813b1
Signed-off-by: Taejin Woo <tt.woo@samsung.com>
org.tizen.tutorials/html/native/network/bluetooth_tutorial_n.htm

index e6a48a3..d5c6c92 100755 (executable)
@@ -36,6 +36,7 @@
                        </li>
                        <li>Bluetooth GATT operations
                                <ul class="toc">
+                                       <li><a href="#gatt">Precondition to use GATT operations</a>
                                        <li><a href="#gatt">Managing the Client Operations</a></li>
                                        <li><a href="#gatt_getter">Managing Common Getter Operations</a></li>
                                        <li><a href="#gatt_setter">Managing Common Setter Operations</a></li>
@@ -95,6 +96,7 @@
                                </ul></li>
                                <li>Bluetooth GATT operations
                                <ul>
+                                       <li><a href="#gatt">Precondition to use GATT operations</a>
                                        <li><a href="#gatt">Managing the Client Operations</a>
                                        <p>Create a client to connect to a remote service, get service details, read and set service attributes, and set and release callbacks when the characteristic value changes.</p></li>
                                        <li><a href="#gatt_getter">Managing Common Getter Operations</a>
@@ -811,6 +813,25 @@ else
 &nbsp;&nbsp;&nbsp;dlog_print(DLOG_INFO, LOG_TAG, &quot;[bt_socket_destroy_rfcomm] Succeeded. server_socket_fd = %d.&quot;, server_socket_fd);
 }</pre></li></ul>
 
+<h2 id="gatt" name="gatt">Precondition to use the GATT operations</h2>
+<p> There is an essential precondition for use GATT APIs. To use those, you need to connect BLE target you want successfully.</p>
+<p> This is the process to connect BLE target below.</p>
+<pre class="prettyprint">
+int ret = BT_ERROR_NONE;
+ret = bt_adapter_le_start_scan(__bt_adapter_le_scan_result_cb, NULL);
+/* If you want to know the cb function, you can refer to the list, "Managing Bluetooth LE Scans" */
+if (ret != BT_ERROR_NONE) {
+       dlog_print(DLOG_ERROR, LOG_TAG, "[bt_adapter_le_start_scan] Failed.");
+}
+/* You should wait while searching LE target you want to connect */
+ret = bt_adapter_le_stop_scan();
+/* If you find LE target you want, you should stop finding LE target */
+ret = bt_gatt_connect(ADDRESS_BLE_DEVICE_YOU_WANT, false);
+if (ret != BT_ERROR_NONE) {
+       dlog_print(DLOG_ERROR, LOG_TAG, "Fail to connect LE device.");
+}
+</pre></li>
+
 <h2 id="gatt" name="gatt">Managing the Client Operations</h2>
 <p>To perform GATT client operations:</p>
 <ol>
@@ -2245,4 +2266,4 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga
 </script>
 
  </body>
-</html>
\ No newline at end of file
+</html>