Hi developers,
I would need some help, as I am fighting since 2 days on a simple problem.
I used the Nordic BLE example:
https://github.com/fabiobaltieri/ciq-nrf-blinky
as a template for my BLE project.
Now I run into the problem, that the device name is not reported by BLE scan result. This is a known issue in the SDK:
As a workaround I want to compare the UUID instead of the device name in my project, as the UUID is found in the BLE scan correctly.
=> But how to compare the UUID provided via getServiceUuids() against a fix value?
Sounds simple, tried many times with printf debugging (log), no solution found.
Some code snippets:
function initialize() { SERVICE = Ble.stringToUuid("19067010-db9e-4075-a5b5-e6df36619906"); READ_CHAR = Ble.stringToUuid("19067011-db9e-4075-a5b5-e6df36619906"); READ_DESC = Ble.cccdUuid(); WRITE_CHAR = Ble.stringToUuid("19067012-db9e-4075-a5b5-e6df36619906"); SCAN_TIMEOUT = 5; RESCAN_DELAY = 10; BleDevice.initialize(); } function onScanResults(scanResults) { debug("scan results"); var appearance, name, rssi, rawdata; var mfg, uuids, service; for (var result = scanResults.next(); result != null; result = scanResults.next()) { if (result instanceof Ble.ScanResult) { appearance = result.getAppearance(); name = result.getDeviceName(); rssi = result.getRssi(); mfg = result.getManufacturerSpecificDataIterator(); uuids = result.getServiceUuids(); rawdata = result.getRawData(); debug("device: appearance: " + appearance + " name: " + name + " rssi: " + rssi); debug("result raw: " + rawdata); debug("Vor matchDevice"); if (matchDevice(name, mfg, uuids)) { //if (appearance==4660) { connect(result); return; } } } } protected function matchDevice(name, mfg, uuids) { //dumpUuids(uuids); //dumpUuids(UUID_COMPARE); //dumpMfg(mfg); // if (name != null && ( // name.equals(DEVICE_NAME) || // name.equals(DEVICE_NAME_Z))) { // return true; // } var uuidString = uuids.String; debug("SERVICE: " + SERVICE); debug("uuidString: " + uuidString); if (uuids.equals(SERVICE)) { debug("matchDevice: Found"); return true; } debug("matchDevice: NOT Found"); return false; }
Main question is on line 53 the does not work....
Thanks for support.
Best Regards Sven