Search in sources :

Example 1 with TbLwM2MReadCompositeRequest

use of org.thingsboard.server.transport.lwm2m.server.downlink.composite.TbLwM2MReadCompositeRequest in project thingsboard by thingsboard.

the class DefaultLwM2mDownlinkMsgHandler method sendReadCompositeRequest.

@Override
public void sendReadCompositeRequest(LwM2mClient client, TbLwM2MReadCompositeRequest request, DownlinkRequestCallback<ReadCompositeRequest, ReadCompositeResponse> callback, ContentFormat compositeContentFormat) {
    try {
        ReadCompositeRequest downlink = new ReadCompositeRequest(compositeContentFormat, compositeContentFormat, request.getObjectIds());
        sendCompositeRequest(client, downlink, this.config.getTimeout(), callback);
    } catch (InvalidRequestException e) {
        callback.onValidationError(request.toString(), e.getMessage());
    }
}
Also used : InvalidRequestException(org.eclipse.leshan.core.request.exception.InvalidRequestException) TbLwM2MReadCompositeRequest(org.thingsboard.server.transport.lwm2m.server.downlink.composite.TbLwM2MReadCompositeRequest) ReadCompositeRequest(org.eclipse.leshan.core.request.ReadCompositeRequest)

Example 2 with TbLwM2MReadCompositeRequest

use of org.thingsboard.server.transport.lwm2m.server.downlink.composite.TbLwM2MReadCompositeRequest in project thingsboard by thingsboard.

the class DefaultLwM2MRpcRequestHandler method sendReadCompositeRequest.

private void sendReadCompositeRequest(LwM2mClient client, TransportProtos.ToDeviceRpcRequestMsg requestMsg, ContentFormat contentFormatComposite) {
    String[] versionedIds = getIdsFromParameters(client, requestMsg);
    TbLwM2MReadCompositeRequest request = TbLwM2MReadCompositeRequest.builder().versionedIds(versionedIds).timeout(clientContext.getRequestTimeout(client)).build();
    var mainCallback = new TbLwM2MReadCompositeCallback(uplinkHandler, logService, client, versionedIds);
    var rpcCallback = new RpcReadResponseCompositeCallback(transportService, client, requestMsg, mainCallback);
    downlinkHandler.sendReadCompositeRequest(client, request, rpcCallback, contentFormatComposite);
}
Also used : TbLwM2MReadCompositeRequest(org.thingsboard.server.transport.lwm2m.server.downlink.composite.TbLwM2MReadCompositeRequest) RpcReadResponseCompositeCallback(org.thingsboard.server.transport.lwm2m.server.rpc.composite.RpcReadResponseCompositeCallback) TbLwM2MReadCompositeCallback(org.thingsboard.server.transport.lwm2m.server.downlink.composite.TbLwM2MReadCompositeCallback)

Aggregations

TbLwM2MReadCompositeRequest (org.thingsboard.server.transport.lwm2m.server.downlink.composite.TbLwM2MReadCompositeRequest)2 ReadCompositeRequest (org.eclipse.leshan.core.request.ReadCompositeRequest)1 InvalidRequestException (org.eclipse.leshan.core.request.exception.InvalidRequestException)1 TbLwM2MReadCompositeCallback (org.thingsboard.server.transport.lwm2m.server.downlink.composite.TbLwM2MReadCompositeCallback)1 RpcReadResponseCompositeCallback (org.thingsboard.server.transport.lwm2m.server.rpc.composite.RpcReadResponseCompositeCallback)1