コメントを追加

This commit is contained in:
it232115 2024-01-23 02:59:54 +09:00
parent 10fc0d7251
commit 1077db14b0

View File

@ -249,6 +249,7 @@ public class TestService extends Service {
if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) { if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) {
//Do something if connected //Do something if connected
//Bluetoothデバイスが接続されたときの処理
Log.d("BT", "Device connected"); Log.d("BT", "Device connected");
@ -256,10 +257,12 @@ public class TestService extends Service {
Log.d("BT_Judge", "Registered: " + registeredId); Log.d("BT_Judge", "Registered: " + registeredId);
if (deviceHardwareAddress.equals(registeredId)) { if (deviceHardwareAddress.equals(registeredId)) {
//登録済みのデバイスだったときの処理
Log.d("BT_Judge", "登録済み"); Log.d("BT_Judge", "登録済み");
e.putBoolean("connection_status",true); e.putBoolean("connection_status",true);
} else{ } else{
//登録していないデバイスだったときの処理
Log.d("BT_Judge", "未登録"); Log.d("BT_Judge", "未登録");
e.putBoolean("connection_status",false); e.putBoolean("connection_status",false);
} }
@ -268,6 +271,7 @@ public class TestService extends Service {
} else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)&&!isInCar) {//bluetoothが切断されたときに乗車状態のとき } else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)&&!isInCar) {//bluetoothが切断されたときに乗車状態のとき
//Do something if disconnected //Do something if disconnected
//デバイスが切断されたときの処理
if (deviceHardwareAddress.equals(registeredId)) { if (deviceHardwareAddress.equals(registeredId)) {
// 5分待機する // 5分待機する
Handler handler = new Handler(); Handler handler = new Handler();