Search in sources :

Example 1 with FromDeviceRpcResponse

use of org.thingsboard.server.extensions.api.plugins.msg.FromDeviceRpcResponse in project thingsboard by thingsboard.

the class ClusterGrpcService method toProtoMsg.

private static ClusterAPIProtos.ToPluginRpcResponseRpcMessage toProtoMsg(ToPluginRpcResponseDeviceMsg msg) {
    ClusterAPIProtos.ToPluginRpcResponseRpcMessage.Builder builder = ClusterAPIProtos.ToPluginRpcResponseRpcMessage.newBuilder();
    FromDeviceRpcResponse request = msg.getResponse();
    builder.setAddress(ClusterAPIProtos.PluginAddress.newBuilder().setTenantId(toUid(msg.getPluginTenantId().getId())).setPluginId(toUid(msg.getPluginId().getId())).build());
    builder.setMsgId(toUid(request.getId()));
    request.getResponse().ifPresent(builder::setResponse);
    request.getError().ifPresent(e -> builder.setError(e.name()));
    return builder.build();
}
Also used : FromDeviceRpcResponse(org.thingsboard.server.extensions.api.plugins.msg.FromDeviceRpcResponse)

Aggregations

FromDeviceRpcResponse (org.thingsboard.server.extensions.api.plugins.msg.FromDeviceRpcResponse)1