corrected protos
This commit is contained in:
@@ -59,21 +59,20 @@ fun main(args: Array<String>) {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import proto.car.RouteP.Route.WayPoint
|
||||
*/
|
||||
class ThisCar private constructor() {
|
||||
|
||||
var id = ""
|
||||
var id = 0
|
||||
|
||||
|
||||
//metr
|
||||
|
||||
@@ -21,7 +21,6 @@ class ClientHandler : SimpleChannelInboundHandler<Any> {
|
||||
var url: String = ""
|
||||
var contentBytes: ByteArray = ByteArray(0);
|
||||
|
||||
|
||||
override fun channelReadComplete(ctx: ChannelHandlerContext) {
|
||||
|
||||
val url = ctx.channel().attr(AttributeKey.valueOf<String>("url")).get()
|
||||
@@ -29,17 +28,17 @@ class ClientHandler : SimpleChannelInboundHandler<Any> {
|
||||
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()
|
||||
}
|
||||
|
||||
@@ -518,14 +518,20 @@ public final class ConnectP {
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
java.lang.String getUid();
|
||||
proto.car.ErrorP.Error getError();
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getUidBytes();
|
||||
proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder();
|
||||
|
||||
/**
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
public proto.car.ErrorP.Error getError() {
|
||||
if (responseCase_ == 2) {
|
||||
return (proto.car.ErrorP.Error) response_;
|
||||
}
|
||||
return proto.car.ErrorP.Error.getDefaultInstance();
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
public proto.car.ErrorP.Error.Builder getErrorBuilder() {
|
||||
return getErrorFieldBuilder().getBuilder();
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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_;
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
public int getUid() {
|
||||
if (responseCase_ == 1) {
|
||||
return (java.lang.Integer) response_;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
public Builder setUid(int value) {
|
||||
responseCase_ = 1;
|
||||
response_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
public Builder clearUid() {
|
||||
|
||||
uid_ = getDefaultInstance().getUid();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
java.lang.String getErrorMessage();
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getErrorMessageBytes();
|
||||
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
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<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_ = "";
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
public Builder setErrorMessage(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
errorMessage_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
public Builder clearErrorMessage() {
|
||||
|
||||
errorMessage_ = getDefaultInstance().getErrorMessage();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
public Builder setErrorMessageBytes(
|
||||
com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
checkByteStringIsUtf8(value);
|
||||
|
||||
errorMessage_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private int errorCode_ ;
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
public int getErrorCode() {
|
||||
return errorCode_;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
public Builder setErrorCode(int value) {
|
||||
|
||||
errorCode_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
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<Error>
|
||||
PARSER = new com.google.protobuf.AbstractParser<Error>() {
|
||||
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<Error> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<Error> 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)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,14 +13,9 @@ public final class RouteDoneP {
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
java.lang.String getUid();
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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_ ;
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
public Builder setUid(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
public Builder setUid(int value) {
|
||||
|
||||
uid_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
public Builder clearUid() {
|
||||
|
||||
uid_ = getDefaultInstance().getUid();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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 =
|
||||
|
||||
@@ -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<Any>() {
|
||||
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<Any>() {
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ fun main(args: Array<String>) {
|
||||
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<String>) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String>("url"), "")
|
||||
.attr(AttributeKey.newInstance<String>("uid"), "")
|
||||
.attr(AttributeKey.newInstance<Int>("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<String>("url"), request.uri())
|
||||
bootstrap.attr(AttributeKey.valueOf<String>("uid"), carUid)
|
||||
bootstrap.attr(AttributeKey.valueOf<Int>("uid"), carUid)
|
||||
val ch = bootstrap.connect(host, port).sync().channel()
|
||||
ch.writeAndFlush(request)
|
||||
ch.closeFuture().sync()//wait for answer
|
||||
|
||||
@@ -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<Any> {
|
||||
|
||||
override fun channelReadComplete(ctx: ChannelHandlerContext) {
|
||||
val url = ctx.channel().attr(AttributeKey.valueOf<String>("url")).get()
|
||||
val carUid = ctx.channel().attr(AttributeKey.valueOf<String>("uid")).get()
|
||||
val carUid = ctx.channel().attr(AttributeKey.valueOf<Int>("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 -> {
|
||||
|
||||
@@ -27,15 +27,14 @@ class Handler : SimpleChannelInboundHandler<Any>() {
|
||||
|
||||
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<Any>() {
|
||||
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<Any>() {
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import java.util.*
|
||||
*/
|
||||
class Environment private constructor() {
|
||||
|
||||
val map: MutableMap<String, Car>
|
||||
val map: MutableMap<Int, Car>
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
||||
+291
-100
@@ -518,14 +518,20 @@ public final class ConnectP {
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
java.lang.String getUid();
|
||||
proto.car.ErrorP.Error getError();
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getUidBytes();
|
||||
proto.car.ErrorP.ErrorOrBuilder getErrorOrBuilder();
|
||||
|
||||
/**
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
public proto.car.ErrorP.Error getError() {
|
||||
if (responseCase_ == 2) {
|
||||
return (proto.car.ErrorP.Error) response_;
|
||||
}
|
||||
return proto.car.ErrorP.Error.getDefaultInstance();
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
public proto.car.ErrorP.Error.Builder getErrorBuilder() {
|
||||
return getErrorFieldBuilder().getBuilder();
|
||||
}
|
||||
/**
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional .carkot.Error error = 2;</code>
|
||||
*/
|
||||
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_;
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
public int getUid() {
|
||||
if (responseCase_ == 1) {
|
||||
return (java.lang.Integer) response_;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
public Builder setUid(int value) {
|
||||
responseCase_ = 1;
|
||||
response_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
public Builder clearUid() {
|
||||
|
||||
uid_ = getDefaultInstance().getUid();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
java.lang.String getErrorMessage();
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getErrorMessageBytes();
|
||||
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
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<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_ = "";
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
public Builder setErrorMessage(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
errorMessage_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
public Builder clearErrorMessage() {
|
||||
|
||||
errorMessage_ = getDefaultInstance().getErrorMessage();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string errorMessage = 1;</code>
|
||||
*/
|
||||
public Builder setErrorMessageBytes(
|
||||
com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
checkByteStringIsUtf8(value);
|
||||
|
||||
errorMessage_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private int errorCode_ ;
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
public int getErrorCode() {
|
||||
return errorCode_;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
public Builder setErrorCode(int value) {
|
||||
|
||||
errorCode_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 errorCode = 2;</code>
|
||||
*/
|
||||
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<Error>
|
||||
PARSER = new com.google.protobuf.AbstractParser<Error>() {
|
||||
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<Error> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<Error> 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)
|
||||
}
|
||||
+898
-123
File diff suppressed because it is too large
Load Diff
@@ -13,14 +13,9 @@ public final class RouteDoneP {
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
java.lang.String getUid();
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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_ ;
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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_;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
public Builder setUid(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
public Builder setUid(int value) {
|
||||
|
||||
uid_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
* <code>optional int32 uid = 1;</code>
|
||||
*/
|
||||
public Builder clearUid() {
|
||||
|
||||
uid_ = getDefaultInstance().getUid();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
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 =
|
||||
|
||||
Reference in New Issue
Block a user