Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
miya-hardware
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengguangpu
miya-hardware
Commits
baed0766
Commit
baed0766
authored
Dec 20, 2018
by
pengguangpu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
暂存
parent
b554710c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
259 additions
and
9 deletions
+259
-9
build_file_checksums.ser
.idea/caches/build_file_checksums.ser
+0
-0
misc.xml
.idea/misc.xml
+7
-3
vcs.xml
.idea/vcs.xml
+1
-1
IPrinter.java
print/src/main/java/com/miya/print/IPrinter.java
+11
-0
CpuUtils.java
print/src/main/java/com/miya/print/utils/CpuUtils.java
+1
-1
D.java
print/src/main/java/com/miya/print/utils/D.java
+83
-0
HisenseWeighing.java
...hing/src/main/java/com/miya/weighing/HisenseWeighing.java
+1
-1
YingtaiWeighing.java
...hing/src/main/java/com/miya/weighing/YingtaiWeighing.java
+2
-2
CpuUtils.java
weighing/src/main/java/com/miya/weighing/utils/CpuUtils.java
+152
-0
D.java
weighing/src/main/java/com/miya/weighing/utils/D.java
+1
-1
No files found.
.idea/caches/build_file_checksums.ser
View file @
baed0766
No preview for this file type
.idea/misc.xml
View file @
baed0766
...
...
@@ -5,27 +5,31 @@
<option
name=
"myDefaultNotNull"
value=
"android.support.annotation.NonNull"
/>
<option
name=
"myNullables"
>
<value>
<list
size=
"
5
"
>
<list
size=
"
7
"
>
<item
index=
"0"
class=
"java.lang.String"
itemvalue=
"org.jetbrains.annotations.Nullable"
/>
<item
index=
"1"
class=
"java.lang.String"
itemvalue=
"javax.annotation.Nullable"
/>
<item
index=
"2"
class=
"java.lang.String"
itemvalue=
"javax.annotation.CheckForNull"
/>
<item
index=
"3"
class=
"java.lang.String"
itemvalue=
"edu.umd.cs.findbugs.annotations.Nullable"
/>
<item
index=
"4"
class=
"java.lang.String"
itemvalue=
"android.support.annotation.Nullable"
/>
<item
index=
"5"
class=
"java.lang.String"
itemvalue=
"androidx.annotation.Nullable"
/>
<item
index=
"6"
class=
"java.lang.String"
itemvalue=
"androidx.annotation.RecentlyNullable"
/>
</list>
</value>
</option>
<option
name=
"myNotNulls"
>
<value>
<list
size=
"
4
"
>
<list
size=
"
6
"
>
<item
index=
"0"
class=
"java.lang.String"
itemvalue=
"org.jetbrains.annotations.NotNull"
/>
<item
index=
"1"
class=
"java.lang.String"
itemvalue=
"javax.annotation.Nonnull"
/>
<item
index=
"2"
class=
"java.lang.String"
itemvalue=
"edu.umd.cs.findbugs.annotations.NonNull"
/>
<item
index=
"3"
class=
"java.lang.String"
itemvalue=
"android.support.annotation.NonNull"
/>
<item
index=
"4"
class=
"java.lang.String"
itemvalue=
"androidx.annotation.NonNull"
/>
<item
index=
"5"
class=
"java.lang.String"
itemvalue=
"androidx.annotation.RecentlyNonNull"
/>
</list>
</value>
</option>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
7
"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
8
"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
.idea/vcs.xml
View file @
baed0766
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"
$PROJECT_DIR$
"
vcs=
"Git"
/>
<mapping
directory=
""
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
print/src/main/java/com/miya/print/IPrinter.java
0 → 100644
View file @
baed0766
package
com
.
miya
.
print
;
/**
* 标准打印接口
*
* @author pupu
* @time 2018/12/17
*/
public
interface
IPrinter
{
}
weighing/src/main/java/com/miya
/utils/CpuUtils.java
→
print/src/main/java/com/miya/print
/utils/CpuUtils.java
View file @
baed0766
package
com
.
miya
.
utils
;
package
com
.
miya
.
print
.
utils
;
import
android.os.Build
;
...
...
print/src/main/java/com/miya/print/utils/D.java
0 → 100644
View file @
baed0766
package
com
.
miya
.
print
.
utils
;
import
com.miya.print.BuildConfig
;
public
class
D
{
private
static
final
String
Tag
=
"HHVerify"
;
public
static
void
log
(
String
text
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
v
(
Tag
,
"-----:"
+
text
);
}
}
public
static
void
v
(
String
tag
,
String
msg
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
v
(
tag
,
msg
);
}
}
public
static
void
v
(
String
tag
,
String
msg
,
Throwable
tr
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
v
(
tag
,
msg
,
tr
);
}
}
public
static
void
d
(
String
tag
,
String
msg
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
d
(
tag
,
msg
);
}
}
public
static
void
d
(
String
tag
,
String
msg
,
Throwable
tr
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
d
(
tag
,
msg
,
tr
);
}
}
public
static
void
i
(
String
tag
,
String
msg
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
i
(
tag
,
msg
);
}
}
public
static
void
i
(
String
tag
,
String
msg
,
Throwable
tr
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
i
(
tag
,
msg
,
tr
);
}
}
public
static
void
w
(
String
tag
,
String
msg
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
w
(
tag
,
msg
);
}
}
public
static
void
w
(
String
tag
,
String
msg
,
Throwable
tr
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
w
(
tag
,
msg
,
tr
);
}
}
public
static
void
w
(
String
tag
,
Throwable
tr
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
w
(
tag
,
tr
);
}
}
public
static
void
e
(
String
tag
,
String
msg
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
e
(
tag
,
msg
);
}
}
public
static
void
e
(
String
tag
,
String
msg
,
Throwable
tr
)
{
if
(
BuildConfig
.
DEBUG
)
{
android
.
util
.
Log
.
e
(
tag
,
msg
,
tr
);
}
}
}
weighing/src/main/java/com/miya/weighing/HisenseWeighing.java
View file @
baed0766
...
...
@@ -10,7 +10,7 @@ import android.os.RemoteException;
import
com.hisense.optionalservice.aidl.OnDataReceiveListener
;
import
com.hisense.optionalservice.aidl.OptionalApi
;
import
com.hisense.optionalservice.aidl.UartScale
;
import
com.miya.utils.D
;
import
com.miya.
weighing.
utils.D
;
/**
* 海信称重实现子类
...
...
weighing/src/main/java/com/miya/weighing/YingtaiWeighing.java
View file @
baed0766
...
...
@@ -2,8 +2,8 @@ package com.miya.weighing;
import
android.content.Context
;
import
com.miya.utils.CpuUtils
;
import
com.miya.utils.D
;
import
com.miya.
weighing.
utils.CpuUtils
;
import
com.miya.
weighing.
utils.D
;
import
java.util.Timer
;
import
java.util.TimerTask
;
...
...
weighing/src/main/java/com/miya/weighing/utils/CpuUtils.java
0 → 100644
View file @
baed0766
package
com
.
miya
.
weighing
.
utils
;
import
android.os.Build
;
import
java.io.BufferedReader
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* cpu相关工具类
*
* @author pupu
* @time 2018/10/24
*/
public
class
CpuUtils
{
private
CpuUtils
()
{
throw
new
UnsupportedOperationException
(
"不允许外部创建实例"
);
}
/**
* 获取cpu支持的架构类型
*
* @return 支持的架构字符串
*/
public
static
List
<
String
>
getCpuSupportAbis
()
{
String
[]
abis
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
abis
=
Build
.
SUPPORTED_ABIS
;
}
else
{
abis
=
new
String
[]{
Build
.
CPU_ABI
,
Build
.
CPU_ABI2
};
}
List
<
String
>
list
=
new
ArrayList
<>();
for
(
String
tmp
:
abis
)
{
list
.
add
(
tmp
);
}
return
list
;
}
/**
* 是否是arm架构
*
* @return
*/
public
static
boolean
isArm
()
{
boolean
isArm
=
false
;
for
(
String
tmp
:
getCpuSupportAbis
())
{
if
(
tmp
.
contains
(
"armeabi"
))
{
//是arm架构
isArm
=
true
;
break
;
}
}
return
isArm
;
}
/**
* 是否是x86架构
*
* @return
*/
public
static
boolean
isX86
()
{
boolean
isX86
=
false
;
for
(
String
tmp
:
getCpuSupportAbis
())
{
if
(
tmp
.
contains
(
"x86"
))
{
isX86
=
true
;
break
;
}
}
return
isX86
;
}
/**
* [获取cpu类型和架构]
*
* @return 三个参数类型的数组,第一个参数标识是不是ARM架构,第二个参数标识是V6还是V7架构,第三个参数标识是不是neon指令集
*/
public
static
Object
[]
getCpuArchitecture
()
{
Object
[]
mArmArchitecture
=
new
Object
[
3
];
// if ((Integer) mArmArchitecture[1] != -1) {
// return mArmArchitecture;
// }
try
{
InputStream
is
=
new
FileInputStream
(
"/proc/cpuinfo"
);
InputStreamReader
ir
=
new
InputStreamReader
(
is
);
BufferedReader
br
=
new
BufferedReader
(
ir
);
try
{
String
nameProcessor
=
"Processor"
;
String
nameFeatures
=
"Features"
;
String
nameModel
=
"model name"
;
String
nameCpuFamily
=
"cpu family"
;
while
(
true
)
{
String
line
=
br
.
readLine
();
String
[]
pair
=
null
;
if
(
line
==
null
)
{
break
;
}
pair
=
line
.
split
(
":"
);
if
(
pair
.
length
!=
2
)
continue
;
String
key
=
pair
[
0
].
trim
();
String
val
=
pair
[
1
].
trim
();
if
(
key
.
compareTo
(
nameProcessor
)
==
0
)
{
String
n
=
""
;
for
(
int
i
=
val
.
indexOf
(
"ARMv"
)
+
4
;
i
<
val
.
length
();
i
++)
{
String
temp
=
val
.
charAt
(
i
)
+
""
;
if
(
temp
.
matches
(
"\\d"
))
{
n
+=
temp
;
}
else
{
break
;
}
}
mArmArchitecture
[
0
]
=
"ARM"
;
mArmArchitecture
[
1
]
=
Integer
.
parseInt
(
n
);
continue
;
}
if
(
key
.
compareToIgnoreCase
(
nameFeatures
)
==
0
)
{
if
(
val
.
contains
(
"neon"
))
{
mArmArchitecture
[
2
]
=
"neon"
;
}
continue
;
}
if
(
key
.
compareToIgnoreCase
(
nameModel
)
==
0
)
{
if
(
val
.
contains
(
"Intel"
))
{
mArmArchitecture
[
0
]
=
"INTEL"
;
mArmArchitecture
[
2
]
=
"atom"
;
}
continue
;
}
if
(
key
.
compareToIgnoreCase
(
nameCpuFamily
)
==
0
)
{
mArmArchitecture
[
1
]
=
Integer
.
parseInt
(
val
);
continue
;
}
}
}
finally
{
br
.
close
();
ir
.
close
();
is
.
close
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
mArmArchitecture
;
}
}
weighing/src/main/java/com/miya/utils/D.java
→
weighing/src/main/java/com/miya/
weighing/
utils/D.java
View file @
baed0766
package
com
.
miya
.
utils
;
package
com
.
miya
.
weighing
.
utils
;
import
com.miya.weighing.BuildConfig
;
...
...
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