Commit 3d1f0f8f by onuma

Log出力を整理

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