Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
32a57b15
Commit
32a57b15
authored
Jun 20, 2022
by
onuma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#47941 HW連携 アルコールチェッカーから値を取得する処理を追加中5
RDY状態に戻るように修正。
parent
b23320c1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
156 deletions
+18
-156
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerTimerTask.java
+6
-11
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerUtil.java
+0
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerUtilListener.java
+0
-4
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BleManagerUtil.java
+12
-114
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BleManagerUtilListener.java
+0
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
+0
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/BlePairingSettingActivity.java
+0
-26
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerTimerTask.java
View file @
32a57b15
...
...
@@ -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
;
}
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerUtil.java
View file @
32a57b15
This diff is collapsed.
Click to expand it.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerUtilListener.java
View file @
32a57b15
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
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BleManagerUtil.java
View file @
32a57b15
...
...
@@ -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;
// }
// }
mListener
.
onServicesDiscovered
(
status
);
}
// キャラクタリスティックが読み込まれたときの処理
...
...
@@ -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) {
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;
// }
Logger
.
d
(
TAG
,
"onCharacteristicChanged"
);
mListener
.
onCharacteristicChanged
(
gatt
,
characteristic
);
}
@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
bl
uetoothManager2
=
(
BluetoothManager
)
mContext
.
getSystemService
(
Context
.
BLUETOOTH_SERVICE
);
if
(
bl
uetoothManager2
!=
null
)
{
mBluetoothAdapter
=
bl
uetoothManager2
.
getAdapter
();
BluetoothManager
bl
eMgr
=
(
BluetoothManager
)
mContext
.
getSystemService
(
Context
.
BLUETOOTH_SERVICE
);
if
(
bl
eMgr
!=
null
)
{
mBluetoothAdapter
=
bl
eMgr
.
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
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BleManagerUtilListener.java
View file @
32a57b15
...
...
@@ -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
);
// ディバイス接続エラー
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
View file @
32a57b15
This diff is collapsed.
Click to expand it.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/BlePairingSettingActivity.java
View file @
32a57b15
...
...
@@ -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
=
"アルコールチェッカー"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment