From c7ce0e47f46c43c4ffc960a3f2d1ac2cd70e398e Mon Sep 17 00:00:00 2001 From: "Blake J. Harnden" Date: Mon, 10 Jun 2019 13:36:40 -0700 Subject: [PATCH] corefx updates to account for latest protobuf file --- .../com/core/client/grpc/CoreGrpcClient.java | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/corefx/src/main/java/com/core/client/grpc/CoreGrpcClient.java b/corefx/src/main/java/com/core/client/grpc/CoreGrpcClient.java index 4c1484d4..972c30be 100644 --- a/corefx/src/main/java/com/core/client/grpc/CoreGrpcClient.java +++ b/corefx/src/main/java/com/core/client/grpc/CoreGrpcClient.java @@ -6,7 +6,6 @@ import com.core.client.rest.ServiceFile; import com.core.client.rest.WlanConfig; import com.core.data.*; import com.core.ui.dialogs.MobilityPlayerDialog; -import com.google.protobuf.ByteString; import io.grpc.Context; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; @@ -15,7 +14,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; @@ -38,8 +36,8 @@ public class CoreGrpcClient implements ICoreClient { private CoreProto.Node nodeToProto(CoreNode node) { CoreProto.Position position = CoreProto.Position.newBuilder() - .setX(node.getPosition().getX().floatValue()) - .setY(node.getPosition().getY().floatValue()) + .setX(node.getPosition().getX().intValue()) + .setY(node.getPosition().getY().intValue()) .build(); CoreProto.Node.Builder builder = CoreProto.Node.newBuilder() .addAllServices(node.getServices()) @@ -90,31 +88,31 @@ public class CoreGrpcClient implements ICoreClient { unidirectional = true; } if (options.getBandwidth() != null) { - builder.setBandwidth(options.getBandwidth().floatValue()); + builder.setBandwidth(options.getBandwidth().intValue()); } if (options.getBurst() != null) { - builder.setBurst(options.getBurst().floatValue()); + builder.setBurst(options.getBurst().intValue()); } if (options.getDelay() != null) { - builder.setDelay(options.getDelay().floatValue()); + builder.setDelay(options.getDelay().intValue()); } if (options.getDup() != null) { - builder.setDup(options.getDup().floatValue()); + builder.setDup(options.getDup().intValue()); } if (options.getJitter() != null) { - builder.setJitter(options.getJitter().floatValue()); + builder.setJitter(options.getJitter().intValue()); } if (options.getMburst() != null) { - builder.setMburst(options.getMburst().floatValue()); + builder.setMburst(options.getMburst().intValue()); } if (options.getMer() != null) { - builder.setMer(options.getMer().floatValue()); + builder.setMer(options.getMer().intValue()); } if (options.getPer() != null) { - builder.setPer(options.getPer().floatValue()); + builder.setPer(options.getPer().intValue()); } if (options.getKey() != null) { - builder.setKey(options.getKey().toString()); + builder.setKey(options.getKey()); } if (options.getOpaque() != null) { builder.setOpaque(options.getOpaque()); @@ -196,8 +194,8 @@ public class CoreGrpcClient implements ICoreClient { options.setJitter((double) protoOptions.getJitter()); options.setPer((double) protoOptions.getPer()); options.setBurst((double) protoOptions.getBurst()); - if (!protoOptions.getKey().isEmpty()) { - options.setKey(Integer.parseInt(protoOptions.getKey())); + if (protoOptions.hasField(CoreProto.LinkOptions.getDescriptor().findFieldByName("key"))) { + options.setKey(protoOptions.getKey()); } options.setMburst((double) protoOptions.getMburst()); options.setMer((double) protoOptions.getMer()); @@ -784,8 +782,8 @@ public class CoreGrpcClient implements ICoreClient { @Override public boolean editNode(CoreNode node) throws IOException { CoreProto.Position position = CoreProto.Position.newBuilder() - .setX(node.getPosition().getX().floatValue()) - .setY(node.getPosition().getY().floatValue()) + .setX(node.getPosition().getX().intValue()) + .setY(node.getPosition().getY().intValue()) .build(); CoreProto.EditNodeRequest request = CoreProto.EditNodeRequest.newBuilder() .setSessionId(sessionId) @@ -1104,13 +1102,13 @@ public class CoreGrpcClient implements ICoreClient { } CoreProto.Position.Builder positionBuilder = CoreProto.Position.newBuilder(); if (config.getPosition().getX() != null) { - positionBuilder.setX(config.getPosition().getX().floatValue()); + positionBuilder.setX(config.getPosition().getX().intValue()); } if (config.getPosition().getY() != null) { - positionBuilder.setY(config.getPosition().getY().floatValue()); + positionBuilder.setY(config.getPosition().getY().intValue()); } if (config.getPosition().getZ() != null) { - positionBuilder.setZ(config.getPosition().getZ().floatValue()); + positionBuilder.setZ(config.getPosition().getZ().intValue()); } if (config.getLocation().getLongitude() != null) { positionBuilder.setLon(config.getLocation().getLongitude().floatValue());