Commit 3e48ada3 by onuma

#47941 HW連携 アルコールチェッカーから値を取得する処理を追加中6

iOSとふるまいを同じにした。
parent 32a57b15
......@@ -139,10 +139,9 @@ public class AlcoholCheckerUtil {
}
public void finish() {
sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
isConnected = false;
//stopAlcTimer();
//disconnect(true);
stopAlcTimer();
disconnect(true);
}
// Bluetoothアダプタの取得処理
......@@ -174,8 +173,6 @@ public class AlcoholCheckerUtil {
Logger.i(TAG, "Disconnected from GATT server.");
listener.onConnectionError(19);
}
//finish();
} else {
Logger.i(TAG,"UNKNOW STATE = " + status);
}
......@@ -193,6 +190,7 @@ public class AlcoholCheckerUtil {
Logger.i(TAG,"onConnectionError = %s", status);
listener.onConnectionError(status);
isConnected = false;
stopAlcTimer();
disconnect(true);
}
......
......@@ -79,8 +79,17 @@ public class BleManagerUtil {
@Override
public void run() {
// 接続完了
if (mBluetoothGatt == null || !mBluetoothGatt.discoverServices()) { // サービス検索
boolean isGattaNull = false;
boolean isNotDiscoverService = false;
if (mBluetoothGatt != null) {
if (!mBluetoothGatt.discoverServices()) {
isNotDiscoverService = true;
}
}
if (mBluetoothGatt == null) {
isGattaNull = true;
}
if (isGattaNull || isNotDiscoverService) {
runOnUiThread( new Runnable() { // 接続失敗
@Override
public void run() {
......@@ -99,8 +108,6 @@ public class BleManagerUtil {
disconnect(true);
return;
}
mListener.onConnectionState(status);
}
// サービス検索が完了したときの処理(mBluetoothGatt.discoverServices()の結果として呼ばれる。)
......
......@@ -418,19 +418,26 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override
public void run() {
closeAllDialog();
if (isFinish) {
// BLE接続を解除して接続方法選択状態に戻る(基本中止(キャンセルは切断)
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
alcoholCheckerUtil.finish();
} else {
// BLEは切断しないが測定中断、測定開始状態に戻す(測定完了した場合は、RDYに戻す
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F22);
}
JSONObject responseJson = new JSONObject();
responseJson.put(ABookKeys.TASK_QUESTION_ID, mQid);
responseJson.put("value", value);
afterABookCheckApi(mCmd, "", 0, "", responseJson.toString());
Logger.i(TAG, "successAfterAbookCheckAip JSON [%s]", responseJson.toString());
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (isFinish) {
// BLE接続を解除して接続方法選択状態に戻る(基本中止(キャンセルは切断)
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
alcoholCheckerUtil.finish();
} else {
// BLEは切断しないが測定中断、測定開始状態に戻す(測定完了した場合は、RDYに戻す
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F22);
}
}
}, 1000);
}
});
}
......@@ -445,9 +452,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public void run() {
closeAllDialog();
// BLE接続を解除して接続方法選択状態に戻る(基本中止(キャンセルは切断)
//alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
alcoholCheckerUtil.finish();
//afterABookCheckApi(mCmd, "", 1, errorMessage, null);
afterABookCheckApi(mCmd, "", 1, errorMessage, null);
Logger.e(TAG,errorMessage);
}
});
......
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