Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
Widget
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Android Widget
Widget
Commits
f472763d
Commit
f472763d
authored
Dec 16, 2022
by
tongzifang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加默认brand和model
parent
f323e3dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
8 deletions
+32
-8
build.gradle
zqtoolkit/build.gradle
+1
-1
ScaleHub.kt
zqtoolkit/src/main/java/com/qmai/zqtoolkit/ScaleHub.kt
+5
-4
ScaleBaseKit.kt
...c/main/java/com/qmai/zqtoolkit/base/scale/ScaleBaseKit.kt
+3
-3
QmScaleBrand.kt
...t/src/main/java/com/qmai/zqtoolkit/config/QmScaleBrand.kt
+23
-0
No files found.
zqtoolkit/build.gradle
View file @
f472763d
...
@@ -30,7 +30,7 @@ android {
...
@@ -30,7 +30,7 @@ android {
}
}
}
}
group
'com.qmai.android.zqtoolkit'
group
'com.qmai.android.zqtoolkit'
version
'1.2.6'
version
'1.2.6
.2
'
gradlePublish
{
gradlePublish
{
...
...
zqtoolkit/src/main/java/com/qmai/zqtoolkit/ScaleHub.kt
View file @
f472763d
...
@@ -78,6 +78,11 @@ object ScaleHub : ScaleBaseAction {
...
@@ -78,6 +78,11 @@ object ScaleHub : ScaleBaseAction {
else
->
null
else
->
null
}
}
}
}
//通过tryInitSDK连接的,如果没有指定brand和model,赋一个默认的,若连接成功会被保存
if
(
scaleKit
!=
null
&&
(
scale
.
brand
==
null
||
scale
.
model
==
null
))
{
scale
.
brand
=
QmScaleBrand
.
find
(
scaleKit
)
scale
.
model
=
QmScaleModel
.
find
(
scaleKit
)
}
}
}
}
}
...
@@ -86,10 +91,6 @@ object ScaleHub : ScaleBaseAction {
...
@@ -86,10 +91,6 @@ object ScaleHub : ScaleBaseAction {
SHOP_ASSITANT_2C
->
tryInitSDK2C
()
SHOP_ASSITANT_2C
->
tryInitSDK2C
()
SHOP_ASSITANT_2B
->
tryInitSDK
(
scale
)
SHOP_ASSITANT_2B
->
tryInitSDK
(
scale
)
}
}
// //称只给连一个端口,其他端口用其他hub
// if (isScaleSuccess()) {
// return
// }
scaleKit
?.
run
{
scaleKit
?.
run
{
if
(
connectJob
==
null
)
{
if
(
connectJob
==
null
)
{
connectJob
=
CoroutineScope
(
EmptyCoroutineContext
)
connectJob
=
CoroutineScope
(
EmptyCoroutineContext
)
...
...
zqtoolkit/src/main/java/com/qmai/zqtoolkit/base/scale/ScaleBaseKit.kt
View file @
f472763d
...
@@ -27,14 +27,14 @@ abstract class ScaleBaseKit : ScaleBaseAction, ScaleUpdateAction {
...
@@ -27,14 +27,14 @@ abstract class ScaleBaseKit : ScaleBaseAction, ScaleUpdateAction {
var
lastTryScale
:
ScaleInfo
?
=
null
var
lastTryScale
:
ScaleInfo
?
=
null
private
var
lastConnectScale
:
ScaleInfo
?
=
null
private
var
lastConnectScale
:
ScaleInfo
?
=
null
val
_connectState
=
MutableSharedFlow
<
ConnectState
>()
private
val
_connectState
=
MutableSharedFlow
<
ConnectState
>()
val
connectState
:
SharedFlow
<
ConnectState
>
=
_connectState
val
connectState
:
SharedFlow
<
ConnectState
>
=
_connectState
val
_livingWeight
=
MutableSharedFlow
<
LivingWeight
>()
private
val
_livingWeight
=
MutableSharedFlow
<
LivingWeight
>()
val
livingWeight
:
SharedFlow
<
LivingWeight
>
=
_livingWeight
val
livingWeight
:
SharedFlow
<
LivingWeight
>
=
_livingWeight
val
_scaleLog
=
MutableSharedFlow
<
String
>()
private
val
_scaleLog
=
MutableSharedFlow
<
String
>()
val
scaleLog
:
SharedFlow
<
String
>
=
_scaleLog
val
scaleLog
:
SharedFlow
<
String
>
=
_scaleLog
private
var
stableWeight
=
mutableListOf
<
LivingWeight
>()
private
var
stableWeight
=
mutableListOf
<
LivingWeight
>()
...
...
zqtoolkit/src/main/java/com/qmai/zqtoolkit/config/QmScaleBrand.kt
View file @
f472763d
package
com.qmai.zqtoolkit.config
package
com.qmai.zqtoolkit.config
import
com.qmai.zqtoolkit.base.AclasScaleKit
import
com.qmai.zqtoolkit.base.SunmiScaleKit
import
com.qmai.zqtoolkit.base.ZqScaleKit
import
com.qmai.zqtoolkit.base.scale.ScaleBaseKit
/**
/**
* tongzi
* tongzi
* 2022/5/26
* 2022/5/26
...
@@ -13,6 +18,14 @@ enum class QmScaleBrand(
...
@@ -13,6 +18,14 @@ enum class QmScaleBrand(
fun
list
():
List
<
QmScaleBrandValue
>
{
fun
list
():
List
<
QmScaleBrandValue
>
{
return
values
().
map
{
QmScaleBrandValue
(
it
)
}
return
values
().
map
{
QmScaleBrandValue
(
it
)
}
}
}
fun
find
(
kit
:
ScaleBaseKit
?):
QmScaleBrandValue
?
{
return
when
(
kit
)
{
ZqScaleKit
->
QmScaleBrandValue
(
ZQEB
)
AclasScaleKit
->
QmScaleBrandValue
(
ACLAS
)
SunmiScaleKit
->
QmScaleBrandValue
(
SUNMI
)
else
->
null
}
}
}
}
}
}
...
@@ -41,6 +54,16 @@ enum class QmScaleModel(
...
@@ -41,6 +54,16 @@ enum class QmScaleModel(
QmScaleModelValue
(
it
)
QmScaleModelValue
(
it
)
}
}
}
}
fun
find
(
kit
:
ScaleBaseKit
?):
QmScaleModelValue
?
{
return
when
(
kit
)
{
ZqScaleKit
->
QmScaleModelValue
(
DEFAULT_ZQ
)
AclasScaleKit
->
QmScaleModelValue
(
DEFAULT_ACLAS
)
SunmiScaleKit
->
QmScaleModelValue
(
DEFAULT_SUNMI
)
else
->
null
}
}
}
}
}
}
...
...
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