corrected proto files, compiling proto
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
syntax = "proto3";
|
||||
package carkot;
|
||||
|
||||
option java_package = "carkot";
|
||||
option java_out_classname = "CarConnect";
|
||||
option java_package = "proto.car";
|
||||
option java_outer_classname = "ConnectP";
|
||||
|
||||
message request {
|
||||
message ConnectionRequest {
|
||||
string ip = 1;
|
||||
int32 port = 2;
|
||||
}
|
||||
|
||||
message response {
|
||||
message ConnectionResponse {
|
||||
string uid = 1;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
syntax = "proto3";
|
||||
package carkot;
|
||||
|
||||
option java_package = "carkot";
|
||||
option java_out_classname = "Location";
|
||||
option java_package = "proto.car";
|
||||
option java_outer_classname = "LocationP";
|
||||
|
||||
message location {
|
||||
message Location {
|
||||
double x = 1;
|
||||
double y = 2;
|
||||
double angle = 3;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
syntax = "proto3";
|
||||
package carkot;
|
||||
|
||||
option java_package = "carkot";
|
||||
option java_out_classname = "Route";
|
||||
option java_package = "proto.car";
|
||||
option java_outer_classname = "RouteP";
|
||||
|
||||
message Route {
|
||||
repeated WayPoint way_points = 1;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
syntax = "proto3";
|
||||
package carkot;
|
||||
|
||||
option java_package = "proto.car";
|
||||
option java_outer_classname = "RouteDoneP";
|
||||
|
||||
message RouteDone {
|
||||
string uid = 1;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="protobuf-java-3.0.0-beta-3">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/protobuf-java-3.0.0-beta-3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@@ -8,5 +8,6 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
<orderEntry type="library" name="netty-all-4.1.2.Final-sources" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
Binary file not shown.
@@ -8,6 +8,7 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
<orderEntry type="library" name="protobuf-java-3.0.0-beta-3" level="project" />
|
||||
<orderEntry type="library" name="netty-all-4.1.2.Final-sources" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
+14
-5
@@ -1,14 +1,23 @@
|
||||
import Server.Server
|
||||
import server.Server
|
||||
import java.awt.Robot
|
||||
import java.util.*
|
||||
import kotlin.concurrent.thread
|
||||
import kotlin.jvm.internal.iterator
|
||||
|
||||
/**
|
||||
* Created by user on 7/6/16.
|
||||
*/
|
||||
|
||||
val port:Int = 7925;
|
||||
//хардкод это плохо, но пока так...:)
|
||||
val port:Int = 7925
|
||||
val handlerThreadsCount:Int = 100
|
||||
val getLocationUrl = "getLocation"
|
||||
val routeDoneUrl = "routeDone"
|
||||
val setRouteUrl = "route"
|
||||
val connectUrl = "connect"
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
println("server started")
|
||||
val server = Server(port)
|
||||
val serverThread = Thread(server);
|
||||
serverThread.start()
|
||||
val server = Server(port, handlerThreadsCount)
|
||||
val serverThread = thread{server.run()}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package Server
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext
|
||||
import io.netty.channel.SimpleChannelInboundHandler
|
||||
import io.netty.handler.codec.http.*
|
||||
import io.netty.util.CharsetUtil
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by user on 7/6/16.
|
||||
*/
|
||||
class ServerHandler : SimpleChannelInboundHandler<Any>() {
|
||||
|
||||
val sb: StringBuilder = StringBuilder();
|
||||
|
||||
object static {
|
||||
val stf = SimpleDateFormat("HH-mm-ss");
|
||||
}
|
||||
|
||||
override fun channelReadComplete(ctx: ChannelHandlerContext) {
|
||||
|
||||
val dateTime = ServerHandler.static.stf.format(Date(System.currentTimeMillis()))
|
||||
val fileName: String = "request_$dateTime.log";
|
||||
val response = DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK)
|
||||
response.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, response.content().readableBytes())
|
||||
ctx.writeAndFlush(response)
|
||||
writeToFile(sb.toString(), fileName);
|
||||
}
|
||||
|
||||
|
||||
override fun channelRead0(ctx: ChannelHandlerContext, msg: Any) {
|
||||
if (msg is HttpRequest) {
|
||||
sb.append("" + msg.method() + " " + msg.protocolVersion() + "\n")
|
||||
for (header in msg.headers()) {
|
||||
sb.append(header.key + ":" + header.value + "\n")
|
||||
}
|
||||
}
|
||||
if (msg is DefaultHttpContent) {
|
||||
sb.append(msg.content().toString(CharsetUtil.UTF_8))
|
||||
}
|
||||
}
|
||||
|
||||
fun writeToFile(toFile: String, fileName: String) {
|
||||
val f = File(fileName)
|
||||
if (!f.exists()) f.createNewFile()
|
||||
f.writeText(toFile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package objects
|
||||
|
||||
/**
|
||||
* Created by user on 7/7/16.
|
||||
*/
|
||||
class Car constructor(id: String, host: String, port: Int) {
|
||||
|
||||
private val id: String
|
||||
private val host: String
|
||||
private val port: Int
|
||||
|
||||
var free:Boolean
|
||||
|
||||
init {
|
||||
this.id = id
|
||||
this.host = host
|
||||
this.port = port
|
||||
this.free = true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package objects
|
||||
|
||||
/**
|
||||
* Created by user on 7/7/16.
|
||||
*/
|
||||
class Environment private constructor() {
|
||||
|
||||
val map: MutableMap<String, Car>
|
||||
|
||||
companion object {
|
||||
|
||||
val instance = Environment()
|
||||
}
|
||||
|
||||
init {
|
||||
map = mutableMapOf();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,540 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: location.proto
|
||||
|
||||
package proto.car;
|
||||
|
||||
public final class LocationP {
|
||||
private LocationP() {}
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistry registry) {
|
||||
}
|
||||
public interface LocationOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:carkot.Location)
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>optional double x = 1;</code>
|
||||
*/
|
||||
double getX();
|
||||
|
||||
/**
|
||||
* <code>optional double y = 2;</code>
|
||||
*/
|
||||
double getY();
|
||||
|
||||
/**
|
||||
* <code>optional double angle = 3;</code>
|
||||
*/
|
||||
double getAngle();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code carkot.Location}
|
||||
*/
|
||||
public static final class Location extends
|
||||
com.google.protobuf.GeneratedMessage implements
|
||||
// @@protoc_insertion_point(message_implements:carkot.Location)
|
||||
LocationOrBuilder {
|
||||
// Use Location.newBuilder() to construct.
|
||||
private Location(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
private Location() {
|
||||
x_ = 0D;
|
||||
y_ = 0D;
|
||||
angle_ = 0D;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final com.google.protobuf.UnknownFieldSet
|
||||
getUnknownFields() {
|
||||
return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
|
||||
}
|
||||
private Location(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
this();
|
||||
int mutable_bitField0_ = 0;
|
||||
try {
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
done = true;
|
||||
break;
|
||||
default: {
|
||||
if (!input.skipField(tag)) {
|
||||
done = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
|
||||
x_ = input.readDouble();
|
||||
break;
|
||||
}
|
||||
case 17: {
|
||||
|
||||
y_ = input.readDouble();
|
||||
break;
|
||||
}
|
||||
case 25: {
|
||||
|
||||
angle_ = input.readDouble();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
throw e.setUnfinishedMessage(this);
|
||||
} catch (java.io.IOException e) {
|
||||
throw new com.google.protobuf.InvalidProtocolBufferException(
|
||||
e).setUnfinishedMessage(this);
|
||||
} finally {
|
||||
makeExtensionsImmutable();
|
||||
}
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return proto.car.LocationP.internal_static_carkot_Location_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return proto.car.LocationP.internal_static_carkot_Location_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
proto.car.LocationP.Location.class, proto.car.LocationP.Location.Builder.class);
|
||||
}
|
||||
|
||||
public static final int X_FIELD_NUMBER = 1;
|
||||
private double x_;
|
||||
/**
|
||||
* <code>optional double x = 1;</code>
|
||||
*/
|
||||
public double getX() {
|
||||
return x_;
|
||||
}
|
||||
|
||||
public static final int Y_FIELD_NUMBER = 2;
|
||||
private double y_;
|
||||
/**
|
||||
* <code>optional double y = 2;</code>
|
||||
*/
|
||||
public double getY() {
|
||||
return y_;
|
||||
}
|
||||
|
||||
public static final int ANGLE_FIELD_NUMBER = 3;
|
||||
private double angle_;
|
||||
/**
|
||||
* <code>optional double angle = 3;</code>
|
||||
*/
|
||||
public double getAngle() {
|
||||
return angle_;
|
||||
}
|
||||
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
byte isInitialized = memoizedIsInitialized;
|
||||
if (isInitialized == 1) return true;
|
||||
if (isInitialized == 0) return false;
|
||||
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
if (x_ != 0D) {
|
||||
output.writeDouble(1, x_);
|
||||
}
|
||||
if (y_ != 0D) {
|
||||
output.writeDouble(2, y_);
|
||||
}
|
||||
if (angle_ != 0D) {
|
||||
output.writeDouble(3, angle_);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (x_ != 0D) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeDoubleSize(1, x_);
|
||||
}
|
||||
if (y_ != 0D) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeDoubleSize(2, y_);
|
||||
}
|
||||
if (angle_ != 0D) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeDoubleSize(3, angle_);
|
||||
}
|
||||
memoizedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
public static proto.car.LocationP.Location parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static proto.car.LocationP.Location parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static proto.car.LocationP.Location parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static proto.car.LocationP.Location parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static proto.car.LocationP.Location parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static proto.car.LocationP.Location parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static proto.car.LocationP.Location parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseDelimitedWithIOException(PARSER, input);
|
||||
}
|
||||
public static proto.car.LocationP.Location parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static proto.car.LocationP.Location parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static proto.car.LocationP.Location parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder() {
|
||||
return DEFAULT_INSTANCE.toBuilder();
|
||||
}
|
||||
public static Builder newBuilder(proto.car.LocationP.Location prototype) {
|
||||
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() {
|
||||
return this == DEFAULT_INSTANCE
|
||||
? new Builder() : new Builder().mergeFrom(this);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected Builder newBuilderForType(
|
||||
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
|
||||
Builder builder = new Builder(parent);
|
||||
return builder;
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code carkot.Location}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
|
||||
// @@protoc_insertion_point(builder_implements:carkot.Location)
|
||||
proto.car.LocationP.LocationOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return proto.car.LocationP.internal_static_carkot_Location_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return proto.car.LocationP.internal_static_carkot_Location_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
proto.car.LocationP.Location.class, proto.car.LocationP.Location.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using proto.car.LocationP.Location.newBuilder()
|
||||
private Builder() {
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
|
||||
private Builder(
|
||||
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
|
||||
super(parent);
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
private void maybeForceBuilderInitialization() {
|
||||
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
|
||||
}
|
||||
}
|
||||
public Builder clear() {
|
||||
super.clear();
|
||||
x_ = 0D;
|
||||
|
||||
y_ = 0D;
|
||||
|
||||
angle_ = 0D;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return proto.car.LocationP.internal_static_carkot_Location_descriptor;
|
||||
}
|
||||
|
||||
public proto.car.LocationP.Location getDefaultInstanceForType() {
|
||||
return proto.car.LocationP.Location.getDefaultInstance();
|
||||
}
|
||||
|
||||
public proto.car.LocationP.Location build() {
|
||||
proto.car.LocationP.Location result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public proto.car.LocationP.Location buildPartial() {
|
||||
proto.car.LocationP.Location result = new proto.car.LocationP.Location(this);
|
||||
result.x_ = x_;
|
||||
result.y_ = y_;
|
||||
result.angle_ = angle_;
|
||||
onBuilt();
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof proto.car.LocationP.Location) {
|
||||
return mergeFrom((proto.car.LocationP.Location)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(proto.car.LocationP.Location other) {
|
||||
if (other == proto.car.LocationP.Location.getDefaultInstance()) return this;
|
||||
if (other.getX() != 0D) {
|
||||
setX(other.getX());
|
||||
}
|
||||
if (other.getY() != 0D) {
|
||||
setY(other.getY());
|
||||
}
|
||||
if (other.getAngle() != 0D) {
|
||||
setAngle(other.getAngle());
|
||||
}
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
public final boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
proto.car.LocationP.Location parsedMessage = null;
|
||||
try {
|
||||
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
parsedMessage = (proto.car.LocationP.Location) e.getUnfinishedMessage();
|
||||
throw e.unwrapIOException();
|
||||
} finally {
|
||||
if (parsedMessage != null) {
|
||||
mergeFrom(parsedMessage);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private double x_ ;
|
||||
/**
|
||||
* <code>optional double x = 1;</code>
|
||||
*/
|
||||
public double getX() {
|
||||
return x_;
|
||||
}
|
||||
/**
|
||||
* <code>optional double x = 1;</code>
|
||||
*/
|
||||
public Builder setX(double value) {
|
||||
|
||||
x_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional double x = 1;</code>
|
||||
*/
|
||||
public Builder clearX() {
|
||||
|
||||
x_ = 0D;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private double y_ ;
|
||||
/**
|
||||
* <code>optional double y = 2;</code>
|
||||
*/
|
||||
public double getY() {
|
||||
return y_;
|
||||
}
|
||||
/**
|
||||
* <code>optional double y = 2;</code>
|
||||
*/
|
||||
public Builder setY(double value) {
|
||||
|
||||
y_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional double y = 2;</code>
|
||||
*/
|
||||
public Builder clearY() {
|
||||
|
||||
y_ = 0D;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private double angle_ ;
|
||||
/**
|
||||
* <code>optional double angle = 3;</code>
|
||||
*/
|
||||
public double getAngle() {
|
||||
return angle_;
|
||||
}
|
||||
/**
|
||||
* <code>optional double angle = 3;</code>
|
||||
*/
|
||||
public Builder setAngle(double value) {
|
||||
|
||||
angle_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional double angle = 3;</code>
|
||||
*/
|
||||
public Builder clearAngle() {
|
||||
|
||||
angle_ = 0D;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
public final Builder setUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Builder mergeUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:carkot.Location)
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:carkot.Location)
|
||||
private static final proto.car.LocationP.Location DEFAULT_INSTANCE;
|
||||
static {
|
||||
DEFAULT_INSTANCE = new proto.car.LocationP.Location();
|
||||
}
|
||||
|
||||
public static proto.car.LocationP.Location getDefaultInstance() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Parser<Location>
|
||||
PARSER = new com.google.protobuf.AbstractParser<Location>() {
|
||||
public Location parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return new Location(input, extensionRegistry);
|
||||
}
|
||||
};
|
||||
|
||||
public static com.google.protobuf.Parser<Location> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<Location> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
public proto.car.LocationP.Location getDefaultInstanceForType() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_carkot_Location_descriptor;
|
||||
private static final
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internal_static_carkot_Location_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\016location.proto\022\006carkot\"/\n\010Location\022\t\n\001" +
|
||||
"x\030\001 \001(\001\022\t\n\001y\030\002 \001(\001\022\r\n\005angle\030\003 \001(\001B\026\n\tpro" +
|
||||
"to.carB\tLocationPb\006proto3"
|
||||
};
|
||||
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_Location_descriptor =
|
||||
getDescriptor().getMessageTypes().get(0);
|
||||
internal_static_carkot_Location_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_carkot_Location_descriptor,
|
||||
new java.lang.String[] { "X", "Y", "Angle", });
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
@@ -0,0 +1,496 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: routeDone.proto
|
||||
|
||||
package proto.car;
|
||||
|
||||
public final class RouteDoneP {
|
||||
private RouteDoneP() {}
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistry registry) {
|
||||
}
|
||||
public interface RouteDoneOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:carkot.RouteDone)
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
java.lang.String getUid();
|
||||
/**
|
||||
* <code>optional string uid = 1;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getUidBytes();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code carkot.RouteDone}
|
||||
*/
|
||||
public static final class RouteDone extends
|
||||
com.google.protobuf.GeneratedMessage implements
|
||||
// @@protoc_insertion_point(message_implements:carkot.RouteDone)
|
||||
RouteDoneOrBuilder {
|
||||
// Use RouteDone.newBuilder() to construct.
|
||||
private RouteDone(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
private RouteDone() {
|
||||
uid_ = "";
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final com.google.protobuf.UnknownFieldSet
|
||||
getUnknownFields() {
|
||||
return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
|
||||
}
|
||||
private RouteDone(
|
||||
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();
|
||||
|
||||
uid_ = s;
|
||||
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.RouteDoneP.internal_static_carkot_RouteDone_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return proto.car.RouteDoneP.internal_static_carkot_RouteDone_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
proto.car.RouteDoneP.RouteDone.class, proto.car.RouteDoneP.RouteDone.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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <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;
|
||||
}
|
||||
}
|
||||
|
||||
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 (!getUidBytes().isEmpty()) {
|
||||
com.google.protobuf.GeneratedMessage.writeString(output, 1, uid_);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (!getUidBytes().isEmpty()) {
|
||||
size += com.google.protobuf.GeneratedMessage.computeStringSize(1, uid_);
|
||||
}
|
||||
memoizedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
public static proto.car.RouteDoneP.RouteDone parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static proto.car.RouteDoneP.RouteDone 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.RouteDoneP.RouteDone parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static proto.car.RouteDoneP.RouteDone parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static proto.car.RouteDoneP.RouteDone parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static proto.car.RouteDoneP.RouteDone 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.RouteDoneP.RouteDone parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseDelimitedWithIOException(PARSER, input);
|
||||
}
|
||||
public static proto.car.RouteDoneP.RouteDone 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.RouteDoneP.RouteDone parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static proto.car.RouteDoneP.RouteDone 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.RouteDoneP.RouteDone 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.RouteDone}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
|
||||
// @@protoc_insertion_point(builder_implements:carkot.RouteDone)
|
||||
proto.car.RouteDoneP.RouteDoneOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return proto.car.RouteDoneP.internal_static_carkot_RouteDone_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return proto.car.RouteDoneP.internal_static_carkot_RouteDone_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
proto.car.RouteDoneP.RouteDone.class, proto.car.RouteDoneP.RouteDone.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using proto.car.RouteDoneP.RouteDone.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();
|
||||
uid_ = "";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return proto.car.RouteDoneP.internal_static_carkot_RouteDone_descriptor;
|
||||
}
|
||||
|
||||
public proto.car.RouteDoneP.RouteDone getDefaultInstanceForType() {
|
||||
return proto.car.RouteDoneP.RouteDone.getDefaultInstance();
|
||||
}
|
||||
|
||||
public proto.car.RouteDoneP.RouteDone build() {
|
||||
proto.car.RouteDoneP.RouteDone result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public proto.car.RouteDoneP.RouteDone buildPartial() {
|
||||
proto.car.RouteDoneP.RouteDone result = new proto.car.RouteDoneP.RouteDone(this);
|
||||
result.uid_ = uid_;
|
||||
onBuilt();
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof proto.car.RouteDoneP.RouteDone) {
|
||||
return mergeFrom((proto.car.RouteDoneP.RouteDone)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
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.RouteDoneP.RouteDone parsedMessage = null;
|
||||
try {
|
||||
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
parsedMessage = (proto.car.RouteDoneP.RouteDone) e.getUnfinishedMessage();
|
||||
throw e.unwrapIOException();
|
||||
} finally {
|
||||
if (parsedMessage != null) {
|
||||
mergeFrom(parsedMessage);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private 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)) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string 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();
|
||||
}
|
||||
|
||||
uid_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string 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();
|
||||
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.RouteDone)
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:carkot.RouteDone)
|
||||
private static final proto.car.RouteDoneP.RouteDone DEFAULT_INSTANCE;
|
||||
static {
|
||||
DEFAULT_INSTANCE = new proto.car.RouteDoneP.RouteDone();
|
||||
}
|
||||
|
||||
public static proto.car.RouteDoneP.RouteDone getDefaultInstance() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Parser<RouteDone>
|
||||
PARSER = new com.google.protobuf.AbstractParser<RouteDone>() {
|
||||
public RouteDone parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return new RouteDone(input, extensionRegistry);
|
||||
}
|
||||
};
|
||||
|
||||
public static com.google.protobuf.Parser<RouteDone> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<RouteDone> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
public proto.car.RouteDoneP.RouteDone getDefaultInstanceForType() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_carkot_RouteDone_descriptor;
|
||||
private static final
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internal_static_carkot_RouteDone_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\017routeDone.proto\022\006carkot\"\030\n\tRouteDone\022\013" +
|
||||
"\n\003uid\030\001 \001(\tB\027\n\tproto.carB\nRouteDonePb\006pr" +
|
||||
"oto3"
|
||||
};
|
||||
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_RouteDone_descriptor =
|
||||
getDescriptor().getMessageTypes().get(0);
|
||||
internal_static_carkot_RouteDone_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_carkot_RouteDone_descriptor,
|
||||
new java.lang.String[] { "Uid", });
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
package Server
|
||||
package server
|
||||
|
||||
import io.netty.bootstrap.ServerBootstrap
|
||||
import io.netty.channel.nio.NioEventLoopGroup
|
||||
@@ -12,9 +12,11 @@ import io.netty.handler.logging.LoggingHandler
|
||||
class Server : Runnable {
|
||||
|
||||
val port: Int;
|
||||
val handlerThreadsCount: Int;
|
||||
|
||||
constructor(port: Int) {
|
||||
constructor(port: Int, handlerThreadsCount: Int) {
|
||||
this.port = port
|
||||
this.handlerThreadsCount = handlerThreadsCount
|
||||
}
|
||||
|
||||
override fun run() {
|
||||
@@ -24,7 +26,7 @@ class Server : Runnable {
|
||||
b.group(bossGroup, workerGroup)
|
||||
.channel(NioServerSocketChannel().javaClass)
|
||||
.handler(LoggingHandler(LogLevel.INFO))
|
||||
.childHandler(ServerInitializer())
|
||||
.childHandler(ServerInitializer(handlerThreadsCount))
|
||||
|
||||
try {
|
||||
val channel = b.bind(port).sync().channel()
|
||||
@@ -0,0 +1,85 @@
|
||||
package server
|
||||
|
||||
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 io.netty.util.CharsetUtil
|
||||
import objects.Environment
|
||||
import proto.car.ConnectP.ConnectionRequest
|
||||
import proto.car.RouteDoneP
|
||||
import proto.car.RouteDoneP.RouteDone
|
||||
import routeDoneUrl
|
||||
import setRouteUrl
|
||||
import java.nio.charset.Charset
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by user on 7/6/16.
|
||||
*/
|
||||
class ServerHandler : SimpleChannelInboundHandler<Any>() {
|
||||
|
||||
var url: String = ""
|
||||
var contentBytes: ByteArray = ByteArray(0);
|
||||
|
||||
override fun channelReadComplete(ctx: ChannelHandlerContext) {
|
||||
|
||||
val environment = Environment.instance
|
||||
var success = true;
|
||||
when (url) {
|
||||
connectUrl -> {
|
||||
val data = ConnectionRequest.parseFrom(contentBytes)
|
||||
//todo
|
||||
}
|
||||
routeDoneUrl -> {
|
||||
val data = RouteDone.parseFrom(contentBytes)
|
||||
val id = data.uid
|
||||
synchronized(environment.map, {
|
||||
val car = environment.map.get(id)
|
||||
if (car != null) {
|
||||
car.free = true
|
||||
} else {
|
||||
success = false
|
||||
}
|
||||
})
|
||||
}
|
||||
else -> {
|
||||
success = false
|
||||
//todo unsup operation
|
||||
}
|
||||
}
|
||||
|
||||
val response = DefaultFullHttpResponse(HttpVersion.HTTP_1_1, if (success) HttpResponseStatus.OK else HttpResponseStatus.NOT_FOUND)
|
||||
response.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, response.content().readableBytes())
|
||||
ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
|
||||
override fun channelRead0(ctx: ChannelHandlerContext, msg: Any) {
|
||||
if (msg is HttpRequest) {
|
||||
this.url = msg.uri()
|
||||
// sb.append("" + msg.method() + " " + msg.protocolVersion() + "\n" + msg.uri())
|
||||
// for (header in msg.headers()) {
|
||||
// sb.append(header.key + ":" + header.value + "\n")
|
||||
// }
|
||||
}
|
||||
|
||||
if (msg is DefaultHttpContent) {
|
||||
val contentsBytes = msg.content();
|
||||
contentBytes = ByteArray(contentsBytes.capacity())
|
||||
contentsBytes.readBytes(contentBytes)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun exceptionCaught(ctx: ChannelHandlerContext?, cause: Throwable?) {
|
||||
println("exception")
|
||||
cause?.printStackTrace()
|
||||
if (ctx != null) {
|
||||
ctx.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,28 @@
|
||||
package Server
|
||||
package server
|
||||
|
||||
import Server.ServerHandler
|
||||
import io.netty.channel.ChannelInitializer
|
||||
import io.netty.channel.ChannelPipeline
|
||||
import io.netty.channel.socket.SocketChannel
|
||||
import io.netty.handler.codec.http.HttpRequestDecoder
|
||||
import io.netty.handler.codec.http.HttpResponseEncoder
|
||||
import io.netty.util.concurrent.DefaultEventExecutorGroup
|
||||
import io.netty.util.concurrent.EventExecutorGroup
|
||||
|
||||
/**
|
||||
* Created by user on 7/6/16.
|
||||
*/
|
||||
class ServerInitializer : ChannelInitializer<SocketChannel> {
|
||||
|
||||
constructor() {
|
||||
val group: EventExecutorGroup;
|
||||
|
||||
constructor(handlerThreadCount: Int) {
|
||||
this.group = DefaultEventExecutorGroup(handlerThreadCount)
|
||||
}
|
||||
|
||||
override fun initChannel(channel: SocketChannel) {
|
||||
println("init")
|
||||
val p: ChannelPipeline = channel.pipeline()
|
||||
p.addLast(HttpRequestDecoder())
|
||||
p.addLast(HttpResponseEncoder())
|
||||
p.addLast(ServerHandler())
|
||||
p.addLast(group, ServerHandler())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user