2016-10-30 02:07 AM
Hi,
I did an implementation of my own app starting from sensorDemo. It communicates with an android app. The device is discovered by a call to:BluetoothAdapter.startLeScan(uuids, mLeScanCallback);
which allows to discover devices that are implementing specified services.
At the beginning, I was using x-cube-ble1. Since the upgrade to BlueNrgDK1.9,
the device is no more discovered with this method. It can be discovered if I don't
specify any implemented service.
I went back to sensorDemo in DK 1.9 and I have the same behaviour.
Is it a bug or is there something to change?
Regards
Julien
2016-10-31 10:47 AM
Hello,
Are you using The
version 2.0.2 and follow this ? Are you using this version 2.7.0 ? Have a look to this , it maybe helpful.Regards2016-11-10 10:53 AM
Hello
thanks for your answer, it helped me in understanding that STSW-BLUENRG-DK and is not a new version of X-CUBE-BLE1. It's confusing, they both provide some common projects, some common middlewares but not always exactly the same implementation. Why those 2 packages are not merged in a single one? Appart from this, I found that discovering a service from sensorDemo by an android device is an wrong memory. I had to change some code to able to do it. BUT I still have an issue. I was able to make it work successfully or not with X-CUBE-BLE1 2.7.0. Here's the modified code to discover the service:void setConnectable(void)
{
tBleStatus ret;
const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u', 'e', 'n'};
/* disable scan response */
hci_le_set_scan_resp_data(0,NULL);
PRINTF(''General Discoverable Mode.
'');
uint8_t serviceUUIDList[17];
uint8_t* uuid = serviceUUIDList + 1;
COPY_ACC_SERVICE_UUID(uuid);
serviceUUIDList[0] = AD_TYPE_128_BIT_SERV_UUID;
ret = aci_gap_set_discoverable(ADV_IND, 0, 0, PUBLIC_ADDR, NO_WHITE_LIST_USE, sizeof(local_name), local_name, sizeof(serviceUUIDList), serviceUUIDList, 0,0);
if (ret != BLE_STATUS_SUCCESS) {
PRINTF(''Error while setting discoverable mode (%d)
'', ret);
}
}
This code works except if local_name is longer than 5 bytes.
const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u', 'e', 'n', 'r'};
does not work.
I went thru aci_gap_set_discoverable() code: the status after the call to hci_send_req() is 0x42 while it should be 0. I was not able to find 0x42 anywhere in the lib to go further.
Do you have any idea of what may happen?
Thanks
Julien
2016-11-10 10:55 AM
Oh! and I'm using Nucleo401 and IDB05A1.