Commit eca48e12 authored by tongzifang's avatar tongzifang

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	tools/build.gradle
#	zqtoolkit/build.gradle
#	zqtoolkit/src/main/java/com/qmai/zqtoolkit/ScaleHub.kt
parents fdd59633 6867a6ba
...@@ -4,7 +4,7 @@ buildscript { ...@@ -4,7 +4,7 @@ buildscript {
ext.kotlin_version = '1.4.20' ext.kotlin_version = '1.4.20'
ext.lintVersion = '26.5.0' ext.lintVersion = '26.5.0'
ext.lifecycle_version = "2.2.5" ext.lifecycle_version = "2.2.5"
ext.widgetlib_version = "1.1.33-SNAPSHOT" ext.widgetlib_version = "1.0.2"
repositories { repositories {
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }// 阿里云镜像 maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }// 阿里云镜像
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
......
...@@ -63,7 +63,7 @@ repositories { ...@@ -63,7 +63,7 @@ repositories {
mavenCentral() mavenCentral()
} }
group 'com.qmai.android.fetch' group 'com.qmai.android.fetch'
version '1.2.62-SNAPSHOT' version '1.0.2'
gradlePublish { gradlePublish {
......
...@@ -16,17 +16,16 @@ ...@@ -16,17 +16,16 @@
package com.qimai.android.fetch.callAdapter package com.qimai.android.fetch.callAdapter
import android.util.Log import android.util.Log
import com.google.gson.Gson
import com.qimai.android.fetch.convert.BizException import com.qimai.android.fetch.convert.BizException
import com.qimai.android.fetch.convert.GsonParseErrorException import com.qimai.android.fetch.convert.GsonParseErrorException
import com.qimai.android.fetch.convert.ServerResponseException import com.qimai.android.fetch.convert.ServerResponseException
import com.qimai.android.fetch.interceptors.GsonParseError import com.qimai.android.fetch.interceptors.GsonParseError
import com.qimai.android.fetch.interceptors.ServerError import com.qimai.android.fetch.interceptors.ServerError
import com.qimai.android.fetch.tool.GsonUtils
import okhttp3.Headers import okhttp3.Headers
import okhttp3.MediaType import okhttp3.MediaType
import okhttp3.Request import okhttp3.Request
import okhttp3.logging.HttpLoggingInterceptor import okio.Buffer
import okio.Buffer
import retrofit2.* import retrofit2.*
import java.io.EOFException import java.io.EOFException
import java.lang.reflect.ParameterizedType import java.lang.reflect.ParameterizedType
...@@ -107,7 +106,6 @@ class KotlinCoroutinesCallAdapterFactory( ...@@ -107,7 +106,6 @@ class KotlinCoroutinesCallAdapterFactory(
override fun enqueue(callback: Callback<T>) { override fun enqueue(callback: Callback<T>) {
Log.d(TAG, "enqueue11111: ")
delegate.enqueue(object : Callback<T> { delegate.enqueue(object : Callback<T> {
override fun onResponse(call: Call<T>, response: Response<T>) { override fun onResponse(call: Call<T>, response: Response<T>) {
//获取请求信息 //获取请求信息
...@@ -117,13 +115,12 @@ class KotlinCoroutinesCallAdapterFactory( ...@@ -117,13 +115,12 @@ class KotlinCoroutinesCallAdapterFactory(
//响应信息 //响应信息
val body = response.body() val body = response.body()
val gson = Gson() val responseInfo = GsonUtils.toJson(body)
val responseInfo = gson.toJson(body)
val requestMessage = getRequestInfo(request) val requestMessage = getRequestInfo(request)
successResponseInfo?.invoke(requestUrl, requestMessage, responseInfo) successResponseInfo?.invoke(requestUrl, requestMessage, responseInfo)
} catch (e: Exception) { } catch (e: Exception) {
Log.d(TAG, "onResponse: e= $e") // Log.d(TAG, "onResponse: e= $e")
} }
callback.onResponse(call, response) callback.onResponse(call, response)
...@@ -132,7 +129,6 @@ class KotlinCoroutinesCallAdapterFactory( ...@@ -132,7 +129,6 @@ class KotlinCoroutinesCallAdapterFactory(
override fun onFailure(call: Call<T>, t: Throwable) { override fun onFailure(call: Call<T>, t: Throwable) {
callback.onFailure(call, t) callback.onFailure(call, t)
val gson = Gson()
val request = call.request() val request = call.request()
val requestStartMessage = val requestStartMessage =
RequestInfoBean( RequestInfoBean(
...@@ -146,7 +142,7 @@ class KotlinCoroutinesCallAdapterFactory( ...@@ -146,7 +142,7 @@ class KotlinCoroutinesCallAdapterFactory(
serverError?.apply { serverError?.apply {
this.serverError(request.url().toString(), this.serverError(request.url().toString(),
"${t.message}", "${t.message}",
gson.toJson(requestStartMessage), GsonUtils.toJson(requestStartMessage),
t.responseMsg t.responseMsg
) )
} }
...@@ -156,7 +152,7 @@ class KotlinCoroutinesCallAdapterFactory( ...@@ -156,7 +152,7 @@ class KotlinCoroutinesCallAdapterFactory(
gsonParseError?.apply { gsonParseError?.apply {
this.parseError(request.url().toString(), this.parseError(request.url().toString(),
"${t.message}", "${t.message}",
gson.toJson(requestStartMessage), GsonUtils.toJson(requestStartMessage),
t.responseMsg t.responseMsg
) )
} }
...@@ -164,7 +160,7 @@ class KotlinCoroutinesCallAdapterFactory( ...@@ -164,7 +160,7 @@ class KotlinCoroutinesCallAdapterFactory(
serverError?.apply { serverError?.apply {
this.serverError(request.url().toString(), this.serverError(request.url().toString(),
"${t.message}", "${t.message}",
gson.toJson(requestStartMessage), GsonUtils .toJson(requestStartMessage),
t.responseMsg t.responseMsg
) )
} }
......
...@@ -63,7 +63,9 @@ class OkHttpConfig private constructor(builder: Builder) { ...@@ -63,7 +63,9 @@ class OkHttpConfig private constructor(builder: Builder) {
private var defaultCachePath: String? = null private var defaultCachePath: String? = null
private val defaultTimeout: Long = 10 private val defaultTimeout: Long = 10
fun clientBuilderSettings(config:(OkHttpClient.Builder)->Unit) = apply{
config.invoke(okHttpClientBuilder)
}
fun headers(buildHeadersListener: HeaderConfig) = apply { fun headers(buildHeadersListener: HeaderConfig) = apply {
this.buildHeadersListener = buildHeadersListener this.buildHeadersListener = buildHeadersListener
} }
......
...@@ -19,7 +19,10 @@ import kotlinx.coroutines.flow.* ...@@ -19,7 +19,10 @@ import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import retrofit2.HttpException import retrofit2.HttpException
import java.net.ConnectException import java.net.ConnectException
import java.net.SocketException
import java.net.SocketTimeoutException
import java.net.UnknownHostException import java.net.UnknownHostException
import javax.net.ssl.SSLHandshakeException
/** /**
* created by wangwei ON 2019-09-06 email:wangwei_5521@163.com * created by wangwei ON 2019-09-06 email:wangwei_5521@163.com
...@@ -118,7 +121,13 @@ fun <T> handleResponseError(throwable: Throwable?): Resource<T> { ...@@ -118,7 +121,13 @@ fun <T> handleResponseError(throwable: Throwable?): Resource<T> {
ErrorData(throwable.code.toString(),errorMsg= throwable.message,originThrowable = throwable) ErrorData(throwable.code.toString(),errorMsg= throwable.message,originThrowable = throwable)
) )
is UnknownHostException -> is UnknownHostException ->
Resource.error("当前网络状态不稳定,请检查当前网络", ErrorData(originThrowable = throwable))
is SSLHandshakeException ->
Resource.error("当前网络状态不稳定,请检查当前网络", ErrorData(originThrowable = throwable))
is SocketTimeoutException ->
Resource.error("当前网络状态不稳定,请检查当前网络", ErrorData(originThrowable = throwable))
is SocketException ->
Resource.error("当前网络状态不稳定,请检查当前网络", ErrorData(originThrowable = throwable)) Resource.error("当前网络状态不稳定,请检查当前网络", ErrorData(originThrowable = throwable))
else -> { else -> {
if (!TextUtils.isEmpty(throwable.message)) { if (!TextUtils.isEmpty(throwable.message)) {
......
package com.qimai.android.fetch.tool;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import java.io.Reader;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import androidx.annotation.NonNull;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2018/04/05
* desc : utils about gson
* </pre>
*/
public final class GsonUtils {
private static final String KEY_DEFAULT = "defaultGson";
private static final String KEY_DELEGATE = "delegateGson";
private static final String KEY_LOG_UTILS = "logUtilsGson";
private static final Map<String, Gson> GSONS = new ConcurrentHashMap<>();
private GsonUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/**
* Set the delegate of {@link Gson}.
*
* @param delegate The delegate of {@link Gson}.
*/
public static void setGsonDelegate(Gson delegate) {
if (delegate == null) return;
GSONS.put(KEY_DELEGATE, delegate);
}
/**
* Set the {@link Gson} with key.
*
* @param key The key.
* @param gson The {@link Gson}.
*/
public static void setGson(final String key, final Gson gson) {
if (TextUtils.isEmpty(key) || gson == null) return;
GSONS.put(key, gson);
}
/**
* Return the {@link Gson} with key.
*
* @param key The key.
* @return the {@link Gson} with key
*/
public static Gson getGson(final String key) {
return GSONS.get(key);
}
public static Gson getGson() {
Gson gsonDelegate = GSONS.get(KEY_DELEGATE);
if (gsonDelegate != null) {
return gsonDelegate;
}
Gson gsonDefault = GSONS.get(KEY_DEFAULT);
if (gsonDefault == null) {
gsonDefault = createGson();
GSONS.put(KEY_DEFAULT, gsonDefault);
}
return gsonDefault;
}
/**
* Serializes an object into json.
*
* @param object The object to serialize.
* @return object serialized into json.
*/
public static String toJson(final Object object) {
return toJson(getGson(), object);
}
/**
* Serializes an object into json.
*
* @param src The object to serialize.
* @param typeOfSrc The specific genericized type of src.
* @return object serialized into json.
*/
public static String toJson(final Object src, @NonNull final Type typeOfSrc) {
return toJson(getGson(), src, typeOfSrc);
}
/**
* Serializes an object into json.
*
* @param gson The gson.
* @param object The object to serialize.
* @return object serialized into json.
*/
public static String toJson(@NonNull final Gson gson, final Object object) {
return gson.toJson(object);
}
/**
* Serializes an object into json.
*
* @param gson The gson.
* @param src The object to serialize.
* @param typeOfSrc The specific genericized type of src.
* @return object serialized into json.
*/
public static String toJson(@NonNull final Gson gson, final Object src, @NonNull final Type typeOfSrc) {
return gson.toJson(src, typeOfSrc);
}
/**
* Converts {@link String} to given type.
*
* @param json The json to convert.
* @param type Type json will be converted to.
* @return instance of type
*/
public static <T> T fromJson(final String json, @NonNull final Class<T> type) {
return fromJson(getGson(), json, type);
}
/**
* Converts {@link String} to given type.
*
* @param json the json to convert.
* @param type type type json will be converted to.
* @return instance of type
*/
public static <T> T fromJson(final String json, @NonNull final Type type) {
return fromJson(getGson(), json, type);
}
/**
* Converts {@link Reader} to given type.
*
* @param reader the reader to convert.
* @param type type type json will be converted to.
* @return instance of type
*/
public static <T> T fromJson(@NonNull final Reader reader, @NonNull final Class<T> type) {
return fromJson(getGson(), reader, type);
}
/**
* Converts {@link Reader} to given type.
*
* @param reader the reader to convert.
* @param type type type json will be converted to.
* @return instance of type
*/
public static <T> T fromJson(@NonNull final Reader reader, @NonNull final Type type) {
return fromJson(getGson(), reader, type);
}
/**
* Converts {@link String} to given type.
*
* @param gson The gson.
* @param json The json to convert.
* @param type Type json will be converted to.
* @return instance of type
*/
public static <T> T fromJson(@NonNull final Gson gson, final String json, @NonNull final Class<T> type) {
return gson.fromJson(json, type);
}
/**
* Converts {@link String} to given type.
*
* @param gson The gson.
* @param json the json to convert.
* @param type type type json will be converted to.
* @return instance of type
*/
public static <T> T fromJson(@NonNull final Gson gson, final String json, @NonNull final Type type) {
return gson.fromJson(json, type);
}
/**
* Converts {@link Reader} to given type.
*
* @param gson The gson.
* @param reader the reader to convert.
* @param type type type json will be converted to.
* @return instance of type
*/
public static <T> T fromJson(@NonNull final Gson gson, final Reader reader, @NonNull final Class<T> type) {
return gson.fromJson(reader, type);
}
/**
* Converts {@link Reader} to given type.
*
* @param gson The gson.
* @param reader the reader to convert.
* @param type type type json will be converted to.
* @return instance of type
*/
public static <T> T fromJson(@NonNull final Gson gson, final Reader reader, @NonNull final Type type) {
return gson.fromJson(reader, type);
}
/**
* Return the type of {@link List} with the {@code type}.
*
* @param type The type.
* @return the type of {@link List} with the {@code type}
*/
public static Type getListType(@NonNull final Type type) {
return TypeToken.getParameterized(List.class, type).getType();
}
/**
* Return the type of {@link Set} with the {@code type}.
*
* @param type The type.
* @return the type of {@link Set} with the {@code type}
*/
public static Type getSetType(@NonNull final Type type) {
return TypeToken.getParameterized(Set.class, type).getType();
}
/**
* Return the type of map with the {@code keyType} and {@code valueType}.
*
* @param keyType The type of key.
* @param valueType The type of value.
* @return the type of map with the {@code keyType} and {@code valueType}
*/
public static Type getMapType(@NonNull final Type keyType, @NonNull final Type valueType) {
return TypeToken.getParameterized(Map.class, keyType, valueType).getType();
}
/**
* Return the type of array with the {@code type}.
*
* @param type The type.
* @return the type of map with the {@code type}
*/
public static Type getArrayType(@NonNull final Type type) {
return TypeToken.getArray(type).getType();
}
/**
* Return the type of {@code rawType} with the {@code typeArguments}.
*
* @param rawType The raw type.
* @param typeArguments The type of arguments.
* @return the type of map with the {@code type}
*/
public static Type getType(@NonNull final Type rawType, @NonNull final Type... typeArguments) {
return TypeToken.getParameterized(rawType, typeArguments).getType();
}
static Gson getGson4LogUtils() {
Gson gson4LogUtils = GSONS.get(KEY_LOG_UTILS);
if (gson4LogUtils == null) {
gson4LogUtils = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
GSONS.put(KEY_LOG_UTILS, gson4LogUtils);
}
return gson4LogUtils;
}
private static Gson createGson() {
return new GsonBuilder().serializeNulls().disableHtmlEscaping().create();
}
}
...@@ -39,7 +39,7 @@ dependencies { ...@@ -39,7 +39,7 @@ dependencies {
implementation project(path: ':tools') implementation project(path: ':tools')
implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.github.ybq:Android-SpinKit:1.4.0' implementation 'com.github.ybq:Android-SpinKit:1.4.0'
api 'com.blankj:utilcodex:1.30.6' api 'com.blankj:utilcodex:1.31.1'
// implementation 'com.qmai.android.tools:tools:1.1.1-SNAPSHOT' // implementation 'com.qmai.android.tools:tools:1.1.1-SNAPSHOT'
...@@ -50,7 +50,7 @@ repositories { ...@@ -50,7 +50,7 @@ repositories {
group 'com.qmai.android.sdk' group 'com.qmai.android.sdk'
version '1.1.37-SNAPSHOT' version '1.0.2'
gradlePublish { gradlePublish {
......
package com.qmai.zqtoolkit package com.qmai.zqtoolkit
import android.content.Context import android.content.Context
import android.os.Build
import com.qmai.zqtoolkit.base.AclasScaleKit import com.qmai.zqtoolkit.base.AclasScaleKit
import com.qmai.zqtoolkit.base.GiLongScaleKit
import com.qmai.zqtoolkit.base.SunmiScaleKit import com.qmai.zqtoolkit.base.SunmiScaleKit
import com.qmai.zqtoolkit.base.ZqScaleKit import com.qmai.zqtoolkit.base.ZqScaleKit
import com.qmai.zqtoolkit.base.scale.ScaleBaseAction import com.qmai.zqtoolkit.base.scale.ScaleBaseAction
...@@ -15,6 +17,7 @@ import kotlinx.coroutines.flow.MutableSharedFlow ...@@ -15,6 +17,7 @@ import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.util.*
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
/** /**
...@@ -41,6 +44,7 @@ object ScaleHub : ScaleBaseAction { ...@@ -41,6 +44,7 @@ object ScaleHub : ScaleBaseAction {
QmScaleBrand.ZQEB.brand -> ZqScaleKit QmScaleBrand.ZQEB.brand -> ZqScaleKit
QmScaleBrand.SUNMI.brand -> SunmiScaleKit QmScaleBrand.SUNMI.brand -> SunmiScaleKit
QmScaleBrand.ACLAS.brand -> AclasScaleKit QmScaleBrand.ACLAS.brand -> AclasScaleKit
QmScaleBrand.GILONG.brand -> GiLongScaleKit
else -> null else -> null
} }
} }
...@@ -64,6 +68,7 @@ object ScaleHub : ScaleBaseAction { ...@@ -64,6 +68,7 @@ object ScaleHub : ScaleBaseAction {
QmScaleBrand.ZQEB.brand -> ZqScaleKit QmScaleBrand.ZQEB.brand -> ZqScaleKit
QmScaleBrand.SUNMI.brand -> SunmiScaleKit QmScaleBrand.SUNMI.brand -> SunmiScaleKit
QmScaleBrand.ACLAS.brand -> AclasScaleKit QmScaleBrand.ACLAS.brand -> AclasScaleKit
QmScaleBrand.GILONG.brand -> GiLongScaleKit
else -> when { else -> when {
ScaleChecker.isSUNMI_S2CC() -> SunmiScaleKit ScaleChecker.isSUNMI_S2CC() -> SunmiScaleKit
ScaleChecker.isAclas() -> AclasScaleKit ScaleChecker.isAclas() -> AclasScaleKit
...@@ -90,6 +95,10 @@ object ScaleHub : ScaleBaseAction { ...@@ -90,6 +95,10 @@ object ScaleHub : ScaleBaseAction {
scale.run { scale.run {
port = if (scale.appType == SHOP_ASSITANT_2B && ScaleChecker.isSUNMI()) port = if (scale.appType == SHOP_ASSITANT_2B && ScaleChecker.isSUNMI())
SunmiPort.find() SunmiPort.find()
//如果是GILONG (巨隆)
else if (Build.MODEL=="rk3288"){
"ttyS1"
}
else "ttyS4" else "ttyS4"
buad = "9600" buad = "9600"
} }
......
package com.qmai.zqtoolkit.base
import android.content.Context
import android.util.Log
import com.blankj.utilcode.util.GsonUtils
import com.blankj.utilcode.util.TimeUtils
import com.example.scaler.AclasScaler
import com.example.scaler.AclasScaler.AclasScalerListener
import com.qmai.zqtoolkit.ConnectState
import com.qmai.zqtoolkit.LivingWeight
import com.qmai.zqtoolkit.ScaleInfo
import com.qmai.zqtoolkit.base.scale.ScaleBaseKit
import com.qmai.zqtoolkit.config.QmScaleBrand
import com.qmai.zqtoolkit.utils.ScaleChecker
/**
* 巨隆秤
* 用顶尖的sdk 串口连接方式
*/
object GiLongScaleKit : ScaleBaseKit() {
override val TAG: String
get() = "AclasScaleKit"
override val STABLE_COUNT: Int
get() = 4
override val CONECT_CHECK_COUNT: Int
get() = 0
override val SCALE_TYPE: QmScaleBrand
get() = QmScaleBrand.GILONG
private var aclasScaler: AclasScaler? = null
private var aclasScalerListener = object : AclasScalerListener {
override fun onDisConnected() {
updateState(ConnectState(false, "打开失败"))
}
override fun onConnected() {
updateState(ConnectState(true, "打开成功"))
}
override fun onRcvData(weght: AclasScaler.WeightInfoNew?) {
Log.v(TAG, GsonUtils.toJson(weght))
// getTare()
updateWeight(
LivingWeight(
weght?.isStable ?: false, weght.toString().replace(weght?.unit ?: "", ""),
weght?.unit ?: "", weght?.tareWeight?.toString() ?: "", weght?.netWeight == null
)
)
}
override fun onError(p0: Int, p1: String?) {
Log.v(TAG, "onError:$p0$p1")
}
override fun onUpdateProcess(p0: Int, p1: Int) {
Log.v(TAG, "onUpdateProcess:$p0$p1")
}
}
override fun connect(cxt: Context?, scale: ScaleInfo) {
super.connect(cxt, scale)
if (aclasScaler == null) {
cxt?.let {
aclasScaler = AclasScaler(AclasScaler.Type_SerialPort, it, aclasScalerListener)
}
}
//val usbConnectIndex = getAclasScaleIndex()
//val usbConnectIndex = 0
val aclasConnect = aclasScaler?.AclasConnect("/dev/${scale.port}", (scale.buad?.toIntOrNull()?:9600),0)
Log.v(TAG, "aclasConnect:$aclasConnect")
}
override fun disconnect() {
super.disconnect()
aclasScaler?.AclasDisconnect()
aclasScaler = null
}
override fun readData() {
}
override fun stopReadData() {
}
override fun setZero() {
if (isScaleSuccess()) {
val aclasZero = aclasScaler?.AclasZero()
Log.v(TAG, "setZero:$aclasZero")
}
}
private fun getTare() {
if (isScaleSuccess()) {
val getTare = aclasScaler?.AclasReadTareValue()
Log.v(TAG, "getTare:$getTare")
}
}
override fun setNetWeight() {
if (isScaleSuccess()) {
val aclasTare = aclasScaler?.AclasTare()
Log.v(TAG, "setNetWeight:$aclasTare")
}
}
override fun setNetWeightByElec(tare: Double) {
if (isScaleSuccess()) {
val aclasSetPreTare = aclasScaler?.AclasSetPreTare((tare * 1000.0f).toInt())
Log.v(TAG, "setNetWeightByElec:$aclasSetPreTare")
}
}
//去除 除皮一个方法
override fun clearTare() {
if (isScaleSuccess()) {
val clearTare = aclasScaler?.AclasTare()
Log.v(TAG, "clearTare:$clearTare")
}
}
override fun getParameter(): Array<String> {
var parameter: Array<String> = arrayOf()
if (isScaleSuccess()) {
parameter[0] = aclasScaler?.AclasSDKVersion() ?: ""
parameter[1] = aclasScaler?.AclasReadVersion() ?: ""
parameter[2] = aclasScaler?.AclasReadId() ?: ""
}
return parameter
}
override fun isScaleSuccess(): Boolean {
return super.isScaleSuccess() && aclasScaler?.AclasIsConnect() == true
}
private fun getAclasScaleIndex(): Int {
var usbIndex = 0
var aclasPname = ScaleChecker.getAclasPname()
if (aclasPname.isNotEmpty()) {
var comList = mutableListOf<String>()
aclasScaler?.getCommList(comList)
if (!comList.isNullOrEmpty()) {
usbIndex = comList.indexOfFirst { name -> name.contains(aclasPname) }
return usbIndex
}
}
return usbIndex
}
}
\ No newline at end of file
...@@ -12,8 +12,7 @@ import com.qmai.zqtoolkit.base.scale.ScaleBaseKit ...@@ -12,8 +12,7 @@ import com.qmai.zqtoolkit.base.scale.ScaleBaseKit
enum class QmScaleBrand( enum class QmScaleBrand(
val brand: String, val brand: String,
) { ) {
SUNMI("商米"), ZQEB("中崎"), ACLAS("顶尖"); SUNMI("商米"), ZQEB("中崎"), ACLAS("顶尖"),GILONG("巨隆");
companion object { companion object {
fun list(): List<QmScaleBrandValue> { fun list(): List<QmScaleBrandValue> {
return values().map { QmScaleBrandValue(it) } return values().map { QmScaleBrandValue(it) }
...@@ -44,8 +43,8 @@ enum class QmScaleModel( ...@@ -44,8 +43,8 @@ enum class QmScaleModel(
OX2X("OX2X", QmScaleBrand.ACLAS.brand), OX2X("OX2X", QmScaleBrand.ACLAS.brand),
PX1("PX1", QmScaleBrand.ACLAS.brand), PX1("PX1", QmScaleBrand.ACLAS.brand),
DEFAULT_SUNMI("商米通用", QmScaleBrand.SUNMI.brand), DEFAULT_SUNMI("商米通用", QmScaleBrand.SUNMI.brand),
S2_CC("S2_CC", QmScaleBrand.SUNMI.brand); S2_CC("S2_CC", QmScaleBrand.SUNMI.brand),
DEFAULT_GILONG("巨隆通用",QmScaleBrand.GILONG.brand);
companion object { companion object {
fun list(sort: QmScaleBrandValue): List<QmScaleModelValue> { fun list(sort: QmScaleBrandValue): List<QmScaleModelValue> {
return values().filter { return values().filter {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment