From 36e5a1409aa668fc9974a14a5758be24bc1255a2 Mon Sep 17 00:00:00 2001 From: Michal Pawluk Date: Mon, 4 Jan 2016 12:41:54 +0100 Subject: [PATCH] [SAMPLE APP][Bluetooth LE Collector] 'Devices discovery' and 'Discovered device's details acquisition' sections restructured Change-Id: I94ec870bb9c3c55e74680c316f8985f9b52603a3 Signed-off-by: Michal Pawluk --- .../html/mobile_n/bluetooth_le_collector_sd_mn.htm | 59 ++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/org.tizen.sampledescriptions/html/mobile_n/bluetooth_le_collector_sd_mn.htm b/org.tizen.sampledescriptions/html/mobile_n/bluetooth_le_collector_sd_mn.htm index 6f22236..8ffa74f 100644 --- a/org.tizen.sampledescriptions/html/mobile_n/bluetooth_le_collector_sd_mn.htm +++ b/org.tizen.sampledescriptions/html/mobile_n/bluetooth_le_collector_sd_mn.htm @@ -250,6 +250,7 @@ static void __bt_le_adv_data_process(bt_adapter_le_device_scan_result_info_s *in    if (!dev_added)       return; +   /* See the next section for details. */    __adv_data_process(info, &dev_info); } @@ -257,7 +258,58 @@ static void __bt_le_adv_data_process(bt_adapter_le_device_scan_result_info_s *in

For peer device identification purpose its remote name is used, so the bt_le_get_adv_device_name() function is called in order to extract it from the advertisement message. The obtained name is then stored (__add_found_le_device()) and further used to identify the remote device. -Finally, the entire advertisement message is processed for any additional information acquisition (__adv_data_process()). +Each remote device is represented by a custom bt_le_device_info_s structure referenced by the +dev_info variable created internally by the __add_found_le_device() +function. The mentioned structure is described below and maintained by the model module. Finally, the entire advertisement message is processed for any additional information acquisition +(__adv_data_process() - refer to the Discovered device's details acquisition section for details). +

+ +
+struct _bt_le_device_data {
+   /* The size of the service's data. */
+   int size;
+   /* The UUID of the service's that the data is carried - integral value. */
+   int uuid_value;
+   /* The UUID of the service's that the data is carried - hexadecimal representation. */
+   char *uuid;
+   /* The service's data. */
+   char *data;
+};
+
+typedef struct _bt_le_device_data bt_le_device_data_s;
+
+/* The structure below carries all the peer's related information. */
+struct _bt_le_device_info {
+   /* Device's name. */
+   char *name;
+   /* Transmition power level. */
+   int tx_power_level;
+   /* Device's external appearance identifier. */
+   int appearance;
+   /* Device's manufacturer identifier. */
+   int manufacturer_id;
+   /* The number of exposed services. */
+   int services_count;
+   /* The number of exposed solicitation services. */
+   int services_solicitation_count;
+   /* The number of exposed services' data. */
+   int service_data_count;
+   /* The UUIDs of exposed services. */
+   char **services;
+   /* The UUIDs of exposed solicitation services. */
+   char **services_solicitation;
+   /* The data binded to the services exposed. */
+   bt_le_device_data_s *service_data;
+};
+
+typedef struct _bt_le_device_info bt_le_device_info_s;
+
+ +

Discovered device's details acquisition

+ +

+Once the devices are discovered, their detailed information can be acquired from the advertisement message (refer to the __bt_le_scan_cb() +callback function described in the Devices discovery section).

@@ -311,12 +363,13 @@ The bt_le_get_adv_{a
 		
  • services UUIDs - a list of handled services identifiers;
  • solicitation services UUIDs - a list of handled solicitation services identifiers.
  • -All the acquired information is binded to the remote device name previously obtained and stored internally for further use. +All the acquired information is binded to the remote device name (model_set_device_info()) previously obtained and referenced by the +dev_info variable.
    Finally, the user interface is updated with view_main_update_peer_info() function to reflect received data.

    -

    Discovered device's details acquisition and browsing

    +

    Discovered device's details acquisition and browsing

    Once the devices are discovered and the list is populated with available advertisers, the user is able to select one from all discovered peers. After selection, the UI is changed to the device's detailed view where the -- 2.7.4