Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
63fe3fc0
authored
Aug 20, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用于debug,测试黑色设备异常扫码阻塞的问题
parent
16bc5455
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
7 deletions
+9
-7
app/build.gradle
+2
-2
app/src/main/java/com/bgycc/smartcanteen/qrcode/DefaultQRCodeScan.java
+5
-1
app/src/main/java/com/bgycc/smartcanteen/utils/NetworkUtils.java
+0
-2
app/src/main/java/com/bgycc/smartcanteen/viewModel/QRCodeViewModel.java
+2
-2
No files found.
app/build.gradle
View file @
63fe3fc0
...
...
@@ -7,8 +7,8 @@ android {
applicationId
"com.bgycc.smartcanteen"
minSdkVersion
22
targetSdkVersion
30
versionCode
14
1
versionName
"1.4.
1
"
versionCode
14
3
versionName
"1.4.
3
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
ndk
{
abiFilters
"armeabi"
,
"armeabi-v7a"
,
"x86"
,
"mips"
...
...
app/src/main/java/com/bgycc/smartcanteen/qrcode/DefaultQRCodeScan.java
View file @
63fe3fc0
...
...
@@ -41,10 +41,14 @@ public class DefaultQRCodeScan implements IQRCodeScan {
while
(
buf
==
null
||
!
end
(
buf
))
{
byte
[]
b
=
new
byte
[
64
];
int
l
=
serialPortIS
.
read
(
b
);
if
(
l
==
0
)
break
;
if
(
l
==
0
)
{
LogUtils
.
w
(
TAG
,
"扫码枪异常"
);
break
;
}
b
=
Arrays
.
copyOfRange
(
b
,
0
,
l
);
buf
=
merge
(
buf
,
b
);
len
+=
l
;
LogUtils
.
d
(
TAG
,
"扫码枪结果: "
+
(
buf
!=
null
?
Arrays
.
toString
(
buf
)
:
"empty"
));
}
String
str
=
null
;
...
...
app/src/main/java/com/bgycc/smartcanteen/utils/NetworkUtils.java
View file @
63fe3fc0
...
...
@@ -218,7 +218,6 @@ public class NetworkUtils {
private
static
void
requestEthernet
(
ConnectivityManager
.
NetworkCallback
callback
)
{
NetworkRequest
request
=
new
NetworkRequest
.
Builder
()
.
addTransportType
(
NetworkCapabilities
.
TRANSPORT_ETHERNET
)
.
removeTransportType
(
NetworkCapabilities
.
TRANSPORT_WIFI
)
.
build
();
connectivityManager
.
requestNetwork
(
request
,
callback
);
}
...
...
@@ -230,7 +229,6 @@ public class NetworkUtils {
}
NetworkRequest
request
=
new
NetworkRequest
.
Builder
()
.
addTransportType
(
NetworkCapabilities
.
TRANSPORT_WIFI
)
.
removeTransportType
(
NetworkCapabilities
.
TRANSPORT_ETHERNET
)
.
build
();
connectivityManager
.
requestNetwork
(
request
,
callback
);
}
...
...
app/src/main/java/com/bgycc/smartcanteen/viewModel/QRCodeViewModel.java
View file @
63fe3fc0
...
...
@@ -70,14 +70,14 @@ public class QRCodeViewModel extends ViewModel {
if
(
scan
==
null
)
return
;
if
(
scanFuture
==
null
||
scanFuture
.
isDone
())
{
scanFuture
=
SCTaskExecutor
.
getInstance
().
schedule
(
scanRunnable
,
DELAY
,
TimeUnit
.
MILLISECONDS
);
}
else
{
LogUtils
.
w
(
TAG
,
"当前已有扫码任务"
);
}
}
private
Runnable
scanRunnable
=
()
->
{
qrCodeState
.
postValue
(
new
QRCodeState
(
QRCodeState
.
IDLE
));
LogUtils
.
i
(
TAG
,
"开始扫描二维码"
);
while
(!
scan
.
available
())
{}
qrCodeState
.
postValue
(
new
QRCodeState
(
QRCodeState
.
SCANNING
));
// 读取串口扫描的二维码数据
String
scanData
;
try
{
...
...
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