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
55311ee9
Commit
55311ee9
authored
Jan 23, 2020
by
Lee Jaebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPP通信でデータ取得時、成功音を鳴らす処理追加、SPP通信で受信されない問題修正
parent
5e5dbf1b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/YamatoBluetoothReceiveTask.java
+5
-2
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVCheckContentViewActivity.java
+9
-2
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/YamatoBluetoothReceiveTask.java
View file @
55311ee9
...
...
@@ -55,8 +55,8 @@ public class YamatoBluetoothReceiveTask extends Thread {
@Override
public
void
run
()
{
Logger
.
i
(
TAG
,
"bluetoothReciveTask run"
);
byte
[]
buffer
=
new
byte
[
1024
];
int
readSize
=
0
;
String
str
=
""
;
while
(
mInputStream
!=
null
)
{
Logger
.
i
(
TAG
,
"start read mInputStream."
);
...
...
@@ -66,14 +66,17 @@ public class YamatoBluetoothReceiveTask extends Thread {
}
try
{
byte
[]
buffer
=
new
byte
[
1024
];
readSize
=
mInputStream
.
read
(
buffer
);
String
str
=
new
String
(
buffer
,
0
,
readSize
);
str
+
=
new
String
(
buffer
,
0
,
readSize
);
Logger
.
i
(
TAG
,
"getData : "
+
str
);
if
(
str
.
indexOf
(
new
Character
((
char
)
STX
).
toString
())
!=
-
1
&&
str
.
indexOf
(
new
Character
((
char
)
ETX
).
toString
())
!=
-
1
)
{
String
dataStr
=
str
.
substring
(
str
.
indexOf
(
new
Character
((
char
)
STX
).
toString
())
+
1
,
str
.
indexOf
(
new
Character
((
char
)
ETX
).
toString
()));
Logger
.
i
(
TAG
,
"convert data : "
+
dataStr
);
String
result
=
dataStr
.
substring
(
mSppDeviceDto
.
dataStartIndex
-
1
,
mSppDeviceDto
.
dataEndIndex
-
1
).
replaceAll
(
" "
,
""
);
// データを取得したらリセット
str
=
""
;
mListener
.
onGetData
(
result
);
}
Thread
.
sleep
(
500
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVCheckContentViewActivity.java
View file @
55311ee9
...
...
@@ -670,8 +670,10 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
final
BluetoothDevice
bluetoothDevice
=
mBluetoothAdapter
.
getRemoteDevice
(
sppDeviceDto
.
pairingDeviceAddress
);
if
(
bluetoothDevice
!=
null
)
{
Logger
.
d
(
TAG
,
"----bluetoothDevice is not null"
);
// 既に接続している場合、端末アドレスが一致すれば、接続済みと見做す。
if
(
mSppBluetoothConnectThread
!=
null
&&
mSppBluetoothConnectThread
.
getConnectedAddress
().
equals
(
bluetoothDevice
.
getAddress
()))
{
Logger
.
d
(
TAG
,
"----device address Same"
);
// 接続完了後、処理
if
(
mWaitingDialog
!=
null
)
{
handler
.
post
(
new
Runnable
()
{
...
...
@@ -684,7 +686,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
}
else
{
// 初回のbluetooth接続・bluetooth対象アドレスが異なる場合、新規で接続するようにする。
// 初回ではない場合はbluetoothを一度接続を切る。
if
(
mSppBluetoothConnectThread
!=
null
)
{
Logger
.
i
(
"------------------------------1
"
);
Logger
.
d
(
TAG
,
"address diff change bluetoothThread
"
);
disConnectSppBluetooth
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
...
...
@@ -693,6 +695,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
}
},
5000
);
}
else
{
Logger
.
d
(
TAG
,
"new connect spp bluetooth"
);
setSppBluetoothThread
(
bluetoothDevice
,
sppDeviceDto
);
}
}
...
...
@@ -857,7 +860,10 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
sppBluetoothMachineDataJson
.
put
(
ABookKeys
.
TASK_QUESTION_ID
,
mQid
);
sppBluetoothMachineDataJson
.
put
(
"value"
,
strData
);
afterABookCheckApi
(
mCmd
,
""
,
0
,
""
,
sppBluetoothMachineDataJson
.
toString
());
// 値が空ではない場合、成功音を出す。
if
(
strData
!=
null
&&
strData
.
length
()
>
0
)
{
audioPlay
();
}
// 閉じる
dismissWaitngDialog
();
}
...
...
@@ -991,6 +997,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
@Override
protected
void
onStop
()
{
super
.
onStop
();
Logger
.
d
(
TAG
,
"--onStop"
);
// SPP通信の接続を切る
disConnectSppBluetooth
();
...
...
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