Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
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
zengtianlai3
ioc_sixiang_license
Commits
40d031dc
Commit
40d031dc
authored
Nov 27, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改连接测试
parent
9dbff062
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
21 deletions
+13
-21
DeviceClientInactiveEventHandler.java
...xiang/license/event/DeviceClientInactiveEventHandler.java
+6
-10
ForwardClientConnectEventHandler.java
...xiang/license/event/ForwardClientConnectEventHandler.java
+3
-3
ForwardClientRequestEventHandler.java
...xiang/license/event/ForwardClientRequestEventHandler.java
+3
-6
TerminalDeviceService.java
...va/iot/sixiang/license/service/TerminalDeviceService.java
+0
-1
DeviceControllerTest.java
.../iot/sixiang/license/controller/DeviceControllerTest.java
+1
-1
No files found.
license/src/main/java/iot/sixiang/license/event/DeviceClientInactiveEventHandler.java
View file @
40d031dc
...
@@ -16,7 +16,6 @@ public class DeviceClientInactiveEventHandler {
...
@@ -16,7 +16,6 @@ public class DeviceClientInactiveEventHandler {
EventPublisher
eventPublisher
;
EventPublisher
eventPublisher
;
public
DeviceClientInactiveEventHandler
()
{
public
DeviceClientInactiveEventHandler
()
{
}
}
@EventListener
@EventListener
...
@@ -25,24 +24,21 @@ public class DeviceClientInactiveEventHandler {
...
@@ -25,24 +24,21 @@ public class DeviceClientInactiveEventHandler {
SessionContext
session
=
deviceManager
.
getSessionByChannelId
(
channelId
);
SessionContext
session
=
deviceManager
.
getSessionByChannelId
(
channelId
);
if
(
session
==
null
)
{
if
(
session
==
null
)
{
log
.
debug
(
"device client inactive undo ..."
);
log
.
info
(
"device client inactive undo ..."
);
return
;
return
;
}
else
{
}
else
{
String
appId
=
session
.
getAppId
();
String
sn
=
session
.
getSn
();
// boolean result = deviceManager.removeSessionByChannelId(channelId);
// boolean result = deviceManager.removeSessionByChannelId(channelId);
boolean
result
=
deviceManager
.
changeSessionOffline
(
channelId
);
boolean
result
=
deviceManager
.
changeSessionOffline
(
channelId
);
if
(
result
)
{
if
(
result
)
{
//
TODO
device client 离线需要强制中断该设备对应的forward client
// device client 离线需要强制中断该设备对应的forward client
ForwardClientBeForcedOfflineEvent
forwardClientBeForcedOfflineEvent
=
new
ForwardClientBeForcedOfflineEvent
();
ForwardClientBeForcedOfflineEvent
forwardClientBeForcedOfflineEvent
=
new
ForwardClientBeForcedOfflineEvent
();
forwardClientBeForcedOfflineEvent
.
setSn
(
appId
);
forwardClientBeForcedOfflineEvent
.
setSn
(
sn
);
eventPublisher
.
publishEvent
(
forwardClientBeForcedOfflineEvent
);
eventPublisher
.
publishEvent
(
forwardClientBeForcedOfflineEvent
);
log
.
debug
(
"device client inactive success ..."
);
log
.
info
(
"device client inactive success ..."
);
}
}
}
}
}
}
}
}
...
...
license/src/main/java/iot/sixiang/license/event/ForwardClientConnectEventHandler.java
View file @
40d031dc
...
@@ -21,7 +21,7 @@ public class ForwardClientConnectEventHandler {
...
@@ -21,7 +21,7 @@ public class ForwardClientConnectEventHandler {
@EventListener
@EventListener
public
void
handlerEvent
(
ForwardClientConnectEvent
event
)
{
public
void
handlerEvent
(
ForwardClientConnectEvent
event
)
{
String
appId
=
event
.
getSn
();
String
sn
=
event
.
getSn
();
String
channelId
=
event
.
getChannelId
();
String
channelId
=
event
.
getChannelId
();
SocketChannel
channel
=
event
.
getChannel
();
SocketChannel
channel
=
event
.
getChannel
();
...
@@ -29,14 +29,14 @@ public class ForwardClientConnectEventHandler {
...
@@ -29,14 +29,14 @@ public class ForwardClientConnectEventHandler {
SessionContext
session
=
new
SessionContext
();
SessionContext
session
=
new
SessionContext
();
// session.setRemoteIp(remoteIp);
// session.setRemoteIp(remoteIp);
// session.setRemotePort(remotePort);
// session.setRemotePort(remotePort);
session
.
set
AppId
(
appId
);
session
.
set
Sn
(
sn
);
// session.setAppKey(appKey);
// session.setAppKey(appKey);
// session.setToken(token);
// session.setToken(token);
session
.
setChannelId
(
channelId
);
session
.
setChannelId
(
channelId
);
session
.
setClientChannel
(
channel
);
session
.
setClientChannel
(
channel
);
forwardManager
.
putSession
(
appId
,
session
);
forwardManager
.
putSession
(
sn
,
session
);
log
.
debug
(
"forward client connect:"
+
event
);
log
.
debug
(
"forward client connect:"
+
event
);
}
}
...
...
license/src/main/java/iot/sixiang/license/event/ForwardClientRequestEventHandler.java
View file @
40d031dc
...
@@ -31,14 +31,11 @@ public class ForwardClientRequestEventHandler {
...
@@ -31,14 +31,11 @@ public class ForwardClientRequestEventHandler {
DeviceProtocol
protocol
=
event
.
getProtocol
();
DeviceProtocol
protocol
=
event
.
getProtocol
();
SessionContext
deviceSessionContext
=
deviceManager
.
getSessionByChannelId
(
deviceChannelId
);
SessionContext
deviceSessionContext
=
deviceManager
.
getSessionByChannelId
(
deviceChannelId
);
String
appId
=
deviceSessionContext
.
getAppId
();
String
sn
=
deviceSessionContext
.
getSn
();
SessionContext
forwardSessionContext
=
forwardManager
.
getSessionContextBySN
(
appId
);
SessionContext
forwardSessionContext
=
forwardManager
.
getSessionContextBySN
(
sn
);
log
.
debug
(
"forward client request:"
+
appId
+
","
+
forwardSessionContext
);
log
.
info
(
"forward client request:"
+
sn
+
","
+
forwardSessionContext
);
SocketChannel
clientChannel
=
forwardSessionContext
.
getClientChannel
();
SocketChannel
clientChannel
=
forwardSessionContext
.
getClientChannel
();
clientChannel
.
writeAndFlush
(
protocol
);
clientChannel
.
writeAndFlush
(
protocol
);
}
}
}
}
license/src/main/java/iot/sixiang/license/service/TerminalDeviceService.java
View file @
40d031dc
...
@@ -2,7 +2,6 @@ package iot.sixiang.license.service;
...
@@ -2,7 +2,6 @@ package iot.sixiang.license.service;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.model.dto.GetTerminalDeviceTokenDTO
;
import
iot.sixiang.license.model.dto.GetTerminalDeviceTokenDTO
;
import
iot.sixiang.license.model.vo.GetTerminalDeviceTokenVO
;
public
interface
TerminalDeviceService
{
public
interface
TerminalDeviceService
{
ResResult
getToken
(
GetTerminalDeviceTokenDTO
getTerminalDeviceTokenDTO
);
ResResult
getToken
(
GetTerminalDeviceTokenDTO
getTerminalDeviceTokenDTO
);
...
...
license/src/test/java/iot/sixiang/license/controller/DeviceControllerTest.java
View file @
40d031dc
...
@@ -55,7 +55,7 @@ public class DeviceControllerTest {
...
@@ -55,7 +55,7 @@ public class DeviceControllerTest {
int
serverPort
=
18889
;
int
serverPort
=
18889
;
String
appId
=
"ebsh71dp5t1ck948l5"
;
String
appId
=
"ebsh71dp5t1ck948l5"
;
String
sn
=
"ERE54S619LNYMPKVN9"
;
String
sn
=
"ERE54S619LNYMPKVN9"
;
String
snBind
=
"
snabcd
"
;
String
snBind
=
"
ZA2207G5NQ
"
;
String
appKey
=
"110801"
;
String
appKey
=
"110801"
;
socket
(
serverIp
,
serverPort
,
appId
,
sn
,
snBind
,
appKey
);
socket
(
serverIp
,
serverPort
,
appId
,
sn
,
snBind
,
appKey
);
}
}
...
...
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