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
be3aab96
Commit
be3aab96
authored
Jan 23, 2020
by
Lee Jaebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPP通信 受信処理修正
parent
b7d1d87e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/YamatoBluetoothReceiveTask.java
+6
-10
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/YamatoBluetoothReceiveTask.java
View file @
be3aab96
...
@@ -2,10 +2,8 @@ package jp.agentec.abook.abv.cl.util;
...
@@ -2,10 +2,8 @@ package jp.agentec.abook.abv.cl.util;
import
android.bluetooth.BluetoothSocket
;
import
android.bluetooth.BluetoothSocket
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.dto.SppDeviceDto
;
import
jp.agentec.abook.abv.bl.dto.SppDeviceDto
;
...
@@ -59,6 +57,7 @@ public class YamatoBluetoothReceiveTask extends Thread {
...
@@ -59,6 +57,7 @@ public class YamatoBluetoothReceiveTask extends Thread {
Logger
.
i
(
TAG
,
"bluetoothReciveTask run"
);
Logger
.
i
(
TAG
,
"bluetoothReciveTask run"
);
int
readSize
=
0
;
int
readSize
=
0
;
String
str
=
""
;
while
(
mInputStream
!=
null
)
{
while
(
mInputStream
!=
null
)
{
Logger
.
i
(
TAG
,
"start read mInputStream."
);
Logger
.
i
(
TAG
,
"start read mInputStream."
);
...
@@ -68,20 +67,17 @@ public class YamatoBluetoothReceiveTask extends Thread {
...
@@ -68,20 +67,17 @@ public class YamatoBluetoothReceiveTask extends Thread {
}
}
try
{
try
{
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
mInputStream
));
byte
[]
buffer
=
new
byte
[
1024
];
StringBuilder
sb
=
new
StringBuilder
();
readSize
=
mInputStream
.
read
(
buffer
);
String
line
;
str
+=
new
String
(
buffer
,
0
,
readSize
);
while
((
line
=
br
.
readLine
())
!=
null
)
{
sb
.
append
(
line
);
}
String
str
=
sb
.
toString
();
Logger
.
i
(
TAG
,
"getData : "
+
str
);
Logger
.
i
(
TAG
,
"getData : "
+
str
);
if
(
str
.
indexOf
(
new
Character
((
char
)
STX
).
toString
())
!=
-
1
&&
str
.
indexOf
(
new
Character
((
char
)
ETX
).
toString
())
!=
-
1
)
{
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
()));
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
);
Logger
.
i
(
TAG
,
"convert data : "
+
dataStr
);
String
result
=
dataStr
.
substring
(
mSppDeviceDto
.
dataStartIndex
-
1
,
mSppDeviceDto
.
dataEndIndex
-
1
).
replaceAll
(
" "
,
""
);
String
result
=
dataStr
.
substring
(
mSppDeviceDto
.
dataStartIndex
-
1
,
mSppDeviceDto
.
dataEndIndex
-
1
).
replaceAll
(
" "
,
""
);
// データを取得したらリセット
str
=
""
;
mListener
.
onGetData
(
result
);
mListener
.
onGetData
(
result
);
}
}
Thread
.
sleep
(
500
);
Thread
.
sleep
(
500
);
...
...
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