LWM2M: front del debugger

This commit is contained in:
nickAS21 2021-06-10 13:08:13 +03:00 committed by Andrew Shvayka
parent 308650a308
commit 26bc7841ae
4 changed files with 6 additions and 21 deletions

View File

@ -398,7 +398,7 @@ public class CoapTransportResource extends AbstractCoapTransportResource {
private Optional<DeviceTokenCredentials> decodeCredentials(Request request) {
List<String> uriPath = request.getOptions().getUriPath();
if (uriPath.size() >= ACCESS_TOKEN_POSITION) {
if (uriPath.size() > ACCESS_TOKEN_POSITION) {
return Optional.of(new DeviceTokenCredentials(uriPath.get(ACCESS_TOKEN_POSITION - 1)));
} else {
return Optional.empty();

View File

@ -61,7 +61,6 @@ import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.L
import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.LwM2MFirmwareUpdateStrategy.OBJ_5_TEMP_URL;
import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.LwM2mTypeOper.EXECUTE;
import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.LwM2mTypeOper.OBSERVE;
import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.LwM2mTypeOper.READ;
import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.LwM2mTypeOper.WRITE_REPLACE;
import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.SW_INSTALL_ID;
import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.SW_NAME_ID;
@ -193,19 +192,10 @@ public class LwM2mFwSwUpdate {
request.sendAllRequest(this.lwM2MClient, targetIdVer, WRITE_REPLACE, ContentFormat.OPAQUE,
firmwareChunk, handler.config.getTimeout(), this.rpcRequest);
} else if (LwM2mTransportUtil.LwM2MFirmwareUpdateStrategy.OBJ_5_TEMP_URL.code == this.updateStrategy) {
Registration registration = this.getLwM2MClient().getRegistration();
// String api = handler.config.getHostRequests();
String api = "176.36.143.9";
int port = registration.getIdentity().isSecure() ? handler.config.getSecurePort() : handler.config.getPort();
// String uri = "coap://" + api + ":" + Integer.valueOf(port) + "/" + "api/v1/test_url" + "/" + this.currentId.toString();
String uri = "coap://" + api + ":" + Integer.valueOf(port) + "/" + FIRMWARE_UPDATE_COAP_RECOURSE + "/" + this.currentId.toString();
// home
// String uri = "coap://176.100.5.79:5683/api/v1/test_url/firmware";
// office
// String uri = "coap://176.36.143.9:5683/api/v1/test_url/firmware";
String apiFont = "coap://176.36.143.9:5685";
String uri = apiFont + "/" + FIRMWARE_UPDATE_COAP_RECOURSE + "/" + this.currentId.toString();
log.warn("89) coapUri: [{}]", uri);
// request.sendAllRequest(this.lwM2MClient, targetIdVer, WRITE_REPLACE, null,
request.sendAllRequest(this.lwM2MClient, targetIdVer, READ, null,
request.sendAllRequest(this.lwM2MClient, targetIdVer, WRITE_REPLACE, null,
uri, handler.config.getTimeout(), this.rpcRequest);
} else if (LwM2mTransportUtil.LwM2MFirmwareUpdateStrategy.OBJ_19_BINARY.code == this.updateStrategy) {

View File

@ -176,7 +176,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
}
private updateWriteValue = (value: ModelValue): void => {
debugger
let fwResource = this.configurationValue.clientLwM2mSettings.fwUpdateStrategy === '2' &&
isDefinedAndNotNull(this.configurationValue.clientLwM2mSettings.fwUpdateRecourse) ?
this.configurationValue.clientLwM2mSettings.fwUpdateRecourse : '';
@ -515,7 +514,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
}
changeFwUpdateStrategy($event: MatSelectChange) {
debugger
if ($event.value === '2') {
this.isFwUpdateStrategy = true;
if (isEmpty(this.lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').value)) {
@ -531,7 +529,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
}
changeSwUpdateStrategy($event: MatSelectChange) {
debugger
if ($event.value === '2') {
this.isSwUpdateStrategy = true;
if (isEmpty(this.lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').value)) {

View File

@ -44,10 +44,8 @@ export const KEY_REGEXP_NUMBER = /^(\-?|\+?)\d*$/;
export const INSTANCES_ID_VALUE_MIN = 0;
export const INSTANCES_ID_VALUE_MAX = 65535;
export const DEFAULT_OTA_UPDATE_PROTOCOL = "coap://";
export const DEFAULT_FIRMWARE_UPDATE_COAP_RECOURSE = "firmwareUpdateCoapRecourse";
export const DEFAULT_SOFTWARE_UPDATE_COAP_RECOURSE = "softwareUpdateCoapRecourse";
export const DEFAULT_FW_UPDATE_RESOURCE = DEFAULT_OTA_UPDATE_PROTOCOL + DEFAULT_LOCAL_HOST_NAME + ":"+ DEFAULT_PORT_SERVER_NO_SEC + "/" + DEFAULT_FIRMWARE_UPDATE_COAP_RECOURSE;
export const DEFAULT_SW_UPDATE_RESOURCE = DEFAULT_OTA_UPDATE_PROTOCOL + DEFAULT_LOCAL_HOST_NAME + ":"+ DEFAULT_PORT_SERVER_NO_SEC + "/" + DEFAULT_SOFTWARE_UPDATE_COAP_RECOURSE;
export const DEFAULT_FW_UPDATE_RESOURCE = DEFAULT_OTA_UPDATE_PROTOCOL + DEFAULT_LOCAL_HOST_NAME + ":"+ DEFAULT_PORT_SERVER_NO_SEC;
export const DEFAULT_SW_UPDATE_RESOURCE = DEFAULT_OTA_UPDATE_PROTOCOL + DEFAULT_LOCAL_HOST_NAME + ":"+ DEFAULT_PORT_SERVER_NO_SEC;
export enum BINDING_MODE {