Commit 25e12974 by onuma

まだ2回目が計測できない

parent 932da70f
package jp.agentec.abook.abv.cl.util;
import java.util.TimerTask;
import jp.agentec.abook.abv.bl.common.log.Logger;
import static jp.agentec.abook.abv.cl.util.AlcoholCheckerUtil.F_BLE_COM_INIT;
import static jp.agentec.abook.abv.cl.util.AlcoholCheckerUtil.F_BLE_COM_RD_COMMAND;
import static jp.agentec.abook.abv.cl.util.AlcoholCheckerUtil.F_BLE_COM_RECONNECT1;
import static jp.agentec.abook.abv.cl.util.AlcoholCheckerUtil.F_BLE_COM_RECONNECT2;
import static jp.agentec.abook.abv.cl.util.AlcoholCheckerUtil.F_BLE_COM_RECONNECT3;
import static jp.agentec.abook.abv.cl.util.AlcoholCheckerUtil.F_BLE_COM_RP_COMMAND;
import static jp.agentec.abook.abv.cl.util.AlcoholCheckerUtil.F_BLE_COM_RP_START;
public class AlcoholCheckerTimerTask extends TimerTask {
public static final String TAG = "AlcoholCheckerTimerTask";
private AlcoholCheckerUtil alcoholCheckerUtil;
private AlcoholCheckerUtilListener listener;
public AlcoholCheckerTimerTask( AlcoholCheckerUtil alcoholCheckerUtil,
AlcoholCheckerUtilListener listener) {
this.alcoholCheckerUtil = alcoholCheckerUtil;
this.listener = listener;
}
@Override
public void run() {
//alcoholCheckerUtil.gi_rxlength = 0;
switch (alcoholCheckerUtil.gi_status) {
case F_BLE_COM_INIT:
// BLE Init
break;
case F_BLE_COM_RP_START:
// RP Command Send
//Logger.d(TAG,"F_BLE_COM_RP_START");
//alcoholCheckerUtil.sendMessage(F_BLE_COM_RP_COMMAND);
break;
case AlcoholCheckerUtil.F_BLE_COM_RD_START:
// RD Command Send
//Logger.d(TAG,"F_BLE_COM_RD_START");
//alcoholCheckerUtil.sendMessage(F_BLE_COM_RD_COMMAND);
break;
case AlcoholCheckerUtil.F_BLE_COM_FC_START:
// Fc Command Send
//Logger.d(TAG,"F_BLE_COM_FC_START");
//alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F11);
break;
case AlcoholCheckerUtil.F_BLE_COM_FC_START22:
// Fc Command Send
//Logger.d(TAG,"F_BLE_COM_FC_START22");
//alcoholCheckerUtil.sendMessage(AlcoholCheckerUtil.F_BLE_COM_FC_COMMAND_F22);
break;
// case F_BLE_COM_RECONNECT1:
// // ReConecting(NOTIFICATION Disable) // @@@
// alcoholCheckerUtil.NotificationDisable(AlcoholCheckerUtil.RxChar, AlcoholCheckerUtil.CCCD);
// alcoholCheckerUtil.gi_status = 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("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("TIMER F_BLE_COM_RP_START");
// break;
default:
// Logger.i(TAG,"AlcohlCheckerTimerTask Timeout");
//
// if (alcoholCheckerUtil.gi_rxretry_cnt < 100) {
// alcoholCheckerUtil.gi_rxretry_cnt++;
// } else {
// alcoholCheckerUtil.gi_status = F_BLE_COM_RECONNECT1;
// //listener.onUpdateStatus("TIMER F_BLE_COM_RECONNECT1");
// }
break;
}
}
}
......@@ -161,16 +161,21 @@ public class BleManagerUtil {
// キャラクタリスティック変更が通知されたときの処理
@Override
public void onCharacteristicChanged( BluetoothGatt gatt, BluetoothGattCharacteristic characteristic ) {
public void onCharacteristicChanged(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic ) {
Logger.d(TAG,"onCharacteristicChanged");
try {
//if (mListener != null)
{
mListener.onCharacteristicChanged(gatt, characteristic);
}
} catch (Exception e) {
Logger.e(TAG,e);
}
mListener.onCharacteristicChanged(gatt, characteristic);
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// try {
// if (mListener != null) {
// mListener.onCharacteristicChanged(gatt, characteristic);
// }
// } catch (Exception e) {
// Logger.e(TAG,e);
// }
// }
// });
}
@Override
......
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