Commit 3d1f0f8f by onuma

Log出力を整理

parent 578660c4
......@@ -23,8 +23,6 @@ public class AlcoholCheckerTimerTask extends TimerTask {
this.listener = listener;
}
public boolean notimeout = false;
@Override
public void run() {
......
......@@ -187,16 +187,16 @@ public class AlcoholCheckerUtil {
@Override
public void onDisConnectionState() {
Logger.i(TAG,"onDisConnectionState");
Logger.d(TAG,"onDisConnectionState");
listener.onConnectionError(0);
isConnected = false;
//isConnected = false;
}
@Override
public void onConnectionError(int status) {
Logger.i(TAG,"onConnectionError = %s", status);
Logger.d(TAG,"onConnectionError = %s", status);
listener.onConnectionError(status);
isConnected = false;
//isConnected = false;
//stopAlcTimer();
//disconnect(true);
......@@ -204,7 +204,7 @@ public class AlcoholCheckerUtil {
@Override
public void onServicesDiscovered(int status) {
Logger.i(TAG,"onServicesDiscovered = %s", status);
Logger.d(TAG,"onServicesDiscovered = %s", status);
if (status == BluetoothGatt.GATT_SUCCESS) {
Logger.i(TAG,"BluetoothGatt.GATT_SUCCESS");
......@@ -249,7 +249,7 @@ public class AlcoholCheckerUtil {
}
}
} else {
Logger.d(TAG,"");
}
}
......@@ -269,7 +269,7 @@ public class AlcoholCheckerUtil {
@Override
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
Logger.i(TAG,"onDescriptorWrite");
Logger.d(TAG,"onDescriptorWrite");
if (bleManagerUtil.mBluetoothGatt != null) {
if (bleManagerUtil.mBluetoothGatt.getService(TY_SERVICE_UUID).getCharacteristic(INDICATION_CHARACTERISTIC_UUID) == null) {
Logger.d(TAG, "Old version");
......@@ -293,7 +293,7 @@ public class AlcoholCheckerUtil {
notification_descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
bleManagerUtil.mBluetoothGatt.writeDescriptor(notification_descriptor);
} else if(characteristic_uuid.equals(BATTERY_LEVEL_UUID)){
Logger.i(TAG, "Wrote descriptor: " + BATTERY_LEVEL_UUID);
Logger.d(TAG, "Wrote descriptor: " + BATTERY_LEVEL_UUID);
}
}
});
......@@ -517,7 +517,7 @@ public class AlcoholCheckerUtil {
sub_rx_data_gen(rxdata);
// Mode
Logger.i(TAG,"---------------------------------gi_status = " + gi_status);
Logger.i(TAG,"gi_status = " + gi_status);
switch (gi_status) {
case F_BLE_COM_INIT:
// BLE Init
......@@ -573,7 +573,7 @@ public class AlcoholCheckerUtil {
si_ret = F_BLE_COM_RP_WAIT;
// Command Check
Logger.i(TAG,"RP_RENGTH=" + gi_rxlength);
Logger.d(TAG,"RP_RENGTH=" + gi_rxlength);
if (gi_rxlength == F_RX_RP_LENGTH) {
if ((gb_rxdat[F_RX_COMMAND_POS] == F_RP_COMMAND_MSB) && (gb_rxdat[(F_RX_COMMAND_POS + 1)] == F_RP_COMMAND_LSB)) {
sb_mode = gb_rxdat[F_RX_RP_MODE_POS];
......@@ -644,61 +644,59 @@ public class AlcoholCheckerUtil {
// Failed
listener.onBreakDownError("BreakDown");
si_ret = F_BLE_COM_RP_START;
Logger.i(TAG, "ERROR 0x12 si_ret = F_BLE_COM_RP_START");
Logger.d(TAG, "ERROR 0x12 si_ret = F_BLE_COM_RP_START");
break;
case (byte) 0x14:
listener.onLowBatteryError("Low Battery");
// Low Battery
si_ret = F_BLE_COM_RP_START;
Logger.i(TAG, "ERROR 0x14 si_ret = F_BLE_COM_RP_START");
Logger.d(TAG, "ERROR 0x14 si_ret = F_BLE_COM_RP_START");
break;
case (byte) 0x15:
// Calc
listener.onUpdateTBVCalc("Calculationg");
gf_result_flg = false;
si_ret = F_BLE_COM_RP_START;
Logger.i(TAG, "ERROR 0x15 si_ret = F_BLE_COM_RP_START");
Logger.d(TAG, "ERROR 0x15 si_ret = F_BLE_COM_RP_START");
break;
case (byte) 0x1F:
listener.onOverUsedError("Over Used");
// Excess usage count
gf_result_flg = false;
si_ret = F_BLE_COM_RP_START;
Logger.i(TAG, "ERROR 0x1F si_ret = F_BLE_COM_RP_START");
Logger.d(TAG, "ERROR 0x1F si_ret = F_BLE_COM_RP_START");
break;
case (byte) 0x20:
listener.onPowerOff("OFF");
// Power Down
si_ret = F_BLE_COM_RP_START;
Logger.i(TAG, "ERROR 0x20 si_ret = F_BLE_COM_RP_START");
Logger.d(TAG, "ERROR 0x20 si_ret = F_BLE_COM_RP_START");
break;
case (byte) 0x21:
listener.onUpdateTBVCalc("Data");
// Result Data Screen
si_ret = F_BLE_COM_RP_START;
Logger.i(TAG, "DATA 0x21 si_ret = F_BLE_COM_RP_START");
Logger.d(TAG, "DATA 0x21 si_ret = F_BLE_COM_RP_START");
break;
default:
// Others
si_ret = F_BLE_COM_RP_START;
Logger.i(TAG, "OTHERS 0x20 si_ret = F_BLE_COM_RP_START");
Logger.d(TAG, "OTHERS 0x20 si_ret = F_BLE_COM_RP_START");
break;
}
} else {
//Logger.e(TAG,"RP Error");
si_ret = F_BLE_COM_RP_START;
}
} else {
if (gi_rxlength < F_RX_RP_LENGTH) {
/* Receiving */
si_ret = F_BLE_COM_RP_WAIT;
//Logger.e(TAG,"gi_rxlength < F_RX_RP_LENGTH, si_ret == F_BLE_COM_RP_WAIT");
Logger.d(TAG,"gi_rxlength < F_RX_RP_LENGTH, si_ret == F_BLE_COM_RP_WAIT");
} else {
Logger.e(TAG,"RP Length Error");
si_ret = F_BLE_COM_RP_START;
//Logger.e(TAG,"gi_rxlength < F_RX_RP_LENGTH, si_ret = F_BLE_COM_RP_START;");
Logger.d(TAG,"gi_rxlength < F_RX_RP_LENGTH, si_ret = F_BLE_COM_RP_START;");
}
}
......@@ -730,9 +728,7 @@ public class AlcoholCheckerUtil {
//
if (fcWaitMode == 0) {
if (rxdata[0] == 1 && rxdata[1] == 102 && rxdata[2] == 99 && rxdata[3] == 3) {
Logger.i(TAG, "fc-----あああああああああああああああ---------------");
//Logger.i(TAG, "fc--------------------------------------------------------------------------------");
//Logger.i(TAG, "fc--------------------------------------------------------------------------------");
//Logger.i(TAG, "fc--------------------");
fcWaitMode = 1;
}
} else if (fcWaitMode == 1) {
......@@ -743,9 +739,9 @@ public class AlcoholCheckerUtil {
// E 14 チェックサム
// 4 4
if (rxdata[0] != 0x31) {
Logger.i(TAG, "------FC失敗");
//Logger.i(TAG, "------FC失敗");
}
Logger.i(TAG, "fc=" + fcWaitMode);
//Logger.i(TAG, "fc=" + fcWaitMode);
listener.onGetDeviceInfo(alcol);
fcWaitMode = 0;
......
......@@ -106,7 +106,7 @@ public class BleManagerUtil {
}
if( BluetoothProfile.STATE_DISCONNECTED == newState ) { // 切断完了(接続可能範囲から外れて切断された)
Logger.e(TAG,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
Logger.e(TAG,"out of range");
// 切断が発生する場合、Bluetoothと接続を切断する。
disconnect(true);
return;
......@@ -132,7 +132,7 @@ public class BleManagerUtil {
// キャラクタリスティックが読み込まれたときの処理
@Override
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status ) {
Logger.i(TAG, "onCharacteristicRead");
Logger.d(TAG, "onCharacteristicRead");
if (BluetoothGatt.GATT_SUCCESS != status) {
return;
}
......
......@@ -287,7 +287,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override
public void onUpdateSendMessage(String text) {
Logger.i(TAG, "onUpdateSendMessage = %s", text);
Logger.d(TAG, "onUpdateSendMessage = %s", text);
}
@Override
......@@ -297,7 +297,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override
public void onServicesDiscovered(int status) {
Logger.i(TAG, "onServicesDiscovered = %s", status);
Logger.d(TAG, "onServicesDiscovered = %s", status);
if (alcStatus == fugo_wait_connect) {
alcStatus = fugo_conntected;
} else {
......@@ -325,6 +325,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override
public void onStartMeasurement() {
Logger.d(TAG, "onStartMeasurement");
if (alcStatus == fugo_conntected) {
alcStatus = fugo_wait_go;
} else {
......@@ -344,17 +345,20 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override
public void onConnectionError(int status) {
Logger.d(TAG,"onConnectionError = " + status);
String message = "";
if (status == 133 || status == 8) {
message = getString(R.string.msg_connection_timeout); // デバイスと接続されていない
} else if (status == 19) {
message = getString(R.string.msg_disconnected_device);
}
alcoholCheckerUtil.isConnected = false;
errorAfterAbookCheckApi(message);
}
@Override
public void onMeasurementError(String text) {
Logger.d(TAG,"onMeasurementError = " + text);
if (mMeasureDialog != null) {
alcStatus = fugo_fu_error;
runOnUiThread(new Runnable() {
......@@ -423,19 +427,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
JSONObject responseJson = new JSONObject();
responseJson.put(ABookKeys.TASK_QUESTION_ID, mQid);
responseJson.put("value", value);
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
// }
// });
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
afterABookCheckApi(mCmd, "", 0, "", responseJson.toString());
Logger.i(TAG, "successAfterAbookCheckAip JSON [%s]", responseJson.toString());
// if (isFinish) {
// alcoholCheckerUtil.finish();
// } else {
//
// }
}
});
}
......@@ -449,13 +443,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override
public void run() {
closeAllDialog();
// BLE接続を解除して接続方法選択状態に戻る(基本中止(キャンセルは切断)
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
// }
// });
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
afterABookCheckApi(mCmd, "", 1, errorMessage, null);
Logger.e(TAG,errorMessage);
}
......@@ -570,11 +558,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
BluetoothPairingDeviceInfoDto dto = getABVUIDataCache().getPairingBluetoothDeviceInfo(Constant.DeviceType.alcoholChecker);
alcStatus = fugo_wait_connect;
if (alcoholCheckerUtil.isConnected) {
Logger.i(TAG, "isConnection = true");
Logger.d(TAG, "isConnection = true");
alcStatus = fugo_conntected;
showWaitMeasureDialog(getString(R.string.alcohol_checker), getString(R.string.connection_completed));
} else {
Logger.i(TAG, "isConnection = false");
Logger.d(TAG, "isConnection = false");
// 登録されているアルコールチェッカーがある
String message = String.format(getString(R.string.ble_connecting), dto.deviceName);
showWaitingDialog(getString(R.string.alcohol_checker), message);
......@@ -1383,6 +1371,13 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mCmd, mTaskKey, mEnableReportHistory, abookCheckParam, mOperationId, mContentPath, getContentId(),
operationDto.reportType, finishCallback, taskReportLevel);
// if (StringUtil.equalsAny(mCmd,ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT,
// ABookKeys.CMD_DELETE_TASK_REPORT , ABookKeys.CMD_CANCEL_TASK_REPORT, ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)
// ){
// // 作業一覧に戻る時,bluetoothを切断する。
// disconnectBluetoothDevice();
// }
} catch(Exception e) {
Logger.e(TAG, "doABookCheckParam error", e);
}
......@@ -1945,4 +1940,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
this.mPhotoEditDialog.show();
}
}
// public void disconnectBluetoothDevice() {
// Logger.d(TAG, "disconnectBluetoothDevice");
//
// if (alcoholCheckerUtil != null) {
// alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
// alcoholCheckerUtil.finish();
// }
// }
}
\ No newline at end of file
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