Commit f386bbe4 by Lee Jaebin

デモ用 検証

parent bd120dc4
...@@ -34,6 +34,7 @@ import java.text.SimpleDateFormat; ...@@ -34,6 +34,7 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -652,6 +653,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity { ...@@ -652,6 +653,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
// return; // 以下の処理にかからないようにreturnする // return; // 以下の処理にかからないようにreturnする
// } // }
// 登録されている定量計量器がある // 登録されている定量計量器がある
showWaitingDialog(getString(R.string.weighing_machine), getString(R.string.ble_connecting)); showWaitingDialog(getString(R.string.weighing_machine), getString(R.string.ble_connecting));
...@@ -659,8 +661,18 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity { ...@@ -659,8 +661,18 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
CommonExecutor.execute(new Runnable() { CommonExecutor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
BluetoothDevice bluetoothDevice = null;
BluetoothDevice bluetoothDevice = mBluetoothAdapter.getRemoteDevice(deviceAddress); Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
// getBondedDevices() はエラー時に null を返すのでチェックが必要.
if (pairedDevices != null) {
for (BluetoothDevice device : pairedDevices) {
if (device.getName().startsWith("BT")) {
bluetoothDevice = device;
break;
}
}
}
// BluetoothDevice bluetoothDevice = mBluetoothAdapter.getRemoteDevice(bluetoothDevice);
if (bluetoothDevice != null) { if (bluetoothDevice != null) {
mBluetoothConnectThread = new BluetoothConnectThread(bluetoothDevice, new BluetoothConnectThread.bluetoothConnectThreadListener() { mBluetoothConnectThread = new BluetoothConnectThread(bluetoothDevice, new BluetoothConnectThread.bluetoothConnectThreadListener() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment