Commit 32a57b15 by onuma

#47941 HW連携 アルコールチェッカーから値を取得する処理を追加中5

RDY状態に戻るように修正。
parent b23320c1
......@@ -24,9 +24,6 @@ public class AlcoholCheckerTimerTask extends TimerTask {
}
@Override
public void run() {
//Logger.i(TAG,"--------------------------------------------------------------");
Logger.i(TAG,"AlcohlCheckerTimerTask");
//Logger.i(TAG,"--------------------------------------------------------------");
alcoholCheckerUtil.gi_rxlength = 0;
......@@ -36,41 +33,39 @@ public class AlcoholCheckerTimerTask extends TimerTask {
break;
case F_BLE_COM_RP_START:
// RP Command Send
listener.onUpdateSendMessage("F_BLE_COM_RP_COMMAND");
listener.onUpdateSendMessage("TIMER F_BLE_COM_RP_COMMAND");
alcoholCheckerUtil.sendMessage(" " + F_BLE_COM_RP_COMMAND);
break;
case AlcoholCheckerUtil.F_BLE_COM_RD_START:
// RD Command Send
listener.onUpdateSendMessage("F_BLE_COM_RD_COMMAND");
listener.onUpdateSendMessage("TIMER F_BLE_COM_RD_COMMAND");
alcoholCheckerUtil.sendMessage(" " + F_BLE_COM_RD_COMMAND);
break;
case F_BLE_COM_RECONNECT1:
// ReConecting(NOTIFICATION Disable) // @@@
alcoholCheckerUtil.NotificationDisable(AlcoholCheckerUtil.RxChar, AlcoholCheckerUtil.CCCD);
alcoholCheckerUtil.gi_status = F_BLE_COM_RECONNECT2;
listener.onUpdateStatus("F_BLE_COM_RECONNECT2");
listener.onUpdateStatus("TIMER F_BLE_COM_RECONNECT2");
break;
case F_BLE_COM_RECONNECT2:
// ReConecting(Wait) // @@@
alcoholCheckerUtil.gi_status = F_BLE_COM_RECONNECT3;
listener.onUpdateStatus("F_BLE_COM_RECONNECT3");
listener.onUpdateStatus("TIMER F_BLE_COM_RECONNECT3");
break;
case F_BLE_COM_RECONNECT3:
// ReConecting(NOTIFICATION Enable) // @@@
alcoholCheckerUtil.DescriptorDevice(AlcoholCheckerUtil.RxChar, AlcoholCheckerUtil.CCCD);
alcoholCheckerUtil.gi_status = F_BLE_COM_RP_START;
listener.onUpdateStatus("F_BLE_COM_RP_START");
listener.onUpdateStatus("TIMER F_BLE_COM_RP_START");
break;
default:
//Logger.i(TAG,"--------------------------------------------------------------");
Logger.i(TAG,"AlcohlCheckerTimerTask Timeout");
//Logger.i(TAG,"--------------------------------------------------------------");
if (alcoholCheckerUtil.gi_rxretry_cnt < 100) {
alcoholCheckerUtil.gi_rxretry_cnt++;
}
alcoholCheckerUtil.gi_status = F_BLE_COM_RECONNECT1;
listener.onUpdateStatus("F_BLE_COM_RECONNECT1");
listener.onUpdateStatus("TIMER F_BLE_COM_RECONNECT1");
break;
}
}
......
......@@ -40,9 +40,13 @@ public class AlcoholCheckerUtil {
private static final String PERIPHERAL_NAME = "FALC-31";
public static final UUID CCCD = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
public static final UUID TY_SERVICE_UUID = UUID.fromString("442F1570-8A00-9A28-CBE1-E1D4212D53EB"); // Taiyo Yuden Service UUID
public static final UUID NOTIFICATION_CHARACTERISTIC_UUID = UUID.fromString("442F1571-8A00-9A28-CBE1-E1D4212D53EB"); // Taiyo Yuden Read Notification Characteristic
public static final UUID WRITE_NO_RESPONSE_CHARACTERISTIC_UUID = UUID.fromString("442F1572-8A00-9A28-CBE1-E1D4212D53EB"); // Taiyo Yuden Write No Response Characteristic
public static final UUID INDICATION_CHARACTERISTIC_UUID = UUID.fromString("442F1573-8A00-9A28-CBE1-E1D4212D53EB"); // Taiyo Yuden Read Indication Characteristic
public static final UUID WRITE_CHARACTERISTIC_UUID = UUID.fromString("442F1574-8A00-9A28-CBE1-E1D4212D53EB"); // Taiyo Yuden Write Characteristic
public static final UUID BATTERY_SERVICE_UUID = UUID.fromString("0000180f-0000-1000-8000-00805f9b34fb");
......@@ -67,16 +71,14 @@ public class AlcoholCheckerUtil {
public static final int F_BLE_COM_RECONNECT3 = 7; // ReConecting(NOTIFICATION Enable)
// @BLE Command
public static final String F_BLE_COM_RP_COMMAND = "01525000A304";
public static final String F_BLE_COM_RD_COMMAND = "015244009704";
public static final String F_BLE_COM_FC_COMMAND = "01464301F37E04"; // 測定開始
public static final String F_BLE_COM_FC_COMMAND_F1 = "01464301F17E04"; // BLE接続解除
public static final String F_BLE_COM_FC_COMMAND_F2 = "01464301F27E04"; // 測定中断
public static final String F_BLE_COM_FC_COMMAND_F22 = "01464301F27D04"; // 中断コマンド(rdyに戻す
public static final String F_BLE_COM_RP_COMMAND = "01525000A304"; // 01 52 50 00 A3 04 // RP 送信
public static final String F_BLE_COM_RD_COMMAND = "015244009704"; // 01 52 44 00 97 04 // RD 送信
// RPコマンド 01525000A304
// RDコマンド 015244009704
// FC(中断)コマンド 01464301F27D04
public static final String F_BLE_COM_FC_COMMAND_F11 = "01464301F17C04"; // BLE接続解除 // 01 46 43 01 F1 7C 04
public static final String F_BLE_COM_FC_COMMAND_F22 = "01464301F27D04"; // 測定中断 // 01 46 43 01 F2 7D 04 // READY に戻す
public static final String F_BLE_COM_FC_COMMAND_F33 = "01464301F37E04"; // 測定開始 // 01 46 43 01 F3 7E 04
public static final String F_BLE_COM_RC_COMMAND_D = "0152430144DB04"; // 切断し接続方法選択状態へ戻る  01 52 43 01 44 DB 04
// @BLE Rx
private final int F_RX_BUFSIZE = 32;
......@@ -133,12 +135,14 @@ public class AlcoholCheckerUtil {
public AlcoholCheckerUtil(Context context, AlcoholCheckerUtilListener listener) {
this.context = context;
this.listener = listener;
isConnected = false;
}
public void finish() {
stopAlcTimer();
disconnect(true);
//listener = null;
sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
isConnected = false;
//stopAlcTimer();
//disconnect(true);
}
// Bluetoothアダプタの取得処理
......@@ -148,24 +152,19 @@ public class AlcoholCheckerUtil {
bleManagerUtil = new BleManagerUtil(context, new BleManagerUtilListener() {
@Override
public void onGetDeviceInfoFailed(int status) {
Logger.i(TAG,"onGetDeviceInfoFailed = %s", status);
listener.onGetDeviceInfoFailed(status);
}
@Override
public void onConnectionState(int status) {
Logger.i(TAG,"onConnectionState = %s" + status);
if (status == BluetoothProfile.STATE_CONNECTED) {
Log.i(TAG, "Connected to GATT server.");
Log.d(TAG, "Connected to GATT server.");
// ペリフェラルとの接続に成功した時点でサービスを検索する
if (bleManagerUtil.mBluetoothGatt.discoverServices()) {
Logger.i(TAG, "Started discovering services");
Logger.d(TAG, "Started discovering services");
} else {
Logger.i(TAG, "Failed to start discovering services");
Logger.d(TAG, "Failed to start discovering services");
}
isConnected = true;
} else if (status == BluetoothProfile.STATE_DISCONNECTED) {
......@@ -175,25 +174,27 @@ public class AlcoholCheckerUtil {
Logger.i(TAG, "Disconnected from GATT server.");
listener.onConnectionError(19);
}
} else {
//finish();
} else {
Logger.i(TAG,"UNKNOW STATE = " + status);
}
}
@Override
public void onDisConnectionState() {
//Logger.i(TAG,"------------------------------------");
Logger.i(TAG,"onDisConnectionState");
//Logger.i(TAG,"------------------------------------");
isConnected = false;
listener.onConnectionError(0);
isConnected = false;
}
@Override
public void onConnectionError(int status) {
Logger.i(TAG,"onConnectionError = %s", status);
isConnected = false;
listener.onConnectionError(status);
isConnected = false;
stopAlcTimer();
disconnect(true);
}
@Override
......@@ -249,7 +250,7 @@ public class AlcoholCheckerUtil {
@Override
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
Logger.i(TAG,"onCharacteristicChanged");
Logger.d(TAG,"onCharacteristicChanged");
byte[] rx = characteristic.getValue();
String rxStr = " ";
......@@ -288,7 +289,6 @@ public class AlcoholCheckerUtil {
}
});
if (!bleManagerUtil.startDeviceInfo()) {
return false;
}
......@@ -306,7 +306,7 @@ public class AlcoholCheckerUtil {
}
alcoholCheckerTimerTask = new AlcoholCheckerTimerTask(this, listener);
Timer timer = new Timer(true);
timer.schedule(alcoholCheckerTimerTask, 0, 1000);
timer.schedule(alcoholCheckerTimerTask, 0, 500);
}
/**
......@@ -319,14 +319,12 @@ public class AlcoholCheckerUtil {
}
}
public void connect(int connectTargetDeviceType, String deviceAddress) {
bleManagerUtil.connect(connectTargetDeviceType, deviceAddress);
}
// 切断
public void disconnect(boolean listenerFlg) {
stopAlcTimer();
isConnected = false;
bleManagerUtil.disconnect(listenerFlg);
}
......@@ -365,7 +363,6 @@ public class AlcoholCheckerUtil {
bMessage = hex2string(bMessage); // Requires NumberFormatException
if (bMessage == null) {
// Invalid message
//Toast.makeText(context, "Invalid characters", Toast.LENGTH_SHORT).show();
throw new NumberFormatException();
}
......@@ -384,7 +381,6 @@ public class AlcoholCheckerUtil {
}
TxChar.setValue(chunk);
//if (!mBluetoothGatt.writeCharacteristic(TxChar))
s_mBluetoothGatt = bleManagerUtil.mBluetoothGatt;
if (!s_mBluetoothGatt.writeCharacteristic(TxChar)) {
throw new Exception(new Throwable());
......@@ -393,16 +389,16 @@ public class AlcoholCheckerUtil {
Thread.sleep(10); // Requires InterruptedException
}
Logger.d(TAG,"Tx:" + message);
Logger.i(TAG,"Tx:" + message);
// @Mode Change
switch (gi_status) {
case F_BLE_COM_RP_START:
listener.onUpdateStatus("F_BLE_COM_RP_WAIT");
listener.onUpdateStatus("sendMessage = F_BLE_COM_RP_WAIT");
gi_status = F_BLE_COM_RP_WAIT;
break;
case F_BLE_COM_RD_START:
listener.onUpdateStatus("F_BLE_COM_RD_WAIT");
listener.onUpdateStatus("sendMessage = F_BLE_COM_RD_WAIT");
gi_status = F_BLE_COM_RD_WAIT;
break;
default:
......@@ -415,18 +411,10 @@ public class AlcoholCheckerUtil {
} catch (InterruptedException e) {
Logger.w(TAG,e);
} catch (NumberFormatException e) {
error_msg = "Invalid message format";
//error_msg = "Invalid message format";
} catch (Exception e) {
error_msg = "Failed to send data";
//error_msg = "Failed to send data";
}
//Intent intent;
// if (!error_msg.equals("")) {
// listener.onFugoAction(ACTION_TX_ERROR, null, null, error_msg, null);
// } else {
//
// listener.onFugoAction(ACTION_TX_FINISHED, null, null, message, null);
// }
}
}
Thread thread = new Thread(new MessageSender(message));
......@@ -563,6 +551,7 @@ public class AlcoholCheckerUtil {
si_ret = F_BLE_COM_RP_WAIT;
// Command Check
Logger.i(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];
......@@ -603,6 +592,13 @@ public class AlcoholCheckerUtil {
si_ret = F_BLE_COM_RP_START;
}
//mListener.onUpdateTBVCalc("測定結果表示状態 0x0C");
Logger.i(TAG,"測定結果表示状態 0x0c");
if (si_ret == F_BLE_COM_RD_START) {
Logger.i(TAG, "si_ret = F_BLE_COM_RD_START");
} else {
Logger.i(TAG, "si_ret = F_BLE_COM_RP_START");
}
// 01 46 43 01 F1 7C 04
break;
case (byte) 0x0D:
// Wait
......@@ -621,6 +617,11 @@ public class AlcoholCheckerUtil {
} else {
si_ret = F_BLE_COM_RP_START;
}
if (si_ret == F_BLE_COM_RD_START) {
Logger.i(TAG, "ERROR 0x11 si_ret = F_BLE_COM_RD_START");
} else {
Logger.i(TAG, "ERROR 0x11 si_ret = F_BLE_COM_RP_START");
}
// "エラー 0x11"
listener.onMeasurementError("エラー 0x11");
break;
......@@ -628,50 +629,61 @@ 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");
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");
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");
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");
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");
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");
break;
default:
// Others
si_ret = F_BLE_COM_RP_START;
Logger.i(TAG, "OTHERS 0x20 si_ret = F_BLE_COM_RP_START");
break;
}
} else {
Logger.e(TAG,"RP Error");
//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");
} 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;");
}
}
......
package jp.agentec.abook.abv.cl.util;
public interface AlcoholCheckerUtilListener {
void onGetDeviceInfoFailed(int status);
void onConnectionError(int status); // ディバイス接続エラー
void onMeasurementError(String txt); // 吹付エラー
void onBreakDownError(String txt); // 機器の故障
void onLowBatteryError(String txt); // バッテリー不足
void onOverUsedError(String txt); // 使用回数超過
void onPowerOff(String txt); // 機器の電源がOFF
void onError(String txt); // 機器のエラー
void onStartMeasurement();
void onUpdateTBVCalc(String text);
void onUpdateStatus(String text);
......
......@@ -37,11 +37,6 @@ public class BleManagerUtil {
private BleManagerUtilListener mListener;
private Handler mHandler;
// 定数(Bluetooth LE Gatt UUID)
// Private Service
//private UUID UUID_SERVICE_PRIVATE;
//private UUID UUID_CHARACTERISTIC_PRIVATE;
// for Notification
private UUID UUID_NOTIFY;
......@@ -52,7 +47,6 @@ public class BleManagerUtil {
private int mBleConnectDeviceType;
//public BleManagerUtil(Context context, BleManagerUtilListener listener) {
public BleManagerUtil(Context context, BleManagerUtilListener listener) {
mContext = context;
mListener = listener;
......@@ -74,7 +68,6 @@ public class BleManagerUtil {
@Override
public void run() {
mListener.onConnectionError(status);
//disconnect(true);
Logger.e(TAG,"onConnectionStateChange status = " + status);
}
});
......@@ -91,7 +84,7 @@ public class BleManagerUtil {
runOnUiThread( new Runnable() { // 接続失敗
@Override
public void run() {
mListener.onGetDeviceInfoFailed(status);
//mListener.onGetDeviceInfoFailed(status);
Logger.e("onConnectionStateChange status = " + status);
}
});
......@@ -106,6 +99,8 @@ public class BleManagerUtil {
disconnect(true);
return;
}
mListener.onConnectionState(status);
}
// サービス検索が完了したときの処理(mBluetoothGatt.discoverServices()の結果として呼ばれる。)
......@@ -117,49 +112,11 @@ public class BleManagerUtil {
return;
}
// Logger.d(TAG, "--gattSize : " + gatt.getServices().size());
// if (gatt.getServices().size() == 0) {
// // サービスがない場合は、再接続
// bleGattReconnect();
// return;
// }
mBluetoothGatt.requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_HIGH);
// アルコールチェッカー
//if (mBleConnectDeviceType == Constant.DeviceType.alcoholChecker) {
mListener.onServicesDiscovered(status);
//return;
//}
// 発見されたサービスのループ
// for(BluetoothGattService service : gatt.getServices()) {
// // サービスごとに個別の処理
// if((service == null) || (service.getUuid() == null)) {
// continue;
// }
//
// // GATTサービスのキャラクタリスティックを列挙
// List<BluetoothGattCharacteristic> listCharacteristic = service.getCharacteristics();
// for (BluetoothGattCharacteristic characteristic : listCharacteristic) {
// // 利用したいものがあるはず!
// //Logger.d(TAG, "characteristic : [ " + characteristic );
// }
//
// // プライベートサービス
// if(UUID_SERVICE_PRIVATE.equals(service.getUuid())) {
// // 最初の読み取り
// readCharacteristic(UUID_SERVICE_PRIVATE, UUID_CHARACTERISTIC_PRIVATE);
//
// runOnUiThread( new Runnable() {
// @Override
// public void run() {
// // 操作可能
// mListener.onConnectionState(status);
// }
// });
// continue;
// }
// }
}
// キャラクタリスティックが読み込まれたときの処理
......@@ -170,50 +127,16 @@ public class BleManagerUtil {
return;
}
}
// if( UUID_CHARACTERISTIC_PRIVATE.equals(characteristic.getUuid())) {
// final String strTemperature = byteToString(characteristic.getValue());
// runOnUiThread( new Runnable() {
// @Override
// public void run() {
// // 芯温計の温度を渡す。
// // 端末と接続時に呼ばれるのでコメント処理
//// mListener.onGetDeviceInfo(strTemperature);
// }
// });
// // 通知設定
// setCharacteristicNotification(UUID_SERVICE_PRIVATE, UUID_CHARACTERISTIC_PRIVATE, true);
// return;
// }
// }
// キャラクタリスティック変更が通知されたときの処理
@Override
public void onCharacteristicChanged( BluetoothGatt gatt, BluetoothGattCharacteristic characteristic ) {
Logger.i(TAG,"onCharacteristicChanged");
//if (mBleConnectDeviceType == Constant.DeviceType.alcoholChecker) {
Logger.d(TAG,"onCharacteristicChanged");
mListener.onCharacteristicChanged(gatt, characteristic);
//return;
//}
// if( UUID_CHARACTERISTIC_PRIVATE.equals( characteristic.getUuid() ) ) {
// final String strTemperature = byteToString(characteristic.getValue());
//
// runOnUiThread( new Runnable() {
// @Override
// public void run() {
// // 複数呼ばれるため、mBluetoothGattがnullの場合、以下の処理を行わない
// if(mBluetoothGatt == null) {
// return;
// }
// // 芯温計の温度を渡す。
// mListener.onGetDeviceInfo(strTemperature);
// }
// });
// return;
// }
}
@Override
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status){
Logger.i(TAG,"onDescriptorWrite");
Logger.d(TAG,"onDescriptorWrite");
mListener.onDescriptorWrite(gatt, descriptor, status);
}
};
......@@ -286,7 +209,6 @@ public class BleManagerUtil {
mDeviceAddress = deviceAddress;
// デバイスタイプセット
mBleConnectDeviceType = connectTargetDeviceType;
//setUUID();
if(StringUtil.isNullOrEmpty(mDeviceAddress)) { // DeviceAddressが空の場合は処理しない
return;
}
......@@ -344,16 +266,6 @@ public class BleManagerUtil {
// 切断時のコールバックでmBluetoothGatt.connect()を呼んでおくと、接続可能範囲に入ったら自動接続する。
mBluetoothGatt.disconnect();
mBluetoothGatt = null;
// if (listenerFlg) {
// runOnUiThread( new Runnable() {
// @Override
// public void run() {
// // 切断トーストメッセージを表示する。
// mListener.onDisConnectionState();
// }
// });
// }
}
// キャラクタリスティックの読み込み
......@@ -398,11 +310,11 @@ public class BleManagerUtil {
*/
public boolean startDeviceInfo() {
// Bluetoothアダプタの取得
BluetoothManager bluetoothManager2 = (BluetoothManager) mContext.getSystemService( Context.BLUETOOTH_SERVICE );
if (bluetoothManager2 != null) {
mBluetoothAdapter = bluetoothManager2.getAdapter();
BluetoothManager bleMgr = (BluetoothManager) mContext.getSystemService( Context.BLUETOOTH_SERVICE );
if (bleMgr != null) {
mBluetoothAdapter = bleMgr.getAdapter();
if( mBluetoothAdapter == null ) { // Android端末がBluetoothをサポートしていない
Toast.makeText( mContext, R.string.bluetooth_is_not_supported, Toast.LENGTH_SHORT ).show();
//Toast.makeText( mContext, R.string.bluetooth_is_not_supported, Toast.LENGTH_SHORT ).show();
return false;
}
} else {
......@@ -412,19 +324,6 @@ public class BleManagerUtil {
return true;
}
// UUIDセット
private void setUUID() {
// if (mBleConnectDeviceType == Constant.DeviceType.centerThermomete) {
// // 中心温度計のUUIDセット
// UUID_SERVICE_PRIVATE = UUID.fromString("05fd8c58-9d23-11e7-abc4-cec278b6b50a");
// UUID_CHARACTERISTIC_PRIVATE = UUID.fromString("05fd8f5a-9d23-11e7-abc4-cec278b6b50a");
// } else if (mBleConnectDeviceType == Constant.DeviceType.radiationThermomete) {
// // 放射温度計のUUIDセット
// UUID_SERVICE_PRIVATE = UUID.fromString("462026f6-cfe1-11e7-abc4-cec278b6b50a");
// UUID_CHARACTERISTIC_PRIVATE = UUID.fromString("46202b74-cfe1-11e7-abc4-cec278b6b50a");
// }
}
/**
* bleGattのcache更新
* @param gatt
......@@ -463,7 +362,6 @@ public class BleManagerUtil {
}
}
// @@@@@
public void NotificationDisable(BluetoothGattCharacteristic uRxChar, UUID ucccd) {
if (mBluetoothGatt != null){
mBluetoothGatt.setCharacteristicNotification(uRxChar,true);
......
......@@ -5,7 +5,6 @@ import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
public interface BleManagerUtilListener {
void onGetDeviceInfoFailed(int status); // ディバイスと接続失敗時の情報渡す。
void onConnectionState(int status); // ディバイスと接続された時情報渡す。
void onDisConnectionState(); // ディバイスと切断時
void onConnectionError(int status); // ディバイス接続エラー
......
......@@ -95,6 +95,7 @@ import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.StringUtil;
import static java.lang.Thread.sleep;
import static jp.agentec.abook.abv.bl.common.Constant.ReportType.RoutineTask;
......@@ -183,6 +184,17 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// 設問ID
private String mQid = "";
// 二重起動防止フラグ(アルコールチェッカー)
private boolean isAlcBlock = false;
// ステータス
private static final int fugo_wait_connect = 0;
private static final int fugo_conntected = 1;
private static final int fugo_wait_go = 2;
private static final int fugo_fu_error = 3;
private static final int fugo_restart = 4;
private int alcStatus = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -232,42 +244,35 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
}
// アルコールチェッカースタート
alcoholCheckerUtil = new AlcoholCheckerUtil(this, new AlcoholCheckerUtilListener() {
@Override
public void onUpdateTBVCalc(String text) {
//Logger.i(TAG,"------------------------------------");
Logger.i(TAG,"onUpdateTBVCalc = %s", text);
//Logger.i(TAG,"------------------------------------");
}
@Override
public void onUpdateStatus(String text) {
//Logger.i(TAG,"------------------------------------");
Logger.i(TAG,"onUpdateStatus = %s", text);
//Logger.i(TAG,"------------------------------------");
Logger.d(TAG,"onUpdateStatus = %s", text);
}
@Override
public void onUpdateSendMessage(String text) {
//Logger.i(TAG,"------------------------------------");
Logger.i(TAG,"onFugoActonUpdateSendMessageion = %s", text);
//Logger.i(TAG,"------------------------------------");
Logger.i(TAG,"onUpdateSendMessage = %s", text);
}
@Override
public void onUpdateReceivedData(String text) {
//Logger.i(TAG,"------------------------------------");
Logger.i(TAG,"onUpdateReceivedData = %s", text);
//Logger.i(TAG,"------------------------------------");
Logger.d(TAG,"onUpdateReceivedData = %s", text);
}
@Override
public void onServicesDiscovered(int status){
Logger.i(TAG,"onServicesDiscovered = %s", status);
if (mWaitMeasureDialog != null) {
if (alcStatus == fugo_wait_connect) {
alcStatus = fugo_conntected;
} else {
return;
}
runOnUiThread(new Runnable() {
......@@ -277,21 +282,24 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mWaitingDialog.dismiss();
mWaitingDialog = null;
}
alcoholCheckerUtil.isConnected = true;
// 測定開始ボタン押し待ち
showWaitMeasureDialog(getString(R.string.alcohl_checker), getString(R.string.connection_completed));
showWaitMeasureDialog(getString(R.string.alcohol_checker), getString(R.string.connection_completed));
}
});
}
@Override
public void onGetDeviceInfo(String alcohol) {
// 測定完了
successAfterAbookCheckApi(alcohol);
Logger.d(TAG,"測定完了 = " + alcohol);
successAfterAbookCheckApi(alcohol, false);
}
@Override
public void onStartMeasurement() {
if (mMeasureDialog != null) {
if (alcStatus == fugo_conntected) {
alcStatus = fugo_wait_go;
} else {
return;
}
runOnUiThread(new Runnable() {
......@@ -301,7 +309,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mWaitMeasureDialog.dismiss();
mWaitMeasureDialog = null;
}
showMeasureDialog(getString(R.string.alcohl_checker), getString(R.string.wait_breathe));
showMeasureDialog(getString(R.string.alcohol_checker), getString(R.string.wait_breathe));
}
});
}
......@@ -310,7 +318,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public void onConnectionError(int status) {
String message = "";
if (status == 133 || status == 8) {
message = getString(R.string.msg_connection_timeout);
message = getString(R.string.msg_connection_timeout); // デバイスと接続されていない
} else if (status == 19){
message = getString(R.string.msg_disconnected_device);
}
......@@ -320,6 +328,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override
public void onMeasurementError(String text) {
if (mMeasureDialog != null) {
alcStatus = fugo_fu_error;
runOnUiThread(new Runnable() {
@Override
public void run() {
......@@ -330,11 +339,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
@Override
public void onGetDeviceInfoFailed(int status) {
errorAfterAbookCheckApi("いいいいいいいいいいいいいいいいいいいいいいいいいいいいいい");
}
@Override
public void onBreakDownError(String text) {
errorAfterAbookCheckApi(getString(R.string.msg_break_down_device));
}
......@@ -354,10 +358,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
errorAfterAbookCheckApi(getString(R.string.msg_power_off));
}
@Override
public void onError(String txt) {
errorAfterAbookCheckApi("あああああああああああああああああああ");
}
});
if (!alcoholCheckerUtil.startGetDeviceInfo()) {
......@@ -388,6 +388,185 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
showUpdateContentAlert(contentId);
}
private void closeAllDialog() {
runOnUiThread(new Runnable() {
@Override
public void run() {
// 後始末
if (mWaitingDialog != null) {
mWaitingDialog.dismiss();
mWaitingDialog = null;
}
if (mWaitMeasureDialog != null) {
mWaitMeasureDialog.dismiss();
mWaitMeasureDialog = null;
}
if (mMeasureDialog !=null) {
mMeasureDialog.dismiss();
mMeasureDialog = null;
}
}
});
}
/**
* 各デバイスから値を正常に取得された場合、HTML側にコールする
* @param value 各種デバイスから取得した値
*/
private void successAfterAbookCheckApi(final String value, final boolean isFinish) {
runOnUiThread(new Runnable() {
@Override
public void run() {
closeAllDialog();
if (isFinish) {
// BLE接続を解除して接続方法選択状態に戻る(基本中止(キャンセルは切断)
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
alcoholCheckerUtil.finish();
} else {
// BLEは切断しないが測定中断、測定開始状態に戻す(測定完了した場合は、RDYに戻す
alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F22);
}
JSONObject responseJson = new JSONObject();
responseJson.put(ABookKeys.TASK_QUESTION_ID, mQid);
responseJson.put("value", value);
afterABookCheckApi(mCmd, "", 0, "", responseJson.toString());
Logger.i(TAG, "successAfterAbookCheckAip JSON [%s]", responseJson.toString());
}
});
}
/**
* 各デバイスからエラー(接続不能など)発生した場合、HTML側にコールする
* @param errorMessage 各種デバイスから取得した値
*/
private void errorAfterAbookCheckApi(final String errorMessage) {
runOnUiThread(new Runnable() {
@Override
public void run() {
closeAllDialog();
// BLE接続を解除して接続方法選択状態に戻る(基本中止(キャンセルは切断)
//alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
alcoholCheckerUtil.finish();
//afterABookCheckApi(mCmd, "", 1, errorMessage, null);
Logger.e(TAG,errorMessage);
}
});
}
/**
* 接続待ち
* @param title タイトル
* @param message 内容
*/
private void showWaitingDialog(String title, String message) {
Logger.i(TAG,"showWaitingDialog");
mWaitingDialog = AlertDialogUtil.createAlertDialog(this, title);
mWaitingDialog.setMessage(message);
mWaitingDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.pairing_search_stop), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Logger.i(TAG, "waiting Dialog stop click");
successAfterAbookCheckApi("", true);
}
});
mWaitingDialog.show();
}
/**
* 行き吹きかけボタン押し待ち
* @param title タイトル
* @param message 内容
*/
private void showWaitMeasureDialog(String title, String message) {
Logger.i(TAG,"showWaitMeasureDialog");
mWaitMeasureDialog = AlertDialogUtil.createAlertDialog(this, title);
mWaitMeasureDialog.setMessage(getString(R.string.connection_completed));
mWaitMeasureDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Logger.i(TAG, "waiting mWaitMeasureDialog stop clickf");
successAfterAbookCheckApi("", true);
}
});
mWaitMeasureDialog.show();
}
/**
* 吹きかけてください
* @param title タイトル
* @param message 内容
*/
private void showMeasureDialog(String title, String message) {
Logger.i(TAG,"showMeasureDialog");
mMeasureDialog = AlertDialogUtil.createAlertDialog(this, title);
mMeasureDialog.setMessage(message);
mMeasureDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Logger.i(TAG, "wait mMeasureDialog stop click");
successAfterAbookCheckApi("", true);
}
});
mMeasureDialog.show();
}
/**
* アルコールチェッカー処理
* @param abookCheckParam
*/
private void getDeviceInfo(Map<String, String> abookCheckParam) {
Logger.i(TAG,"getDeviceInfo");
mDeviceType = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_DEVICE_TYPE));
mQid = abookCheckParam.get(ABookKeys.TASK_QUESTION_ID);
// アルコールチェッカー接続
connectToAlcholChecker();
}
/**
* BLEディバイスのアルコールチェッカーの情報取得
*/
private void connectToAlcholChecker() {
if (requestBluetoothFeature(REQUEST_CODE_ENABLEBLUETOOTH_ALCOHL_CHECKER)) { //端末のBluetooth設定を確認
String deviceAddress = getABVUIDataCache().getPairingBluetoothDeviceAddress(Constant.DeviceType.alcoholChecker);
if (StringUtil.isNullOrEmpty(deviceAddress)) {
// 登録されているアルコールチェッカーが無い場合はエラー
errorAfterAbookCheckApi(getString(R.string.msg_pairing_device_no_info));
return;
}
BluetoothPairingDeviceInfoDto dto = getABVUIDataCache().getPairingBluetoothDeviceInfo(Constant.DeviceType.alcoholChecker);
alcStatus = fugo_wait_connect;
if (alcoholCheckerUtil.isConnected) {
Logger.i(TAG, "isConnection = true");
alcStatus = fugo_conntected;
showWaitMeasureDialog(getString(R.string.alcohol_checker), getString(R.string.connection_completed));
} else {
Logger.i(TAG, "isConnection = false");
// 登録されているアルコールチェッカーがある
String message = String.format(getString(R.string.ble_connecting), dto.deviceName);
showWaitingDialog(getString(R.string.alcohol_checker), message);
// 接続まち
alcoholCheckerUtil.connect(Constant.DeviceType.alcoholChecker, deviceAddress);
}
}
}
/**
* Android端末のBluetooth機能の有効化要求
* @return true:bluetooth ON, false:bluetooth OFF
*/
private boolean requestBluetoothFeature(int requestCode) {
if(alcoholCheckerUtil.bleManagerUtil.mBluetoothAdapter.isEnabled()) {
return true;
}
// デバイスのBluetooth機能が有効になっていないときは、有効化要求(ダイアログ表示)
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, requestCode);
return false;
}
private void showUpdateContentAlert(long contentId) {
if (meetingManager.isConnected()) {
ContentDto contentDto = contentDao.getContent(contentId);
......@@ -1008,194 +1187,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
*/
protected void onActionOperationPdfWebView(Map<String, String> checkParam, OperationTaskDto operationTaskDto) {}
private void closeAllDialog() {
runOnUiThread(new Runnable() {
@Override
public void run() {
// 後始末
if (mWaitingDialog != null) {
mWaitingDialog.dismiss();
mWaitingDialog = null;
}
if (mWaitMeasureDialog != null) {
mWaitMeasureDialog.dismiss();
mWaitMeasureDialog = null;
}
if (mMeasureDialog !=null) {
mMeasureDialog.dismiss();
mMeasureDialog = null;
}
}
});
}
/**
* 各デバイスから値を正常に取得された場合、HTML側にコールする
* @param value 各種デバイスから取得した値
*/
private void successAfterAbookCheckApi(final String value) {
runOnUiThread(new Runnable() {
@Override
public void run() {
closeAllDialog();
alcoholCheckerUtil.finish();
JSONObject responseJson = new JSONObject();
responseJson.put(ABookKeys.TASK_QUESTION_ID, mQid);
responseJson.put("value", value);
afterABookCheckApi(mCmd, "", 0, "", responseJson.toString());
Logger.i(TAG, "successAfterAbookCheckAip JSON [%s]", responseJson.toString());
}
});
}
/**
* 各デバイスからエラー(接続不能など)発生した場合、HTML側にコールする
* @param errorMessage 各種デバイスから取得した値
*/
private void errorAfterAbookCheckApi(final String errorMessage) {
runOnUiThread(new Runnable() {
@Override
public void run() {
closeAllDialog();
alcoholCheckerUtil.finish();
afterABookCheckApi(mCmd, "", 1, errorMessage, null);
Logger.e(TAG,errorMessage);
}
});
}
/**
* 接続待ち
* @param title タイトル
* @param message 内容
*/
private void showWaitingDialog(String title, String message) {
// Logger.i(TAG,"-------------------------------------------------");
Logger.i(TAG,"showWaitingDialog");
// Logger.i(TAG,"-------------------------------------------------");
mWaitingDialog = AlertDialogUtil.createAlertDialog(this, title);
mWaitingDialog.setMessage(message);
mWaitingDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.pairing_search_stop), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Logger.i(TAG, "waiting Dialog stop click");
successAfterAbookCheckApi("");
}
});
mWaitingDialog.show();
}
/**
* 行き吹きかけボタン押し待ち
* @param title タイトル
* @param message 内容
*/
private void showWaitMeasureDialog(String title, String message) {
Logger.i(TAG,"showWaitMeasureDialog");
mWaitMeasureDialog = AlertDialogUtil.createAlertDialog(this, title);
mWaitMeasureDialog.setMessage(getString(R.string.connection_completed));
mWaitMeasureDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Logger.i(TAG, "waiting mWaitMeasureDialog stop clickf");
successAfterAbookCheckApi("");
}
});
mWaitMeasureDialog.show();
}
/**
* 吹きかけてください
* @param title タイトル
* @param message 内容
*/
private void showMeasureDialog(String title, String message) {
Logger.i(TAG,"showMeasureDialog");
mMeasureDialog = AlertDialogUtil.createAlertDialog(this, title);
mMeasureDialog.setMessage(message);
mMeasureDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Logger.i(TAG, "wait mMeasureDialog stop click");
returnWaitMeasureDialog();
}
});
mMeasureDialog.show();
}
private void returnWaitMeasureDialog() {
runOnUiThread(new Runnable() {
@Override
public void run() {
closeAllDialog();
showWaitMeasureDialog(getString(R.string.alcohl_checker), getString(R.string.connection_completed));
}
});
}
/**
* アルコールチェッカー処理
* @param abookCheckParam
*/
private void getDeviceInfo(Map<String, String> abookCheckParam) {
Logger.i(TAG,"-------------------------------------------------");
Logger.i(TAG,"getDeviceInfo");
Logger.i(TAG,"-------------------------------------------------");
mDeviceType = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_DEVICE_TYPE));
mQid = abookCheckParam.get(ABookKeys.TASK_QUESTION_ID);
// アルコールチェッカー接続
connectToAlcholChecker();
}
/**
* BLEディバイスのアルコールチェッカーの情報取得
*/
private void connectToAlcholChecker() {
if (requestBluetoothFeature(REQUEST_CODE_ENABLEBLUETOOTH_ALCOHL_CHECKER)) { //端末のBluetooth設定を確認
String deviceAddress = getABVUIDataCache().getPairingBluetoothDeviceAddress(Constant.DeviceType.alcoholChecker);
if (StringUtil.isNullOrEmpty(deviceAddress)) {
// 登録されているアルコールチェッカーが無い場合はエラー
errorAfterAbookCheckApi(getString(R.string.msg_pairing_device_no_info));
return;
}
BluetoothPairingDeviceInfoDto dto = getABVUIDataCache().getPairingBluetoothDeviceInfo(Constant.DeviceType.alcoholChecker);
// if (alcoholCheckerUtil.isConnected) {
// Logger.i(TAG,"-------------------------------------------------");
// Logger.i(TAG, "isConnection = true");
// Logger.i(TAG,"-------------------------------------------------");
// String message = String.format(getString(R.string.msg_ble_connect_success), dto.deviceName);
// showWaitingDialog(getString(R.string.alcohl_checker),message);
// } else
{
// Logger.i(TAG,"-------------------------------------------------");
// Logger.i(TAG, "isConnection = false");
// Logger.i(TAG,"-------------------------------------------------");
// 登録されているアルコールチェッカーがある
String message = String.format(getString(R.string.ble_connecting), dto.deviceName);
showWaitingDialog(getString(R.string.alcohl_checker), message);
// 接続
alcoholCheckerUtil.connect(Constant.DeviceType.alcoholChecker, deviceAddress);
}
}
}
/**
* Android端末のBluetooth機能の有効化要求
* @return true:bluetooth ON, false:bluetooth OFF
*/
private boolean requestBluetoothFeature(int requestCode) {
if(alcoholCheckerUtil.bleManagerUtil.mBluetoothAdapter.isEnabled()) {
return true;
}
// デバイスのBluetooth機能が有効になっていないときは、有効化要求(ダイアログ表示)
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, requestCode);
return false;
}
/**
* WebView発生を受け取るメソッド
......@@ -1487,10 +1478,13 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
Logger.d(TAG,"save userData = " + abookCheckParam.get(ABookKeys.USER_DATA));
saveUserDataKey(abookCheckParam.get(ABookKeys.TASK_KEY), abookCheckParam.get(ABookKeys.USER_DATA));
} else if (mCmd.equals(ABookKeys.CMD_GET_DEVICE_INFO)) {
Logger.i(TAG,"getDeviceInfo");
if (!isAlcBlock) {
isAlcBlock = true;
Logger.d(TAG, "getDeviceInfo");
getDeviceInfo(abookCheckParam);
}
}
}
/**
* アルコールチェッカー、userDataのルートディレクトリを返す
......@@ -1675,6 +1669,10 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
Logger.i(TAG, String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s')", finalParent, cmd, taskKey, result, message));
webViewLoadUrl(String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s')", finalParent, cmd, taskKey, result, message));
}
if (cmd.equals(ABookKeys.CMD_GET_DEVICE_INFO)) {
// アルコールチェッカー終了
isAlcBlock = false;
}
}
});
}
......
......@@ -30,7 +30,6 @@ import jp.agentec.abook.abv.bl.dto.BluetoothPairingDeviceInfoDto;
import jp.agentec.abook.abv.cl.util.BleManagerUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.home.adapter.BleListAdapter;
import jp.agentec.abook.abv.ui.home.adapter.BleListRowData;
import jp.agentec.abook.abv.ui.home.adapter.common.SectionHeaderData;
......@@ -44,9 +43,6 @@ public class BlePairingSettingActivity extends ABVUIActivity {
private static final int REQUEST_ENABLEBLUETOOTH = 1; // Bluetooth機能の有効化要求時の識別コード
private static final long SCAN_PERIOD = 20000; // スキャン時間。単位はミリ秒。
//private static final String CENTER_THERMOMETE_DEVICE_NAME = "MF500"; // 中心温度計のデバイス名
//private static final String RADIATION_THERMOMETE_DEVICE_NAME = "IR-TB"; // 放射温度計のデバイス名
private static final String ALCOHOL_CHECKER_DEVICE_NAME = "FALC-31"; // アルコールチェッカーデバイス名
// メンバー変数
......@@ -73,9 +69,6 @@ public class BlePairingSettingActivity extends ABVUIActivity {
Logger.d("mScanCallback device.getName() = " + device.getName());
}
// 識別商品名に絞る ALC_DEVICE_NAME
// if(device.getName() != null && (device.getName().startsWith(CENTER_THERMOMETE_DEVICE_NAME)
// || device.getName().startsWith(RADIATION_THERMOMETE_DEVICE_NAME)
// || (device.getName().startsWith(ALCOHOL_CHECKER_DEVICE_NAME) )))
if(device.getName() != null && (device.getName().startsWith(ALCOHOL_CHECKER_DEVICE_NAME) )) {
if (!mSavedDeviceAddressList.contains(device.getAddress())) { //登録されたデバイスの場合、スキャン情報から除外する。
boolean isAdd = true;
......@@ -123,11 +116,6 @@ public class BlePairingSettingActivity extends ABVUIActivity {
public void onDeleteConnectInfo(BleListRowData rowData) { // 登録されたデバイス情報削除
Logger.i(rowData.deviceAddress);
Integer deviceType = null;
// if (rowData.title.startsWith(CENTER_THERMOMETE_DEVICE_NAME)) {
// deviceType = DeviceType.centerThermomete;
// } else if (rowData.title.startsWith(RADIATION_THERMOMETE_DEVICE_NAME)) {
// deviceType = DeviceType.radiationThermomete;
// } else
if (rowData.title.startsWith(ALCOHOL_CHECKER_DEVICE_NAME)) {
deviceType = DeviceType.alcoholChecker;
}
......@@ -259,8 +247,6 @@ public class BlePairingSettingActivity extends ABVUIActivity {
scanner.startScan(mLeScanCallback);
}
// スキャン開始(一定時間後にスキャン停止する)
mHandler.postDelayed( new Runnable() {
@Override
......@@ -306,13 +292,6 @@ public class BlePairingSettingActivity extends ABVUIActivity {
mSavedDeviceAddressList.add(bleListRowData.deviceAddress);
BluetoothPairingDeviceInfoDto pairingDeviceInfo = new BluetoothPairingDeviceInfoDto();
// if (bleListRowData.title.startsWith(CENTER_THERMOMETE_DEVICE_NAME)) {
// // デバイス名がMF500から始まると中心温度計と見做す。
// pairingDeviceInfo.deviceType = DeviceType.centerThermomete;
// } else if (bleListRowData.title.startsWith(RADIATION_THERMOMETE_DEVICE_NAME)) {
// // デバイス名がIR-TBから始まると放射温度計と見做す。
// pairingDeviceInfo.deviceType = DeviceType.radiationThermomete;
// } else
if (bleListRowData.title.startsWith(ALCOHOL_CHECKER_DEVICE_NAME)) {
// デバイス名がMF500から始まるとアルコールチェッカーとみなす
pairingDeviceInfo.deviceType = DeviceType.alcoholChecker;
......@@ -403,11 +382,6 @@ public class BlePairingSettingActivity extends ABVUIActivity {
List<BleListRowData> scanRowDataList = new ArrayList<BleListRowData>();
for (BluetoothDevice bleDevice : mScanDeviceInfoList) {
String labelDeviceName = "";
// if (bleDevice.getName().startsWith(CENTER_THERMOMETE_DEVICE_NAME)) {
// labelDeviceName = getString(R.string.center_thermometer);
// } else if (bleDevice.getName().startsWith(RADIATION_THERMOMETE_DEVICE_NAME)) {
// labelDeviceName = getString(R.string.radiation_thermometer);
// } else
if (bleDevice.getName().startsWith(ALCOHOL_CHECKER_DEVICE_NAME)) {
labelDeviceName = "アルコールチェッカー";
}
......
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