Showing
4 changed files
with
9 additions
and
30 deletions
@@ -134,8 +134,8 @@ public class OtaPackageTransportResource extends AbstractCoapTransportResource { | @@ -134,8 +134,8 @@ public class OtaPackageTransportResource extends AbstractCoapTransportResource { | ||
134 | response.setPayload(data); | 134 | response.setPayload(data); |
135 | if (exchange.getRequestOptions().getBlock2() != null) { | 135 | if (exchange.getRequestOptions().getBlock2() != null) { |
136 | int chunkSize = exchange.getRequestOptions().getBlock2().getSzx(); | 136 | int chunkSize = exchange.getRequestOptions().getBlock2().getSzx(); |
137 | - boolean moreFlag = data.length > chunkSize; | ||
138 | - response.getOptions().setBlock2(chunkSize, moreFlag, 0); | 137 | + boolean lastFlag = data.length > chunkSize; |
138 | + response.getOptions().setBlock2(chunkSize, lastFlag, 0); | ||
139 | } | 139 | } |
140 | exchange.respond(response); | 140 | exchange.respond(response); |
141 | } | 141 | } |
@@ -143,9 +143,9 @@ public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource { | @@ -143,9 +143,9 @@ public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource { | ||
143 | response.setPayload(fwData); | 143 | response.setPayload(fwData); |
144 | if (exchange.getRequestOptions().getBlock2() != null) { | 144 | if (exchange.getRequestOptions().getBlock2() != null) { |
145 | int chunkSize = exchange.getRequestOptions().getBlock2().getSzx(); | 145 | int chunkSize = exchange.getRequestOptions().getBlock2().getSzx(); |
146 | - boolean moreFlag = fwData.length > chunkSize; | ||
147 | - response.getOptions().setBlock2(chunkSize, moreFlag, 0); | ||
148 | - log.warn("92) with blokc2 Send currentId: [{}], length: [{}], chunkSize [{}], moreFlag [{}]", currentId.toString(), fwData.length, chunkSize, moreFlag); | 146 | + boolean lastFlag = fwData.length > chunkSize; |
147 | + response.getOptions().setBlock2(chunkSize, lastFlag, 0); | ||
148 | + log.warn("92) with blokc2 Send currentId: [{}], length: [{}], chunkSize [{}], moreFlag [{}]", currentId.toString(), fwData.length, chunkSize, lastFlag); | ||
149 | } | 149 | } |
150 | else { | 150 | else { |
151 | log.warn("92) with block1 Send currentId: [{}], length: [{}], ", currentId.toString(), fwData.length); | 151 | log.warn("92) with block1 Send currentId: [{}], length: [{}], ", currentId.toString(), fwData.length); |
@@ -76,32 +76,11 @@ public class LwM2mTransportServerHelper { | @@ -76,32 +76,11 @@ public class LwM2mTransportServerHelper { | ||
76 | return TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()) * 1000L + (atomicTs.getAndIncrement() % 1000); | 76 | return TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()) * 1000L + (atomicTs.getAndIncrement() % 1000); |
77 | } | 77 | } |
78 | 78 | ||
79 | - /** | ||
80 | - * send to Thingsboard Attribute || Telemetry | ||
81 | - * | ||
82 | - * @param msg - JsonObject: [{name: value}] | ||
83 | - * @return - dummyWriteReplace {\"targetIdVer\":\"/19_1.0/0/0\",\"value\":0082} | ||
84 | - */ | ||
85 | - private <T> TransportServiceCallback<Void> getPubAckCallbackSendAttrTelemetry(final T msg) { | ||
86 | - return new TransportServiceCallback<>() { | ||
87 | - @Override | ||
88 | - public void onSuccess(Void dummy) { | ||
89 | - log.trace("Success to publish msg: {}, dummy: {}", msg, dummy); | ||
90 | - } | ||
91 | - | ||
92 | - @Override | ||
93 | - public void onError(Throwable e) { | ||
94 | - log.trace("[{}] Failed to publish msg: {}", msg, e); | ||
95 | - } | ||
96 | - }; | ||
97 | - } | ||
98 | - | ||
99 | public void sendParametersOnThingsboardAttribute(List<TransportProtos.KeyValueProto> result, SessionInfoProto sessionInfo) { | 79 | public void sendParametersOnThingsboardAttribute(List<TransportProtos.KeyValueProto> result, SessionInfoProto sessionInfo) { |
100 | PostAttributeMsg.Builder request = PostAttributeMsg.newBuilder(); | 80 | PostAttributeMsg.Builder request = PostAttributeMsg.newBuilder(); |
101 | request.addAllKv(result); | 81 | request.addAllKv(result); |
102 | PostAttributeMsg postAttributeMsg = request.build(); | 82 | PostAttributeMsg postAttributeMsg = request.build(); |
103 | - TransportServiceCallback call = this.getPubAckCallbackSendAttrTelemetry(postAttributeMsg); | ||
104 | - context.getTransportService().process(sessionInfo, postAttributeMsg, this.getPubAckCallbackSendAttrTelemetry(call)); | 83 | + context.getTransportService().process(sessionInfo, postAttributeMsg, TransportServiceCallback.EMPTY); |
105 | } | 84 | } |
106 | 85 | ||
107 | public void sendParametersOnThingsboardTelemetry(List<TransportProtos.KeyValueProto> result, SessionInfoProto sessionInfo) { | 86 | public void sendParametersOnThingsboardTelemetry(List<TransportProtos.KeyValueProto> result, SessionInfoProto sessionInfo) { |
@@ -111,8 +90,7 @@ public class LwM2mTransportServerHelper { | @@ -111,8 +90,7 @@ public class LwM2mTransportServerHelper { | ||
111 | builder.addAllKv(result); | 90 | builder.addAllKv(result); |
112 | request.addTsKvList(builder.build()); | 91 | request.addTsKvList(builder.build()); |
113 | PostTelemetryMsg postTelemetryMsg = request.build(); | 92 | PostTelemetryMsg postTelemetryMsg = request.build(); |
114 | - TransportServiceCallback call = this.getPubAckCallbackSendAttrTelemetry(postTelemetryMsg); | ||
115 | - context.getTransportService().process(sessionInfo, postTelemetryMsg, this.getPubAckCallbackSendAttrTelemetry(call)); | 93 | + context.getTransportService().process(sessionInfo, postTelemetryMsg, TransportServiceCallback.EMPTY); |
116 | } | 94 | } |
117 | 95 | ||
118 | /** | 96 | /** |
@@ -85,6 +85,7 @@ public class TbLwM2mSecurityStore implements TbEditableSecurityStore { | @@ -85,6 +85,7 @@ public class TbLwM2mSecurityStore implements TbEditableSecurityStore { | ||
85 | 85 | ||
86 | @Override | 86 | @Override |
87 | public void remove(String endpoint) { | 87 | public void remove(String endpoint) { |
88 | - securityStore.remove(endpoint); | 88 | + //TODO: Make sure we delay removal of security store from endpoint due to reg/unreg race condition. |
89 | +// securityStore.remove(endpoint); | ||
89 | } | 90 | } |
90 | } | 91 | } |