语言

Menu
Sites
Language
Incomplete Bluetooth LE scan results

I'm running the example code [1] for discovering Bluetooth LE devices on a new Samsung Gear S2.

My objective is to compute the distance to a beacon (ByteReal TagBeacon 2.0).

It detects a couple of Bluetooth devices but unfortunately all the values, especially txpowerlevel, are null.

I already tried to connect to the device an request the information again but they are still empty.

Scanning for the same beacon with an Android device returns all the required values, so the beacon seems to send the information but I'm not able to fetch them from Tizen.

Any ideas why all value (despite name and address) are null?

Thanks in advance.

1. https://developer.tizen.org/development/tutorials/web-application/tizen-features/network/bluetooth#Discovering_BT_LE_Devices

 

 

响应

10 回复
daniel kim

Hi,

I could get txpowerlevel value from CSR BLE board on Gear S2.

    Found device name: CSR CSC Sensor txpowerlevel: -2  . Connecting... index.html:74
    Connected to device index.html:78
    remoteDevice.uuids: 1816 index.html:82
    remoteDevice.uuids.length :1 index.html:83
    Service 00001816-0000-1000-8000-00805f9b34fb. Has 4 characteristics and 0 sub-services.

 

Following is a code which was used.

function onDeviceFound(device)
 {
    if (remoteDevice === null)
    {
       remoteDevice = device;
       console.log("Found device name: " + device.name + " txpowerlevel: " + device.txpowerlevel + "  . Connecting...");

       device.connect(function connectSuccess()
        {        
          console.log("Connected to device");
         
          var i = 0, service = null;
          var serviceUUIDs = remoteDevice.uuids;
          console.log("remoteDevice.uuids: "+ serviceUUIDs);
          console.log("remoteDevice.uuids.length :"+ serviceUUIDs.length);
          for (i; i < serviceUUIDs.length; i++)
          {
             service = remoteDevice.getService(serviceUUIDs[i]);
             showGATTService(service);
          }         
        
        }  , connectFail);            
    }

    adapter.stopScan();
 }

 adapter.startScan(onDeviceFound);

 

Regards

Andre Diermann

Many thanks for your reply. This confirms it should work in general (so no incomtability with Gear S2 and no issue with Tizen).

My code looks pretty much similar. I was hoping I just forget an requestoption or something like that.

This is what I get:

app.js:39
{"manufacturerData":{"id":"76","data":""},"solicitationuuids":null,"uuids":null,"isConnected":false,"address":"<BEACON ADDRESS>","txpowerlevel":null,"name":"Bytereal","serviceData":null,"appearance":null} 

