Commit 78b23091 by onuma

吹付エラーの後、10秒経過後に「息を吹きかけてください」が表示されなかったのを修正した。

parent 97554d16
......@@ -146,23 +146,7 @@ public class AlcoholCheckerUtil {
// mutex
private Object lockObj = new Object();
public AlcoholCheckerUtil(Context context, AlcoholCheckerUtilListener listener) {
this.context = context;
isConnected = false;
this.listener = listener;
}
public void finish() {
isConnected = false;
disconnect();
}
// Bluetoothアダプタの取得処理
public boolean startGetDeviceInfo() {
// BLE管理
bleManagerUtil = new BleManagerUtil(context, new BleManagerUtilListener() {
public BleManagerUtilListener bleManagerUtilListener = new BleManagerUtilListener() {
@Override
public void onGetDeviceInfoFailed(int status) {
......@@ -176,38 +160,12 @@ public class AlcoholCheckerUtil {
@Override
public void onConnectionState(int status) {
// Logger.i(TAG,"-------------------------------------------------------------- = %s", status);
// Logger.i(TAG,"onConnectionState = %s", status);
// Logger.i(TAG,"-------------------------------------------------------------- = %s", status);
// if (status == BluetoothProfile.STATE_CONNECTED) {
// Log.d(TAG, "Connected to GATT server.");
//
// // ペリフェラルとの接続に成功した時点でサービスを検索する
// if (bleManagerUtil.mBluetoothGatt.discoverServices()) {
// Logger.d(TAG, "Started discovering services");
// } else {
// Logger.d(TAG, "Failed to start discovering services");
// }
// isConnected = true;
//
// } else if (status == BluetoothProfile.STATE_DISCONNECTED) {
//
// if (bleManagerUtil.mBluetoothGatt == null) {
// return;
// } else {
// Logger.i(TAG, "Disconnected from GATT server.");
// listener.onConnectionError(19);
// }
// } else {
// Logger.i(TAG,"UNKNOW STATE = " + status);
// }
Logger.d(TAG,"onConnectionState = %s", status);
}
@Override
public void onDisConnectionState() {
// Logger.d(TAG,"onDisConnectionState");
// listener.onConnectionError(0);
// //isConnected = false;
}
@Override
......@@ -218,9 +176,7 @@ public class AlcoholCheckerUtil {
@Override
public void onServicesDiscovered(int status) {
//Logger.i(TAG,"-------------------------------------------------------------- = %s", status);
Logger.i(TAG,"onServicesDiscovered = %s", status);
//Logger.i(TAG,"-------------------------------------------------------------- = %s", status);
if (status == BluetoothGatt.GATT_SUCCESS) {
Logger.i(TAG,"BluetoothGatt.GATT_SUCCESS");
......@@ -231,11 +187,9 @@ public class AlcoholCheckerUtil {
// Check TX and RX UUIDs
RxChar = TaiyoYudenService.getCharacteristic(RX_CHARACTERISTIC_UUID);
TxChar = TaiyoYudenService.getCharacteristic(TX_CHARACTERISTIC_UUID);
//Logger.i(TAG,"iiiiiiiiiiiiiiiiiiiiiii");
if (RxChar == null || TxChar == null) {
Logger.e(TAG, "No Tx/Rx");
} else {
//Logger.i(TAG,"iiiiiiiiiiiiiiiiiiiiiii");
gi_status = F_BLE_COM_INIT;
gi_rxlength = 0;
......@@ -334,7 +288,24 @@ public class AlcoholCheckerUtil {
Logger.d(TAG, "Wrote descriptor: " + BATTERY_LEVEL_UUID);
}
}
});
};
public AlcoholCheckerUtil(Context context, AlcoholCheckerUtilListener listener) {
this.context = context;
isConnected = false;
this.listener = listener;
}
public void finish() {
isConnected = false;
disconnect();
}
// Bluetoothアダプタの取得処理
public boolean startGetDeviceInfo() {
// BLE管理
bleManagerUtil = new BleManagerUtil(context, bleManagerUtilListener);
if (!bleManagerUtil.startDeviceInfo()) {
return false;
......
......@@ -420,4 +420,12 @@ public class BleManagerUtil {
mBluetoothGatt.readPhy();
return true;
}
/**
* リスナー設定
* @param listener リスナー
*/
public void setListener(BleManagerUtilListener listener) {
mListener = listener;
}
}
......@@ -273,10 +273,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
*/
private void initAlcoholCheckerUtil() {
Logger.i(TAG,"initAlcoholCheckerUtil");
if (alcoholCheckerUtil != null) {
checkerStatus = AlcoholCheckerUtil.fugo_init;
return;
}
alcoholCheckerUtil = new AlcoholCheckerUtil(this, new AlcoholCheckerUtilListener() {
......@@ -341,7 +337,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public void run() {
if (isFromError) {
if (mMeasureDialog != null) {
mMeasureDialog.setMessage(getString(R.string.msg_breath_error));
mMeasureDialog.setMessage(getString(R.string.wait_breathe));
}
} else {
if (mWaitMeasureDialog != null) {
......@@ -563,6 +559,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
isInitBLE = true;
}
}
alcoholCheckerUtil.bleManagerUtil.setListener(alcoholCheckerUtil.bleManagerUtilListener);
if (!isInitAlcChecker) {
// アルコールチェッカー接続
connectToAlcholChecker();
......
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