Commit 78b23091 by onuma

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

parent 97554d16
...@@ -146,23 +146,7 @@ public class AlcoholCheckerUtil { ...@@ -146,23 +146,7 @@ public class AlcoholCheckerUtil {
// mutex // mutex
private Object lockObj = new Object(); private Object lockObj = new Object();
public AlcoholCheckerUtil(Context context, AlcoholCheckerUtilListener listener) { public BleManagerUtilListener bleManagerUtilListener = new BleManagerUtilListener() {
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() {
@Override @Override
public void onGetDeviceInfoFailed(int status) { public void onGetDeviceInfoFailed(int status) {
...@@ -176,38 +160,12 @@ public class AlcoholCheckerUtil { ...@@ -176,38 +160,12 @@ public class AlcoholCheckerUtil {
@Override @Override
public void onConnectionState(int status) { public void onConnectionState(int status) {
// Logger.i(TAG,"-------------------------------------------------------------- = %s", status); Logger.d(TAG,"onConnectionState = %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);
// }
} }
@Override @Override
public void onDisConnectionState() { public void onDisConnectionState() {
// Logger.d(TAG,"onDisConnectionState");
// listener.onConnectionError(0);
// //isConnected = false;
} }
@Override @Override
...@@ -218,9 +176,7 @@ public class AlcoholCheckerUtil { ...@@ -218,9 +176,7 @@ public class AlcoholCheckerUtil {
@Override @Override
public void onServicesDiscovered(int status) { public void onServicesDiscovered(int status) {
//Logger.i(TAG,"-------------------------------------------------------------- = %s", status);
Logger.i(TAG,"onServicesDiscovered = %s", status); Logger.i(TAG,"onServicesDiscovered = %s", status);
//Logger.i(TAG,"-------------------------------------------------------------- = %s", status);
if (status == BluetoothGatt.GATT_SUCCESS) { if (status == BluetoothGatt.GATT_SUCCESS) {
Logger.i(TAG,"BluetoothGatt.GATT_SUCCESS"); Logger.i(TAG,"BluetoothGatt.GATT_SUCCESS");
...@@ -231,11 +187,9 @@ public class AlcoholCheckerUtil { ...@@ -231,11 +187,9 @@ public class AlcoholCheckerUtil {
// Check TX and RX UUIDs // Check TX and RX UUIDs
RxChar = TaiyoYudenService.getCharacteristic(RX_CHARACTERISTIC_UUID); RxChar = TaiyoYudenService.getCharacteristic(RX_CHARACTERISTIC_UUID);
TxChar = TaiyoYudenService.getCharacteristic(TX_CHARACTERISTIC_UUID); TxChar = TaiyoYudenService.getCharacteristic(TX_CHARACTERISTIC_UUID);
//Logger.i(TAG,"iiiiiiiiiiiiiiiiiiiiiii");
if (RxChar == null || TxChar == null) { if (RxChar == null || TxChar == null) {
Logger.e(TAG, "No Tx/Rx"); Logger.e(TAG, "No Tx/Rx");
} else { } else {
//Logger.i(TAG,"iiiiiiiiiiiiiiiiiiiiiii");
gi_status = F_BLE_COM_INIT; gi_status = F_BLE_COM_INIT;
gi_rxlength = 0; gi_rxlength = 0;
...@@ -334,7 +288,24 @@ public class AlcoholCheckerUtil { ...@@ -334,7 +288,24 @@ public class AlcoholCheckerUtil {
Logger.d(TAG, "Wrote descriptor: " + BATTERY_LEVEL_UUID); 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()) { if (!bleManagerUtil.startDeviceInfo()) {
return false; return false;
......
...@@ -420,4 +420,12 @@ public class BleManagerUtil { ...@@ -420,4 +420,12 @@ public class BleManagerUtil {
mBluetoothGatt.readPhy(); mBluetoothGatt.readPhy();
return true; return true;
} }
/**
* リスナー設定
* @param listener リスナー
*/
public void setListener(BleManagerUtilListener listener) {
mListener = listener;
}
} }
...@@ -273,10 +273,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -273,10 +273,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
*/ */
private void initAlcoholCheckerUtil() { private void initAlcoholCheckerUtil() {
Logger.i(TAG,"initAlcoholCheckerUtil"); Logger.i(TAG,"initAlcoholCheckerUtil");
if (alcoholCheckerUtil != null) {
checkerStatus = AlcoholCheckerUtil.fugo_init;
return;
}
alcoholCheckerUtil = new AlcoholCheckerUtil(this, new AlcoholCheckerUtilListener() { alcoholCheckerUtil = new AlcoholCheckerUtil(this, new AlcoholCheckerUtilListener() {
...@@ -341,7 +337,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -341,7 +337,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public void run() { public void run() {
if (isFromError) { if (isFromError) {
if (mMeasureDialog != null) { if (mMeasureDialog != null) {
mMeasureDialog.setMessage(getString(R.string.msg_breath_error)); mMeasureDialog.setMessage(getString(R.string.wait_breathe));
} }
} else { } else {
if (mWaitMeasureDialog != null) { if (mWaitMeasureDialog != null) {
...@@ -563,6 +559,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -563,6 +559,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
isInitBLE = true; isInitBLE = true;
} }
} }
alcoholCheckerUtil.bleManagerUtil.setListener(alcoholCheckerUtil.bleManagerUtilListener);
if (!isInitAlcChecker) { if (!isInitAlcChecker) {
// アルコールチェッカー接続 // アルコールチェッカー接続
connectToAlcholChecker(); 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