mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-01 19:57:11 +01:00
cleanup (changed to debug and want to keep changes)
This commit is contained in:
parent
c7ebe6e80e
commit
0493ad2ef8
1 changed files with 15 additions and 9 deletions
|
@ -677,21 +677,27 @@ public class BTService extends XWJIService {
|
||||||
if ( BOGUS_MARSHMALLOW_ADDR.equals( btAddr ) ) {
|
if ( BOGUS_MARSHMALLOW_ADDR.equals( btAddr ) ) {
|
||||||
String btName = addr.bt_hostName;
|
String btName = addr.bt_hostName;
|
||||||
if ( null == s_namesToAddrs ) {
|
if ( null == s_namesToAddrs ) {
|
||||||
s_namesToAddrs = new HashMap<String, String>();
|
s_namesToAddrs = new HashMap<>();
|
||||||
}
|
}
|
||||||
if ( ! s_namesToAddrs.containsKey( btName ) ) {
|
|
||||||
|
if ( s_namesToAddrs.containsKey( btName ) ) {
|
||||||
|
btAddr = s_namesToAddrs.get( btName );
|
||||||
|
} else {
|
||||||
|
btAddr = null;
|
||||||
|
}
|
||||||
|
if ( null == btAddr ) {
|
||||||
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
if ( null != adapter ) {
|
if ( null != adapter ) {
|
||||||
Set<BluetoothDevice> devs = adapter.getBondedDevices();
|
for ( BluetoothDevice dev : adapter.getBondedDevices() ) {
|
||||||
Iterator<BluetoothDevice> iter = devs.iterator();
|
Log.d( TAG, "%s => %s", dev.getName(), dev.getAddress() );
|
||||||
while ( iter.hasNext() ) {
|
if ( btName.equals( dev.getName() ) ) {
|
||||||
BluetoothDevice dev = iter.next();
|
btAddr = dev.getAddress();
|
||||||
s_namesToAddrs.put( dev.getName(), dev.getAddress() );
|
s_namesToAddrs.put( btName, btAddr );
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
btAddr = s_namesToAddrs.get( btName );
|
|
||||||
}
|
}
|
||||||
return btAddr;
|
return btAddr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue