diff options
author | Sven Gothel <[email protected]> | 2020-11-23 19:58:47 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-11-23 19:58:47 +0100 |
commit | 21f35e4e448a85cb6ba307e7a10db6bebb42c86b (patch) | |
tree | 1c9dae3e1b8bddf359700419a8ca82d59e4df1d8 | |
parent | 52352d6ba1019107ee8a3619643d472520c0def8 (diff) |
Fix dbt_scanner10.cpp (NPE) and align DBTScanner10.java ..
-rw-r--r-- | examples/direct_bt_scanner10/dbt_scanner10.cpp | 9 | ||||
-rw-r--r-- | examples/java/DBTScanner10.java | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/examples/direct_bt_scanner10/dbt_scanner10.cpp b/examples/direct_bt_scanner10/dbt_scanner10.cpp index c2773cf4..bcda886a 100644 --- a/examples/direct_bt_scanner10/dbt_scanner10.cpp +++ b/examples/direct_bt_scanner10/dbt_scanner10.cpp @@ -68,7 +68,7 @@ static bool REMOVE_DEVICE = true; static bool USE_WHITELIST = false; static std::vector<EUI48> WHITELIST; -static std::string charIdentifier = nullptr; +static std::string charIdentifier = ""; static int charValue = 0; static bool SHOW_UPDATE_EVENTS = false; @@ -423,7 +423,7 @@ static void processConnectedDevice(std::shared_ptr<DBTDevice> device) { { // WIP: Implement a simple Characteristic ping-pong writeValue <-> notify transmission for stress testing. DBTManager & manager = device->getAdapter().getManager(); - if( nullptr != charIdentifier ) { + if( nullptr != charIdentifier && charIdentifier.length() > 0 ) { GATTCharacteristic * char2 = (GATTCharacteristic*) nullptr; // manager.find(BluetoothType.GATT_CHARACTERISTIC, null, charIdentifier, device); fprintf(stderr, "Char UUID %s\n", charIdentifier.c_str()); @@ -788,8 +788,8 @@ int main(int argc, char *argv[]) "[-disconnect] [-enableGATTPing] [-count <number>] [-single] [-show_update_events] [-quiet] " "[-resetEachCon connectionCount] " "(-mac <device_address>)* (-wl <device_address>)* " - "[-seclevel <int>] [-iocap <int>] [-passkey <digits>]" - "[-charid <uuid>] [-charval <byte-val>]" + "[-seclevel <int>] [-iocap <int>] [-passkey <digits>] " + "[-charid <uuid>] [-charval <byte-val>] " "[-dbt_verbose true|false] " "[-dbt_debug true|false|adapter.event,gatt.data,hci.event,mgmt.event] " "[-dbt_mgmt cmd.timeout=3000,ringsize=64,...] " @@ -809,6 +809,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "btmode %s\n", getBTModeString(btMode).c_str()); fprintf(stderr, "passkey %u\n", pairing_passkey); fprintf(stderr, "seclevel %s\n", getBTSecurityLevelString(sec_level).c_str()); + fprintf(stderr, "iocap %s\n", getSMPIOCapabilityString(io_capabilities).c_str()); fprintf(stderr, "characteristic-id: %s\n", charIdentifier.c_str()); fprintf(stderr, "characteristic-value: %d\n", charValue); diff --git a/examples/java/DBTScanner10.java b/examples/java/DBTScanner10.java index 44d7f9d6..33e799ca 100644 --- a/examples/java/DBTScanner10.java +++ b/examples/java/DBTScanner10.java @@ -373,7 +373,7 @@ public class DBTScanner10 { { // WIP: Implement a simple Characteristic ping-pong writeValue <-> notify transmission for stress testing. final BluetoothManager manager = device.getAdapter().getManager(); - if( null != charIdentifier ) { + if( null != charIdentifier && charIdentifier.length() > 0 ) { final BluetoothGattCharacteristic char2 = (BluetoothGattCharacteristic) manager.find(BluetoothType.GATT_CHARACTERISTIC, null, charIdentifier, device); println("Char UUID "+charIdentifier); @@ -762,11 +762,11 @@ public class DBTScanner10 { } println("Run with '[-btmode LE|BREDR|DUAL] "+ "[-bluetoothManager <BluetoothManager-Implementation-Class-Name>] "+ - "[-disconnect] [-enableGATTPing] [-count <number>] [-single] [-show_update_events] [-quiet] "+ + "[-disconnect] [-enableGATTPing] [-count <number>] [-single] [-show_update_events] [-quiet] "+ "[-resetEachCon connectionCount] "+ "(-mac <device_address>)* (-wl <device_address>)* "+ - "[-seclevel <int>] [-iocap <int>] [-passkey <digits>]" + - "[-charid <uuid>] [-charval <byte-val>]"+ + "[-seclevel <int>] [-iocap <int>] [-passkey <digits>] " + + "[-charid <uuid>] [-charval <byte-val>] "+ "[-verbose] [-debug] "+ "[-dbt_verbose true|false] "+ "[-dbt_debug true|false|adapter.event,gatt.data,hci.event,mgmt.event] "+ @@ -787,6 +787,7 @@ public class DBTScanner10 { println("QUIET "+test.QUIET); println("passkey "+test.pairing_passkey); println("seclevel "+test.sec_level); + println("iocap "+test.io_capabilities); println("characteristic-id: "+test.charIdentifier); println("characteristic-value: "+test.charValue); |