mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 14:49:53 +01:00
Ignore case when comparing Bluetooth UUIDs.
This commit is contained in:
@@ -233,6 +233,8 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
|
|||||||
String address = p.get("address");
|
String address = p.get("address");
|
||||||
String uuid = p.get("uuid");
|
String uuid = p.get("uuid");
|
||||||
if(address != null && uuid != null) {
|
if(address != null && uuid != null) {
|
||||||
|
if(LOG.isLoggable(Level.FINE))
|
||||||
|
LOG.fine("Searching for " + uuid + " at " + address);
|
||||||
addresses.put(address, c);
|
addresses.put(address, c);
|
||||||
uuids.put(c, uuid);
|
uuids.put(c, uuid);
|
||||||
}
|
}
|
||||||
@@ -255,7 +257,9 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
|
|||||||
if(!started) return null;
|
if(!started) return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
if(LOG.isLoggable(Level.INFO)) LOG.info("Connecting to " + url);
|
||||||
StreamConnection s = (StreamConnection) Connector.open(url);
|
StreamConnection s = (StreamConnection) Connector.open(url);
|
||||||
|
if(LOG.isLoggable(Level.INFO)) LOG.info("Connected");
|
||||||
return new BluetoothTransportConnection(s);
|
return new BluetoothTransportConnection(s);
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
|
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ class ContactListener implements DiscoveryListener {
|
|||||||
for(ServiceRecord record : services) {
|
for(ServiceRecord record : services) {
|
||||||
// Do we recognise the address?
|
// Do we recognise the address?
|
||||||
RemoteDevice device = record.getHostDevice();
|
RemoteDevice device = record.getHostDevice();
|
||||||
ContactId c = addresses.get(device.getBluetoothAddress());
|
String address = device.getBluetoothAddress();
|
||||||
|
ContactId c = addresses.get(address);
|
||||||
if(c == null) continue;
|
if(c == null) continue;
|
||||||
// Do we have a UUID for this contact?
|
// Do we have a UUID for this contact?
|
||||||
String uuid = uuids.get(c);
|
String uuid = uuids.get(c);
|
||||||
@@ -98,8 +99,10 @@ class ContactListener implements DiscoveryListener {
|
|||||||
(Enumeration<DataElement>) classIds.getValue();
|
(Enumeration<DataElement>) classIds.getValue();
|
||||||
for(DataElement classId : Collections.list(e)) {
|
for(DataElement classId : Collections.list(e)) {
|
||||||
UUID serviceUuid = (UUID) classId.getValue();
|
UUID serviceUuid = (UUID) classId.getValue();
|
||||||
if(uuid.equals(serviceUuid.toString())) {
|
if(uuid.equalsIgnoreCase(serviceUuid.toString())) {
|
||||||
// The UUID matches - store the URL
|
// The UUID matches - store the URL
|
||||||
|
if(LOG.isLoggable(Level.FINE))
|
||||||
|
LOG.fine("Discovered " + uuid + " at " + address);
|
||||||
urls.put(c, serviceUrl);
|
urls.put(c, serviceUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user