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
e931b805
Commit
e931b805
authored
Jul 29, 2020
by
onuma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TR41をスキャンして温度を取得できるように修正途中。
parent
39e4fbdc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
15 deletions
+45
-15
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/Constant.java
+1
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/TR41BluetoothUtil.java
+22
-10
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVCheckContentViewActivity.java
+22
-4
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/Constant.java
View file @
e931b805
...
...
@@ -176,7 +176,7 @@ public class Constant {
int
barcode
=
3
;
// バーコード
int
radiationThermomete
=
4
;
// 放射温度計
int
sppBluetoothMachine
=
5
;
// SPP通信機器
int
nfc
=
7
;
// nfc機器
int
nfc
=
7
;
// nfc機器
.... テスト用に 6 -> 7に変更
int
tr41
=
6
;
// TR41温度計
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/TR41BluetoothUtil.java
View file @
e931b805
...
...
@@ -48,14 +48,16 @@ public class TR41BluetoothUtil {
public
static
final
String
TAG
=
"TR41BluetootUtil"
;
private
BluetoothManager
mBluetoothManager
;
p
rivate
BluetoothAdapter
mBluetoothAdapter
;
p
ublic
BluetoothAdapter
mBluetoothAdapter
;
private
BluetoothLeScanner
mBluetoothLeScanner
;
private
TR41BluetoothUtilLeScanner
mListener
;
private
Context
mContext
;
private
Handler
mHandler
;
private
static
final
long
SCAN_PERIOD
=
10000
;
// スキャン時間。単位はミリ秒
private
boolean
mIsScaning
;
private
static
final
long
SCAN_PERIOD
=
60000
;
// スキャン時間。単位はミリ秒
/**
*
...
...
@@ -66,6 +68,7 @@ public class TR41BluetoothUtil {
void
onScanFailed
(
int
errorCode
);
//void onScanResult(int callbackType, ScanResult result);
void
onScanResult
(
String
strTemperature
);
// デバイスから温度を渡す
void
onScanStop
();
// スキャンを停止した
}
public
TR41BluetoothUtil
(
Context
context
,
TR41BluetoothUtilLeScanner
listener
)
...
...
@@ -73,6 +76,8 @@ public class TR41BluetoothUtil {
mContext
=
context
;
mListener
=
listener
;
mHandler
=
new
Handler
();
mIsScaning
=
false
;
}
// ************************************************************************
// void Sb_Init_Ble_Scan()
...
...
@@ -83,19 +88,16 @@ public class TR41BluetoothUtil {
// ************************************************************************
private
void
Sb_Init_Ble_Scan
()
{
if
(
mBluetoothAdapter
!
=
null
){
if
(
mBluetoothAdapter
=
=
null
){
return
;
}
//BluetoothAdapter取得
BluetoothAdapter
btAdpt
=
BluetoothAdapter
.
getDefaultAdapter
()
;
// boolean btEnable = btAdpt
.isEnabled() ;
//
if(btEnable == true) {
boolean
btEnable
=
mBluetoothAdapter
.
isEnabled
()
;
if
(
btEnable
==
true
)
{
// Bluetoothアダプタ作成
mBluetoothManager
=
(
BluetoothManager
)
mContext
.
getSystemService
(
Context
.
BLUETOOTH_SERVICE
);
mBluetoothAdapter
=
mBluetoothManager
.
getAdapter
()
;
mBluetoothLeScanner
=
mBluetoothAdapter
.
getBluetoothLeScanner
()
;
//
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -120,14 +122,18 @@ public class TR41BluetoothUtil {
@Override
public
void
run
()
{
// SCAN_PERIOD 秒後に呼ばれた時はスキャンで端末を取得できなかったと見做す。
mBluetoothLeScanner
.
stopScan
(
mScanCallback
)
;
mListener
.
onScanStop
();
Sb_StopScan
();
Logger
.
d
(
TAG
,
"scan in 20 sec"
);
}
},
SCAN_PERIOD
);
mIsScaning
=
true
;
}
public
void
Sb_StopScan
()
{
mIsScaning
=
false
;
mBluetoothLeScanner
.
stopScan
(
mScanCallback
)
;
}
...
...
@@ -163,6 +169,12 @@ public class TR41BluetoothUtil {
@Override
public
void
onScanResult
(
int
callbackType
,
ScanResult
result
)
{
if
(!
mIsScaning
){
Logger
.
d
(
TAG
,
"mIsScaning == false"
);
return
;
}
BluetoothDevice
device
=
result
.
getDevice
()
;
byte
[]
scanRecord
=
result
.
getScanRecord
().
getBytes
()
;
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVCheckContentViewActivity.java
View file @
e931b805
...
...
@@ -346,8 +346,11 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
Logger
.
e
(
TAG
,
"BluetoothAdapter is null."
);
}
// TR41温度センサー
if
(
mBluetoothAdapter
!=
null
){
// TR41温度センサー
mIsTR41Scaning
=
false
;
mTR41SerialNo
=
""
;
mTR41BluetoothUtil
=
new
TR41BluetoothUtil
(
this
,
new
TR41BluetoothUtil
.
TR41BluetoothUtilLeScanner
()
{
@Override
public
void
onScanFailed
(
int
errorCode
)
{
...
...
@@ -380,12 +383,20 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
setNfcData
(
strTemperature
);
// 取得できたら、ダイアログ消す。
dismissWaitngDialog
();
// TR41スキャン停止
stopTR41BeaconScan
();
}
}
@Override
public
void
onScanStop
()
{
Logger
.
d
(
TAG
,
"-------------------------------------------------"
);
Logger
.
d
(
TAG
,
"onScanStop"
);
Logger
.
d
(
TAG
,
"-------------------------------------------------"
);
// TR41スキャン停止
stopTR41BeaconScan
();
}
});
mTR41BluetoothUtil
.
mBluetoothAdapter
=
this
.
mBluetoothAdapter
;
}
}
...
...
@@ -702,6 +713,8 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
if
(!
mIsTR41Scaning
)
{
mTR41BluetoothUtil
.
Sb_StartScan
();
mIsTR41Scaning
=
true
;
showWaitingDialog
(
getString
(
R
.
string
.
tr41_thermometer
),
getString
(
R
.
string
.
pairing_search_scaning
));
}
}
}
...
...
@@ -716,11 +729,13 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
if
(
mIsTR41Scaning
)
{
mTR41BluetoothUtil
.
Sb_StopScan
();
mIsTR41Scaning
=
false
;
dismissWaitngDialog
();
}
}
/**
* 中心温度計、置くだけセンサー接続の待機ダイヤログ表示
* 中心温度計、置くだけセンサー接続の待機
、TR41温度センサースキャン中、
ダイヤログ表示
* @param title タイトル
* @param message 内容
*/
...
...
@@ -739,7 +754,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
case
DeviceType
.
centerThermomete
:
case
DeviceType
.
radiationThermomete
:
Logger
.
d
(
TAG
,
"-------------------------------------------------"
);
Logger
.
d
(
TAG
,
"中止"
);
Logger
.
d
(
TAG
,
"
放射・中心温度計 接続待
中止"
);
Logger
.
d
(
TAG
,
"-------------------------------------------------"
);
bleManagerDisconnect
(
true
);
// 放射温度計、中心温度計接続切断
break
;
...
...
@@ -762,6 +777,9 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
mNfcAdapter
.
disableForegroundDispatch
(
ABVCheckContentViewActivity
.
this
);
break
;
case
DeviceType
.
tr41
:
// TR41温度センサー
Logger
.
d
(
TAG
,
"-------------------------------------------------"
);
Logger
.
d
(
TAG
,
"TR41温度センサー スキャン中止"
);
Logger
.
d
(
TAG
,
"-------------------------------------------------"
);
stopTR41BeaconScan
();
break
;
}
...
...
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