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
88fdc1ad
Commit
88fdc1ad
authored
Jun 17, 2022
by
onuma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#47941 HW連携 アルコールチェッカーから値を取得する処理を追加中4
parent
b71b72a9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
161 additions
and
117 deletions
+161
-117
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/type/ServiceOption.java
+7
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/Constant.java
+7
-7
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/ABVDataCache.java
+4
-0
ABVJE_Res_Default_Android/res/values-ja/strings.xml
+6
-1
ABVJE_Res_Default_Android/res/values/strings.xml
+6
-3
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerTimerTask.java
+4
-4
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
+12
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BleManagerUtil.java
+35
-35
ABVJE_UI_Android/src/jp/agentec/abook/abv/launcher/android/ABVUIDataCache.java
+36
-32
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/ABookSettingFragment.java
+10
-5
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/BlePairingSettingActivity.java
+34
-30
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/type/ServiceOption.java
View file @
88fdc1ad
...
...
@@ -174,5 +174,11 @@ public interface ServiceOption {
* 利用しない:N(通常)、利用する:Y
*/
int
UsableRFIDBarcodeScan
=
190
;
/**
* アルコールチェッカーHW
* 利用しない:N(通常)、利用する:Y
*/
int
AlcoholCheckerHw
=
202
;
}
}
\ No newline at end of file
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/Constant.java
View file @
88fdc1ad
...
...
@@ -186,12 +186,12 @@ public class Constant {
// 連携機器の区分
public
interface
DeviceType
{
int
centerThermomete
=
1
;
// 中心温度計
int
sensor
=
2
;
// 置くだけセンサー
int
barcode
=
3
;
// バーコード
int
radiationThermomete
=
4
;
// 放射温度計
int
sppBluetoothMachine
=
5
;
// SPP通信機器
int
nfc
=
6
;
// nfc機器
int
alcoholChecker
=
7
;
// アルコールチェッカー
//
int centerThermomete = 1; // 中心温度計
//
int sensor = 2; // 置くだけセンサー
//
int barcode = 3; // バーコード
//
int radiationThermomete = 4; // 放射温度計
//
int sppBluetoothMachine = 5; // SPP通信機器
//
int nfc = 6; // nfc機器
int
alcoholChecker
=
0
;
// アルコールチェッカー
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/ABVDataCache.java
View file @
88fdc1ad
...
...
@@ -347,6 +347,10 @@ public class ABVDataCache {
return
isServiceOptionEnable
(
ServiceOptionId
.
UsableRFIDBarcodeScan
);
}
public
boolean
isAlcoholCheckerHw
()
{
return
isServiceOptionEnable
(
ServiceOptionId
.
AlcoholCheckerHw
);
}
/**
* @version 1.2.300
* サービスオプション(ユーザパスワードソルト付加)返す
...
...
ABVJE_Res_Default_Android/res/values-ja/strings.xml
View file @
88fdc1ad
...
...
@@ -1522,10 +1522,15 @@
<string
name=
"chino_machine"
>
CHINO機器
</string>
<string
name=
"spp_machine"
>
シリアル通信機器
</string>
<string
name=
"center_thermometer"
>
中心温度計
</string>
<string
name=
"pairing_save_machine"
>
接続機器名
</string>
<string
name=
"connection_completed"
>
接続しました。\n機器のボタンを押してください。
</string>
<string
name=
"pairing_other_machine_searching"
>
その他の %s(検索中...)
</string>
<string
name=
"bluetooth_is_not_supported"
>
Bluetooth機能が利用できない端末です。
</string>
<string
name=
"msg_scan_bluetooth_no_allow"
>
BlueToothの利用を「許可」しないと、%1$sのスキャンができません。
</string>
<string
name=
"msg_location_device_no_allow"
>
端末の設定から位置情報をONにしてください。
</string>
<string
name=
"alc_checker_setting"
>
アルコールチェッカー設定
</string>
<string
name=
"alcohl_checker"
>
アルコールチェッカー
</string>
<string
name=
"ble_connecting"
>
の電源を入れて、電源ボタンを押してください
</string>
<string
name=
"msg_ble_connect_success"
>
%1$sと接続になりました。%1$sを操作してください。
</string>
<string
name=
"ble_connecting"
>
%1$sの電源を入れて、電源ボタンを押してください
</string>
<string
name=
"start_measurement"
>
測定開始
</string>
</resources>
ABVJE_Res_Default_Android/res/values/strings.xml
View file @
88fdc1ad
...
...
@@ -1527,14 +1527,17 @@
<string
name=
"bluetooth_is_not_supported"
>
Bluetooth is not supported.
</string>
<string
name=
"msg_scan_bluetooth_no_allow"
>
If Bluetooth is not allow, %1$s scan is disabled.
</string>
<string
name=
"msg_location_device_no_allow"
>
Please set the location information to ON in the device setting.
</string>
<string
name=
"pairing_save_machine"
>
Saved %s
</string>
<string
name=
"pairing_save_machine"
>
接続機器名
</string>
<string
name=
"pairing_other_machine"
>
Other %s
</string>
<string
name=
"pairing_other_machine_searching"
>
Other %s(Searching...)
</string>
<string
name=
"connection_completed"
>
接続しました。\n機器のボタンを押してください。
</string>
<string
name=
"select_spp_device_title"
>
シリアル通信機器選択
</string>
<string
name=
"alc_checker_setting"
>
アルコールチェッカー設定
</string>
<string
name=
"alcohl_checker"
>
アルコールチェッカー
</string>
<string
name=
"pairing_other_alcohl_checker_searching"
>
アルコールチェッカー(Searching...)
</string>
<string
name=
"msg_pairing_device_no_info"
>
登録されたアルコールチェッカー情報がありません。\n設定画面のアルコールチェッカー設定から登録できます。
</string>
<string
name=
"msg_pairing_device_no_info"
>
登録されたアルコールチェッカー情報がありません。\n設定画面のアルコールチェッカー
HW
設定から登録できます。
</string>
<string
name=
"msg_ble_connect_success"
>
%1$sと接続になりました。%1$sを操作してください。
</string>
<string
name=
"ble_connecting"
>
Connection...
</string>
<string
name=
"ble_connecting"
>
%1$sの電源を入れて、電源ボタンを押してください。
</string>
<string
name=
"wait_breathe"
>
息を吹きかけてください。
</string>
<string
name=
"start_measurement"
>
測定開始
</string>
</resources>
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerTimerTask.java
View file @
88fdc1ad
...
...
@@ -28,9 +28,9 @@ public class AlcoholCheckerTimerTask extends TimerTask {
}
@Override
public
void
run
()
{
Logger
.
i
(
TAG
,
"--------------------------------------------------------------"
);
//
Logger.i(TAG,"--------------------------------------------------------------");
Logger
.
i
(
TAG
,
"AlcohlCheckerTimerTask"
);
Logger
.
i
(
TAG
,
"--------------------------------------------------------------"
);
//
Logger.i(TAG,"--------------------------------------------------------------");
alcoholCheckerUtil
.
gi_rxlength
=
0
;
...
...
@@ -66,9 +66,9 @@ public class AlcoholCheckerTimerTask extends TimerTask {
listener
.
onUpdateStatus
(
"F_BLE_COM_RP_START"
);
break
;
default
:
Logger
.
i
(
TAG
,
"--------------------------------------------------------------"
);
//
Logger.i(TAG,"--------------------------------------------------------------");
Logger
.
i
(
TAG
,
"AlcohlCheckerTimerTask Timeout"
);
Logger
.
i
(
TAG
,
"--------------------------------------------------------------"
);
//
Logger.i(TAG,"--------------------------------------------------------------");
if
(
alcoholCheckerUtil
.
gi_rxretry_cnt
<
100
)
{
alcoholCheckerUtil
.
gi_rxretry_cnt
++;
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerUtil.java
View file @
88fdc1ad
This diff is collapsed.
Click to expand it.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/AlcoholCheckerUtilListener.java
View file @
88fdc1ad
...
...
@@ -7,6 +7,18 @@ import java.util.UUID;
public
interface
AlcoholCheckerUtilListener
{
void
onFugoAction
(
String
action
,
UUID
CHAR
,
byte
[]
data
,
String
MESSAGE
,
String
Type
);
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
);
void
onUpdateSendMessage
(
String
text
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BleManagerUtil.java
View file @
88fdc1ad
...
...
@@ -78,6 +78,7 @@ public class BleManagerUtil {
@Override
public
void
run
()
{
mListener
.
onConnectionError
(
status
);
disconnect
(
true
);
}
});
return
;
...
...
@@ -94,7 +95,7 @@ public class BleManagerUtil {
@Override
public
void
run
()
{
mListener
.
onGetDeviceInfoFailed
(
status
);
Logger
.
e
(
"onConnectionStateChange
2
status = "
+
status
);
Logger
.
e
(
"onConnectionStateChange status = "
+
status
);
}
});
}
...
...
@@ -134,20 +135,20 @@ public class BleManagerUtil {
}
// 発見されたサービスのループ
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
);
}
// プライベートサービス
//
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);
...
...
@@ -161,16 +162,16 @@ public class BleManagerUtil {
// });
// continue;
// }
}
//
}
}
// キャラクタリスティックが読み込まれたときの処理
//
@Override
//
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status ) {
//
Logger.i(TAG,"onCharacteristicChanged");
//
if( BluetoothGatt.GATT_SUCCESS != status ) {
//
return;
//
}
@Override
public
void
onCharacteristicRead
(
BluetoothGatt
gatt
,
BluetoothGattCharacteristic
characteristic
,
int
status
)
{
Logger
.
i
(
TAG
,
"onCharacteristicChanged"
);
if
(
BluetoothGatt
.
GATT_SUCCESS
!=
status
)
{
return
;
}
// if( UUID_CHARACTERISTIC_PRIVATE.equals(characteristic.getUuid())) {
// final String strTemperature = byteToString(characteristic.getValue());
// runOnUiThread( new Runnable() {
...
...
@@ -185,12 +186,12 @@ public class BleManagerUtil {
// setCharacteristicNotification(UUID_SERVICE_PRIVATE, UUID_CHARACTERISTIC_PRIVATE, true);
// return;
// }
//
}
}
// キャラクタリスティック変更が通知されたときの処理
@Override
public
void
onCharacteristicChanged
(
BluetoothGatt
gatt
,
BluetoothGattCharacteristic
characteristic
)
{
Logger
.
i
(
TAG
,
"
------------------------------------------------------
onCharacteristicChanged"
);
Logger
.
i
(
TAG
,
"onCharacteristicChanged"
);
if
(
mBleConnectDeviceType
==
Constant
.
DeviceType
.
alcoholChecker
)
{
mListener
.
onCharacteristicChanged
(
gatt
,
characteristic
);
return
;
...
...
@@ -282,7 +283,7 @@ public class BleManagerUtil {
mDeviceAddress
=
deviceAddress
;
// デバイスタイプセット
mBleConnectDeviceType
=
connectTargetDeviceType
;
setUUID
();
//
setUUID();
if
(
StringUtil
.
isNullOrEmpty
(
mDeviceAddress
))
{
// DeviceAddressが空の場合は処理しない
return
;
}
...
...
@@ -339,18 +340,17 @@ public class BleManagerUtil {
// ②「接続可能範囲から外れた切断」は、内部処理でmBluetoothGatt.disconnect()処理が実施される。
// 切断時のコールバックでmBluetoothGatt.connect()を呼んでおくと、接続可能範囲に入ったら自動接続する。
mBluetoothGatt
.
disconnect
();
// mBluetoothGatt.close();
mBluetoothGatt
=
null
;
if
(
listenerFlg
)
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
// 切断トーストメッセージを表示する。
mListener
.
onDisConnectionState
();
}
});
}
//
if (listenerFlg) {
//
runOnUiThread( new Runnable() {
//
@Override
//
public void run() {
//
// 切断トーストメッセージを表示する。
//
mListener.onDisConnectionState();
//
}
//
});
//
}
}
// キャラクタリスティックの読み込み
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/launcher/android/ABVUIDataCache.java
View file @
88fdc1ad
...
...
@@ -194,15 +194,16 @@ public class ABVUIDataCache {
BluetoothPairingDeviceInfoDto
dto
=
new
BluetoothPairingDeviceInfoDto
();
String
deviceName
=
null
;
String
deviceAddress
=
null
;
if
(
bluetoothDeviceType
==
Constant
.
DeviceType
.
centerThermomete
)
{
// 中心温度計
deviceName
=
PreferenceUtil
.
getUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_CENTER_TEMPERATURE_NAME
,
""
);
deviceAddress
=
PreferenceUtil
.
getUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS
,
""
);
}
else
if
(
bluetoothDeviceType
==
Constant
.
DeviceType
.
radiationThermomete
)
{
// 放射温度計
deviceName
=
PreferenceUtil
.
getUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_RADIATION_TEMPERATURE_NAME
,
""
);
deviceAddress
=
PreferenceUtil
.
getUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS
,
""
);
}
else
if
(
bluetoothDeviceType
==
Constant
.
DeviceType
.
alcoholChecker
)
{
// if (bluetoothDeviceType == Constant.DeviceType.centerThermomete) {
// // 中心温度計
// deviceName = PreferenceUtil.getUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_NAME, "");
// deviceAddress = PreferenceUtil.getUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS, "");
// } else if (bluetoothDeviceType == Constant.DeviceType.radiationThermomete) {
// // 放射温度計
// deviceName = PreferenceUtil.getUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_NAME, "");
// deviceAddress = PreferenceUtil.getUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS, "");
// } else
if
(
bluetoothDeviceType
==
Constant
.
DeviceType
.
alcoholChecker
)
{
// アルコールチェッカー
deviceName
=
PreferenceUtil
.
getUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_ALCOHO_CHECKER_NAME
,
""
);
deviceAddress
=
PreferenceUtil
.
getUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_ALCOHO_CHECKER_ADDRESS
,
""
);
...
...
@@ -226,11 +227,12 @@ public class ABVUIDataCache {
*/
public
String
getPairingBluetoothDeviceAddress
(
int
bluetoothDeviceType
)
{
String
deviceAddressKey
=
null
;
if
(
bluetoothDeviceType
==
Constant
.
DeviceType
.
centerThermomete
)
{
deviceAddressKey
=
UserPrefKey
.
BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS
;
}
else
if
(
bluetoothDeviceType
==
Constant
.
DeviceType
.
radiationThermomete
)
{
deviceAddressKey
=
UserPrefKey
.
BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS
;
}
else
if
(
bluetoothDeviceType
==
Constant
.
DeviceType
.
alcoholChecker
)
{
// if (bluetoothDeviceType == Constant.DeviceType.centerThermomete) {
// deviceAddressKey = UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS;
// } else if (bluetoothDeviceType == Constant.DeviceType.radiationThermomete) {
// deviceAddressKey = UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS;
// } else
if
(
bluetoothDeviceType
==
Constant
.
DeviceType
.
alcoholChecker
)
{
deviceAddressKey
=
UserPrefKey
.
BLE_DEVICE_ALCOHO_CHECKER_ADDRESS
;
}
if
(
deviceAddressKey
==
null
)
{
...
...
@@ -266,15 +268,16 @@ public class ABVUIDataCache {
* @param pairingDeviceInfoDto
*/
public
void
setPairingBluetoothDeviceInfo
(
BluetoothPairingDeviceInfoDto
pairingDeviceInfoDto
)
{
if
(
pairingDeviceInfoDto
.
deviceType
.
equals
(
Constant
.
DeviceType
.
centerThermomete
))
{
// 中心温度計
PreferenceUtil
.
putUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_CENTER_TEMPERATURE_NAME
,
pairingDeviceInfoDto
.
deviceName
);
PreferenceUtil
.
putUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS
,
pairingDeviceInfoDto
.
deviceAddress
);
}
else
if
(
pairingDeviceInfoDto
.
deviceType
.
equals
(
Constant
.
DeviceType
.
radiationThermomete
))
{
// 放射温度計
PreferenceUtil
.
putUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_RADIATION_TEMPERATURE_NAME
,
pairingDeviceInfoDto
.
deviceName
);
PreferenceUtil
.
putUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS
,
pairingDeviceInfoDto
.
deviceAddress
);
}
else
if
(
pairingDeviceInfoDto
.
deviceType
.
equals
(
Constant
.
DeviceType
.
alcoholChecker
))
{
// if (pairingDeviceInfoDto.deviceType.equals(Constant.DeviceType.centerThermomete)) {
// // 中心温度計
// PreferenceUtil.putUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_NAME, pairingDeviceInfoDto.deviceName);
// PreferenceUtil.putUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS, pairingDeviceInfoDto.deviceAddress);
// } else if (pairingDeviceInfoDto.deviceType.equals(Constant.DeviceType.radiationThermomete)) {
// // 放射温度計
// PreferenceUtil.putUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_NAME, pairingDeviceInfoDto.deviceName);
// PreferenceUtil.putUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS, pairingDeviceInfoDto.deviceAddress);
// } else
if
(
pairingDeviceInfoDto
.
deviceType
.
equals
(
Constant
.
DeviceType
.
alcoholChecker
))
{
// アルコールチェッカー
PreferenceUtil
.
putUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_ALCOHO_CHECKER_NAME
,
pairingDeviceInfoDto
.
deviceName
);
PreferenceUtil
.
putUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_ALCOHO_CHECKER_ADDRESS
,
pairingDeviceInfoDto
.
deviceAddress
);
...
...
@@ -287,15 +290,16 @@ public class ABVUIDataCache {
* @param deviceType
*/
public
void
removePairingBluetoothDeviceInfo
(
int
deviceType
)
{
if
(
deviceType
==
Constant
.
DeviceType
.
centerThermomete
)
{
// 中心温度計
PreferenceUtil
.
removeUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_CENTER_TEMPERATURE_NAME
);
PreferenceUtil
.
removeUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS
);
}
else
if
(
deviceType
==
Constant
.
DeviceType
.
radiationThermomete
)
{
// 放射温度計
PreferenceUtil
.
removeUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_RADIATION_TEMPERATURE_NAME
);
PreferenceUtil
.
removeUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS
);
}
else
if
(
deviceType
==
Constant
.
DeviceType
.
alcoholChecker
)
{
// if (deviceType == Constant.DeviceType.centerThermomete) {
// // 中心温度計
// PreferenceUtil.removeUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_NAME);
// PreferenceUtil.removeUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS);
// } else if (deviceType == Constant.DeviceType.radiationThermomete) {
// // 放射温度計
// PreferenceUtil.removeUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_NAME);
// PreferenceUtil.removeUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS);
// } else
if
(
deviceType
==
Constant
.
DeviceType
.
alcoholChecker
)
{
// 放射温度計
PreferenceUtil
.
removeUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_ALCOHO_CHECKER_NAME
);
PreferenceUtil
.
removeUserPref
(
context
,
UserPrefKey
.
BLE_DEVICE_ALCOHO_CHECKER_ADDRESS
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
View file @
88fdc1ad
This diff is collapsed.
Click to expand it.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ABookSettingFragment.java
View file @
88fdc1ad
...
...
@@ -35,6 +35,7 @@ import java.io.File;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.AppLastVersionParameters
;
import
jp.agentec.abook.abv.bl.acms.type.AcmsApis
;
import
jp.agentec.abook.abv.bl.acms.type.ServiceOptionId
;
import
jp.agentec.abook.abv.bl.common.ABVEnvironment
;
import
jp.agentec.abook.abv.bl.common.CommonExecutor
;
import
jp.agentec.abook.abv.bl.common.Constant
;
...
...
@@ -69,6 +70,7 @@ public class ABookSettingFragment extends PreferenceFragment {
private
static
final
String
ACCOUNT_SET
=
"account_set"
;
private
static
final
String
LOG_INFO
=
"log_info"
;
private
static
final
String
APP_INFO
=
"app_info"
;
private
static
final
String
SET_PAIRING
=
"set_pairing"
;
// アカウント
private
static
final
String
ACCOUNT_PATH
=
"accountPath"
;
...
...
@@ -88,8 +90,6 @@ public class ABookSettingFragment extends PreferenceFragment {
private
static
final
String
PRIVACY_POLICY
=
"privacyPolicy"
;
// 機器連携(ペアリング)
//private static final String SET_CHINO_PAIRING = "setChinoPairing"; // CHINO機器
//private static final String SET_SPP_PAIRING = "setSppPairing"; // SPP通信機器
private
static
final
String
SET_ALC_PAIRING
=
"setAlcPairing"
;
protected
Handler
handler
=
new
Handler
();
...
...
@@ -482,10 +482,15 @@ public class ABookSettingFragment extends PreferenceFragment {
// 機器連携のペアリング設定
private
void
setPairingSetting
()
{
// CHINO機器
PreferenceGroup
chinoDevicePairing
=
(
PreferenceGroup
)
findPreference
(
SET_ALC_PAIRING
);
chinoDevicePairing
.
setOnPreferenceClickListener
(
new
OnPreferenceClickListener
()
{
PreferenceGroup
devicePairing
=
(
PreferenceGroup
)
findPreference
(
SET_ALC_PAIRING
);
if
(!
ABVDataCache
.
getInstance
().
serviceOption
.
isAlcoholCheckerHw
())
{
// Preference alcoholChecker = (Preference) findPreference(SET_ALC_PAIRING);
// devicePairing.removePreference(alcoholChecker);
return
;
}
//PreferenceUtil ppp = devicePairing.findPreference(SET_ALC_PAIRING);
devicePairing
.
setOnPreferenceClickListener
(
new
OnPreferenceClickListener
()
{
@Override
public
boolean
onPreferenceClick
(
Preference
preference
)
{
try
{
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/BlePairingSettingActivity.java
View file @
88fdc1ad
...
...
@@ -44,8 +44,8 @@ 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 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,10 +73,10 @@ 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(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
;
for
(
BluetoothDevice
savedDevice
:
mScanDeviceInfoList
)
{
...
...
@@ -123,11 +123,12 @@ 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
))
{
// 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
;
}
...
...
@@ -305,13 +306,14 @@ 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
))
{
// 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
;
}
...
...
@@ -350,15 +352,16 @@ public class BlePairingSettingActivity extends ABVUIActivity {
List
<
SectionHeaderData
>
sectionList
=
new
ArrayList
<>();
List
<
BluetoothPairingDeviceInfoDto
>
bluetoothPairingInfoDtoList
=
getABVUIDataCache
().
getPairingBluetoothDeviceInfoList
(
Arrays
.
asList
(
DeviceType
.
centerThermomete
,
DeviceType
.
radiationThermomete
,
DeviceType
.
alcoholChecker
));
getABVUIDataCache
().
getPairingBluetoothDeviceInfoList
(
Arrays
.
asList
(
DeviceType
.
alcoholChecker
));
if
(
CollectionUtil
.
isNotEmpty
(
bluetoothPairingInfoDtoList
))
{
for
(
BluetoothPairingDeviceInfoDto
bluetoothPairingDeviceInfoDto
:
bluetoothPairingInfoDtoList
)
{
// ペアリング情報が既に保存されてる場合はヘッダー情報を各機器毎に追加する
if
(
bluetoothPairingDeviceInfoDto
.
deviceType
.
equals
(
DeviceType
.
centerThermomete
))
{
sectionList
.
add
(
new
SectionHeaderData
(
String
.
format
(
getString
(
R
.
string
.
pairing_save_machine
),
getString
(
R
.
string
.
center_thermometer
))));
}
else
if
(
bluetoothPairingDeviceInfoDto
.
deviceType
.
equals
(
DeviceType
.
radiationThermomete
))
{
sectionList
.
add
(
new
SectionHeaderData
(
String
.
format
(
getString
(
R
.
string
.
pairing_save_machine
),
getString
(
R
.
string
.
radiation_thermometer
))));
}
else
if
(
bluetoothPairingDeviceInfoDto
.
deviceType
.
equals
(
DeviceType
.
alcoholChecker
))
{
// if (bluetoothPairingDeviceInfoDto.deviceType.equals(DeviceType.centerThermomete)) {
// sectionList.add(new SectionHeaderData(String.format(getString(R.string.pairing_save_machine), getString(R.string.center_thermometer))));
// } else if (bluetoothPairingDeviceInfoDto.deviceType.equals(DeviceType.radiationThermomete)) {
// sectionList.add(new SectionHeaderData(String.format(getString(R.string.pairing_save_machine), getString(R.string.radiation_thermometer))));
// } else
if
(
bluetoothPairingDeviceInfoDto
.
deviceType
.
equals
(
DeviceType
.
alcoholChecker
))
{
sectionList
.
add
(
new
SectionHeaderData
(
String
.
format
(
getString
(
R
.
string
.
pairing_save_machine
),
getString
(
R
.
string
.
alcohl_checker
))));
}
}
...
...
@@ -380,7 +383,7 @@ public class BlePairingSettingActivity extends ABVUIActivity {
List
<
List
<
BleListRowData
>>
rowList
=
new
ArrayList
<
List
<
BleListRowData
>>();
// 引数で指定したタイプリストのペアリング情報を取得
List
<
BluetoothPairingDeviceInfoDto
>
bluetoothPairingInfoDtoList
=
getABVUIDataCache
().
getPairingBluetoothDeviceInfoList
(
Arrays
.
asList
(
DeviceType
.
centerThermomete
,
DeviceType
.
radiationThermomete
,
DeviceType
.
alcoholChecker
));
getABVUIDataCache
().
getPairingBluetoothDeviceInfoList
(
Arrays
.
asList
(
DeviceType
.
alcoholChecker
));
if
(
CollectionUtil
.
isNotEmpty
(
bluetoothPairingInfoDtoList
))
{
for
(
BluetoothPairingDeviceInfoDto
bluetoothPairingDeviceInfoDto
:
bluetoothPairingInfoDtoList
)
{
...
...
@@ -405,11 +408,12 @@ 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
))
{
// 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
=
"アルコールチェッカー"
;
}
BleListRowData
scanRowData
=
new
BleListRowData
(
bleDevice
.
getName
(),
labelDeviceName
,
bleDevice
.
getAddress
(),
false
);
...
...
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