-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Try to build and test the demo but it never execure evt.getSource();
hi.add(new Button(new Command("start scan") {
@Override
public void actionPerformed(ActionEvent evt) {
updateAction("start scan");
try {
bt.startScan((ActionListener) evt1 -> {
try {
JSONObject res = (JSONObject) evt1.getSource();
System.out.println("response " + res);
updateAction("response " + res);
if (res.getString("status").equals("scanResult")) {
//if this is a new device add it
if (!devices.containsKey(res.getString("address"))) {
devices.put(res.getString("address"), res);
updateAction("Dispositivi: " + devices.size());
updateUI();
}
}
} catch (JSONException ex) {
Log.e(ex);
}
}, null, true, Bluetooth.SCAN_MODE_LOW_POWER, Bluetooth.MATCH_MODE_STICKY,
Bluetooth.MATCH_NUM_MAX_ADVERTISEMENT, Bluetooth.CALLBACK_TYPE_ALL_MATCHES);
}catch (IOException ex) {
Log.e(ex);
}
}
}));
How can I get the list of the devices?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels