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
ce425b44
authored
May 20, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化设备上传日志的设计,增加日志输出
parent
14ea85d2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
15 deletions
+13
-15
app/src/main/java/com/bgycc/smartcanteen/command/LogCommandWorker.java
+5
-5
app/src/main/java/com/bgycc/smartcanteen/device/DeviceFeatures.java
+1
-1
app/src/main/java/com/bgycc/smartcanteen/device/QUADDevice.java
+3
-3
app/src/main/java/com/bgycc/smartcanteen/device/TPSDevice.java
+2
-4
app/src/main/java/com/bgycc/smartcanteen/utils/DeviceProxy.java
+2
-2
No files found.
app/src/main/java/com/bgycc/smartcanteen/command/LogCommandWorker.java
View file @
ce425b44
...
...
@@ -14,8 +14,6 @@ import com.blankj.utilcode.util.LogUtils;
import
com.blankj.utilcode.util.PathUtils
;
import
com.blankj.utilcode.util.ZipUtils
;
import
org.jetbrains.annotations.NotNull
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.io.IOException
;
...
...
@@ -149,15 +147,14 @@ public class LogCommandWorker extends CommandWorker {
return
zip
;
}
@NotNull
private
File
getLogDirByType
(
String
logType
)
{
File
logDir
;
if
(
logType
.
equals
(
BOOT_LOG
))
{
logDir
=
new
File
(
DeviceProxy
.
systemLogPath
()
);
logDir
=
DeviceProxy
.
systemLogDir
(
);
}
else
{
logDir
=
new
File
(
LogUtils
.
getConfig
().
getDir
());
}
LogUtils
.
d
(
TAG
,
"待上传日志文件类型: "
+
logType
);
LogUtils
.
d
(
TAG
,
"待上传日志文件类型: "
+
logType
+
", 日志文件夹路径: "
+
(
logDir
!=
null
?
logDir
:
"null"
)
);
return
logDir
;
}
...
...
@@ -177,6 +174,9 @@ public class LogCommandWorker extends CommandWorker {
}
private
boolean
copyTargetFiles
(
File
src
,
File
descDir
)
{
if
(
src
==
null
||
descDir
==
null
)
{
return
true
;
}
FileFilter
filter
=
file
->
{
Date
date
=
new
Date
(
file
.
lastModified
());
return
date
.
after
(
startTime
)
&&
date
.
before
(
endTime
);
...
...
app/src/main/java/com/bgycc/smartcanteen/device/DeviceFeatures.java
View file @
ce425b44
...
...
@@ -9,7 +9,7 @@ import java.io.File;
public
interface
DeviceFeatures
{
IQRCodeScan
createQRCodeScan
()
throws
Exception
;
String
systemLogPath
();
File
systemLogDir
();
boolean
updateApp
(
Context
context
,
File
updateApk
);
}
app/src/main/java/com/bgycc/smartcanteen/device/QUADDevice.java
View file @
ce425b44
...
...
@@ -12,7 +12,7 @@ import java.io.File;
import
java.io.IOException
;
public
class
QUADDevice
implements
DeviceFeatures
{
private
static
final
String
SYSTEM_LOG_
PATH
=
"boot_log"
;
private
static
final
String
SYSTEM_LOG_
DIR_NAME
=
"boot_log"
;
private
static
final
String
PORT
=
"/dev/ttyS6"
;
@Override
...
...
@@ -21,8 +21,8 @@ public class QUADDevice implements DeviceFeatures {
}
@Override
public
String
systemLogPath
()
{
return
PathUtils
.
getExternalStoragePath
()
+
File
.
separator
+
SYSTEM_LOG_PATH
;
public
File
systemLogDir
()
{
return
new
File
(
PathUtils
.
getExternalStoragePath
()
+
File
.
separator
+
SYSTEM_LOG_DIR_NAME
)
;
}
@Override
...
...
app/src/main/java/com/bgycc/smartcanteen/device/TPSDevice.java
View file @
ce425b44
...
...
@@ -5,14 +5,12 @@ import android.content.Context;
import
com.bgycc.smartcanteen.installer.TPSInstaller
;
import
com.bgycc.smartcanteen.qrcode.DefaultQRCodeScan
;
import
com.bgycc.smartcanteen.qrcode.IQRCodeScan
;
import
com.blankj.utilcode.util.PathUtils
;
import
com.telpo.tps550.api.DeviceAlreadyOpenException
;
import
java.io.File
;
import
java.io.IOException
;
public
class
TPSDevice
implements
DeviceFeatures
{
private
static
final
String
SYSTEM_LOG_PATH
=
"boot_log"
;
private
static
final
String
PORT
=
"/dev/ttyS0"
;
@Override
...
...
@@ -21,8 +19,8 @@ public class TPSDevice implements DeviceFeatures {
}
@Override
public
String
systemLogPath
()
{
return
PathUtils
.
getExternalStoragePath
()
+
File
.
separator
+
SYSTEM_LOG_PATH
;
public
File
systemLogDir
()
{
return
null
;
}
@Override
...
...
app/src/main/java/com/bgycc/smartcanteen/utils/DeviceProxy.java
View file @
ce425b44
...
...
@@ -38,7 +38,7 @@ public class DeviceProxy {
return
deviceImpl
.
updateApp
(
context
,
updateApk
);
}
public
static
String
systemLogPath
()
{
return
deviceImpl
.
systemLog
Path
();
public
static
File
systemLogDir
()
{
return
deviceImpl
.
systemLog
Dir
();
}
}
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