...so it seems to be an individual issue :-(

Andre Diermann

Using "sdb dlog" shows me this:

E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(39) > Failed to get device name from scan response: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(43) > Failed to get device name from advertise data: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(59) > Failed to get txpower strength from scan response: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(63) > Failed to get txpower strength from advertise data: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(77) > Failed to get appearance value from scan response: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(81) > Failed to get appearance value from advertise data: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(96) > Failed to get service data list from scan response: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(100) > Failed to get service data list from advertise data: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(118) > Failed to get manufacturer data list from scan response: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(148) > Failed to get the service solicitation UUID list from scan response: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(152) > Failed to get the service solicitation UUID list from advertise data: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(167) > Failed to get the service service_uuids list from scan response: -61
E/WRT_PLUGINS/TIZEN(19345): BluetoothLEDevice.cpp: BluetoothLEDevice(171) > Failed to get the service service_uuids list from advertise data: -61

Furthermore, when now using another beacon (Hi Bytereal Intelligent Connect) the application just closes. No error, no log, nothing. I removed all code accept "adapter.startScan()" and the application closes as soon as I turn on the beacon.

So it has to be a Tizen internal error... I'm using a Samsung Gear S2 with software version R732XXU2BOL6.

Aldrin Joe Mathew

I'm also having the same issue. Have you got it working?

vrajesh s

Hello,

I am facing similar issue. once GATT Operation done, Second time i am unable to scan any Beacon.

I am developing basic demo BLE app.  Wearable  SDK 3.0, Device: Samsung Gear S2, I have two buttons Start and  Stop. when press start button app start scanning and if found perticular like MY_BEACON_1 then gatt operation perform. GATT operation-> read service - characterstic- descriptor UUIDs, Write command and get response. once i finished this unable to scan beacon second time. Even i destroy client, deregister service on stop button. But unable to scan.  If i disconnect battery cell of beacon  then connect (add) , scanning is wors. 

 

Stop button some time give positive response like: client successfully destroy, Successfully deregister GATT, But not work all time

Please suggest me the right way to disconnet chip, GATT, Client.

Code (stop) button:


    
static void btn_stop_cb(void *data, Evas_Object *obj, void *event_info) {
//Disconnect : got null value;
	ret = bt_gatt_disconnect(remoteaddress);
	dlog_print(DLOG_INFO, LOG_TAG, "Remote address of FxChip %s",
			remoteaddress);
	dlog_print(DLOG_INFO, LOG_TAG, "%s",
			ret == BT_ERROR_NONE ?
					"Successfully disconnect - stop call" :
					"Fail to disconnect - stop call ");

	ret = bt_gatt_client_unset_characteristic_value_changed_cb(chr);
	if (ret == BT_ERROR_NONE)
		dlog_print(DLOG_INFO, LOG_TAG, "UNSET Characteristics result success");
	else
		dlog_print(DLOG_INFO, LOG_TAG, "UNSET Characteristics result failed");

	// Destroy the client
	if (client != NULL) {
		ret = bt_gatt_client_destroy(client);
		if (ret == BT_ERROR_NONE) {
			dlog_print(DLOG_INFO, LOG_TAG, "Successfully destroy client");

		} else
			dlog_print(DLOG_INFO, LOG_TAG, "Falied to destroy client");
		client = NULL;
	}

	//De-register the GATT connection callback
	ret = bt_gatt_unset_connection_state_changed_cb();
	if (ret != BT_ERROR_NONE) {
		dlog_print(DLOG_INFO, LOG_TAG, "Failed to deregister");
	} else
		dlog_print(DLOG_INFO, LOG_TAG, "Successfully deregister");

	//stop scanning
		ret = bt_adapter_le_stop_scan();
		if (ret != BT_ERROR_NONE) {
			dlog_print(DLOG_ERROR, LOG_TAG, "[bt_adapter_le_stop_scan] failed.");
		}
}

 

Thanks,

Vrajesh S

 

 

vrajesh s

Hello, daniel kim and Andre Diermann 

 Any suggestion regarding this issue ?

what i did for disconnect beacon:

1) Stop scan, -success

2) Derigister characteristic. -success

3) Call GATT connection callback - success

4) Disconnect Client -success

5) Deregister GATT -success

6) Deintiliaze Bluetooth all operations. -success

"If i disconnect battery cell of beacon then connect (add) , scanning is work."

Ref: http://stackoverflow.com/questions/43560730/how-to-disconnect-ble-beacon-from-samsung-gear-s2-watch

Regards,

Vrajesh s

Aldrin Joe Mathew

When I use the bluetooth LE adapter after the startScan() method is called, the control does not enter into the success callback and the beacon is not detected and after 10-20 seconds, the application is exited. And when I invoke stopScan() method it casues an unknown error stating 'Unable to stop scan'. Any solutions?
 

André Reus

How did you tried ? It will be better if you post your problem with a new thread with some code snippet. 

Aldrin Joe Mathew

Actually I have got it working. But how do I get my required characteristic and descriptor values by providing the UUID as in android, iOS or in Tizen Native like service.getCharacteristic(uuid) or characteristic.getDescriptor(uuid)? Now the option I have is to loop through the characteristic and descriptor arrays, and there's no provision to see their UUIDs. What can I do about this?