Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
A
AnchorCollect_p
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hywang
AnchorCollect_p
Commits
8f861aa3
Commit
8f861aa3
authored
Aug 02, 2023
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加根据cpu型号选择上电方式;
2.修复配种显示bug
parent
54a50586
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
152 additions
and
35 deletions
+152
-35
build.gradle
app/build.gradle
+3
-3
App.java
app/src/main/java/com/phlx/anchorcollect_p/App.java
+7
-0
Configs.java
app/src/main/java/com/phlx/anchorcollect_p/Configs.java
+2
-0
DaoMaster.java
.../main/java/com/phlx/anchorcollect_p/db/gen/DaoMaster.java
+2
-2
RetrofitClient.java
...ain/java/com/phlx/anchorcollect_p/net/RetrofitClient.java
+1
-1
DeviceControl.java
...ain/java/com/phlx/anchorcollect_p/rfid/DeviceControl.java
+80
-22
ModuleManager.java
...ain/java/com/phlx/anchorcollect_p/rfid/ModuleManager.java
+23
-4
BreedingRecordVM.java
...phlx/anchorcollect_p/ui/fragment/vm/BreedingRecordVM.java
+4
-3
DeviceIdUtils.java
...ain/java/com/phlx/anchorcollect_p/util/DeviceIdUtils.java
+30
-0
ic_launcher.png
app/src/main/res/drawable/ic_launcher.png
+0
-0
No files found.
app/build.gradle
View file @
8f861aa3
...
...
@@ -9,8 +9,8 @@ android {
applicationId
"com.phlx.anchorcollect_p"
minSdkVersion
21
targetSdkVersion
29
versionCode
9
versionName
"2.0.
3
"
versionCode
10
versionName
"2.0.
4
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
...
...
@@ -48,7 +48,7 @@ android {
}
greendao
{
schemaVersion
3
//数据库版本号
schemaVersion
4
//数据库版本号
daoPackage
'com.phlx.anchorcollect_p.db.gen'
targetGenDir
'src/main/java'
}
...
...
app/src/main/java/com/phlx/anchorcollect_p/App.java
View file @
8f861aa3
...
...
@@ -5,6 +5,7 @@ import android.graphics.Typeface;
import
com.kongzue.dialogx.DialogX
;
import
com.kongzue.dialogx.style.KongzueStyle
;
import
com.phlx.anchorcollect_p.util.DeviceIdUtils
;
import
com.uhf.linkage.Linkage
;
import
cn.wandersnail.bluetooth.BTManager
;
...
...
@@ -41,6 +42,12 @@ public class App extends BaseApplication {
//实例化并初始化
// EasyBLE.getInstance().initialize(this)
BTManager
.
getInstance
().
initialize
(
this
);
Configs
.
cpuName
=
DeviceIdUtils
.
getCpuName
();
if
(
""
.
equals
(
Configs
.
cpuName
)){
}
}
public
static
App
getInstance
()
{
...
...
app/src/main/java/com/phlx/anchorcollect_p/Configs.java
View file @
8f861aa3
...
...
@@ -124,6 +124,8 @@ public class Configs {
public
static
String
currentEvent
;
//控制接受重量数据的页面
public
static
String
cpuName
=
""
;
// public static boolean ISCONNECTED;
...
...
app/src/main/java/com/phlx/anchorcollect_p/db/gen/DaoMaster.java
View file @
8f861aa3
...
...
@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version
3
): knows all DAOs.
* Master of DAO (schema version
4
): knows all DAOs.
*/
public
class
DaoMaster
extends
AbstractDaoMaster
{
public
static
final
int
SCHEMA_VERSION
=
3
;
public
static
final
int
SCHEMA_VERSION
=
4
;
/** Creates underlying database table using DAOs. */
public
static
void
createAllTables
(
Database
db
,
boolean
ifNotExists
)
{
...
...
app/src/main/java/com/phlx/anchorcollect_p/net/RetrofitClient.java
View file @
8f861aa3
...
...
@@ -51,7 +51,7 @@ public class RetrofitClient {
public
static
String
baseUrl
=
"serve.xlglmnmyzspt.org.cn"
//正式
// "39.101.170.186"//阿里云测试
// "192.168.
8.135
"//董
// "192.168.
1.80
"//董
// "192.168.43.154"//张敏
;
public
static
String
port
=
...
...
app/src/main/java/com/phlx/anchorcollect_p/rfid/DeviceControl.java
View file @
8f861aa3
package
com
.
phlx
.
anchorcollect_p
.
rfid
;
import
android.os.SystemClock
;
import
com.phlx.anchorcollect_p.Configs
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileWriter
;
...
...
@@ -13,42 +17,96 @@ class DeviceControl {
void
PowerOnDevice
()
{
try
{
//RM_7088_MT2
//手持机
WriteFile
(
"/sys/class/misc/mtgpio/pin"
,
"-wdout94 1"
);
switch
(
Configs
.
cpuName
)
{
//pad RM_SD100T_MT1
// WriteFile("/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio", "mode75 0");
// WriteFile("/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio", "out75 1");
// WriteFile("/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio", "out55 1");
case
"MT6735"
:
try
{
//手持机 RM_7088_MT2
WriteFile
(
"/sys/class/misc/mtgpio/pin"
,
"-wdout94 1"
);
Thread
.
sleep
(
300
);
//RM_SD100T_MT1
// WriteFile("/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio", "out55 1");
}
catch
(
IOException
|
InterruptedException
e
)
{
e
.
printStackTrace
();
}
break
;
case
"MT6762V/CB"
:
try
{
//手持机 RM_WIOT61c_S1
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"out 009 1"
);
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"mode 009 0"
);
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"dir 009 1"
);
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"out 170 1"
);
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"mode 170 0"
);
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"dir 170 1"
);
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"out 156 1"
);
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"mode 156 0"
);
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"dir 156 1"
);
SystemClock
.
sleep
(
500
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
break
;
Thread
.
sleep
(
300
);
case
"MT6763V/B"
:
try
{
//pad RM_SD100T_MT1
WriteFile
(
"/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio"
,
"mode75 0"
);
WriteFile
(
"/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio"
,
"out75 1"
);
WriteFile
(
"/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio"
,
"out55 1"
);
}
catch
(
IOException
|
InterruptedException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
break
;
}
//RM_SD100T_MT1
// WriteFile("/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio", "out55 1");
// Thread.sleep(300);
}
void
PowerOffDevice
()
{
try
{
//RM_7088_MT2
//手持机
WriteFile
(
"/sys/class/misc/mtgpio/pin"
,
"-wdout94 0"
);
//pad RM_SD100T_MT1
// WriteFile("/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio", "out75 0");
// WriteFile("/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio", "out55 0");
switch
(
Configs
.
cpuName
)
{
case
"MT6735"
:
try
{
//手持机 RM_7088_MT2
WriteFile
(
"/sys/class/misc/mtgpio/pin"
,
"-wdout94 0"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
break
;
case
"MT6762V/CB"
:
try
{
//手持机 RM_WIOT61c_S1
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"out 009 0"
);
WriteFile
(
"/sys/devices/platform/pinctrl/mt_gpio"
,
"dir 009 1"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
break
;
case
"MT6763V/B"
:
try
{
//pad RM_SD100T_MT1
WriteFile
(
"/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio"
,
"out75 0"
);
WriteFile
(
"/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio"
,
"out55 0"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
break
;
//RM_SD100T_MT1
// WriteFile("/sys/bus/platform/drivers/mediatek-pinctrl/10005000.pinctrl/mt_gpio", "out55 0");
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
...
...
app/src/main/java/com/phlx/anchorcollect_p/rfid/ModuleManager.java
View file @
8f861aa3
...
...
@@ -2,16 +2,35 @@ package com.phlx.anchorcollect_p.rfid;
import
com.phlx.anchorcollect_p.App
;
import
com.phlx.anchorcollect_p.Configs
;
import
com.uhf.structures.Rfid_Value
;
public
class
ModuleManager
{
private
static
String
serialPort
=
"/dev/ttyMT2"
;
public
static
int
openCom
()
{
//手持机
return
App
.
getInstance
().
getLinkage
().
open_serial
(
"/dev/ttyMT2"
);
//pad
// return App.getInstance().getLinkage().open_serial("/dev/ttyMT1");
switch
(
Configs
.
cpuName
)
{
//手持机 RM_7088_MT2
case
"MT6735"
:
serialPort
=
"/dev/ttyMT2"
;
break
;
//手持机 RM_WIOT61c_S1
case
"MT6762V/CB"
:
serialPort
=
"/dev/ttyS1"
;
break
;
//pad RM_SD100T_MT1
case
"MT6763V/B"
:
serialPort
=
"/dev/ttyMT1"
;
break
;
}
return
App
.
getInstance
().
getLinkage
().
open_serial
(
serialPort
);
}
public
static
void
destroyLibSO
()
{
...
...
app/src/main/java/com/phlx/anchorcollect_p/ui/fragment/vm/BreedingRecordVM.java
View file @
8f861aa3
...
...
@@ -323,9 +323,10 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
QueryBuilder
<
BreedingRecordDetailEntity
>
builder
=
DbUtil
.
getInstance
().
getQueryBuilder
(
BreedingRecordDetailEntity
.
class
)
.
where
(
BreedingRecordDetailEntityDao
.
Properties
.
CaId
.
eq
(
breedingRecordEntity
.
getCattleresumeId
())
,
BreedingRecordDetailEntityDao
.
Properties
.
CreateTime
.
like
(
DateUtils
.
getYear
()
+
"%"
)
);
.
where
(
BreedingRecordDetailEntityDao
.
Properties
.
FUnid
.
eq
(
breedingRecordEntity
.
getUnid
())
// , BreedingRecordDetailEntityDao.Properties.CreateTime.like(DateUtils.getYear() + "%")
)
.
orderDesc
(
BreedingRecordDetailEntityDao
.
Properties
.
CreateTime
);
DbUtil
.
getInstance
().
setDbQueryCallBack
(
new
DbQueryCallBack
<
BreedingRecordDetailEntity
>()
{
@Override
public
void
onSuccess
(
List
<
BreedingRecordDetailEntity
>
result
)
{
...
...
app/src/main/java/com/phlx/anchorcollect_p/util/DeviceIdUtils.java
View file @
8f861aa3
...
...
@@ -205,4 +205,34 @@ public class DeviceIdUtils {
return
null
;
}
}
public
static
String
getCpuName
()
{
String
str1
=
"/proc/cpuinfo"
;
String
str2
=
""
;
String
cpuName
=
""
;
try
{
FileReader
fileReader
=
new
FileReader
(
str1
);
BufferedReader
bufferedReader
=
new
BufferedReader
(
fileReader
);
while
((
str2
=
bufferedReader
.
readLine
())
!=
null
)
{
if
(
TextUtils
.
isEmpty
(
str2
))
{
continue
;
}
String
[]
arrayOfString
=
str2
.
split
(
":\\s+"
,
2
);
if
(
TextUtils
.
equals
(
arrayOfString
[
0
].
trim
(),
"Hardware"
))
{
cpuName
=
arrayOfString
[
1
];
break
;
}
}
bufferedReader
.
close
();
fileReader
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
cpuName
;
}
}
app/src/main/res/drawable/ic_launcher.png
View replaced file @
54a50586
View file @
8f861aa3
2.81 KB
|
W:
|
H:
6.82 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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