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();
}
Aggregations