make rc work with SID
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import clientClasses.Client
|
||||
import io.netty.buffer.Unpooled
|
||||
import io.netty.handler.codec.http.*
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
/**
|
||||
@@ -9,23 +7,21 @@ import java.io.ByteArrayOutputStream
|
||||
class CarControl constructor(client: Client) {
|
||||
|
||||
val client: Client
|
||||
var sid: Int
|
||||
|
||||
init {
|
||||
this.client = client
|
||||
this.sid = 0
|
||||
}
|
||||
|
||||
fun executeCommand(command: DirectionRequest.Command) {
|
||||
|
||||
val directionBuilder = DirectionRequest.BuilderDirectionRequest()
|
||||
directionBuilder.setCommand(command)
|
||||
directionBuilder.setCommand(command).setSid(sid)
|
||||
val byteArrayStream = ByteArrayOutputStream()
|
||||
|
||||
directionBuilder.build().writeTo(CodedOutputStream(byteArrayStream))
|
||||
val request = DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/control", Unpooled.copiedBuffer(byteArrayStream.toByteArray()));
|
||||
request.headers().set(HttpHeaderNames.HOST, client.host)
|
||||
request.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE)
|
||||
request.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, request.content().readableBytes())
|
||||
request.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/plain; charset=UTF-8")
|
||||
val request = getDefaultHttpRequest(client.host, controlUrl, byteArrayStream)
|
||||
|
||||
client.sendRequest(request)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@ import clientClasses.Client
|
||||
import clientClasses.ClientHandler
|
||||
import com.martiansoftware.jsap.FlaggedOption
|
||||
import com.martiansoftware.jsap.JSAP
|
||||
import io.netty.buffer.Unpooled
|
||||
import io.netty.handler.codec.http.*
|
||||
import java.io.ByteArrayOutputStream
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
/**
|
||||
* Created by user on 7/14/16.
|
||||
@@ -16,6 +20,13 @@ val correctDirectionMap = mapOf<Char, Command>(
|
||||
Pair('d', Command.right),
|
||||
Pair('h', Command.stop))
|
||||
|
||||
//urls
|
||||
val heartbeatUrl = "/rc/heartbeat"
|
||||
val connectUrl = "/rc/connect"
|
||||
val disconnectUrl = "/rc/disconnect"
|
||||
val controlUrl = "/rc/control"
|
||||
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val jsap: JSAP = JSAP()
|
||||
setOptions(jsap)
|
||||
@@ -26,7 +37,6 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
val host = config.getString("host")
|
||||
val port = config.getInt("port")
|
||||
val direction = config.getChar("direction")
|
||||
|
||||
val ipRegex = Regex("^(?:[0-9]{1,3}.){3}[0-9]{1,3}$")
|
||||
if (!ipRegex.matches(host)) {
|
||||
@@ -34,18 +44,69 @@ fun main(args: Array<String>) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
val client = Client(host, port)
|
||||
val carControl = CarControl(client)
|
||||
if (direction.equals('t', true)) {
|
||||
initTextInterface(carControl)
|
||||
} else if (correctDirectionMap.containsKey(direction)) {
|
||||
carControl.executeCommand(correctDirectionMap.get(direction)!!)
|
||||
printRequestResult()
|
||||
} else {
|
||||
println("incorrect direction.")
|
||||
println(jsap.getHelp())
|
||||
|
||||
//connect and get SID
|
||||
var byteArrayStream = ByteArrayOutputStream()
|
||||
byteArrayStream.use {
|
||||
val rcSessionUpRequest = getDefaultHttpRequest(client.host, connectUrl, byteArrayStream)
|
||||
client.sendRequest(rcSessionUpRequest)
|
||||
}
|
||||
val sid = synchronized(ClientHandler.requestResult, {
|
||||
if (ClientHandler.requestResult.code != 0) {
|
||||
println("connection refused")
|
||||
printRequestResult()
|
||||
0
|
||||
} else {
|
||||
ClientHandler.requestResult.sid
|
||||
}
|
||||
})
|
||||
if (sid == 0) {
|
||||
client.close()
|
||||
return
|
||||
}
|
||||
|
||||
//init heartbeat
|
||||
val byteArrayOutputStream = ByteArrayOutputStream()
|
||||
byteArrayOutputStream.use {
|
||||
HeartBeatRequest.BuilderHeartBeatRequest().setSid(sid).build().writeTo(CodedOutputStream(byteArrayOutputStream))
|
||||
}
|
||||
val heartbeatThread = thread {
|
||||
while (true) {
|
||||
val heartbeatRequest = getDefaultHttpRequest(client.host, heartbeatUrl, byteArrayOutputStream)
|
||||
client.sendRequest(heartbeatRequest)
|
||||
try {
|
||||
Thread.sleep(400)
|
||||
} catch (e: InterruptedException) {
|
||||
break
|
||||
}
|
||||
printRequestResult()
|
||||
}
|
||||
}
|
||||
|
||||
carControl.sid = sid
|
||||
initTextInterface(carControl)
|
||||
|
||||
//disconnect
|
||||
byteArrayStream = ByteArrayOutputStream()
|
||||
byteArrayStream.use {
|
||||
SessionDownRequest.BuilderSessionDownRequest().setSid(sid).build().writeTo(CodedOutputStream(byteArrayStream))
|
||||
}
|
||||
val rcSessionDownRequest = getDefaultHttpRequest(client.host, disconnectUrl, byteArrayStream)
|
||||
client.sendRequest(rcSessionDownRequest)
|
||||
heartbeatThread.interrupt()
|
||||
client.close()
|
||||
printRequestResult()
|
||||
}
|
||||
|
||||
fun getDefaultHttpRequest(host: String, url: String, byteArrayStream: ByteArrayOutputStream): DefaultFullHttpRequest {
|
||||
val request = DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url, Unpooled.copiedBuffer(byteArrayStream.toByteArray()));
|
||||
request.headers().set(HttpHeaderNames.HOST, host)
|
||||
request.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE)
|
||||
request.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, request.content().readableBytes())
|
||||
request.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/plain; charset=UTF-8")
|
||||
return request
|
||||
}
|
||||
|
||||
fun initTextInterface(carControl: CarControl) {
|
||||
@@ -78,10 +139,11 @@ fun initTextInterface(carControl: CarControl) {
|
||||
fun printRequestResult() {
|
||||
synchronized(ClientHandler.requestResult, {
|
||||
if (ClientHandler.requestResult.code != 0) {
|
||||
println("result code: ${ClientHandler.requestResult.code}\nerror message ${ClientHandler.requestResult.errorString}")
|
||||
println("result code: ${ClientHandler.requestResult.code}\n" +
|
||||
"error message: ${ClientHandler.requestResult.errorString}\n" +
|
||||
"sid: ${ClientHandler.requestResult.sid}")
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
fun setOptions(jsap: JSAP) {
|
||||
@@ -89,10 +151,7 @@ fun setOptions(jsap: JSAP) {
|
||||
opthost.setHelp("write here only ip address. domain name (e.g. vk.com is incorrect)")
|
||||
val optPort = FlaggedOption("port").setStringParser(JSAP.INTEGER_PARSER).setDefault("8888").setRequired(false).setShortFlag('p').setLongFlag("port")
|
||||
val optHelp = FlaggedOption("help").setStringParser(JSAP.BOOLEAN_PARSER).setRequired(false).setDefault("false").setLongFlag("help")
|
||||
val optDirection = FlaggedOption("direction").setStringParser(JSAP.CHARACTER_PARSER).setRequired(false).setDefault("t").setShortFlag('d')
|
||||
optDirection.setHelp("move direction: available values - one symbol:\n\"w (forward),s (backward),a (left),f (right),h (stop)\". example: -d w\nwithout argument used default \"t\" - running text interface")
|
||||
jsap.registerParameter(opthost)
|
||||
jsap.registerParameter(optPort)
|
||||
jsap.registerParameter(optHelp)
|
||||
jsap.registerParameter(optDirection)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package clientClasses
|
||||
|
||||
import io.netty.bootstrap.Bootstrap
|
||||
import io.netty.channel.EventLoopGroup
|
||||
import io.netty.channel.nio.NioEventLoopGroup
|
||||
import io.netty.channel.socket.nio.NioSocketChannel
|
||||
import io.netty.handler.codec.http.HttpRequest
|
||||
import io.netty.util.AttributeKey
|
||||
import java.net.ConnectException
|
||||
|
||||
/**
|
||||
@@ -13,17 +15,27 @@ class Client constructor(host: String, port: Int) {
|
||||
|
||||
val host: String
|
||||
val port: Int
|
||||
val group: EventLoopGroup
|
||||
|
||||
|
||||
init {
|
||||
this.host = host
|
||||
this.port = port
|
||||
group = NioEventLoopGroup(1)
|
||||
}
|
||||
|
||||
val bootstrap: Bootstrap = makeBootstrap()
|
||||
|
||||
private fun makeBootstrap(): Bootstrap {
|
||||
val b = Bootstrap()
|
||||
b.group(group).channel(NioSocketChannel().javaClass).handler(ClientInitializer())
|
||||
.attr(AttributeKey.newInstance<String>("url"), "")
|
||||
return b
|
||||
}
|
||||
|
||||
fun sendRequest(request: HttpRequest) {
|
||||
val group = NioEventLoopGroup(1)
|
||||
try {
|
||||
val bootstrap = Bootstrap()
|
||||
bootstrap.group(group).channel(NioSocketChannel().javaClass).handler(ClientInitializer())
|
||||
bootstrap.attr(AttributeKey.valueOf<String>("url"), request.uri())
|
||||
val channelFuture = bootstrap.connect(host, port).sync()
|
||||
val channel = channelFuture.channel()
|
||||
channel.writeAndFlush(request)
|
||||
@@ -34,9 +46,11 @@ class Client constructor(host: String, port: Int) {
|
||||
} catch (e: ConnectException) {
|
||||
ClientHandler.requestResult.code = 10
|
||||
ClientHandler.requestResult.errorString = "don't can connect to server ($host:$port)"
|
||||
} finally {
|
||||
group.shutdownGracefully()
|
||||
}
|
||||
}
|
||||
|
||||
fun close() {
|
||||
group.shutdownGracefully()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,9 +3,14 @@ package clientClasses
|
||||
import CodedInputStream
|
||||
import DirectionResponse
|
||||
import InvalidProtocolBufferException
|
||||
import connectUrl
|
||||
import controlUrl
|
||||
import disconnectUrl
|
||||
import heartbeatUrl
|
||||
import io.netty.channel.ChannelHandlerContext
|
||||
import io.netty.channel.SimpleChannelInboundHandler
|
||||
import io.netty.handler.codec.http.DefaultHttpContent
|
||||
import io.netty.util.AttributeKey
|
||||
import java.io.ByteArrayInputStream
|
||||
|
||||
/**
|
||||
@@ -16,6 +21,7 @@ class ClientHandler : SimpleChannelInboundHandler<Any> {
|
||||
object requestResult {
|
||||
var code = -1
|
||||
var errorString = ""
|
||||
var sid = 0
|
||||
}
|
||||
|
||||
constructor()
|
||||
@@ -24,29 +30,63 @@ class ClientHandler : SimpleChannelInboundHandler<Any> {
|
||||
|
||||
override fun channelReadComplete(ctx: ChannelHandlerContext) {
|
||||
|
||||
if (contentBytes.size == 0) {
|
||||
//socket is closed
|
||||
if (!ctx.channel().isOpen) {
|
||||
ctx.close()
|
||||
return
|
||||
}
|
||||
val url = ctx.channel().attr(AttributeKey.valueOf<String>("url")).get()
|
||||
val responseStream = CodedInputStream(ByteArrayInputStream(contentBytes))
|
||||
val response = DirectionResponse.BuilderDirectionResponse().build()
|
||||
try {
|
||||
response.mergeFrom(responseStream)
|
||||
} catch (e: InvalidProtocolBufferException) {
|
||||
synchronized(requestResult, {
|
||||
requestResult.code = 1
|
||||
requestResult.errorString = "protobuf parsing error. bytes from server is not message. stack trace:\n ${e.message}"
|
||||
})
|
||||
return
|
||||
when (url) {
|
||||
controlUrl -> {
|
||||
val response = DirectionResponse.BuilderDirectionResponse().build()
|
||||
try {
|
||||
response.mergeFrom(responseStream)
|
||||
setRequestResultValues(response.code, response.errorMsg)
|
||||
} catch (e: InvalidProtocolBufferException) {
|
||||
setRequestResultValues(1, "protobuf parsing error. bytes from server is not message. stack trace:\n ${e.message}")
|
||||
}
|
||||
}
|
||||
connectUrl -> {
|
||||
val response = SessionUpResponse.BuilderSessionUpResponse().build()
|
||||
try {
|
||||
response.mergeFrom(responseStream)
|
||||
setRequestResultValues(response.code, response.errorMsg, response.sid)
|
||||
} catch (e: InvalidProtocolBufferException) {
|
||||
setRequestResultValues(1, "protobuf parsing error. bytes from server is not message. stack trace:\n ${e.message}", response.sid)
|
||||
}
|
||||
}
|
||||
disconnectUrl -> {
|
||||
val response = SessionDownResponse.BuilderSessionDownResponse().build()
|
||||
try {
|
||||
response.mergeFrom(responseStream)
|
||||
setRequestResultValues(response.code, response.errorMsg)
|
||||
} catch (e: InvalidProtocolBufferException) {
|
||||
setRequestResultValues(1, "protobuf parsing error. bytes from server is not message. stack trace:\n ${e.message}")
|
||||
}
|
||||
}
|
||||
heartbeatUrl -> {
|
||||
val response = HeartBeatResponse.BuilderHeartBeatResponse().build()
|
||||
try {
|
||||
response.mergeFrom(responseStream)
|
||||
setRequestResultValues(response.code, response.errorMsg)
|
||||
} catch (e: InvalidProtocolBufferException) {
|
||||
setRequestResultValues(1, "protobuf parsing error. bytes from server is not message. stack trace:\n ${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
synchronized(requestResult, {
|
||||
requestResult.code = response.code
|
||||
requestResult.errorString = response.errorMsg
|
||||
})
|
||||
ctx.close()
|
||||
}
|
||||
|
||||
fun setRequestResultValues(code: Int, error: String, sid: Int = -1) {
|
||||
synchronized(requestResult, {
|
||||
requestResult.code = code
|
||||
requestResult.errorString = error
|
||||
if (sid != -1) {
|
||||
requestResult.sid = sid
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun channelRead0(ctx: ChannelHandlerContext?, msg: Any?) {
|
||||
if (msg is DefaultHttpContent) {
|
||||
//read bytes from http body
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
class DirectionRequest private constructor (command: DirectionRequest.Command = DirectionRequest.Command.fromIntToCommand(0)) {
|
||||
class DirectionRequest private constructor (command: DirectionRequest.Command = DirectionRequest.Command.fromIntToCommand(0), sid: Int = 0) {
|
||||
var command : DirectionRequest.Command
|
||||
private set
|
||||
|
||||
var sid : Int
|
||||
private set
|
||||
|
||||
|
||||
init {
|
||||
this.command = command
|
||||
this.sid = sid
|
||||
}
|
||||
enum class Command(val ord: Int) {
|
||||
stop (0),
|
||||
@@ -31,9 +35,12 @@ class DirectionRequest private constructor (command: DirectionRequest.Command =
|
||||
if (command != DirectionRequest.Command.fromIntToCommand(0)) {
|
||||
output.writeEnum (1, command.ord)
|
||||
}
|
||||
if (sid != 0) {
|
||||
output.writeInt32 (2, sid)
|
||||
}
|
||||
}
|
||||
|
||||
class BuilderDirectionRequest constructor (command: DirectionRequest.Command = DirectionRequest.Command.fromIntToCommand(0)) {
|
||||
class BuilderDirectionRequest constructor (command: DirectionRequest.Command = DirectionRequest.Command.fromIntToCommand(0), sid: Int = 0) {
|
||||
var command : DirectionRequest.Command
|
||||
private set
|
||||
fun setCommand(value: DirectionRequest.Command): DirectionRequest.BuilderDirectionRequest {
|
||||
@@ -41,19 +48,30 @@ class DirectionRequest private constructor (command: DirectionRequest.Command =
|
||||
return this
|
||||
}
|
||||
|
||||
var sid : Int
|
||||
private set
|
||||
fun setSid(value: Int): DirectionRequest.BuilderDirectionRequest {
|
||||
sid = value
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
this.command = command
|
||||
this.sid = sid
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (command != DirectionRequest.Command.fromIntToCommand(0)) {
|
||||
output.writeEnum (1, command.ord)
|
||||
}
|
||||
if (sid != 0) {
|
||||
output.writeInt32 (2, sid)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(): DirectionRequest {
|
||||
return DirectionRequest(command)
|
||||
return DirectionRequest(command, sid)
|
||||
}
|
||||
|
||||
fun parseFieldFrom(input: CodedInputStream): Boolean {
|
||||
@@ -68,6 +86,11 @@ class DirectionRequest private constructor (command: DirectionRequest.Command =
|
||||
throw InvalidProtocolBufferException("Error: Field number 1 has wire type WireType.VARINT but read ${wireType.toString()}")}
|
||||
command = DirectionRequest.Command.fromIntToCommand(input.readEnumNoTag())
|
||||
}
|
||||
2 -> {
|
||||
if (wireType != WireType.VARINT) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 2 has wire type WireType.VARINT but read ${wireType.toString()}")}
|
||||
sid = input.readInt32NoTag()
|
||||
}
|
||||
}
|
||||
return true}
|
||||
fun parseFromWithSize(input: CodedInputStream, expectedSize: Int): DirectionRequest.BuilderDirectionRequest {
|
||||
@@ -86,6 +109,9 @@ class DirectionRequest private constructor (command: DirectionRequest.Command =
|
||||
if (command != DirectionRequest.Command.fromIntToCommand(0)) {
|
||||
size += WireFormat.getEnumSize(1, command.ord)
|
||||
}
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(2, sid)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
@@ -94,6 +120,9 @@ class DirectionRequest private constructor (command: DirectionRequest.Command =
|
||||
if (command != DirectionRequest.Command.fromIntToCommand(0)) {
|
||||
size += WireFormat.getEnumSize(1, command.ord)
|
||||
}
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(2, sid)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
@@ -101,6 +130,7 @@ class DirectionRequest private constructor (command: DirectionRequest.Command =
|
||||
|
||||
fun mergeWith (other: DirectionRequest) {
|
||||
command = other.command
|
||||
sid = other.sid
|
||||
}
|
||||
|
||||
fun mergeFromWithSize (input: CodedInputStream, expectedSize: Int) {
|
||||
@@ -115,6 +145,9 @@ class DirectionRequest private constructor (command: DirectionRequest.Command =
|
||||
if (command != DirectionRequest.Command.fromIntToCommand(0)) {
|
||||
size += WireFormat.getEnumSize(1, command.ord)
|
||||
}
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(2, sid)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
@@ -123,6 +156,9 @@ class DirectionRequest private constructor (command: DirectionRequest.Command =
|
||||
if (command != DirectionRequest.Command.fromIntToCommand(0)) {
|
||||
size += WireFormat.getEnumSize(1, command.ord)
|
||||
}
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(2, sid)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,694 @@
|
||||
class SessionUpResponse private constructor (code: Int = 0, errorMsg: String = "", sid: Int = 0) {
|
||||
var code : Int
|
||||
private set
|
||||
|
||||
var errorMsg : String
|
||||
private set
|
||||
|
||||
var sid : Int
|
||||
private set
|
||||
|
||||
|
||||
init {
|
||||
this.code = code
|
||||
this.errorMsg = errorMsg
|
||||
this.sid = sid
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (code != 0) {
|
||||
output.writeInt32 (1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
output.writeString (2, errorMsg)
|
||||
}
|
||||
if (sid != 0) {
|
||||
output.writeInt32 (3, sid)
|
||||
}
|
||||
}
|
||||
|
||||
class BuilderSessionUpResponse constructor (code: Int = 0, errorMsg: String = "", sid: Int = 0) {
|
||||
var code : Int
|
||||
private set
|
||||
fun setCode(value: Int): SessionUpResponse.BuilderSessionUpResponse {
|
||||
code = value
|
||||
return this
|
||||
}
|
||||
|
||||
var errorMsg : String
|
||||
private set
|
||||
fun setErrorMsg(value: String): SessionUpResponse.BuilderSessionUpResponse {
|
||||
errorMsg = value
|
||||
return this
|
||||
}
|
||||
|
||||
var sid : Int
|
||||
private set
|
||||
fun setSid(value: Int): SessionUpResponse.BuilderSessionUpResponse {
|
||||
sid = value
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
this.code = code
|
||||
this.errorMsg = errorMsg
|
||||
this.sid = sid
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (code != 0) {
|
||||
output.writeInt32 (1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
output.writeString (2, errorMsg)
|
||||
}
|
||||
if (sid != 0) {
|
||||
output.writeInt32 (3, sid)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(): SessionUpResponse {
|
||||
return SessionUpResponse(code, errorMsg, sid)
|
||||
}
|
||||
|
||||
fun parseFieldFrom(input: CodedInputStream): Boolean {
|
||||
if (input.isAtEnd()) { return false }
|
||||
val tag = input.readInt32NoTag()
|
||||
if (tag == 0) { return false }
|
||||
val fieldNumber = WireFormat.getTagFieldNumber(tag)
|
||||
val wireType = WireFormat.getTagWireType(tag)
|
||||
when(fieldNumber) {
|
||||
1 -> {
|
||||
if (wireType != WireType.VARINT) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 1 has wire type WireType.VARINT but read ${wireType.toString()}")}
|
||||
code = input.readInt32NoTag()
|
||||
}
|
||||
2 -> {
|
||||
if (wireType != WireType.LENGTH_DELIMITED) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 2 has wire type WireType.LENGTH_DELIMITED but read ${wireType.toString()}")}
|
||||
errorMsg = input.readStringNoTag()
|
||||
}
|
||||
3 -> {
|
||||
if (wireType != WireType.VARINT) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 3 has wire type WireType.VARINT but read ${wireType.toString()}")}
|
||||
sid = input.readInt32NoTag()
|
||||
}
|
||||
}
|
||||
return true}
|
||||
fun parseFromWithSize(input: CodedInputStream, expectedSize: Int): SessionUpResponse.BuilderSessionUpResponse {
|
||||
while(getSizeNoTag() < expectedSize) {
|
||||
parseFieldFrom(input)
|
||||
}
|
||||
if (getSizeNoTag() > expectedSize) { throw InvalidProtocolBufferException("Error: expected size of message $expectedSize, but have read at least ${getSizeNoTag()}") }
|
||||
return this
|
||||
}
|
||||
fun parseFrom(input: CodedInputStream): SessionUpResponse.BuilderSessionUpResponse {
|
||||
while(parseFieldFrom(input)) {}
|
||||
return this
|
||||
}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(3, sid)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(3, sid)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun mergeWith (other: SessionUpResponse) {
|
||||
code = other.code
|
||||
errorMsg = other.errorMsg
|
||||
sid = other.sid
|
||||
}
|
||||
|
||||
fun mergeFromWithSize (input: CodedInputStream, expectedSize: Int) {
|
||||
val builder = SessionUpResponse.BuilderSessionUpResponse()
|
||||
mergeWith(builder.parseFromWithSize(input, expectedSize).build())}
|
||||
|
||||
fun mergeFrom (input: CodedInputStream) {
|
||||
val builder = SessionUpResponse.BuilderSessionUpResponse()
|
||||
mergeWith(builder.parseFrom(input).build())}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(3, sid)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(3, sid)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SessionDownResponse private constructor (code: Int = 0, errorMsg: String = "") {
|
||||
var code : Int
|
||||
private set
|
||||
|
||||
var errorMsg : String
|
||||
private set
|
||||
|
||||
|
||||
init {
|
||||
this.code = code
|
||||
this.errorMsg = errorMsg
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (code != 0) {
|
||||
output.writeInt32 (1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
output.writeString (2, errorMsg)
|
||||
}
|
||||
}
|
||||
|
||||
class BuilderSessionDownResponse constructor (code: Int = 0, errorMsg: String = "") {
|
||||
var code : Int
|
||||
private set
|
||||
fun setCode(value: Int): SessionDownResponse.BuilderSessionDownResponse {
|
||||
code = value
|
||||
return this
|
||||
}
|
||||
|
||||
var errorMsg : String
|
||||
private set
|
||||
fun setErrorMsg(value: String): SessionDownResponse.BuilderSessionDownResponse {
|
||||
errorMsg = value
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
this.code = code
|
||||
this.errorMsg = errorMsg
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (code != 0) {
|
||||
output.writeInt32 (1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
output.writeString (2, errorMsg)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(): SessionDownResponse {
|
||||
return SessionDownResponse(code, errorMsg)
|
||||
}
|
||||
|
||||
fun parseFieldFrom(input: CodedInputStream): Boolean {
|
||||
if (input.isAtEnd()) { return false }
|
||||
val tag = input.readInt32NoTag()
|
||||
if (tag == 0) { return false }
|
||||
val fieldNumber = WireFormat.getTagFieldNumber(tag)
|
||||
val wireType = WireFormat.getTagWireType(tag)
|
||||
when(fieldNumber) {
|
||||
1 -> {
|
||||
if (wireType != WireType.VARINT) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 1 has wire type WireType.VARINT but read ${wireType.toString()}")}
|
||||
code = input.readInt32NoTag()
|
||||
}
|
||||
2 -> {
|
||||
if (wireType != WireType.LENGTH_DELIMITED) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 2 has wire type WireType.LENGTH_DELIMITED but read ${wireType.toString()}")}
|
||||
errorMsg = input.readStringNoTag()
|
||||
}
|
||||
}
|
||||
return true}
|
||||
fun parseFromWithSize(input: CodedInputStream, expectedSize: Int): SessionDownResponse.BuilderSessionDownResponse {
|
||||
while(getSizeNoTag() < expectedSize) {
|
||||
parseFieldFrom(input)
|
||||
}
|
||||
if (getSizeNoTag() > expectedSize) { throw InvalidProtocolBufferException("Error: expected size of message $expectedSize, but have read at least ${getSizeNoTag()}") }
|
||||
return this
|
||||
}
|
||||
fun parseFrom(input: CodedInputStream): SessionDownResponse.BuilderSessionDownResponse {
|
||||
while(parseFieldFrom(input)) {}
|
||||
return this
|
||||
}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun mergeWith (other: SessionDownResponse) {
|
||||
code = other.code
|
||||
errorMsg = other.errorMsg
|
||||
}
|
||||
|
||||
fun mergeFromWithSize (input: CodedInputStream, expectedSize: Int) {
|
||||
val builder = SessionDownResponse.BuilderSessionDownResponse()
|
||||
mergeWith(builder.parseFromWithSize(input, expectedSize).build())}
|
||||
|
||||
fun mergeFrom (input: CodedInputStream) {
|
||||
val builder = SessionDownResponse.BuilderSessionDownResponse()
|
||||
mergeWith(builder.parseFrom(input).build())}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SessionDownRequest private constructor (sid: Int = 0) {
|
||||
var sid : Int
|
||||
private set
|
||||
|
||||
|
||||
init {
|
||||
this.sid = sid
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (sid != 0) {
|
||||
output.writeInt32 (1, sid)
|
||||
}
|
||||
}
|
||||
|
||||
class BuilderSessionDownRequest constructor (sid: Int = 0) {
|
||||
var sid : Int
|
||||
private set
|
||||
fun setSid(value: Int): SessionDownRequest.BuilderSessionDownRequest {
|
||||
sid = value
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
this.sid = sid
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (sid != 0) {
|
||||
output.writeInt32 (1, sid)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(): SessionDownRequest {
|
||||
return SessionDownRequest(sid)
|
||||
}
|
||||
|
||||
fun parseFieldFrom(input: CodedInputStream): Boolean {
|
||||
if (input.isAtEnd()) { return false }
|
||||
val tag = input.readInt32NoTag()
|
||||
if (tag == 0) { return false }
|
||||
val fieldNumber = WireFormat.getTagFieldNumber(tag)
|
||||
val wireType = WireFormat.getTagWireType(tag)
|
||||
when(fieldNumber) {
|
||||
1 -> {
|
||||
if (wireType != WireType.VARINT) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 1 has wire type WireType.VARINT but read ${wireType.toString()}")}
|
||||
sid = input.readInt32NoTag()
|
||||
}
|
||||
}
|
||||
return true}
|
||||
fun parseFromWithSize(input: CodedInputStream, expectedSize: Int): SessionDownRequest.BuilderSessionDownRequest {
|
||||
while(getSizeNoTag() < expectedSize) {
|
||||
parseFieldFrom(input)
|
||||
}
|
||||
if (getSizeNoTag() > expectedSize) { throw InvalidProtocolBufferException("Error: expected size of message $expectedSize, but have read at least ${getSizeNoTag()}") }
|
||||
return this
|
||||
}
|
||||
fun parseFrom(input: CodedInputStream): SessionDownRequest.BuilderSessionDownRequest {
|
||||
while(parseFieldFrom(input)) {}
|
||||
return this
|
||||
}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(1, sid)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(1, sid)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun mergeWith (other: SessionDownRequest) {
|
||||
sid = other.sid
|
||||
}
|
||||
|
||||
fun mergeFromWithSize (input: CodedInputStream, expectedSize: Int) {
|
||||
val builder = SessionDownRequest.BuilderSessionDownRequest()
|
||||
mergeWith(builder.parseFromWithSize(input, expectedSize).build())}
|
||||
|
||||
fun mergeFrom (input: CodedInputStream) {
|
||||
val builder = SessionDownRequest.BuilderSessionDownRequest()
|
||||
mergeWith(builder.parseFrom(input).build())}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(1, sid)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(1, sid)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class HeartBeatRequest private constructor (sid: Int = 0) {
|
||||
var sid : Int
|
||||
private set
|
||||
|
||||
|
||||
init {
|
||||
this.sid = sid
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (sid != 0) {
|
||||
output.writeInt32 (1, sid)
|
||||
}
|
||||
}
|
||||
|
||||
class BuilderHeartBeatRequest constructor (sid: Int = 0) {
|
||||
var sid : Int
|
||||
private set
|
||||
fun setSid(value: Int): HeartBeatRequest.BuilderHeartBeatRequest {
|
||||
sid = value
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
this.sid = sid
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (sid != 0) {
|
||||
output.writeInt32 (1, sid)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(): HeartBeatRequest {
|
||||
return HeartBeatRequest(sid)
|
||||
}
|
||||
|
||||
fun parseFieldFrom(input: CodedInputStream): Boolean {
|
||||
if (input.isAtEnd()) { return false }
|
||||
val tag = input.readInt32NoTag()
|
||||
if (tag == 0) { return false }
|
||||
val fieldNumber = WireFormat.getTagFieldNumber(tag)
|
||||
val wireType = WireFormat.getTagWireType(tag)
|
||||
when(fieldNumber) {
|
||||
1 -> {
|
||||
if (wireType != WireType.VARINT) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 1 has wire type WireType.VARINT but read ${wireType.toString()}")}
|
||||
sid = input.readInt32NoTag()
|
||||
}
|
||||
}
|
||||
return true}
|
||||
fun parseFromWithSize(input: CodedInputStream, expectedSize: Int): HeartBeatRequest.BuilderHeartBeatRequest {
|
||||
while(getSizeNoTag() < expectedSize) {
|
||||
parseFieldFrom(input)
|
||||
}
|
||||
if (getSizeNoTag() > expectedSize) { throw InvalidProtocolBufferException("Error: expected size of message $expectedSize, but have read at least ${getSizeNoTag()}") }
|
||||
return this
|
||||
}
|
||||
fun parseFrom(input: CodedInputStream): HeartBeatRequest.BuilderHeartBeatRequest {
|
||||
while(parseFieldFrom(input)) {}
|
||||
return this
|
||||
}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(1, sid)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(1, sid)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun mergeWith (other: HeartBeatRequest) {
|
||||
sid = other.sid
|
||||
}
|
||||
|
||||
fun mergeFromWithSize (input: CodedInputStream, expectedSize: Int) {
|
||||
val builder = HeartBeatRequest.BuilderHeartBeatRequest()
|
||||
mergeWith(builder.parseFromWithSize(input, expectedSize).build())}
|
||||
|
||||
fun mergeFrom (input: CodedInputStream) {
|
||||
val builder = HeartBeatRequest.BuilderHeartBeatRequest()
|
||||
mergeWith(builder.parseFrom(input).build())}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(1, sid)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (sid != 0) {
|
||||
size += WireFormat.getInt32Size(1, sid)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class HeartBeatResponse private constructor (code: Int = 0, errorMsg: String = "") {
|
||||
var code : Int
|
||||
private set
|
||||
|
||||
var errorMsg : String
|
||||
private set
|
||||
|
||||
|
||||
init {
|
||||
this.code = code
|
||||
this.errorMsg = errorMsg
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (code != 0) {
|
||||
output.writeInt32 (1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
output.writeString (2, errorMsg)
|
||||
}
|
||||
}
|
||||
|
||||
class BuilderHeartBeatResponse constructor (code: Int = 0, errorMsg: String = "") {
|
||||
var code : Int
|
||||
private set
|
||||
fun setCode(value: Int): HeartBeatResponse.BuilderHeartBeatResponse {
|
||||
code = value
|
||||
return this
|
||||
}
|
||||
|
||||
var errorMsg : String
|
||||
private set
|
||||
fun setErrorMsg(value: String): HeartBeatResponse.BuilderHeartBeatResponse {
|
||||
errorMsg = value
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
this.code = code
|
||||
this.errorMsg = errorMsg
|
||||
}
|
||||
|
||||
fun writeTo (output: CodedOutputStream) {
|
||||
if (code != 0) {
|
||||
output.writeInt32 (1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
output.writeString (2, errorMsg)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(): HeartBeatResponse {
|
||||
return HeartBeatResponse(code, errorMsg)
|
||||
}
|
||||
|
||||
fun parseFieldFrom(input: CodedInputStream): Boolean {
|
||||
if (input.isAtEnd()) { return false }
|
||||
val tag = input.readInt32NoTag()
|
||||
if (tag == 0) { return false }
|
||||
val fieldNumber = WireFormat.getTagFieldNumber(tag)
|
||||
val wireType = WireFormat.getTagWireType(tag)
|
||||
when(fieldNumber) {
|
||||
1 -> {
|
||||
if (wireType != WireType.VARINT) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 1 has wire type WireType.VARINT but read ${wireType.toString()}")}
|
||||
code = input.readInt32NoTag()
|
||||
}
|
||||
2 -> {
|
||||
if (wireType != WireType.LENGTH_DELIMITED) {
|
||||
throw InvalidProtocolBufferException("Error: Field number 2 has wire type WireType.LENGTH_DELIMITED but read ${wireType.toString()}")}
|
||||
errorMsg = input.readStringNoTag()
|
||||
}
|
||||
}
|
||||
return true}
|
||||
fun parseFromWithSize(input: CodedInputStream, expectedSize: Int): HeartBeatResponse.BuilderHeartBeatResponse {
|
||||
while(getSizeNoTag() < expectedSize) {
|
||||
parseFieldFrom(input)
|
||||
}
|
||||
if (getSizeNoTag() > expectedSize) { throw InvalidProtocolBufferException("Error: expected size of message $expectedSize, but have read at least ${getSizeNoTag()}") }
|
||||
return this
|
||||
}
|
||||
fun parseFrom(input: CodedInputStream): HeartBeatResponse.BuilderHeartBeatResponse {
|
||||
while(parseFieldFrom(input)) {}
|
||||
return this
|
||||
}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun mergeWith (other: HeartBeatResponse) {
|
||||
code = other.code
|
||||
errorMsg = other.errorMsg
|
||||
}
|
||||
|
||||
fun mergeFromWithSize (input: CodedInputStream, expectedSize: Int) {
|
||||
val builder = HeartBeatResponse.BuilderHeartBeatResponse()
|
||||
mergeWith(builder.parseFromWithSize(input, expectedSize).build())}
|
||||
|
||||
fun mergeFrom (input: CodedInputStream) {
|
||||
val builder = HeartBeatResponse.BuilderHeartBeatResponse()
|
||||
mergeWith(builder.parseFrom(input).build())}
|
||||
fun getSize(fieldNumber: Int): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
size += WireFormat.getVarint32Size(size) + WireFormat.getTagSize(fieldNumber, WireType.LENGTH_DELIMITED)
|
||||
return size
|
||||
}
|
||||
fun getSizeNoTag(): Int {
|
||||
var size = 0
|
||||
if (code != 0) {
|
||||
size += WireFormat.getInt32Size(1, code)
|
||||
}
|
||||
if (errorMsg != "") {
|
||||
size += WireFormat.getStringSize(2, errorMsg)
|
||||
}
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user