Commit a076d201 by 王宇航

1.8.1

增加一些日誌
parent 27d4fdec
...@@ -55,7 +55,7 @@ afterEvaluate { ...@@ -55,7 +55,7 @@ afterEvaluate {
groupId = "com.gingersoft.connect" groupId = "com.gingersoft.connect"
artifactId = "Connect" artifactId = "Connect"
version = "1.8.0" version = "1.8.1"
// 添加 POM 配置 // 添加 POM 配置
// pom { // pom {
// name.set("GingerSoftConnect") // name.set("GingerSoftConnect")
......
package com.gingersoft.connect.utils package com.gingersoft.connect.utils
import android.util.Log
import com.gingersoft.connect.bean.MessageBean import com.gingersoft.connect.bean.MessageBean
import com.gingersoft.connect.bean.SocketCallbackBean import com.gingersoft.connect.bean.SocketCallbackBean
...@@ -12,7 +13,9 @@ object MsgParser { ...@@ -12,7 +13,9 @@ object MsgParser {
suspend fun process(msgBean: MessageBean?): SocketCallbackBean? { suspend fun process(msgBean: MessageBean?): SocketCallbackBean? {
return if (msgBean != null) { return if (msgBean != null) {
Log.e("MyWebSocketServer", "開始處理消息:${parserMap.keys},${msgBean.action}")
val result = parserMap[msgBean.action.toString()]?.processMsg(msgBean.data) val result = parserMap[msgBean.action.toString()]?.processMsg(msgBean.data)
Log.e("MyWebSocketServer", "消息處理結果:$result")
if (result != null) { if (result != null) {
SocketCallbackBean( SocketCallbackBean(
result.success, result.success,
......
...@@ -32,13 +32,12 @@ class MyWebSocketServer(address: InetSocketAddress) : ...@@ -32,13 +32,12 @@ class MyWebSocketServer(address: InetSocketAddress) :
// 有KDS主動獲取食品、沽清信息接口 // 有KDS主動獲取食品、沽清信息接口
// RicePOS收到KDS要獲取食品的消息後,發送本地食品信息過去 // RicePOS收到KDS要獲取食品的消息後,發送本地食品信息過去
message?.let { message?.let {
Log.e(TAG, "創建協程")
val msg = GsonUtils.GsonToBean(message, MessageBean::class.java) val msg = GsonUtils.GsonToBean(message, MessageBean::class.java)
// 创建一个协程作用域 // 创建一个协程作用域
val scope = CoroutineScope(Dispatchers.IO) val scope = CoroutineScope(Dispatchers.IO)
// 在协程作用域中异步处理消息 // 在协程作用域中异步处理消息
scope.launch { scope.launch {
Log.e(TAG, "開始處理消息") Log.e(TAG, "開始處理消息:$msg")
MsgParser.process(msg)?.let { MsgParser.process(msg)?.let {
val gsonString = GsonUtils.GsonString(it) val gsonString = GsonUtils.GsonString(it)
Log.e(TAG, "處理結果:$gsonString") Log.e(TAG, "處理結果:$gsonString")
......
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