Commit 80a3681c by onuma

フォームから作業一覧に戻る時に、Bluetooth接続を切断するように修正した。

parent 28ce1e86
...@@ -340,8 +340,15 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity { ...@@ -340,8 +340,15 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
Logger.d(TAG,"-------------------------------------------------"); Logger.d(TAG,"-------------------------------------------------");
Logger.d(TAG,"onDestroy"); Logger.d(TAG,"onDestroy");
Logger.d(TAG,"-------------------------------------------------"); Logger.d(TAG,"-------------------------------------------------");
//Beacon受信停止
unregisterReceiver(mReceiver); try {
//Beacon受信停止
unregisterReceiver(mReceiver);
} catch (Exception e){
// 重量計・放射温度計を切断後に実行したところ
// IllegalArgumentException
Logger.e(TAG, "disconnectBluetoothDevice error", e);
}
// 接続されている機器と切断する。 // 接続されている機器と切断する。
// onuma // onuma
...@@ -1068,6 +1075,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity { ...@@ -1068,6 +1075,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
// SPP通信のタスクが存在すれば接続を切るにする // SPP通信のタスクが存在すれば接続を切るにする
private void disConnectSppBluetooth() { private void disConnectSppBluetooth() {
mDisConnectSppBluetoothFlg = true; mDisConnectSppBluetoothFlg = true;
if (mYamatoReceiveTask != null) { if (mYamatoReceiveTask != null) {
mYamatoReceiveTask.finish(); mYamatoReceiveTask.finish();
mYamatoReceiveTask = null; mYamatoReceiveTask = null;
...@@ -1079,6 +1087,28 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity { ...@@ -1079,6 +1087,28 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
} }
} }
// すべてのBluetooth機器から切断
// onPause処理 -> onDestroy処理の順番を一度に行う
@Override
protected void disconnectBluetoothDevice()
{
Logger.d(TAG,"-------------------------------------------------");
Logger.d(TAG, "disconnectBluetoothDevice");
Logger.d(TAG,"-------------------------------------------------");
try {
disConnectSppBluetooth();
unregisterReceiver(mReceiver);
bleManagerDisconnect(true);
} catch (Exception e){
// 重量計・放射温度計を切断後に実行したところ
// IllegalArgumentException
Logger.e(TAG, "disconnectBluetoothDevice error", e);
}
}
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
......
...@@ -988,6 +988,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -988,6 +988,12 @@ 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)
){
disconnectBluetoothDevice();
}
} catch(Exception e) { } catch(Exception e) {
Logger.e(TAG, "doABookCheckParam error", e); Logger.e(TAG, "doABookCheckParam error", e);
} }
...@@ -1322,4 +1328,5 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1322,4 +1328,5 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
//ABVCheckContentViewActivityから処理 //ABVCheckContentViewActivityから処理
protected void getDeviceInfo(Map<String, String> abookCheckParam) {} protected void getDeviceInfo(Map<String, String> abookCheckParam) {}
protected void disconnectBluetoothDevice(){}
} }
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