Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GingerSoftLANInterconnection
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
GingerSoftLANInterconnection
Commits
a076d201
Commit
a076d201
authored
Nov 02, 2024
by
王宇航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.8.1
增加一些日誌
parent
27d4fdec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
mylibrary/build.gradle.kts
+1
-1
mylibrary/src/main/java/com/gingersoft/connect/utils/MsgParser.kt
+3
-0
mylibrary/src/main/java/com/gingersoft/connect/utils/MyWebSocketServer.kt
+1
-2
No files found.
mylibrary/build.gradle.kts
View file @
a076d201
...
...
@@ -55,7 +55,7 @@ afterEvaluate {
groupId = "com.gingersoft.connect"
artifactId = "Connect"
version = "1.8.
0
"
version = "1.8.
1
"
// 添加 POM 配置
// pom {
// name.set("GingerSoftConnect")
...
...
mylibrary/src/main/java/com/gingersoft/connect/utils/MsgParser.kt
View file @
a076d201
package
com.gingersoft.connect.utils
import
android.util.Log
import
com.gingersoft.connect.bean.MessageBean
import
com.gingersoft.connect.bean.SocketCallbackBean
...
...
@@ -12,7 +13,9 @@ object MsgParser {
suspend
fun
process
(
msgBean
:
MessageBean
?):
SocketCallbackBean
?
{
return
if
(
msgBean
!=
null
)
{
Log
.
e
(
"MyWebSocketServer"
,
"開始處理消息:${parserMap.keys},${msgBean.action}"
)
val
result
=
parserMap
[
msgBean
.
action
.
toString
()]
?.
processMsg
(
msgBean
.
data
)
Log
.
e
(
"MyWebSocketServer"
,
"消息處理結果:$result"
)
if
(
result
!=
null
)
{
SocketCallbackBean
(
result
.
success
,
...
...
mylibrary/src/main/java/com/gingersoft/connect/utils/MyWebSocketServer.kt
View file @
a076d201
...
...
@@ -32,13 +32,12 @@ class MyWebSocketServer(address: InetSocketAddress) :
// 有KDS主動獲取食品、沽清信息接口
// RicePOS收到KDS要獲取食品的消息後,發送本地食品信息過去
message
?.
let
{
Log
.
e
(
TAG
,
"創建協程"
)
val
msg
=
GsonUtils
.
GsonToBean
(
message
,
MessageBean
::
class
.
java
)
// 创建一个协程作用域
val
scope
=
CoroutineScope
(
Dispatchers
.
IO
)
// 在协程作用域中异步处理消息
scope
.
launch
{
Log
.
e
(
TAG
,
"開始處理消息"
)
Log
.
e
(
TAG
,
"開始處理消息
:$msg
"
)
MsgParser
.
process
(
msg
)
?.
let
{
val
gsonString
=
GsonUtils
.
GsonString
(
it
)
Log
.
e
(
TAG
,
"處理結果:$gsonString"
)
...
...
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