lwm2m/coap: client queue Mode
This commit is contained in:
parent
cb674048e7
commit
9cdcad8775
@ -18,7 +18,6 @@ package org.thingsboard.server.transport.coap.client;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.californium.core.coap.CoAP;
|
||||
import org.eclipse.californium.core.coap.CoAP.ResponseCode;
|
||||
import org.eclipse.californium.core.coap.Response;
|
||||
import org.eclipse.californium.core.observe.ObserveRelation;
|
||||
import org.eclipse.californium.core.server.resources.CoapExchange;
|
||||
@ -222,7 +221,7 @@ public class DefaultCoapClientContext implements CoapClientContext {
|
||||
private void onUplink(TbCoapClientState client, boolean notifyOtherServers, long uplinkTs) {
|
||||
PowerMode powerMode = client.getPowerMode();
|
||||
PowerSavingConfiguration profileSettings = null;
|
||||
if (powerMode == null) {
|
||||
if (powerMode == null && client.getProfileId() != null) {
|
||||
var clientProfile = getProfile(client.getProfileId());
|
||||
if (clientProfile.isPresent()) {
|
||||
profileSettings = clientProfile.get().getClientSettings();
|
||||
@ -736,7 +735,7 @@ public class DefaultCoapClientContext implements CoapClientContext {
|
||||
private boolean isDownlinkAllowed(TbCoapClientState client) {
|
||||
PowerMode powerMode = client.getPowerMode();
|
||||
PowerSavingConfiguration profileSettings = null;
|
||||
if (powerMode == null) {
|
||||
if (powerMode == null && client.getProfileId() != null) {
|
||||
var clientProfile = getProfile(client.getProfileId());
|
||||
if (clientProfile.isPresent()) {
|
||||
profileSettings = clientProfile.get().getClientSettings();
|
||||
@ -785,11 +784,12 @@ public class DefaultCoapClientContext implements CoapClientContext {
|
||||
private PowerMode getPowerMode(TbCoapClientState client) {
|
||||
PowerMode powerMode = client.getPowerMode();
|
||||
if (powerMode == null) {
|
||||
Optional<CoapDeviceProfileTransportConfiguration> deviceProfile = getProfile(client.getProfileId());
|
||||
if (deviceProfile.isPresent()) {
|
||||
powerMode = deviceProfile.get().getClientSettings().getPowerMode();
|
||||
} else {
|
||||
powerMode = PowerMode.PSM;
|
||||
powerMode = PowerMode.PSM;
|
||||
if (client.getProfileId() != null) {
|
||||
Optional<CoapDeviceProfileTransportConfiguration> deviceProfile = getProfile(client.getProfileId());
|
||||
if (deviceProfile.isPresent()) {
|
||||
powerMode = deviceProfile.get().getClientSettings().getPowerMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
return powerMode;
|
||||
|
||||
@ -411,15 +411,12 @@ public class LwM2mClientContextImpl implements LwM2mClientContext {
|
||||
public boolean isDownlinkAllowed(LwM2mClient client) {
|
||||
PowerMode powerMode = client.getPowerMode();
|
||||
OtherConfiguration profileSettings = null;
|
||||
if (powerMode == null) {
|
||||
if (powerMode == null && client.getProfileId() != null) {
|
||||
var clientProfile = getProfile(client.getProfileId());
|
||||
profileSettings = clientProfile.getClientLwM2mSettings();
|
||||
powerMode = profileSettings.getPowerMode();
|
||||
if (powerMode == null) {
|
||||
powerMode = PowerMode.DRX;
|
||||
}
|
||||
}
|
||||
if (PowerMode.DRX.equals(powerMode) || otaUpdateService.isOtaDownloading(client)) {
|
||||
if (powerMode == null || PowerMode.DRX.equals(powerMode) || otaUpdateService.isOtaDownloading(client)) {
|
||||
return true;
|
||||
}
|
||||
client.lock();
|
||||
@ -460,19 +457,12 @@ public class LwM2mClientContextImpl implements LwM2mClientContext {
|
||||
public void onUplink(LwM2mClient client) {
|
||||
PowerMode powerMode = client.getPowerMode();
|
||||
OtherConfiguration profileSettings = null;
|
||||
if (powerMode == null) {
|
||||
if (client.getProfileId() == null) {
|
||||
powerMode = PowerMode.DRX;
|
||||
} else {
|
||||
var clientProfile = getProfile(client.getProfileId());
|
||||
profileSettings = clientProfile.getClientLwM2mSettings();
|
||||
powerMode = profileSettings.getPowerMode();
|
||||
if (powerMode == null) {
|
||||
powerMode = PowerMode.DRX;
|
||||
}
|
||||
}
|
||||
if (powerMode == null && client.getProfileId() != null) {
|
||||
var clientProfile = getProfile(client.getProfileId());
|
||||
profileSettings = clientProfile.getClientLwM2mSettings();
|
||||
powerMode = profileSettings.getPowerMode();
|
||||
}
|
||||
if (PowerMode.DRX.equals(powerMode)) {
|
||||
if (powerMode == null || PowerMode.DRX.equals(powerMode)) {
|
||||
client.updateLastUplinkTime();
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user