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
52c2fe29
Commit
52c2fe29
authored
Aug 10, 2024
by
王宇航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.6.4
用泛型會解析失敗,轉用String
parent
32862f7d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
8 deletions
+5
-8
app/src/main/java/com/example/demo/MainActivity.kt
+0
-4
mylibrary/src/main/java/com/gingersoft/connect/bean/MessageBean.kt
+3
-2
mylibrary/src/main/java/com/gingersoft/connect/bean/MessageSender.kt
+1
-1
mylibrary/src/main/java/com/gingersoft/connect/utils/MsgParser.kt
+1
-1
No files found.
app/src/main/java/com/example/demo/MainActivity.kt
View file @
52c2fe29
...
...
@@ -2,18 +2,14 @@ package com.example.demo
import
android.app.Activity
import
android.os.Bundle
import
android.util.Log
import
android.widget.TextView
import
com.example.gingersoft_connect.R
import
com.gingersoft.connect.SendCallback
import
com.gingersoft.connect.bean.Action
import
com.gingersoft.connect.bean.FoodInfoBean
import
com.gingersoft.connect.bean.MessageBuilder
import
com.gingersoft.connect.bean.MessageSender
import
com.gingersoft.connect.bean.OrderInfoBean
import
com.gingersoft.connect.utils.GingerSoftConnect
import
java.text.SimpleDateFormat
import
java.util.Date
class
MainActivity
:
Activity
()
{
...
...
mylibrary/src/main/java/com/gingersoft/connect/bean/MessageBean.kt
View file @
52c2fe29
package
com.gingersoft.connect.bean
class
MessageBean
<
T
>
(
class
MessageBean
(
/**
* 消息唯一ID,發送消息過去,服務端收到後會發送一條成功接收消息,通過這個code來區分是哪條消息
*/
var
code
:
Int
=
0
,
var
action
:
String
?
=
null
,
var
data
:
T
?
=
null
var
data
:
String
?
=
null
)
\ No newline at end of file
mylibrary/src/main/java/com/gingersoft/connect/bean/MessageSender.kt
View file @
52c2fe29
...
...
@@ -12,7 +12,7 @@ import kotlinx.coroutines.runBlocking
class
MessageSender
(
private
val
connect
:
GingerSoftConnect
,
private
val
webSocketClient
:
MyWebSocketClient
,
private
val
msg
:
MessageBean
<*>
private
val
msg
:
MessageBean
)
{
fun
send
():
GingerSoftConnect
{
...
...
mylibrary/src/main/java/com/gingersoft/connect/utils/MsgParser.kt
View file @
52c2fe29
...
...
@@ -10,7 +10,7 @@ object MsgParser {
val
parserMap
by
lazy
{
mutableMapOf
<
String
,
MsgProcess
>()
}
fun
process
(
msgBean
:
MessageBean
<*>
?):
SocketCallbackBean
?
{
fun
process
(
msgBean
:
MessageBean
?):
SocketCallbackBean
?
{
return
if
(
msgBean
!=
null
)
{
val
result
=
parserMap
[
msgBean
.
action
.
toString
()]
?.
processMsg
(
msgBean
.
data
)
if
(
result
!=
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