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 | 13 | import org.thingsboard.common.util.JacksonUtil; |
14 | 14 | import org.thingsboard.server.common.adaptor.AdaptorException; |
15 | 15 | import org.thingsboard.server.common.data.DataConstants; |
16 | +import org.thingsboard.server.common.data.Device; | |
16 | 17 | import org.thingsboard.server.common.data.DeviceProfile; |
17 | 18 | import org.thingsboard.server.common.data.DeviceTransportType; |
18 | 19 | import org.thingsboard.server.common.data.device.profile.TkTcpDeviceProfileTransportConfiguration; |
... | ... | @@ -138,7 +139,6 @@ public class TcpUdpDataHandler implements SessionMsgListener { |
138 | 139 | } |
139 | 140 | deviceSessionCtx.tryProcessQueuedMsgs(msg -> processDeviceSessionMsg(ctx, msg)); |
140 | 141 | } |
141 | - | |
142 | 142 | private void processAuthTokenConnect(ChannelHandlerContext ctx, TcpAuthEntry accessToken) { |
143 | 143 | |
144 | 144 | log.debug( |
... | ... | @@ -519,6 +519,20 @@ public class TcpUdpDataHandler implements SessionMsgListener { |
519 | 519 | } |
520 | 520 | |
521 | 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 | 536 | public void onDeviceDeleted(DeviceId deviceId) { |
523 | 537 | context.onAuthFailure(address); |
524 | 538 | if (isTcp) { | ... | ... |