From 659be75b57a1328ceb085d27fccc684aca391cdb Mon Sep 17 00:00:00 2001 From: MaximZaitsev Date: Fri, 8 Jul 2016 17:55:59 +0300 Subject: [PATCH] corrected protos --- server/carEmulator/src/CarEmulatorMain.kt | 27 +- server/carEmulator/src/ThisCar.kt | 2 +- .../carEmulator/src/client/ClientHandler.kt | 17 +- .../carEmulator/src/proto/car/ConnectP.java | 391 +++++-- server/carEmulator/src/proto/car/ErrorP.java | 555 +++++++++ .../carEmulator/src/proto/car/LocationP.java | 1021 +++++++++++++++-- .../carEmulator/src/proto/car/RouteDoneP.java | 128 +-- server/carEmulator/src/server/Handler.kt | 13 +- server/src/ServerMain.kt | 4 +- server/src/car/client/Client.kt | 9 +- server/src/car/client/ClientHandler.kt | 29 +- server/src/car/server/Handler.kt | 11 +- server/src/objects/Car.kt | 8 +- server/src/objects/Environment.kt | 14 +- server/src/proto/car/ConnectP.java | 391 +++++-- server/src/proto/car/ErrorP.java | 555 +++++++++ server/src/proto/car/LocationP.java | 1021 +++++++++++++++-- server/src/proto/car/RouteDoneP.java | 128 +-- 18 files changed, 3601 insertions(+), 723 deletions(-) create mode 100644 server/carEmulator/src/proto/car/ErrorP.java create mode 100644 server/src/proto/car/ErrorP.java diff --git a/server/carEmulator/src/CarEmulatorMain.kt b/server/carEmulator/src/CarEmulatorMain.kt index ac1fdae496b..c10306e5e08 100644 --- a/server/carEmulator/src/CarEmulatorMain.kt +++ b/server/carEmulator/src/CarEmulatorMain.kt @@ -59,21 +59,20 @@ fun main(args: Array) { val car = ThisCar.instance var lastTime: Long = System.currentTimeMillis() while (true) { + Thread.sleep(50) val deltaTimeMs = (System.currentTimeMillis() - lastTime) - if (deltaTimeMs > 50) { - if (!car.pathDone) { - println(car) - } - var pathDone = car.move(deltaTimeMs.toDouble()/ 1000) - if (pathDone) { - val routeDone = RouteDoneP.RouteDone.newBuilder().setUid(car.id).build() - val pathDoneRequest = DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, setRouteUrl, Unpooled.copiedBuffer(routeDone.toByteArray())) - pathDoneRequest.headers().set(HttpHeaderNames.HOST, serverHost) - pathDoneRequest.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE) - pathDoneRequest.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, pathDoneRequest.content().readableBytes()) - Client.sendRequest(pathDoneRequest, serverHost, serverPort) - } - lastTime = System.currentTimeMillis() + if (!car.pathDone) { + println(car) } + var pathDone = car.move(deltaTimeMs.toDouble() / 1000) + if (pathDone) { + val routeDone = RouteDoneP.RouteDone.newBuilder().setUid(car.id).build() + val pathDoneRequest = DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, setRouteUrl, Unpooled.copiedBuffer(routeDone.toByteArray())) + pathDoneRequest.headers().set(HttpHeaderNames.HOST, serverHost) + pathDoneRequest.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE) + pathDoneRequest.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, pathDoneRequest.content().readableBytes()) + Client.sendRequest(pathDoneRequest, serverHost, serverPort) + } + lastTime = System.currentTimeMillis() } } diff --git a/server/carEmulator/src/ThisCar.kt b/server/carEmulator/src/ThisCar.kt index 574efe31581..e273abc161c 100644 --- a/server/carEmulator/src/ThisCar.kt +++ b/server/carEmulator/src/ThisCar.kt @@ -9,7 +9,7 @@ import proto.car.RouteP.Route.WayPoint */ class ThisCar private constructor() { - var id = "" + var id = 0 //metr diff --git a/server/carEmulator/src/client/ClientHandler.kt b/server/carEmulator/src/client/ClientHandler.kt index e93b6cfce15..0634f3e699f 100644 --- a/server/carEmulator/src/client/ClientHandler.kt +++ b/server/carEmulator/src/client/ClientHandler.kt @@ -21,7 +21,6 @@ class ClientHandler : SimpleChannelInboundHandler { var url: String = "" var contentBytes: ByteArray = ByteArray(0); - override fun channelReadComplete(ctx: ChannelHandlerContext) { val url = ctx.channel().attr(AttributeKey.valueOf("url")).get() @@ -29,17 +28,17 @@ class ClientHandler : SimpleChannelInboundHandler { when (url) { connectUrl -> { try { - val uid = ConnectP.ConnectionResponse.parseFrom(contentBytes).uid - synchronized(ThisCar.instance, { - ThisCar.instance.id = uid; - }) + val response = ConnectP.ConnectionResponse.parseFrom(contentBytes) + if (response.responseCase == ConnectP.ConnectionResponse.ResponseCase.UID) { + val uid = response.uid + synchronized(ThisCar.instance, { + ThisCar.instance.id = uid; + }) + } } catch (e: InvalidProtocolBufferException) { - e.printStackTrace() + } } - else -> { - //todo error - } } ctx.close() } diff --git a/server/carEmulator/src/proto/car/ConnectP.java b/server/carEmulator/src/proto/car/ConnectP.java index f4b42e29bbb..3198c292b29 100644 --- a/server/carEmulator/src/proto/car/ConnectP.java +++ b/server/carEmulator/src/proto/car/ConnectP.java @@ -518,14 +518,20 @@ public final class ConnectP { com.google.protobuf.MessageOrBuilder { /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - java.lang.String getUid(); + proto.car.ErrorP.Error getError(); /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - com.google.protobuf.ByteString - getUidBytes(); + proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder(); + + /** + * optional int32 uid = 1; + */ + int getUid(); + + public proto.car.ConnectP.ConnectionResponse.ResponseCase getResponseCase(); } /** * Protobuf type {@code carkot.ConnectionResponse} @@ -539,7 +545,6 @@ public final class ConnectP { super(builder); } private ConnectionResponse() { - uid_ = ""; } @java.lang.Override @@ -567,10 +572,23 @@ public final class ConnectP { } break; } - case 10: { - java.lang.String s = input.readStringRequireUtf8(); - - uid_ = s; + case 8: { + responseCase_ = 1; + response_ = input.readInt32(); + break; + } + case 18: { + proto.car.ErrorP.Error.Builder subBuilder = null; + if (responseCase_ == 2) { + subBuilder = ((proto.car.ErrorP.Error) response_).toBuilder(); + } + response_ = + input.readMessage(proto.car.ErrorP.Error.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((proto.car.ErrorP.Error) response_); + response_ = subBuilder.buildPartial(); + } + responseCase_ = 2; break; } } @@ -596,38 +614,73 @@ public final class ConnectP { proto.car.ConnectP.ConnectionResponse.class, proto.car.ConnectP.ConnectionResponse.Builder.class); } - public static final int UID_FIELD_NUMBER = 1; - private volatile java.lang.Object uid_; - /** - * optional string uid = 1; - */ - public java.lang.String getUid() { - java.lang.Object ref = uid_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uid_ = s; - return s; + private int responseCase_ = 0; + private java.lang.Object response_; + public enum ResponseCase + implements com.google.protobuf.Internal.EnumLite { + ERROR(2), + UID(1), + RESPONSE_NOT_SET(0); + private final int value; + private ResponseCase(int value) { + this.value = value; } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ResponseCase valueOf(int value) { + return forNumber(value); + } + + public static ResponseCase forNumber(int value) { + switch (value) { + case 2: return ERROR; + case 1: return UID; + case 0: return RESPONSE_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public ResponseCase + getResponseCase() { + return ResponseCase.forNumber( + responseCase_); + } + + public static final int ERROR_FIELD_NUMBER = 2; + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.Error getError() { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); } /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - public com.google.protobuf.ByteString - getUidBytes() { - java.lang.Object ref = uid_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; + public proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder() { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; } + return proto.car.ErrorP.Error.getDefaultInstance(); + } + + public static final int UID_FIELD_NUMBER = 1; + /** + * optional int32 uid = 1; + */ + public int getUid() { + if (responseCase_ == 1) { + return (java.lang.Integer) response_; + } + return 0; } private byte memoizedIsInitialized = -1; @@ -642,8 +695,12 @@ public final class ConnectP { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getUidBytes().isEmpty()) { - com.google.protobuf.GeneratedMessage.writeString(output, 1, uid_); + if (responseCase_ == 1) { + output.writeInt32( + 1, (int)((java.lang.Integer) response_)); + } + if (responseCase_ == 2) { + output.writeMessage(2, (proto.car.ErrorP.Error) response_); } } @@ -652,8 +709,14 @@ public final class ConnectP { if (size != -1) return size; size = 0; - if (!getUidBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessage.computeStringSize(1, uid_); + if (responseCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size( + 1, (int)((java.lang.Integer) response_)); + } + if (responseCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (proto.car.ErrorP.Error) response_); } memoizedSize = size; return size; @@ -772,8 +835,8 @@ public final class ConnectP { } public Builder clear() { super.clear(); - uid_ = ""; - + responseCase_ = 0; + response_ = null; return this; } @@ -796,7 +859,17 @@ public final class ConnectP { public proto.car.ConnectP.ConnectionResponse buildPartial() { proto.car.ConnectP.ConnectionResponse result = new proto.car.ConnectP.ConnectionResponse(this); - result.uid_ = uid_; + if (responseCase_ == 2) { + if (errorBuilder_ == null) { + result.response_ = response_; + } else { + result.response_ = errorBuilder_.build(); + } + } + if (responseCase_ == 1) { + result.response_ = response_; + } + result.responseCase_ = responseCase_; onBuilt(); return result; } @@ -812,9 +885,18 @@ public final class ConnectP { public Builder mergeFrom(proto.car.ConnectP.ConnectionResponse other) { if (other == proto.car.ConnectP.ConnectionResponse.getDefaultInstance()) return this; - if (!other.getUid().isEmpty()) { - uid_ = other.uid_; - onChanged(); + switch (other.getResponseCase()) { + case ERROR: { + mergeError(other.getError()); + break; + } + case UID: { + setUid(other.getUid()); + break; + } + case RESPONSE_NOT_SET: { + break; + } } onChanged(); return this; @@ -841,73 +923,179 @@ public final class ConnectP { } return this; } + private int responseCase_ = 0; + private java.lang.Object response_; + public ResponseCase + getResponseCase() { + return ResponseCase.forNumber( + responseCase_); + } - private java.lang.Object uid_ = ""; + public Builder clearResponse() { + responseCase_ = 0; + response_ = null; + onChanged(); + return this; + } + + + private com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder> errorBuilder_; /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - public java.lang.String getUid() { - java.lang.Object ref = uid_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uid_ = s; - return s; + public proto.car.ErrorP.Error getError() { + if (errorBuilder_ == null) { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); } else { - return (java.lang.String) ref; + if (responseCase_ == 2) { + return errorBuilder_.getMessage(); + } + return proto.car.ErrorP.Error.getDefaultInstance(); } } /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - public com.google.protobuf.ByteString - getUidBytes() { - java.lang.Object ref = uid_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uid_ = b; - return b; + public Builder setError(proto.car.ErrorP.Error value) { + if (errorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + errorBuilder_.setMessage(value); + } + responseCase_ = 2; + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public Builder setError( + proto.car.ErrorP.Error.Builder builderForValue) { + if (errorBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + errorBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 2; + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public Builder mergeError(proto.car.ErrorP.Error value) { + if (errorBuilder_ == null) { + if (responseCase_ == 2 && + response_ != proto.car.ErrorP.Error.getDefaultInstance()) { + response_ = proto.car.ErrorP.Error.newBuilder((proto.car.ErrorP.Error) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 2) { + errorBuilder_.mergeFrom(value); + } + errorBuilder_.setMessage(value); + } + responseCase_ = 2; + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public Builder clearError() { + if (errorBuilder_ == null) { + if (responseCase_ == 2) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 2) { + responseCase_ = 0; + response_ = null; + } + errorBuilder_.clear(); + } + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.Error.Builder getErrorBuilder() { + return getErrorFieldBuilder().getBuilder(); + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder() { + if ((responseCase_ == 2) && (errorBuilder_ != null)) { + return errorBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); } } /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - public Builder setUid( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - uid_ = value; + private com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder> + getErrorFieldBuilder() { + if (errorBuilder_ == null) { + if (!(responseCase_ == 2)) { + response_ = proto.car.ErrorP.Error.getDefaultInstance(); + } + errorBuilder_ = new com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder>( + (proto.car.ErrorP.Error) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 2; + onChanged();; + return errorBuilder_; + } + + /** + * optional int32 uid = 1; + */ + public int getUid() { + if (responseCase_ == 1) { + return (java.lang.Integer) response_; + } + return 0; + } + /** + * optional int32 uid = 1; + */ + public Builder setUid(int value) { + responseCase_ = 1; + response_ = value; onChanged(); return this; } /** - * optional string uid = 1; + * optional int32 uid = 1; */ public Builder clearUid() { - - uid_ = getDefaultInstance().getUid(); - onChanged(); - return this; - } - /** - * optional string uid = 1; - */ - public Builder setUidBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - uid_ = value; - onChanged(); + if (responseCase_ == 1) { + responseCase_ = 0; + response_ = null; + onChanged(); + } return this; } public final Builder setUnknownFields( @@ -978,10 +1166,11 @@ public final class ConnectP { descriptor; static { java.lang.String[] descriptorData = { - "\n\rconnect.proto\022\006carkot\"-\n\021ConnectionReq" + - "uest\022\n\n\002ip\030\001 \001(\t\022\014\n\004port\030\002 \001(\005\"!\n\022Connec" + - "tionResponse\022\013\n\003uid\030\001 \001(\tB\025\n\tproto.carB\010" + - "ConnectPb\006proto3" + "\n\rconnect.proto\022\006carkot\032\013error.proto\"-\n\021" + + "ConnectionRequest\022\n\n\002ip\030\001 \001(\t\022\014\n\004port\030\002 " + + "\001(\005\"O\n\022ConnectionResponse\022\036\n\005error\030\002 \001(\013" + + "2\r.carkot.ErrorH\000\022\r\n\003uid\030\001 \001(\005H\000B\n\n\010resp" + + "onseB\025\n\tproto.carB\010ConnectPb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -994,6 +1183,7 @@ public final class ConnectP { com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + proto.car.ErrorP.getDescriptor(), }, assigner); internal_static_carkot_ConnectionRequest_descriptor = getDescriptor().getMessageTypes().get(0); @@ -1006,7 +1196,8 @@ public final class ConnectP { internal_static_carkot_ConnectionResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_carkot_ConnectionResponse_descriptor, - new java.lang.String[] { "Uid", }); + new java.lang.String[] { "Error", "Uid", "Response", }); + proto.car.ErrorP.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/server/carEmulator/src/proto/car/ErrorP.java b/server/carEmulator/src/proto/car/ErrorP.java new file mode 100644 index 00000000000..2f2a71e4667 --- /dev/null +++ b/server/carEmulator/src/proto/car/ErrorP.java @@ -0,0 +1,555 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: error.proto + +package proto.car; + +public final class ErrorP { + private ErrorP() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface ErrorOrBuilder extends + // @@protoc_insertion_point(interface_extends:carkot.Error) + com.google.protobuf.MessageOrBuilder { + + /** + * optional string errorMessage = 1; + */ + java.lang.String getErrorMessage(); + /** + * optional string errorMessage = 1; + */ + com.google.protobuf.ByteString + getErrorMessageBytes(); + + /** + * optional int32 errorCode = 2; + */ + int getErrorCode(); + } + /** + * Protobuf type {@code carkot.Error} + */ + public static final class Error extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:carkot.Error) + ErrorOrBuilder { + // Use Error.newBuilder() to construct. + private Error(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Error() { + errorMessage_ = ""; + errorCode_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private Error( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + errorMessage_ = s; + break; + } + case 16: { + + errorCode_ = input.readInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return proto.car.ErrorP.internal_static_carkot_Error_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return proto.car.ErrorP.internal_static_carkot_Error_fieldAccessorTable + .ensureFieldAccessorsInitialized( + proto.car.ErrorP.Error.class, proto.car.ErrorP.Error.Builder.class); + } + + public static final int ERRORMESSAGE_FIELD_NUMBER = 1; + private volatile java.lang.Object errorMessage_; + /** + * optional string errorMessage = 1; + */ + public java.lang.String getErrorMessage() { + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } + } + /** + * optional string errorMessage = 1; + */ + public com.google.protobuf.ByteString + getErrorMessageBytes() { + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ERRORCODE_FIELD_NUMBER = 2; + private int errorCode_; + /** + * optional int32 errorCode = 2; + */ + public int getErrorCode() { + return errorCode_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getErrorMessageBytes().isEmpty()) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, errorMessage_); + } + if (errorCode_ != 0) { + output.writeInt32(2, errorCode_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getErrorMessageBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, errorMessage_); + } + if (errorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, errorCode_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + public static proto.car.ErrorP.Error parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static proto.car.ErrorP.Error parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static proto.car.ErrorP.Error parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static proto.car.ErrorP.Error parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static proto.car.ErrorP.Error parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static proto.car.ErrorP.Error parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static proto.car.ErrorP.Error parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + public static proto.car.ErrorP.Error parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static proto.car.ErrorP.Error parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static proto.car.ErrorP.Error parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(proto.car.ErrorP.Error prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code carkot.Error} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:carkot.Error) + proto.car.ErrorP.ErrorOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return proto.car.ErrorP.internal_static_carkot_Error_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return proto.car.ErrorP.internal_static_carkot_Error_fieldAccessorTable + .ensureFieldAccessorsInitialized( + proto.car.ErrorP.Error.class, proto.car.ErrorP.Error.Builder.class); + } + + // Construct using proto.car.ErrorP.Error.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + errorMessage_ = ""; + + errorCode_ = 0; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return proto.car.ErrorP.internal_static_carkot_Error_descriptor; + } + + public proto.car.ErrorP.Error getDefaultInstanceForType() { + return proto.car.ErrorP.Error.getDefaultInstance(); + } + + public proto.car.ErrorP.Error build() { + proto.car.ErrorP.Error result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public proto.car.ErrorP.Error buildPartial() { + proto.car.ErrorP.Error result = new proto.car.ErrorP.Error(this); + result.errorMessage_ = errorMessage_; + result.errorCode_ = errorCode_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof proto.car.ErrorP.Error) { + return mergeFrom((proto.car.ErrorP.Error)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(proto.car.ErrorP.Error other) { + if (other == proto.car.ErrorP.Error.getDefaultInstance()) return this; + if (!other.getErrorMessage().isEmpty()) { + errorMessage_ = other.errorMessage_; + onChanged(); + } + if (other.getErrorCode() != 0) { + setErrorCode(other.getErrorCode()); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + proto.car.ErrorP.Error parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (proto.car.ErrorP.Error) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object errorMessage_ = ""; + /** + * optional string errorMessage = 1; + */ + public java.lang.String getErrorMessage() { + java.lang.Object ref = errorMessage_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string errorMessage = 1; + */ + public com.google.protobuf.ByteString + getErrorMessageBytes() { + java.lang.Object ref = errorMessage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string errorMessage = 1; + */ + public Builder setErrorMessage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + errorMessage_ = value; + onChanged(); + return this; + } + /** + * optional string errorMessage = 1; + */ + public Builder clearErrorMessage() { + + errorMessage_ = getDefaultInstance().getErrorMessage(); + onChanged(); + return this; + } + /** + * optional string errorMessage = 1; + */ + public Builder setErrorMessageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + errorMessage_ = value; + onChanged(); + return this; + } + + private int errorCode_ ; + /** + * optional int32 errorCode = 2; + */ + public int getErrorCode() { + return errorCode_; + } + /** + * optional int32 errorCode = 2; + */ + public Builder setErrorCode(int value) { + + errorCode_ = value; + onChanged(); + return this; + } + /** + * optional int32 errorCode = 2; + */ + public Builder clearErrorCode() { + + errorCode_ = 0; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:carkot.Error) + } + + // @@protoc_insertion_point(class_scope:carkot.Error) + private static final proto.car.ErrorP.Error DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new proto.car.ErrorP.Error(); + } + + public static proto.car.ErrorP.Error getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public Error parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Error(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public proto.car.ErrorP.Error getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_carkot_Error_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_carkot_Error_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\013error.proto\022\006carkot\"0\n\005Error\022\024\n\014errorM" + + "essage\030\001 \001(\t\022\021\n\terrorCode\030\002 \001(\005B\023\n\tproto" + + ".carB\006ErrorPb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_carkot_Error_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_carkot_Error_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_carkot_Error_descriptor, + new java.lang.String[] { "ErrorMessage", "ErrorCode", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/server/carEmulator/src/proto/car/LocationP.java b/server/carEmulator/src/proto/car/LocationP.java index 1a7c61d8a9d..cd5c32827b8 100644 --- a/server/carEmulator/src/proto/car/LocationP.java +++ b/server/carEmulator/src/proto/car/LocationP.java @@ -13,19 +13,24 @@ public final class LocationP { com.google.protobuf.MessageOrBuilder { /** - * optional double x = 1; + * optional .carkot.Error error = 2; */ - double getX(); + proto.car.ErrorP.Error getError(); + /** + * optional .carkot.Error error = 2; + */ + proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder(); /** - * optional double y = 2; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - double getY(); - + proto.car.LocationP.Location.LocationResponse getLocationResponse(); /** - * optional double angle = 3; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - double getAngle(); + proto.car.LocationP.Location.LocationResponseOrBuilder getLocationResponseOrBuilder(); + + public proto.car.LocationP.Location.ResponseCase getResponseCase(); } /** * Protobuf type {@code carkot.Location} @@ -39,9 +44,6 @@ public final class LocationP { super(builder); } private Location() { - x_ = 0D; - y_ = 0D; - angle_ = 0D; } @java.lang.Override @@ -69,19 +71,32 @@ public final class LocationP { } break; } - case 9: { - - x_ = input.readDouble(); + case 10: { + proto.car.LocationP.Location.LocationResponse.Builder subBuilder = null; + if (responseCase_ == 1) { + subBuilder = ((proto.car.LocationP.Location.LocationResponse) response_).toBuilder(); + } + response_ = + input.readMessage(proto.car.LocationP.Location.LocationResponse.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((proto.car.LocationP.Location.LocationResponse) response_); + response_ = subBuilder.buildPartial(); + } + responseCase_ = 1; break; } - case 17: { - - y_ = input.readDouble(); - break; - } - case 25: { - - angle_ = input.readDouble(); + case 18: { + proto.car.ErrorP.Error.Builder subBuilder = null; + if (responseCase_ == 2) { + subBuilder = ((proto.car.ErrorP.Error) response_).toBuilder(); + } + response_ = + input.readMessage(proto.car.ErrorP.Error.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((proto.car.ErrorP.Error) response_); + response_ = subBuilder.buildPartial(); + } + responseCase_ = 2; break; } } @@ -107,31 +122,572 @@ public final class LocationP { proto.car.LocationP.Location.class, proto.car.LocationP.Location.Builder.class); } - public static final int X_FIELD_NUMBER = 1; - private double x_; + public interface LocationResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:carkot.Location.LocationResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * optional double x = 1; + */ + double getX(); + + /** + * optional double y = 2; + */ + double getY(); + + /** + * optional double angle = 3; + */ + double getAngle(); + } /** - * optional double x = 1; + * Protobuf type {@code carkot.Location.LocationResponse} */ - public double getX() { - return x_; + public static final class LocationResponse extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:carkot.Location.LocationResponse) + LocationResponseOrBuilder { + // Use LocationResponse.newBuilder() to construct. + private LocationResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private LocationResponse() { + x_ = 0D; + y_ = 0D; + angle_ = 0D; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private LocationResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 9: { + + x_ = input.readDouble(); + break; + } + case 17: { + + y_ = input.readDouble(); + break; + } + case 25: { + + angle_ = input.readDouble(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + proto.car.LocationP.Location.LocationResponse.class, proto.car.LocationP.Location.LocationResponse.Builder.class); + } + + public static final int X_FIELD_NUMBER = 1; + private double x_; + /** + * optional double x = 1; + */ + public double getX() { + return x_; + } + + public static final int Y_FIELD_NUMBER = 2; + private double y_; + /** + * optional double y = 2; + */ + public double getY() { + return y_; + } + + public static final int ANGLE_FIELD_NUMBER = 3; + private double angle_; + /** + * optional double angle = 3; + */ + public double getAngle() { + return angle_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (x_ != 0D) { + output.writeDouble(1, x_); + } + if (y_ != 0D) { + output.writeDouble(2, y_); + } + if (angle_ != 0D) { + output.writeDouble(3, angle_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (x_ != 0D) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(1, x_); + } + if (y_ != 0D) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(2, y_); + } + if (angle_ != 0D) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(3, angle_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + public static proto.car.LocationP.Location.LocationResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static proto.car.LocationP.Location.LocationResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + public static proto.car.LocationP.Location.LocationResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(proto.car.LocationP.Location.LocationResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code carkot.Location.LocationResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:carkot.Location.LocationResponse) + proto.car.LocationP.Location.LocationResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + proto.car.LocationP.Location.LocationResponse.class, proto.car.LocationP.Location.LocationResponse.Builder.class); + } + + // Construct using proto.car.LocationP.Location.LocationResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + x_ = 0D; + + y_ = 0D; + + angle_ = 0D; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_descriptor; + } + + public proto.car.LocationP.Location.LocationResponse getDefaultInstanceForType() { + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } + + public proto.car.LocationP.Location.LocationResponse build() { + proto.car.LocationP.Location.LocationResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public proto.car.LocationP.Location.LocationResponse buildPartial() { + proto.car.LocationP.Location.LocationResponse result = new proto.car.LocationP.Location.LocationResponse(this); + result.x_ = x_; + result.y_ = y_; + result.angle_ = angle_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof proto.car.LocationP.Location.LocationResponse) { + return mergeFrom((proto.car.LocationP.Location.LocationResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(proto.car.LocationP.Location.LocationResponse other) { + if (other == proto.car.LocationP.Location.LocationResponse.getDefaultInstance()) return this; + if (other.getX() != 0D) { + setX(other.getX()); + } + if (other.getY() != 0D) { + setY(other.getY()); + } + if (other.getAngle() != 0D) { + setAngle(other.getAngle()); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + proto.car.LocationP.Location.LocationResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (proto.car.LocationP.Location.LocationResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private double x_ ; + /** + * optional double x = 1; + */ + public double getX() { + return x_; + } + /** + * optional double x = 1; + */ + public Builder setX(double value) { + + x_ = value; + onChanged(); + return this; + } + /** + * optional double x = 1; + */ + public Builder clearX() { + + x_ = 0D; + onChanged(); + return this; + } + + private double y_ ; + /** + * optional double y = 2; + */ + public double getY() { + return y_; + } + /** + * optional double y = 2; + */ + public Builder setY(double value) { + + y_ = value; + onChanged(); + return this; + } + /** + * optional double y = 2; + */ + public Builder clearY() { + + y_ = 0D; + onChanged(); + return this; + } + + private double angle_ ; + /** + * optional double angle = 3; + */ + public double getAngle() { + return angle_; + } + /** + * optional double angle = 3; + */ + public Builder setAngle(double value) { + + angle_ = value; + onChanged(); + return this; + } + /** + * optional double angle = 3; + */ + public Builder clearAngle() { + + angle_ = 0D; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:carkot.Location.LocationResponse) + } + + // @@protoc_insertion_point(class_scope:carkot.Location.LocationResponse) + private static final proto.car.LocationP.Location.LocationResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new proto.car.LocationP.Location.LocationResponse(); + } + + public static proto.car.LocationP.Location.LocationResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public LocationResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LocationResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public proto.car.LocationP.Location.LocationResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } - public static final int Y_FIELD_NUMBER = 2; - private double y_; - /** - * optional double y = 2; - */ - public double getY() { - return y_; + private int responseCase_ = 0; + private java.lang.Object response_; + public enum ResponseCase + implements com.google.protobuf.Internal.EnumLite { + ERROR(2), + LOCATIONRESPONSE(1), + RESPONSE_NOT_SET(0); + private final int value; + private ResponseCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ResponseCase valueOf(int value) { + return forNumber(value); + } + + public static ResponseCase forNumber(int value) { + switch (value) { + case 2: return ERROR; + case 1: return LOCATIONRESPONSE; + case 0: return RESPONSE_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public ResponseCase + getResponseCase() { + return ResponseCase.forNumber( + responseCase_); } - public static final int ANGLE_FIELD_NUMBER = 3; - private double angle_; + public static final int ERROR_FIELD_NUMBER = 2; /** - * optional double angle = 3; + * optional .carkot.Error error = 2; */ - public double getAngle() { - return angle_; + public proto.car.ErrorP.Error getError() { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder() { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } + + public static final int LOCATIONRESPONSE_FIELD_NUMBER = 1; + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public proto.car.LocationP.Location.LocationResponse getLocationResponse() { + if (responseCase_ == 1) { + return (proto.car.LocationP.Location.LocationResponse) response_; + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public proto.car.LocationP.Location.LocationResponseOrBuilder getLocationResponseOrBuilder() { + if (responseCase_ == 1) { + return (proto.car.LocationP.Location.LocationResponse) response_; + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @@ -146,14 +702,11 @@ public final class LocationP { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (x_ != 0D) { - output.writeDouble(1, x_); + if (responseCase_ == 1) { + output.writeMessage(1, (proto.car.LocationP.Location.LocationResponse) response_); } - if (y_ != 0D) { - output.writeDouble(2, y_); - } - if (angle_ != 0D) { - output.writeDouble(3, angle_); + if (responseCase_ == 2) { + output.writeMessage(2, (proto.car.ErrorP.Error) response_); } } @@ -162,17 +715,13 @@ public final class LocationP { if (size != -1) return size; size = 0; - if (x_ != 0D) { + if (responseCase_ == 1) { size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(1, x_); + .computeMessageSize(1, (proto.car.LocationP.Location.LocationResponse) response_); } - if (y_ != 0D) { + if (responseCase_ == 2) { size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(2, y_); - } - if (angle_ != 0D) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(3, angle_); + .computeMessageSize(2, (proto.car.ErrorP.Error) response_); } memoizedSize = size; return size; @@ -291,12 +840,8 @@ public final class LocationP { } public Builder clear() { super.clear(); - x_ = 0D; - - y_ = 0D; - - angle_ = 0D; - + responseCase_ = 0; + response_ = null; return this; } @@ -319,9 +864,21 @@ public final class LocationP { public proto.car.LocationP.Location buildPartial() { proto.car.LocationP.Location result = new proto.car.LocationP.Location(this); - result.x_ = x_; - result.y_ = y_; - result.angle_ = angle_; + if (responseCase_ == 2) { + if (errorBuilder_ == null) { + result.response_ = response_; + } else { + result.response_ = errorBuilder_.build(); + } + } + if (responseCase_ == 1) { + if (locationResponseBuilder_ == null) { + result.response_ = response_; + } else { + result.response_ = locationResponseBuilder_.build(); + } + } + result.responseCase_ = responseCase_; onBuilt(); return result; } @@ -337,14 +894,18 @@ public final class LocationP { public Builder mergeFrom(proto.car.LocationP.Location other) { if (other == proto.car.LocationP.Location.getDefaultInstance()) return this; - if (other.getX() != 0D) { - setX(other.getX()); - } - if (other.getY() != 0D) { - setY(other.getY()); - } - if (other.getAngle() != 0D) { - setAngle(other.getAngle()); + switch (other.getResponseCase()) { + case ERROR: { + mergeError(other.getError()); + break; + } + case LOCATIONRESPONSE: { + mergeLocationResponse(other.getLocationResponse()); + break; + } + case RESPONSE_NOT_SET: { + break; + } } onChanged(); return this; @@ -371,84 +932,281 @@ public final class LocationP { } return this; } + private int responseCase_ = 0; + private java.lang.Object response_; + public ResponseCase + getResponseCase() { + return ResponseCase.forNumber( + responseCase_); + } - private double x_ ; - /** - * optional double x = 1; - */ - public double getX() { - return x_; - } - /** - * optional double x = 1; - */ - public Builder setX(double value) { - - x_ = value; - onChanged(); - return this; - } - /** - * optional double x = 1; - */ - public Builder clearX() { - - x_ = 0D; + public Builder clearResponse() { + responseCase_ = 0; + response_ = null; onChanged(); return this; } - private double y_ ; + + private com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder> errorBuilder_; /** - * optional double y = 2; + * optional .carkot.Error error = 2; */ - public double getY() { - return y_; + public proto.car.ErrorP.Error getError() { + if (errorBuilder_ == null) { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } else { + if (responseCase_ == 2) { + return errorBuilder_.getMessage(); + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } } /** - * optional double y = 2; + * optional .carkot.Error error = 2; */ - public Builder setY(double value) { - - y_ = value; - onChanged(); + public Builder setError(proto.car.ErrorP.Error value) { + if (errorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); + } else { + errorBuilder_.setMessage(value); + } + responseCase_ = 2; return this; } /** - * optional double y = 2; + * optional .carkot.Error error = 2; */ - public Builder clearY() { - - y_ = 0D; - onChanged(); + public Builder setError( + proto.car.ErrorP.Error.Builder builderForValue) { + if (errorBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + errorBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 2; return this; } + /** + * optional .carkot.Error error = 2; + */ + public Builder mergeError(proto.car.ErrorP.Error value) { + if (errorBuilder_ == null) { + if (responseCase_ == 2 && + response_ != proto.car.ErrorP.Error.getDefaultInstance()) { + response_ = proto.car.ErrorP.Error.newBuilder((proto.car.ErrorP.Error) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 2) { + errorBuilder_.mergeFrom(value); + } + errorBuilder_.setMessage(value); + } + responseCase_ = 2; + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public Builder clearError() { + if (errorBuilder_ == null) { + if (responseCase_ == 2) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 2) { + responseCase_ = 0; + response_ = null; + } + errorBuilder_.clear(); + } + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.Error.Builder getErrorBuilder() { + return getErrorFieldBuilder().getBuilder(); + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder() { + if ((responseCase_ == 2) && (errorBuilder_ != null)) { + return errorBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } + } + /** + * optional .carkot.Error error = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder> + getErrorFieldBuilder() { + if (errorBuilder_ == null) { + if (!(responseCase_ == 2)) { + response_ = proto.car.ErrorP.Error.getDefaultInstance(); + } + errorBuilder_ = new com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder>( + (proto.car.ErrorP.Error) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 2; + onChanged();; + return errorBuilder_; + } - private double angle_ ; + private com.google.protobuf.SingleFieldBuilder< + proto.car.LocationP.Location.LocationResponse, proto.car.LocationP.Location.LocationResponse.Builder, proto.car.LocationP.Location.LocationResponseOrBuilder> locationResponseBuilder_; /** - * optional double angle = 3; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - public double getAngle() { - return angle_; + public proto.car.LocationP.Location.LocationResponse getLocationResponse() { + if (locationResponseBuilder_ == null) { + if (responseCase_ == 1) { + return (proto.car.LocationP.Location.LocationResponse) response_; + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } else { + if (responseCase_ == 1) { + return locationResponseBuilder_.getMessage(); + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } } /** - * optional double angle = 3; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - public Builder setAngle(double value) { - - angle_ = value; - onChanged(); + public Builder setLocationResponse(proto.car.LocationP.Location.LocationResponse value) { + if (locationResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); + } else { + locationResponseBuilder_.setMessage(value); + } + responseCase_ = 1; return this; } /** - * optional double angle = 3; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - public Builder clearAngle() { - - angle_ = 0D; - onChanged(); + public Builder setLocationResponse( + proto.car.LocationP.Location.LocationResponse.Builder builderForValue) { + if (locationResponseBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + locationResponseBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 1; return this; } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public Builder mergeLocationResponse(proto.car.LocationP.Location.LocationResponse value) { + if (locationResponseBuilder_ == null) { + if (responseCase_ == 1 && + response_ != proto.car.LocationP.Location.LocationResponse.getDefaultInstance()) { + response_ = proto.car.LocationP.Location.LocationResponse.newBuilder((proto.car.LocationP.Location.LocationResponse) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 1) { + locationResponseBuilder_.mergeFrom(value); + } + locationResponseBuilder_.setMessage(value); + } + responseCase_ = 1; + return this; + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public Builder clearLocationResponse() { + if (locationResponseBuilder_ == null) { + if (responseCase_ == 1) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 1) { + responseCase_ = 0; + response_ = null; + } + locationResponseBuilder_.clear(); + } + return this; + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public proto.car.LocationP.Location.LocationResponse.Builder getLocationResponseBuilder() { + return getLocationResponseFieldBuilder().getBuilder(); + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public proto.car.LocationP.Location.LocationResponseOrBuilder getLocationResponseOrBuilder() { + if ((responseCase_ == 1) && (locationResponseBuilder_ != null)) { + return locationResponseBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 1) { + return (proto.car.LocationP.Location.LocationResponse) response_; + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + proto.car.LocationP.Location.LocationResponse, proto.car.LocationP.Location.LocationResponse.Builder, proto.car.LocationP.Location.LocationResponseOrBuilder> + getLocationResponseFieldBuilder() { + if (locationResponseBuilder_ == null) { + if (!(responseCase_ == 1)) { + response_ = proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } + locationResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder< + proto.car.LocationP.Location.LocationResponse, proto.car.LocationP.Location.LocationResponse.Builder, proto.car.LocationP.Location.LocationResponseOrBuilder>( + (proto.car.LocationP.Location.LocationResponse) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 1; + onChanged();; + return locationResponseBuilder_; + } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; @@ -503,6 +1261,11 @@ public final class LocationP { private static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_carkot_Location_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_carkot_Location_LocationResponse_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_carkot_Location_LocationResponse_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -512,9 +1275,13 @@ public final class LocationP { descriptor; static { java.lang.String[] descriptorData = { - "\n\016location.proto\022\006carkot\"/\n\010Location\022\t\n\001" + - "x\030\001 \001(\001\022\t\n\001y\030\002 \001(\001\022\r\n\005angle\030\003 \001(\001B\026\n\tpro" + - "to.carB\tLocationPb\006proto3" + "\n\016location.proto\022\006carkot\032\013error.proto\"\256\001" + + "\n\010Location\022\036\n\005error\030\002 \001(\0132\r.carkot.Error" + + "H\000\022=\n\020locationResponse\030\001 \001(\0132!.carkot.Lo" + + "cation.LocationResponseH\000\0327\n\020LocationRes" + + "ponse\022\t\n\001x\030\001 \001(\001\022\t\n\001y\030\002 \001(\001\022\r\n\005angle\030\003 \001" + + "(\001B\n\n\010responseB\026\n\tproto.carB\tLocationPb\006" + + "proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -527,13 +1294,21 @@ public final class LocationP { com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + proto.car.ErrorP.getDescriptor(), }, assigner); internal_static_carkot_Location_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_carkot_Location_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_carkot_Location_descriptor, + new java.lang.String[] { "Error", "LocationResponse", "Response", }); + internal_static_carkot_Location_LocationResponse_descriptor = + internal_static_carkot_Location_descriptor.getNestedTypes().get(0); + internal_static_carkot_Location_LocationResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_carkot_Location_LocationResponse_descriptor, new java.lang.String[] { "X", "Y", "Angle", }); + proto.car.ErrorP.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/server/carEmulator/src/proto/car/RouteDoneP.java b/server/carEmulator/src/proto/car/RouteDoneP.java index 36e630de8b5..aa1c1366cf4 100644 --- a/server/carEmulator/src/proto/car/RouteDoneP.java +++ b/server/carEmulator/src/proto/car/RouteDoneP.java @@ -13,14 +13,9 @@ public final class RouteDoneP { com.google.protobuf.MessageOrBuilder { /** - * optional string uid = 1; + * optional int32 uid = 1; */ - java.lang.String getUid(); - /** - * optional string uid = 1; - */ - com.google.protobuf.ByteString - getUidBytes(); + int getUid(); } /** * Protobuf type {@code carkot.RouteDone} @@ -34,7 +29,7 @@ public final class RouteDoneP { super(builder); } private RouteDone() { - uid_ = ""; + uid_ = 0; } @java.lang.Override @@ -62,10 +57,9 @@ public final class RouteDoneP { } break; } - case 10: { - java.lang.String s = input.readStringRequireUtf8(); + case 8: { - uid_ = s; + uid_ = input.readInt32(); break; } } @@ -92,37 +86,12 @@ public final class RouteDoneP { } public static final int UID_FIELD_NUMBER = 1; - private volatile java.lang.Object uid_; + private int uid_; /** - * optional string uid = 1; + * optional int32 uid = 1; */ - public java.lang.String getUid() { - java.lang.Object ref = uid_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uid_ = s; - return s; - } - } - /** - * optional string uid = 1; - */ - public com.google.protobuf.ByteString - getUidBytes() { - java.lang.Object ref = uid_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public int getUid() { + return uid_; } private byte memoizedIsInitialized = -1; @@ -137,8 +106,8 @@ public final class RouteDoneP { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getUidBytes().isEmpty()) { - com.google.protobuf.GeneratedMessage.writeString(output, 1, uid_); + if (uid_ != 0) { + output.writeInt32(1, uid_); } } @@ -147,8 +116,9 @@ public final class RouteDoneP { if (size != -1) return size; size = 0; - if (!getUidBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessage.computeStringSize(1, uid_); + if (uid_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, uid_); } memoizedSize = size; return size; @@ -267,7 +237,7 @@ public final class RouteDoneP { } public Builder clear() { super.clear(); - uid_ = ""; + uid_ = 0; return this; } @@ -307,9 +277,8 @@ public final class RouteDoneP { public Builder mergeFrom(proto.car.RouteDoneP.RouteDone other) { if (other == proto.car.RouteDoneP.RouteDone.getDefaultInstance()) return this; - if (!other.getUid().isEmpty()) { - uid_ = other.uid_; - onChanged(); + if (other.getUid() != 0) { + setUid(other.getUid()); } onChanged(); return this; @@ -337,71 +306,28 @@ public final class RouteDoneP { return this; } - private java.lang.Object uid_ = ""; + private int uid_ ; /** - * optional string uid = 1; + * optional int32 uid = 1; */ - public java.lang.String getUid() { - java.lang.Object ref = uid_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uid_ = s; - return s; - } else { - return (java.lang.String) ref; - } + public int getUid() { + return uid_; } /** - * optional string uid = 1; + * optional int32 uid = 1; */ - public com.google.protobuf.ByteString - getUidBytes() { - java.lang.Object ref = uid_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string uid = 1; - */ - public Builder setUid( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - + public Builder setUid(int value) { + uid_ = value; onChanged(); return this; } /** - * optional string uid = 1; + * optional int32 uid = 1; */ public Builder clearUid() { - uid_ = getDefaultInstance().getUid(); - onChanged(); - return this; - } - /** - * optional string uid = 1; - */ - public Builder setUidBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - uid_ = value; + uid_ = 0; onChanged(); return this; } @@ -469,7 +395,7 @@ public final class RouteDoneP { static { java.lang.String[] descriptorData = { "\n\017routeDone.proto\022\006carkot\"\030\n\tRouteDone\022\013" + - "\n\003uid\030\001 \001(\tB\027\n\tproto.carB\nRouteDonePb\006pr" + + "\n\003uid\030\001 \001(\005B\027\n\tproto.carB\nRouteDonePb\006pr" + "oto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = diff --git a/server/carEmulator/src/server/Handler.kt b/server/carEmulator/src/server/Handler.kt index 82b1fbea14a..048d915e996 100644 --- a/server/carEmulator/src/server/Handler.kt +++ b/server/carEmulator/src/server/Handler.kt @@ -1,20 +1,16 @@ package server +import ThisCar import com.google.protobuf.InvalidProtocolBufferException -import connectUrl import getLocationUrl import io.netty.buffer.Unpooled import io.netty.channel.ChannelFutureListener import io.netty.channel.ChannelHandlerContext import io.netty.channel.SimpleChannelInboundHandler import io.netty.handler.codec.http.* -import proto.car.ConnectP.ConnectionRequest import proto.car.LocationP -import proto.car.RouteDoneP.RouteDone import proto.car.RouteP -import routeDoneUrl import setRouteUrl -import java.util.* /** * Created by user on 7/6/16. @@ -32,14 +28,14 @@ class Handler : SimpleChannelInboundHandler() { var dataAnswer: ByteArray = ByteArray(0) when (url) { getLocationUrl -> { - dataAnswer = LocationP.Location.newBuilder().setAngle(car.angle).setX(car.x).setY(car.y).build().toByteArray(); + dataAnswer = LocationP.Location.newBuilder().setLocationResponse(LocationP.Location.LocationResponse.newBuilder().setAngle(car.angle).setX(car.x).setY(car.y)).build().toByteArray() } setRouteUrl -> { var data: RouteP.Route? = null; try { data = RouteP.Route.parseFrom(contentBytes) } catch (e: InvalidProtocolBufferException) { - //todo error answer + success = false; } if (data != null) { val wayPoints = data.wayPointsList @@ -49,11 +45,10 @@ class Handler : SimpleChannelInboundHandler() { } else -> { success = false - //todo unsup operation. error answer } } - val response = DefaultFullHttpResponse(HttpVersion.HTTP_1_1, if (success) HttpResponseStatus.OK else HttpResponseStatus.NOT_FOUND, Unpooled.copiedBuffer(dataAnswer)) + val response = DefaultFullHttpResponse(HttpVersion.HTTP_1_1, if (success) HttpResponseStatus.OK else HttpResponseStatus.BAD_REQUEST, Unpooled.copiedBuffer(dataAnswer)) response.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, response.content().readableBytes()) ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } diff --git a/server/src/ServerMain.kt b/server/src/ServerMain.kt index 98e4a8ab21c..1a599fb335f 100644 --- a/server/src/ServerMain.kt +++ b/server/src/ServerMain.kt @@ -77,7 +77,7 @@ fun main(args: Array) { val data = scanner.nextLine() val datas = data.split(" ") try { - val id = datas[0] + val id = datas[0].toInt() val distance = datas[1].toDouble() val angle = datas[2].toDouble() @@ -106,7 +106,7 @@ fun main(args: Array) { request.headers().set(HttpHeaderNames.HOST, car.host) request.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE) request.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, request.content().readableBytes()) - Client.sendRequest(request, car.host, car.port, car.id) + Client.sendRequest(request, car.host, car.port, car.uid) } } } diff --git a/server/src/car/client/Client.kt b/server/src/car/client/Client.kt index 60139148dac..3ab9a35f1e0 100644 --- a/server/src/car/client/Client.kt +++ b/server/src/car/client/Client.kt @@ -1,10 +1,7 @@ package car.client import io.netty.bootstrap.Bootstrap -import io.netty.channel.ChannelFutureListener -import io.netty.channel.ChannelInitializer import io.netty.channel.nio.NioEventLoopGroup -import io.netty.channel.socket.SocketChannel import io.netty.channel.socket.nio.NioSocketChannel import io.netty.handler.codec.http.HttpRequest import io.netty.util.AttributeKey @@ -21,14 +18,14 @@ object Client { val b = Bootstrap(); b.group(group).channel(NioSocketChannel().javaClass).handler(ClientInitializer()) .attr(AttributeKey.newInstance("url"), "") - .attr(AttributeKey.newInstance("uid"), "") + .attr(AttributeKey.newInstance("uid"), 0) return b } - fun sendRequest(request: HttpRequest, host: String, port: Int, carUid: String) { + fun sendRequest(request: HttpRequest, host: String, port: Int, carUid: Int) { try { bootstrap.attr(AttributeKey.valueOf("url"), request.uri()) - bootstrap.attr(AttributeKey.valueOf("uid"), carUid) + bootstrap.attr(AttributeKey.valueOf("uid"), carUid) val ch = bootstrap.connect(host, port).sync().channel() ch.writeAndFlush(request) ch.closeFuture().sync()//wait for answer diff --git a/server/src/car/client/ClientHandler.kt b/server/src/car/client/ClientHandler.kt index 066b788fd98..fd92ce72cfd 100644 --- a/server/src/car/client/ClientHandler.kt +++ b/server/src/car/client/ClientHandler.kt @@ -8,8 +8,6 @@ import io.netty.handler.codec.http.HttpContent import io.netty.util.AttributeKey import objects.Environment import proto.car.LocationP -import setRouteUrl -import java.util.* /** * Created by user on 7/8/16. @@ -22,25 +20,24 @@ class ClientHandler : SimpleChannelInboundHandler { override fun channelReadComplete(ctx: ChannelHandlerContext) { val url = ctx.channel().attr(AttributeKey.valueOf("url")).get() - val carUid = ctx.channel().attr(AttributeKey.valueOf("uid")).get() + val carUid = ctx.channel().attr(AttributeKey.valueOf("uid")).get() val environment = Environment.instance when (url) { - setRouteUrl -> { - - } getLocationUrl -> { - try { - val data = LocationP.Location.parseFrom(contentBytes) - synchronized(environment, { - val car = environment.map.get(carUid) - if (car != null) { - car.x = data.x - car.y = data.y - } - }) + val response = LocationP.Location.parseFrom(contentBytes); + + if (response.responseCase == LocationP.Location.ResponseCase.LOCATIONRESPONSE) { + val data = response.locationResponse + synchronized(environment, { + val car = environment.map.get(carUid) + if (car != null) { + car.x = data.x + car.y = data.y + } + }) + } } catch (e: InvalidProtocolBufferException) { - //todo error answer } } else -> { diff --git a/server/src/car/server/Handler.kt b/server/src/car/server/Handler.kt index 6f62d455e0c..f935927579d 100644 --- a/server/src/car/server/Handler.kt +++ b/server/src/car/server/Handler.kt @@ -27,15 +27,14 @@ class Handler : SimpleChannelInboundHandler() { val environment = Environment.instance var success = true; - - var answer:ByteArray = ByteArray(0) + var answer: ByteArray = ByteArray(0) when (url) { connectUrl -> { var data: ConnectionRequest? = null try { data = ConnectionRequest.parseFrom(contentBytes) } catch (e: InvalidProtocolBufferException) { - //todo error answer + success = false; } if (data != null) { val uid = environment.connectCar(data.ip, data.port) @@ -47,7 +46,7 @@ class Handler : SimpleChannelInboundHandler() { try { data = RouteDone.parseFrom(contentBytes) } catch (e: InvalidProtocolBufferException) { - //todo error answer + success = false; } if (data != null) { val id = data.uid @@ -63,11 +62,9 @@ class Handler : SimpleChannelInboundHandler() { } else -> { success = false - //todo unsup operation. error answer } } - - val response = DefaultFullHttpResponse(HttpVersion.HTTP_1_1, if (success) HttpResponseStatus.OK else HttpResponseStatus.NOT_FOUND, Unpooled.copiedBuffer(answer)) + val response = DefaultFullHttpResponse(HttpVersion.HTTP_1_1, if (success) HttpResponseStatus.OK else HttpResponseStatus.BAD_REQUEST, Unpooled.copiedBuffer(answer)) response.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, response.content().readableBytes()) ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } diff --git a/server/src/objects/Car.kt b/server/src/objects/Car.kt index e5f6738e6e2..025bb04ad5f 100644 --- a/server/src/objects/Car.kt +++ b/server/src/objects/Car.kt @@ -5,9 +5,9 @@ import car.client.Client /** * Created by user on 7/7/16. */ -class Car constructor(id: String, host: String, port: Int) { +class Car constructor(uid: Int, host: String, port: Int) { - val id: String + val uid: Int val host: String val port: Int @@ -17,7 +17,7 @@ class Car constructor(id: String, host: String, port: Int) { var y: Double init { - this.id = id + this.uid = uid this.host = host this.port = port this.free = true @@ -26,6 +26,6 @@ class Car constructor(id: String, host: String, port: Int) { } override fun toString(): String { - return "$id ; x:$x; y:$y" + return "$uid ; x:$x; y:$y" } } \ No newline at end of file diff --git a/server/src/objects/Environment.kt b/server/src/objects/Environment.kt index 00468f5298c..69b3dc5b5c6 100644 --- a/server/src/objects/Environment.kt +++ b/server/src/objects/Environment.kt @@ -7,7 +7,7 @@ import java.util.* */ class Environment private constructor() { - val map: MutableMap + val map: MutableMap companion object { @@ -19,20 +19,20 @@ class Environment private constructor() { } @Synchronized - fun connectCar(host:String, port:Int):String { + fun connectCar(host:String, port:Int):Int { //todo учетка памяти, тут машинки добавляются,но никогда не удаляются. Если включать и выключать одну и ту же машинку, то либо сервер зациклится, либо out of memory //todo в зависимости от того, что кончится раньше, память или айдишники:) Может сделать поток, который мониторит раз в N минут все машинки и дропает те, которые не активны более какого-то времени? var unique = false val random = Random() - var stringUid = "" + var uid:Int = 0 while (!unique) { - stringUid = "id:" + random.nextInt(1000000) - if (map.get(stringUid) == null) { + uid = random.nextInt(1000000) + if (map.get(uid) == null) { unique = true; } } - map.put(stringUid, Car(stringUid, host, port)) - return stringUid + map.put(uid, Car(uid, host, port)) + return uid } diff --git a/server/src/proto/car/ConnectP.java b/server/src/proto/car/ConnectP.java index f4b42e29bbb..3198c292b29 100644 --- a/server/src/proto/car/ConnectP.java +++ b/server/src/proto/car/ConnectP.java @@ -518,14 +518,20 @@ public final class ConnectP { com.google.protobuf.MessageOrBuilder { /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - java.lang.String getUid(); + proto.car.ErrorP.Error getError(); /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - com.google.protobuf.ByteString - getUidBytes(); + proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder(); + + /** + * optional int32 uid = 1; + */ + int getUid(); + + public proto.car.ConnectP.ConnectionResponse.ResponseCase getResponseCase(); } /** * Protobuf type {@code carkot.ConnectionResponse} @@ -539,7 +545,6 @@ public final class ConnectP { super(builder); } private ConnectionResponse() { - uid_ = ""; } @java.lang.Override @@ -567,10 +572,23 @@ public final class ConnectP { } break; } - case 10: { - java.lang.String s = input.readStringRequireUtf8(); - - uid_ = s; + case 8: { + responseCase_ = 1; + response_ = input.readInt32(); + break; + } + case 18: { + proto.car.ErrorP.Error.Builder subBuilder = null; + if (responseCase_ == 2) { + subBuilder = ((proto.car.ErrorP.Error) response_).toBuilder(); + } + response_ = + input.readMessage(proto.car.ErrorP.Error.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((proto.car.ErrorP.Error) response_); + response_ = subBuilder.buildPartial(); + } + responseCase_ = 2; break; } } @@ -596,38 +614,73 @@ public final class ConnectP { proto.car.ConnectP.ConnectionResponse.class, proto.car.ConnectP.ConnectionResponse.Builder.class); } - public static final int UID_FIELD_NUMBER = 1; - private volatile java.lang.Object uid_; - /** - * optional string uid = 1; - */ - public java.lang.String getUid() { - java.lang.Object ref = uid_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uid_ = s; - return s; + private int responseCase_ = 0; + private java.lang.Object response_; + public enum ResponseCase + implements com.google.protobuf.Internal.EnumLite { + ERROR(2), + UID(1), + RESPONSE_NOT_SET(0); + private final int value; + private ResponseCase(int value) { + this.value = value; } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ResponseCase valueOf(int value) { + return forNumber(value); + } + + public static ResponseCase forNumber(int value) { + switch (value) { + case 2: return ERROR; + case 1: return UID; + case 0: return RESPONSE_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public ResponseCase + getResponseCase() { + return ResponseCase.forNumber( + responseCase_); + } + + public static final int ERROR_FIELD_NUMBER = 2; + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.Error getError() { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); } /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - public com.google.protobuf.ByteString - getUidBytes() { - java.lang.Object ref = uid_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; + public proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder() { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; } + return proto.car.ErrorP.Error.getDefaultInstance(); + } + + public static final int UID_FIELD_NUMBER = 1; + /** + * optional int32 uid = 1; + */ + public int getUid() { + if (responseCase_ == 1) { + return (java.lang.Integer) response_; + } + return 0; } private byte memoizedIsInitialized = -1; @@ -642,8 +695,12 @@ public final class ConnectP { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getUidBytes().isEmpty()) { - com.google.protobuf.GeneratedMessage.writeString(output, 1, uid_); + if (responseCase_ == 1) { + output.writeInt32( + 1, (int)((java.lang.Integer) response_)); + } + if (responseCase_ == 2) { + output.writeMessage(2, (proto.car.ErrorP.Error) response_); } } @@ -652,8 +709,14 @@ public final class ConnectP { if (size != -1) return size; size = 0; - if (!getUidBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessage.computeStringSize(1, uid_); + if (responseCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size( + 1, (int)((java.lang.Integer) response_)); + } + if (responseCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (proto.car.ErrorP.Error) response_); } memoizedSize = size; return size; @@ -772,8 +835,8 @@ public final class ConnectP { } public Builder clear() { super.clear(); - uid_ = ""; - + responseCase_ = 0; + response_ = null; return this; } @@ -796,7 +859,17 @@ public final class ConnectP { public proto.car.ConnectP.ConnectionResponse buildPartial() { proto.car.ConnectP.ConnectionResponse result = new proto.car.ConnectP.ConnectionResponse(this); - result.uid_ = uid_; + if (responseCase_ == 2) { + if (errorBuilder_ == null) { + result.response_ = response_; + } else { + result.response_ = errorBuilder_.build(); + } + } + if (responseCase_ == 1) { + result.response_ = response_; + } + result.responseCase_ = responseCase_; onBuilt(); return result; } @@ -812,9 +885,18 @@ public final class ConnectP { public Builder mergeFrom(proto.car.ConnectP.ConnectionResponse other) { if (other == proto.car.ConnectP.ConnectionResponse.getDefaultInstance()) return this; - if (!other.getUid().isEmpty()) { - uid_ = other.uid_; - onChanged(); + switch (other.getResponseCase()) { + case ERROR: { + mergeError(other.getError()); + break; + } + case UID: { + setUid(other.getUid()); + break; + } + case RESPONSE_NOT_SET: { + break; + } } onChanged(); return this; @@ -841,73 +923,179 @@ public final class ConnectP { } return this; } + private int responseCase_ = 0; + private java.lang.Object response_; + public ResponseCase + getResponseCase() { + return ResponseCase.forNumber( + responseCase_); + } - private java.lang.Object uid_ = ""; + public Builder clearResponse() { + responseCase_ = 0; + response_ = null; + onChanged(); + return this; + } + + + private com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder> errorBuilder_; /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - public java.lang.String getUid() { - java.lang.Object ref = uid_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uid_ = s; - return s; + public proto.car.ErrorP.Error getError() { + if (errorBuilder_ == null) { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); } else { - return (java.lang.String) ref; + if (responseCase_ == 2) { + return errorBuilder_.getMessage(); + } + return proto.car.ErrorP.Error.getDefaultInstance(); } } /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - public com.google.protobuf.ByteString - getUidBytes() { - java.lang.Object ref = uid_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uid_ = b; - return b; + public Builder setError(proto.car.ErrorP.Error value) { + if (errorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + errorBuilder_.setMessage(value); + } + responseCase_ = 2; + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public Builder setError( + proto.car.ErrorP.Error.Builder builderForValue) { + if (errorBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + errorBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 2; + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public Builder mergeError(proto.car.ErrorP.Error value) { + if (errorBuilder_ == null) { + if (responseCase_ == 2 && + response_ != proto.car.ErrorP.Error.getDefaultInstance()) { + response_ = proto.car.ErrorP.Error.newBuilder((proto.car.ErrorP.Error) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 2) { + errorBuilder_.mergeFrom(value); + } + errorBuilder_.setMessage(value); + } + responseCase_ = 2; + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public Builder clearError() { + if (errorBuilder_ == null) { + if (responseCase_ == 2) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 2) { + responseCase_ = 0; + response_ = null; + } + errorBuilder_.clear(); + } + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.Error.Builder getErrorBuilder() { + return getErrorFieldBuilder().getBuilder(); + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder() { + if ((responseCase_ == 2) && (errorBuilder_ != null)) { + return errorBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); } } /** - * optional string uid = 1; + * optional .carkot.Error error = 2; */ - public Builder setUid( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - uid_ = value; + private com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder> + getErrorFieldBuilder() { + if (errorBuilder_ == null) { + if (!(responseCase_ == 2)) { + response_ = proto.car.ErrorP.Error.getDefaultInstance(); + } + errorBuilder_ = new com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder>( + (proto.car.ErrorP.Error) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 2; + onChanged();; + return errorBuilder_; + } + + /** + * optional int32 uid = 1; + */ + public int getUid() { + if (responseCase_ == 1) { + return (java.lang.Integer) response_; + } + return 0; + } + /** + * optional int32 uid = 1; + */ + public Builder setUid(int value) { + responseCase_ = 1; + response_ = value; onChanged(); return this; } /** - * optional string uid = 1; + * optional int32 uid = 1; */ public Builder clearUid() { - - uid_ = getDefaultInstance().getUid(); - onChanged(); - return this; - } - /** - * optional string uid = 1; - */ - public Builder setUidBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - uid_ = value; - onChanged(); + if (responseCase_ == 1) { + responseCase_ = 0; + response_ = null; + onChanged(); + } return this; } public final Builder setUnknownFields( @@ -978,10 +1166,11 @@ public final class ConnectP { descriptor; static { java.lang.String[] descriptorData = { - "\n\rconnect.proto\022\006carkot\"-\n\021ConnectionReq" + - "uest\022\n\n\002ip\030\001 \001(\t\022\014\n\004port\030\002 \001(\005\"!\n\022Connec" + - "tionResponse\022\013\n\003uid\030\001 \001(\tB\025\n\tproto.carB\010" + - "ConnectPb\006proto3" + "\n\rconnect.proto\022\006carkot\032\013error.proto\"-\n\021" + + "ConnectionRequest\022\n\n\002ip\030\001 \001(\t\022\014\n\004port\030\002 " + + "\001(\005\"O\n\022ConnectionResponse\022\036\n\005error\030\002 \001(\013" + + "2\r.carkot.ErrorH\000\022\r\n\003uid\030\001 \001(\005H\000B\n\n\010resp" + + "onseB\025\n\tproto.carB\010ConnectPb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -994,6 +1183,7 @@ public final class ConnectP { com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + proto.car.ErrorP.getDescriptor(), }, assigner); internal_static_carkot_ConnectionRequest_descriptor = getDescriptor().getMessageTypes().get(0); @@ -1006,7 +1196,8 @@ public final class ConnectP { internal_static_carkot_ConnectionResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_carkot_ConnectionResponse_descriptor, - new java.lang.String[] { "Uid", }); + new java.lang.String[] { "Error", "Uid", "Response", }); + proto.car.ErrorP.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/server/src/proto/car/ErrorP.java b/server/src/proto/car/ErrorP.java new file mode 100644 index 00000000000..2f2a71e4667 --- /dev/null +++ b/server/src/proto/car/ErrorP.java @@ -0,0 +1,555 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: error.proto + +package proto.car; + +public final class ErrorP { + private ErrorP() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface ErrorOrBuilder extends + // @@protoc_insertion_point(interface_extends:carkot.Error) + com.google.protobuf.MessageOrBuilder { + + /** + * optional string errorMessage = 1; + */ + java.lang.String getErrorMessage(); + /** + * optional string errorMessage = 1; + */ + com.google.protobuf.ByteString + getErrorMessageBytes(); + + /** + * optional int32 errorCode = 2; + */ + int getErrorCode(); + } + /** + * Protobuf type {@code carkot.Error} + */ + public static final class Error extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:carkot.Error) + ErrorOrBuilder { + // Use Error.newBuilder() to construct. + private Error(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Error() { + errorMessage_ = ""; + errorCode_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private Error( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + errorMessage_ = s; + break; + } + case 16: { + + errorCode_ = input.readInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return proto.car.ErrorP.internal_static_carkot_Error_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return proto.car.ErrorP.internal_static_carkot_Error_fieldAccessorTable + .ensureFieldAccessorsInitialized( + proto.car.ErrorP.Error.class, proto.car.ErrorP.Error.Builder.class); + } + + public static final int ERRORMESSAGE_FIELD_NUMBER = 1; + private volatile java.lang.Object errorMessage_; + /** + * optional string errorMessage = 1; + */ + public java.lang.String getErrorMessage() { + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } + } + /** + * optional string errorMessage = 1; + */ + public com.google.protobuf.ByteString + getErrorMessageBytes() { + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ERRORCODE_FIELD_NUMBER = 2; + private int errorCode_; + /** + * optional int32 errorCode = 2; + */ + public int getErrorCode() { + return errorCode_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getErrorMessageBytes().isEmpty()) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, errorMessage_); + } + if (errorCode_ != 0) { + output.writeInt32(2, errorCode_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getErrorMessageBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, errorMessage_); + } + if (errorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, errorCode_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + public static proto.car.ErrorP.Error parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static proto.car.ErrorP.Error parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static proto.car.ErrorP.Error parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static proto.car.ErrorP.Error parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static proto.car.ErrorP.Error parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static proto.car.ErrorP.Error parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static proto.car.ErrorP.Error parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + public static proto.car.ErrorP.Error parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static proto.car.ErrorP.Error parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static proto.car.ErrorP.Error parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(proto.car.ErrorP.Error prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code carkot.Error} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:carkot.Error) + proto.car.ErrorP.ErrorOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return proto.car.ErrorP.internal_static_carkot_Error_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return proto.car.ErrorP.internal_static_carkot_Error_fieldAccessorTable + .ensureFieldAccessorsInitialized( + proto.car.ErrorP.Error.class, proto.car.ErrorP.Error.Builder.class); + } + + // Construct using proto.car.ErrorP.Error.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + errorMessage_ = ""; + + errorCode_ = 0; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return proto.car.ErrorP.internal_static_carkot_Error_descriptor; + } + + public proto.car.ErrorP.Error getDefaultInstanceForType() { + return proto.car.ErrorP.Error.getDefaultInstance(); + } + + public proto.car.ErrorP.Error build() { + proto.car.ErrorP.Error result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public proto.car.ErrorP.Error buildPartial() { + proto.car.ErrorP.Error result = new proto.car.ErrorP.Error(this); + result.errorMessage_ = errorMessage_; + result.errorCode_ = errorCode_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof proto.car.ErrorP.Error) { + return mergeFrom((proto.car.ErrorP.Error)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(proto.car.ErrorP.Error other) { + if (other == proto.car.ErrorP.Error.getDefaultInstance()) return this; + if (!other.getErrorMessage().isEmpty()) { + errorMessage_ = other.errorMessage_; + onChanged(); + } + if (other.getErrorCode() != 0) { + setErrorCode(other.getErrorCode()); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + proto.car.ErrorP.Error parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (proto.car.ErrorP.Error) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object errorMessage_ = ""; + /** + * optional string errorMessage = 1; + */ + public java.lang.String getErrorMessage() { + java.lang.Object ref = errorMessage_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string errorMessage = 1; + */ + public com.google.protobuf.ByteString + getErrorMessageBytes() { + java.lang.Object ref = errorMessage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string errorMessage = 1; + */ + public Builder setErrorMessage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + errorMessage_ = value; + onChanged(); + return this; + } + /** + * optional string errorMessage = 1; + */ + public Builder clearErrorMessage() { + + errorMessage_ = getDefaultInstance().getErrorMessage(); + onChanged(); + return this; + } + /** + * optional string errorMessage = 1; + */ + public Builder setErrorMessageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + errorMessage_ = value; + onChanged(); + return this; + } + + private int errorCode_ ; + /** + * optional int32 errorCode = 2; + */ + public int getErrorCode() { + return errorCode_; + } + /** + * optional int32 errorCode = 2; + */ + public Builder setErrorCode(int value) { + + errorCode_ = value; + onChanged(); + return this; + } + /** + * optional int32 errorCode = 2; + */ + public Builder clearErrorCode() { + + errorCode_ = 0; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:carkot.Error) + } + + // @@protoc_insertion_point(class_scope:carkot.Error) + private static final proto.car.ErrorP.Error DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new proto.car.ErrorP.Error(); + } + + public static proto.car.ErrorP.Error getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public Error parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Error(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public proto.car.ErrorP.Error getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_carkot_Error_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_carkot_Error_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\013error.proto\022\006carkot\"0\n\005Error\022\024\n\014errorM" + + "essage\030\001 \001(\t\022\021\n\terrorCode\030\002 \001(\005B\023\n\tproto" + + ".carB\006ErrorPb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_carkot_Error_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_carkot_Error_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_carkot_Error_descriptor, + new java.lang.String[] { "ErrorMessage", "ErrorCode", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/server/src/proto/car/LocationP.java b/server/src/proto/car/LocationP.java index 1a7c61d8a9d..cd5c32827b8 100644 --- a/server/src/proto/car/LocationP.java +++ b/server/src/proto/car/LocationP.java @@ -13,19 +13,24 @@ public final class LocationP { com.google.protobuf.MessageOrBuilder { /** - * optional double x = 1; + * optional .carkot.Error error = 2; */ - double getX(); + proto.car.ErrorP.Error getError(); + /** + * optional .carkot.Error error = 2; + */ + proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder(); /** - * optional double y = 2; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - double getY(); - + proto.car.LocationP.Location.LocationResponse getLocationResponse(); /** - * optional double angle = 3; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - double getAngle(); + proto.car.LocationP.Location.LocationResponseOrBuilder getLocationResponseOrBuilder(); + + public proto.car.LocationP.Location.ResponseCase getResponseCase(); } /** * Protobuf type {@code carkot.Location} @@ -39,9 +44,6 @@ public final class LocationP { super(builder); } private Location() { - x_ = 0D; - y_ = 0D; - angle_ = 0D; } @java.lang.Override @@ -69,19 +71,32 @@ public final class LocationP { } break; } - case 9: { - - x_ = input.readDouble(); + case 10: { + proto.car.LocationP.Location.LocationResponse.Builder subBuilder = null; + if (responseCase_ == 1) { + subBuilder = ((proto.car.LocationP.Location.LocationResponse) response_).toBuilder(); + } + response_ = + input.readMessage(proto.car.LocationP.Location.LocationResponse.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((proto.car.LocationP.Location.LocationResponse) response_); + response_ = subBuilder.buildPartial(); + } + responseCase_ = 1; break; } - case 17: { - - y_ = input.readDouble(); - break; - } - case 25: { - - angle_ = input.readDouble(); + case 18: { + proto.car.ErrorP.Error.Builder subBuilder = null; + if (responseCase_ == 2) { + subBuilder = ((proto.car.ErrorP.Error) response_).toBuilder(); + } + response_ = + input.readMessage(proto.car.ErrorP.Error.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((proto.car.ErrorP.Error) response_); + response_ = subBuilder.buildPartial(); + } + responseCase_ = 2; break; } } @@ -107,31 +122,572 @@ public final class LocationP { proto.car.LocationP.Location.class, proto.car.LocationP.Location.Builder.class); } - public static final int X_FIELD_NUMBER = 1; - private double x_; + public interface LocationResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:carkot.Location.LocationResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * optional double x = 1; + */ + double getX(); + + /** + * optional double y = 2; + */ + double getY(); + + /** + * optional double angle = 3; + */ + double getAngle(); + } /** - * optional double x = 1; + * Protobuf type {@code carkot.Location.LocationResponse} */ - public double getX() { - return x_; + public static final class LocationResponse extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:carkot.Location.LocationResponse) + LocationResponseOrBuilder { + // Use LocationResponse.newBuilder() to construct. + private LocationResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private LocationResponse() { + x_ = 0D; + y_ = 0D; + angle_ = 0D; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private LocationResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 9: { + + x_ = input.readDouble(); + break; + } + case 17: { + + y_ = input.readDouble(); + break; + } + case 25: { + + angle_ = input.readDouble(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + proto.car.LocationP.Location.LocationResponse.class, proto.car.LocationP.Location.LocationResponse.Builder.class); + } + + public static final int X_FIELD_NUMBER = 1; + private double x_; + /** + * optional double x = 1; + */ + public double getX() { + return x_; + } + + public static final int Y_FIELD_NUMBER = 2; + private double y_; + /** + * optional double y = 2; + */ + public double getY() { + return y_; + } + + public static final int ANGLE_FIELD_NUMBER = 3; + private double angle_; + /** + * optional double angle = 3; + */ + public double getAngle() { + return angle_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (x_ != 0D) { + output.writeDouble(1, x_); + } + if (y_ != 0D) { + output.writeDouble(2, y_); + } + if (angle_ != 0D) { + output.writeDouble(3, angle_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (x_ != 0D) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(1, x_); + } + if (y_ != 0D) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(2, y_); + } + if (angle_ != 0D) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(3, angle_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + public static proto.car.LocationP.Location.LocationResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static proto.car.LocationP.Location.LocationResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + public static proto.car.LocationP.Location.LocationResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static proto.car.LocationP.Location.LocationResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(proto.car.LocationP.Location.LocationResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code carkot.Location.LocationResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:carkot.Location.LocationResponse) + proto.car.LocationP.Location.LocationResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + proto.car.LocationP.Location.LocationResponse.class, proto.car.LocationP.Location.LocationResponse.Builder.class); + } + + // Construct using proto.car.LocationP.Location.LocationResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + x_ = 0D; + + y_ = 0D; + + angle_ = 0D; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return proto.car.LocationP.internal_static_carkot_Location_LocationResponse_descriptor; + } + + public proto.car.LocationP.Location.LocationResponse getDefaultInstanceForType() { + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } + + public proto.car.LocationP.Location.LocationResponse build() { + proto.car.LocationP.Location.LocationResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public proto.car.LocationP.Location.LocationResponse buildPartial() { + proto.car.LocationP.Location.LocationResponse result = new proto.car.LocationP.Location.LocationResponse(this); + result.x_ = x_; + result.y_ = y_; + result.angle_ = angle_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof proto.car.LocationP.Location.LocationResponse) { + return mergeFrom((proto.car.LocationP.Location.LocationResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(proto.car.LocationP.Location.LocationResponse other) { + if (other == proto.car.LocationP.Location.LocationResponse.getDefaultInstance()) return this; + if (other.getX() != 0D) { + setX(other.getX()); + } + if (other.getY() != 0D) { + setY(other.getY()); + } + if (other.getAngle() != 0D) { + setAngle(other.getAngle()); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + proto.car.LocationP.Location.LocationResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (proto.car.LocationP.Location.LocationResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private double x_ ; + /** + * optional double x = 1; + */ + public double getX() { + return x_; + } + /** + * optional double x = 1; + */ + public Builder setX(double value) { + + x_ = value; + onChanged(); + return this; + } + /** + * optional double x = 1; + */ + public Builder clearX() { + + x_ = 0D; + onChanged(); + return this; + } + + private double y_ ; + /** + * optional double y = 2; + */ + public double getY() { + return y_; + } + /** + * optional double y = 2; + */ + public Builder setY(double value) { + + y_ = value; + onChanged(); + return this; + } + /** + * optional double y = 2; + */ + public Builder clearY() { + + y_ = 0D; + onChanged(); + return this; + } + + private double angle_ ; + /** + * optional double angle = 3; + */ + public double getAngle() { + return angle_; + } + /** + * optional double angle = 3; + */ + public Builder setAngle(double value) { + + angle_ = value; + onChanged(); + return this; + } + /** + * optional double angle = 3; + */ + public Builder clearAngle() { + + angle_ = 0D; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:carkot.Location.LocationResponse) + } + + // @@protoc_insertion_point(class_scope:carkot.Location.LocationResponse) + private static final proto.car.LocationP.Location.LocationResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new proto.car.LocationP.Location.LocationResponse(); + } + + public static proto.car.LocationP.Location.LocationResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public LocationResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LocationResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public proto.car.LocationP.Location.LocationResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } - public static final int Y_FIELD_NUMBER = 2; - private double y_; - /** - * optional double y = 2; - */ - public double getY() { - return y_; + private int responseCase_ = 0; + private java.lang.Object response_; + public enum ResponseCase + implements com.google.protobuf.Internal.EnumLite { + ERROR(2), + LOCATIONRESPONSE(1), + RESPONSE_NOT_SET(0); + private final int value; + private ResponseCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ResponseCase valueOf(int value) { + return forNumber(value); + } + + public static ResponseCase forNumber(int value) { + switch (value) { + case 2: return ERROR; + case 1: return LOCATIONRESPONSE; + case 0: return RESPONSE_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public ResponseCase + getResponseCase() { + return ResponseCase.forNumber( + responseCase_); } - public static final int ANGLE_FIELD_NUMBER = 3; - private double angle_; + public static final int ERROR_FIELD_NUMBER = 2; /** - * optional double angle = 3; + * optional .carkot.Error error = 2; */ - public double getAngle() { - return angle_; + public proto.car.ErrorP.Error getError() { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder() { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } + + public static final int LOCATIONRESPONSE_FIELD_NUMBER = 1; + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public proto.car.LocationP.Location.LocationResponse getLocationResponse() { + if (responseCase_ == 1) { + return (proto.car.LocationP.Location.LocationResponse) response_; + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public proto.car.LocationP.Location.LocationResponseOrBuilder getLocationResponseOrBuilder() { + if (responseCase_ == 1) { + return (proto.car.LocationP.Location.LocationResponse) response_; + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @@ -146,14 +702,11 @@ public final class LocationP { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (x_ != 0D) { - output.writeDouble(1, x_); + if (responseCase_ == 1) { + output.writeMessage(1, (proto.car.LocationP.Location.LocationResponse) response_); } - if (y_ != 0D) { - output.writeDouble(2, y_); - } - if (angle_ != 0D) { - output.writeDouble(3, angle_); + if (responseCase_ == 2) { + output.writeMessage(2, (proto.car.ErrorP.Error) response_); } } @@ -162,17 +715,13 @@ public final class LocationP { if (size != -1) return size; size = 0; - if (x_ != 0D) { + if (responseCase_ == 1) { size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(1, x_); + .computeMessageSize(1, (proto.car.LocationP.Location.LocationResponse) response_); } - if (y_ != 0D) { + if (responseCase_ == 2) { size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(2, y_); - } - if (angle_ != 0D) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(3, angle_); + .computeMessageSize(2, (proto.car.ErrorP.Error) response_); } memoizedSize = size; return size; @@ -291,12 +840,8 @@ public final class LocationP { } public Builder clear() { super.clear(); - x_ = 0D; - - y_ = 0D; - - angle_ = 0D; - + responseCase_ = 0; + response_ = null; return this; } @@ -319,9 +864,21 @@ public final class LocationP { public proto.car.LocationP.Location buildPartial() { proto.car.LocationP.Location result = new proto.car.LocationP.Location(this); - result.x_ = x_; - result.y_ = y_; - result.angle_ = angle_; + if (responseCase_ == 2) { + if (errorBuilder_ == null) { + result.response_ = response_; + } else { + result.response_ = errorBuilder_.build(); + } + } + if (responseCase_ == 1) { + if (locationResponseBuilder_ == null) { + result.response_ = response_; + } else { + result.response_ = locationResponseBuilder_.build(); + } + } + result.responseCase_ = responseCase_; onBuilt(); return result; } @@ -337,14 +894,18 @@ public final class LocationP { public Builder mergeFrom(proto.car.LocationP.Location other) { if (other == proto.car.LocationP.Location.getDefaultInstance()) return this; - if (other.getX() != 0D) { - setX(other.getX()); - } - if (other.getY() != 0D) { - setY(other.getY()); - } - if (other.getAngle() != 0D) { - setAngle(other.getAngle()); + switch (other.getResponseCase()) { + case ERROR: { + mergeError(other.getError()); + break; + } + case LOCATIONRESPONSE: { + mergeLocationResponse(other.getLocationResponse()); + break; + } + case RESPONSE_NOT_SET: { + break; + } } onChanged(); return this; @@ -371,84 +932,281 @@ public final class LocationP { } return this; } + private int responseCase_ = 0; + private java.lang.Object response_; + public ResponseCase + getResponseCase() { + return ResponseCase.forNumber( + responseCase_); + } - private double x_ ; - /** - * optional double x = 1; - */ - public double getX() { - return x_; - } - /** - * optional double x = 1; - */ - public Builder setX(double value) { - - x_ = value; - onChanged(); - return this; - } - /** - * optional double x = 1; - */ - public Builder clearX() { - - x_ = 0D; + public Builder clearResponse() { + responseCase_ = 0; + response_ = null; onChanged(); return this; } - private double y_ ; + + private com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder> errorBuilder_; /** - * optional double y = 2; + * optional .carkot.Error error = 2; */ - public double getY() { - return y_; + public proto.car.ErrorP.Error getError() { + if (errorBuilder_ == null) { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } else { + if (responseCase_ == 2) { + return errorBuilder_.getMessage(); + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } } /** - * optional double y = 2; + * optional .carkot.Error error = 2; */ - public Builder setY(double value) { - - y_ = value; - onChanged(); + public Builder setError(proto.car.ErrorP.Error value) { + if (errorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); + } else { + errorBuilder_.setMessage(value); + } + responseCase_ = 2; return this; } /** - * optional double y = 2; + * optional .carkot.Error error = 2; */ - public Builder clearY() { - - y_ = 0D; - onChanged(); + public Builder setError( + proto.car.ErrorP.Error.Builder builderForValue) { + if (errorBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + errorBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 2; return this; } + /** + * optional .carkot.Error error = 2; + */ + public Builder mergeError(proto.car.ErrorP.Error value) { + if (errorBuilder_ == null) { + if (responseCase_ == 2 && + response_ != proto.car.ErrorP.Error.getDefaultInstance()) { + response_ = proto.car.ErrorP.Error.newBuilder((proto.car.ErrorP.Error) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 2) { + errorBuilder_.mergeFrom(value); + } + errorBuilder_.setMessage(value); + } + responseCase_ = 2; + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public Builder clearError() { + if (errorBuilder_ == null) { + if (responseCase_ == 2) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 2) { + responseCase_ = 0; + response_ = null; + } + errorBuilder_.clear(); + } + return this; + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.Error.Builder getErrorBuilder() { + return getErrorFieldBuilder().getBuilder(); + } + /** + * optional .carkot.Error error = 2; + */ + public proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder() { + if ((responseCase_ == 2) && (errorBuilder_ != null)) { + return errorBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 2) { + return (proto.car.ErrorP.Error) response_; + } + return proto.car.ErrorP.Error.getDefaultInstance(); + } + } + /** + * optional .carkot.Error error = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder> + getErrorFieldBuilder() { + if (errorBuilder_ == null) { + if (!(responseCase_ == 2)) { + response_ = proto.car.ErrorP.Error.getDefaultInstance(); + } + errorBuilder_ = new com.google.protobuf.SingleFieldBuilder< + proto.car.ErrorP.Error, proto.car.ErrorP.Error.Builder, proto.car.ErrorP.ErrorOrBuilder>( + (proto.car.ErrorP.Error) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 2; + onChanged();; + return errorBuilder_; + } - private double angle_ ; + private com.google.protobuf.SingleFieldBuilder< + proto.car.LocationP.Location.LocationResponse, proto.car.LocationP.Location.LocationResponse.Builder, proto.car.LocationP.Location.LocationResponseOrBuilder> locationResponseBuilder_; /** - * optional double angle = 3; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - public double getAngle() { - return angle_; + public proto.car.LocationP.Location.LocationResponse getLocationResponse() { + if (locationResponseBuilder_ == null) { + if (responseCase_ == 1) { + return (proto.car.LocationP.Location.LocationResponse) response_; + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } else { + if (responseCase_ == 1) { + return locationResponseBuilder_.getMessage(); + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } } /** - * optional double angle = 3; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - public Builder setAngle(double value) { - - angle_ = value; - onChanged(); + public Builder setLocationResponse(proto.car.LocationP.Location.LocationResponse value) { + if (locationResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + response_ = value; + onChanged(); + } else { + locationResponseBuilder_.setMessage(value); + } + responseCase_ = 1; return this; } /** - * optional double angle = 3; + * optional .carkot.Location.LocationResponse locationResponse = 1; */ - public Builder clearAngle() { - - angle_ = 0D; - onChanged(); + public Builder setLocationResponse( + proto.car.LocationP.Location.LocationResponse.Builder builderForValue) { + if (locationResponseBuilder_ == null) { + response_ = builderForValue.build(); + onChanged(); + } else { + locationResponseBuilder_.setMessage(builderForValue.build()); + } + responseCase_ = 1; return this; } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public Builder mergeLocationResponse(proto.car.LocationP.Location.LocationResponse value) { + if (locationResponseBuilder_ == null) { + if (responseCase_ == 1 && + response_ != proto.car.LocationP.Location.LocationResponse.getDefaultInstance()) { + response_ = proto.car.LocationP.Location.LocationResponse.newBuilder((proto.car.LocationP.Location.LocationResponse) response_) + .mergeFrom(value).buildPartial(); + } else { + response_ = value; + } + onChanged(); + } else { + if (responseCase_ == 1) { + locationResponseBuilder_.mergeFrom(value); + } + locationResponseBuilder_.setMessage(value); + } + responseCase_ = 1; + return this; + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public Builder clearLocationResponse() { + if (locationResponseBuilder_ == null) { + if (responseCase_ == 1) { + responseCase_ = 0; + response_ = null; + onChanged(); + } + } else { + if (responseCase_ == 1) { + responseCase_ = 0; + response_ = null; + } + locationResponseBuilder_.clear(); + } + return this; + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public proto.car.LocationP.Location.LocationResponse.Builder getLocationResponseBuilder() { + return getLocationResponseFieldBuilder().getBuilder(); + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + public proto.car.LocationP.Location.LocationResponseOrBuilder getLocationResponseOrBuilder() { + if ((responseCase_ == 1) && (locationResponseBuilder_ != null)) { + return locationResponseBuilder_.getMessageOrBuilder(); + } else { + if (responseCase_ == 1) { + return (proto.car.LocationP.Location.LocationResponse) response_; + } + return proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } + } + /** + * optional .carkot.Location.LocationResponse locationResponse = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + proto.car.LocationP.Location.LocationResponse, proto.car.LocationP.Location.LocationResponse.Builder, proto.car.LocationP.Location.LocationResponseOrBuilder> + getLocationResponseFieldBuilder() { + if (locationResponseBuilder_ == null) { + if (!(responseCase_ == 1)) { + response_ = proto.car.LocationP.Location.LocationResponse.getDefaultInstance(); + } + locationResponseBuilder_ = new com.google.protobuf.SingleFieldBuilder< + proto.car.LocationP.Location.LocationResponse, proto.car.LocationP.Location.LocationResponse.Builder, proto.car.LocationP.Location.LocationResponseOrBuilder>( + (proto.car.LocationP.Location.LocationResponse) response_, + getParentForChildren(), + isClean()); + response_ = null; + } + responseCase_ = 1; + onChanged();; + return locationResponseBuilder_; + } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; @@ -503,6 +1261,11 @@ public final class LocationP { private static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_carkot_Location_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_carkot_Location_LocationResponse_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_carkot_Location_LocationResponse_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -512,9 +1275,13 @@ public final class LocationP { descriptor; static { java.lang.String[] descriptorData = { - "\n\016location.proto\022\006carkot\"/\n\010Location\022\t\n\001" + - "x\030\001 \001(\001\022\t\n\001y\030\002 \001(\001\022\r\n\005angle\030\003 \001(\001B\026\n\tpro" + - "to.carB\tLocationPb\006proto3" + "\n\016location.proto\022\006carkot\032\013error.proto\"\256\001" + + "\n\010Location\022\036\n\005error\030\002 \001(\0132\r.carkot.Error" + + "H\000\022=\n\020locationResponse\030\001 \001(\0132!.carkot.Lo" + + "cation.LocationResponseH\000\0327\n\020LocationRes" + + "ponse\022\t\n\001x\030\001 \001(\001\022\t\n\001y\030\002 \001(\001\022\r\n\005angle\030\003 \001" + + "(\001B\n\n\010responseB\026\n\tproto.carB\tLocationPb\006" + + "proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -527,13 +1294,21 @@ public final class LocationP { com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + proto.car.ErrorP.getDescriptor(), }, assigner); internal_static_carkot_Location_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_carkot_Location_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_carkot_Location_descriptor, + new java.lang.String[] { "Error", "LocationResponse", "Response", }); + internal_static_carkot_Location_LocationResponse_descriptor = + internal_static_carkot_Location_descriptor.getNestedTypes().get(0); + internal_static_carkot_Location_LocationResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_carkot_Location_LocationResponse_descriptor, new java.lang.String[] { "X", "Y", "Angle", }); + proto.car.ErrorP.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/server/src/proto/car/RouteDoneP.java b/server/src/proto/car/RouteDoneP.java index 36e630de8b5..aa1c1366cf4 100644 --- a/server/src/proto/car/RouteDoneP.java +++ b/server/src/proto/car/RouteDoneP.java @@ -13,14 +13,9 @@ public final class RouteDoneP { com.google.protobuf.MessageOrBuilder { /** - * optional string uid = 1; + * optional int32 uid = 1; */ - java.lang.String getUid(); - /** - * optional string uid = 1; - */ - com.google.protobuf.ByteString - getUidBytes(); + int getUid(); } /** * Protobuf type {@code carkot.RouteDone} @@ -34,7 +29,7 @@ public final class RouteDoneP { super(builder); } private RouteDone() { - uid_ = ""; + uid_ = 0; } @java.lang.Override @@ -62,10 +57,9 @@ public final class RouteDoneP { } break; } - case 10: { - java.lang.String s = input.readStringRequireUtf8(); + case 8: { - uid_ = s; + uid_ = input.readInt32(); break; } } @@ -92,37 +86,12 @@ public final class RouteDoneP { } public static final int UID_FIELD_NUMBER = 1; - private volatile java.lang.Object uid_; + private int uid_; /** - * optional string uid = 1; + * optional int32 uid = 1; */ - public java.lang.String getUid() { - java.lang.Object ref = uid_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uid_ = s; - return s; - } - } - /** - * optional string uid = 1; - */ - public com.google.protobuf.ByteString - getUidBytes() { - java.lang.Object ref = uid_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public int getUid() { + return uid_; } private byte memoizedIsInitialized = -1; @@ -137,8 +106,8 @@ public final class RouteDoneP { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getUidBytes().isEmpty()) { - com.google.protobuf.GeneratedMessage.writeString(output, 1, uid_); + if (uid_ != 0) { + output.writeInt32(1, uid_); } } @@ -147,8 +116,9 @@ public final class RouteDoneP { if (size != -1) return size; size = 0; - if (!getUidBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessage.computeStringSize(1, uid_); + if (uid_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, uid_); } memoizedSize = size; return size; @@ -267,7 +237,7 @@ public final class RouteDoneP { } public Builder clear() { super.clear(); - uid_ = ""; + uid_ = 0; return this; } @@ -307,9 +277,8 @@ public final class RouteDoneP { public Builder mergeFrom(proto.car.RouteDoneP.RouteDone other) { if (other == proto.car.RouteDoneP.RouteDone.getDefaultInstance()) return this; - if (!other.getUid().isEmpty()) { - uid_ = other.uid_; - onChanged(); + if (other.getUid() != 0) { + setUid(other.getUid()); } onChanged(); return this; @@ -337,71 +306,28 @@ public final class RouteDoneP { return this; } - private java.lang.Object uid_ = ""; + private int uid_ ; /** - * optional string uid = 1; + * optional int32 uid = 1; */ - public java.lang.String getUid() { - java.lang.Object ref = uid_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uid_ = s; - return s; - } else { - return (java.lang.String) ref; - } + public int getUid() { + return uid_; } /** - * optional string uid = 1; + * optional int32 uid = 1; */ - public com.google.protobuf.ByteString - getUidBytes() { - java.lang.Object ref = uid_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string uid = 1; - */ - public Builder setUid( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - + public Builder setUid(int value) { + uid_ = value; onChanged(); return this; } /** - * optional string uid = 1; + * optional int32 uid = 1; */ public Builder clearUid() { - uid_ = getDefaultInstance().getUid(); - onChanged(); - return this; - } - /** - * optional string uid = 1; - */ - public Builder setUidBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - uid_ = value; + uid_ = 0; onChanged(); return this; } @@ -469,7 +395,7 @@ public final class RouteDoneP { static { java.lang.String[] descriptorData = { "\n\017routeDone.proto\022\006carkot\"\030\n\tRouteDone\022\013" + - "\n\003uid\030\001 \001(\tB\027\n\tproto.carB\nRouteDonePb\006pr" + + "\n\003uid\030\001 \001(\005B\027\n\tproto.carB\nRouteDonePb\006pr" + "oto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =