Commit 3ad210f9499ad77c2a4190b1a7304d5a765968b3
Merge branch 'cherry-pick-45fed0b1' into 'master'
fix: tcp/udp设备接入更新产品和设备信息时,更新其session信息 See merge request yunteng/thingskit!400
Showing
1 changed file
with
15 additions
and
1 deletions
@@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils; | @@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils; | ||
13 | import org.thingsboard.common.util.JacksonUtil; | 13 | import org.thingsboard.common.util.JacksonUtil; |
14 | import org.thingsboard.server.common.adaptor.AdaptorException; | 14 | import org.thingsboard.server.common.adaptor.AdaptorException; |
15 | import org.thingsboard.server.common.data.DataConstants; | 15 | import org.thingsboard.server.common.data.DataConstants; |
16 | +import org.thingsboard.server.common.data.Device; | ||
16 | import org.thingsboard.server.common.data.DeviceProfile; | 17 | import org.thingsboard.server.common.data.DeviceProfile; |
17 | import org.thingsboard.server.common.data.DeviceTransportType; | 18 | import org.thingsboard.server.common.data.DeviceTransportType; |
18 | import org.thingsboard.server.common.data.device.profile.TkTcpDeviceProfileTransportConfiguration; | 19 | import org.thingsboard.server.common.data.device.profile.TkTcpDeviceProfileTransportConfiguration; |
@@ -138,7 +139,6 @@ public class TcpUdpDataHandler implements SessionMsgListener { | @@ -138,7 +139,6 @@ public class TcpUdpDataHandler implements SessionMsgListener { | ||
138 | } | 139 | } |
139 | deviceSessionCtx.tryProcessQueuedMsgs(msg -> processDeviceSessionMsg(ctx, msg)); | 140 | deviceSessionCtx.tryProcessQueuedMsgs(msg -> processDeviceSessionMsg(ctx, msg)); |
140 | } | 141 | } |
141 | - | ||
142 | private void processAuthTokenConnect(ChannelHandlerContext ctx, TcpAuthEntry accessToken) { | 142 | private void processAuthTokenConnect(ChannelHandlerContext ctx, TcpAuthEntry accessToken) { |
143 | 143 | ||
144 | log.debug( | 144 | log.debug( |
@@ -519,6 +519,20 @@ public class TcpUdpDataHandler implements SessionMsgListener { | @@ -519,6 +519,20 @@ public class TcpUdpDataHandler implements SessionMsgListener { | ||
519 | } | 519 | } |
520 | 520 | ||
521 | @Override | 521 | @Override |
522 | + public void onDeviceProfileUpdate( | ||
523 | + TransportProtos.SessionInfoProto sessionInfo, DeviceProfile deviceProfile) { | ||
524 | + deviceSessionCtx.onDeviceProfileUpdate(sessionInfo, deviceProfile); | ||
525 | + } | ||
526 | + | ||
527 | + @Override | ||
528 | + public void onDeviceUpdate( | ||
529 | + TransportProtos.SessionInfoProto sessionInfo, | ||
530 | + Device device, | ||
531 | + Optional<DeviceProfile> deviceProfileOpt) { | ||
532 | + deviceSessionCtx.onDeviceUpdate(sessionInfo, device, deviceProfileOpt); | ||
533 | + deviceSessionCtx.setDeviceCode(JacksonUtil.toString(device.getAdditionalInfo())); | ||
534 | + } | ||
535 | + @Override | ||
522 | public void onDeviceDeleted(DeviceId deviceId) { | 536 | public void onDeviceDeleted(DeviceId deviceId) { |
523 | context.onAuthFailure(address); | 537 | context.onAuthFailure(address); |
524 | if (isTcp) { | 538 | if (isTcp) { |