Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
p x
SuZhouAvp
Commits
fecf07e4
Commit
fecf07e4
authored
Jun 13, 2025
by
pxl
Browse files
proto
parent
e32fe570
Changes
7
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
fecf07e4
# SuZhouAvp
停车场泊车 苏州 约等于(长春) AVP
\ No newline at end of file
停车场泊车 苏州 约等于(长春) AVP
https://protobuf.dev/getting-started/javatutorial/
protoc --java_out=app
\s
rc
\m
ain
\j
ava
\
-I d:
\W
orkSpace
\s
uzhouavp
\a
pp
\s
rc
\m
ain
\p
roto
\
d:
\W
orkSpace
\s
uzhouavp
\a
pp
\s
rc
\m
ain
\p
roto
\r
esponse.proto
\ No newline at end of file
app/build.gradle.kts
View file @
fecf07e4
import
org.gradle.internal.declarativedsl.parsing.main
import
org.jetbrains.kotlin.gradle.internal.wrapPluginOptions
plugins
{
alias
(
libs
.
plugins
.
android
.
application
)
alias
(
libs
.
plugins
.
kotlin
.
android
)
id
(
"dagger.hilt.android.plugin"
)
id
(
"kotlin-kapt"
)
id
(
"com.google.protobuf"
)
// id("com.google.protobuf")
// alias(libs.plugins.proto.google)
}
android
{
...
...
@@ -46,39 +45,8 @@ android {
abortOnError
=
false
checkReleaseBuilds
=
false
}
sourceSets
{
//配置 protoc 编译器
}
}
protobuf
{
//配置 protoc 编译器
// protoc {
// artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
// }
plugins
{
// The codegen for lite comes as a separate artifact
// artifacts {
// "com.google.protobuf:protoc-gen-javalite:3.0.0"
// }
}
//配置生成目录,编译后会在 build 的目录下生成对应的java文件
generateProtoTasks
{
all
().
forEach
{
task-
>
task
.
builtins
{
// remove(com.google.protobuf.gradle.ProtobufPlugin.j)
// remove(java)
}
task
.
builtins
{
java
{
}
}
}
}
}
dependencies
{
implementation
(
fileTree
(
mapOf
(
"dir"
to
"libs"
,
"include"
to
listOf
(
"*.jar"
,
"*.aar"
))))
...
...
@@ -91,9 +59,9 @@ dependencies {
androidTestImplementation
(
libs
.
androidx
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
espresso
.
core
)
implementation
(
"com.google.protobuf:protobuf-java:
3.19.2
"
)
// implementation("com.google.protobuf:protobuf-lite:
3.0.0
")
// implementation("com.google.protobuf:proto
buf-lite
:3.0.0")
implementation
(
"com.google.protobuf:protobuf-java:
4.31.1
"
)
// implementation("com.google.protobuf:protobuf-
java
lite:
4.31.1
")
// implementation("com.google.protobuf:proto
c
:3.0.0")
// implementation("com.google.protobuf:protobuf-kotlin-lite:4.31.1")
//java web socket
...
...
app/src/main/java/com/sd/cavphmi/viewmodels/MainVm.kt
View file @
fecf07e4
...
...
@@ -61,7 +61,7 @@ class MainVm @Inject constructor(
}
override
fun
onMessage
(
bytes
:
ByteBuffer
?)
{
// SocketResponse.parseFrom(bytes)
}
override
fun
onClose
(
code
:
Int
,
reason
:
String
?,
remote
:
Boolean
)
{
...
...
app/src/main/java/com/sd/cavphmi/websockets/MyWebSocketClient.kt
View file @
fecf07e4
package
com.sd.cavphmi.websockets
import
org.java_websocket.client.WebSocketClient
import
org.java_websocket.drafts.Draft
import
org.java_websocket.handshake.ServerHandshake
import
protocol.Response.SocketResponse
import
java.net.URI
import
java.nio.ByteBuffer
...
...
@@ -49,6 +51,8 @@ class MyWebSocketClient : WebSocketClient {
override
fun
onMessage
(
bytes
:
ByteBuffer
?)
{
System
.
out
.
println
(
TAG
+
" received ByteBuffer"
)
var
socketResponse
=
SocketResponse
.
parseFrom
(
bytes
)
// socketResponse.
onSocketCb
?.
onMessage
(
bytes
)
}
...
...
app/src/main/java/protocol/Response.java
0 → 100644
View file @
fecf07e4
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: response.proto
// Protobuf Java Version: 4.31.1
package
protocol
;
@com
.
google
.
protobuf
.
Generated
public
final
class
Response
{
private
Response
()
{}
static
{
com
.
google
.
protobuf
.
RuntimeVersion
.
validateProtobufGencodeVersion
(
com
.
google
.
protobuf
.
RuntimeVersion
.
RuntimeDomain
.
PUBLIC
,
/* major= */
4
,
/* minor= */
31
,
/* patch= */
1
,
/* suffix= */
""
,
Response
.
class
.
getName
());
}
public
static
void
registerAllExtensions
(
com
.
google
.
protobuf
.
ExtensionRegistryLite
registry
)
{
}
public
static
void
registerAllExtensions
(
com
.
google
.
protobuf
.
ExtensionRegistry
registry
)
{
registerAllExtensions
(
(
com
.
google
.
protobuf
.
ExtensionRegistryLite
)
registry
);
}
public
interface
SocketResponseOrBuilder
extends
// @@protoc_insertion_point(interface_extends:protocol.SocketResponse)
com
.
google
.
protobuf
.
MessageOrBuilder
{
/**
* <code>int32 code = 1;</code>
* @return The code.
*/
int
getCode
();
/**
* <code>string msg = 2;</code>
* @return The msg.
*/
java
.
lang
.
String
getMsg
();
/**
* <code>string msg = 2;</code>
* @return The bytes for msg.
*/
com
.
google
.
protobuf
.
ByteString
getMsgBytes
();
/**
* <pre>
* </pre>
*
* <code>int32 msgType = 3;</code>
* @return The msgType.
*/
int
getMsgType
();
/**
* <code>string data = 4;</code>
* @return The data.
*/
java
.
lang
.
String
getData
();
/**
* <code>string data = 4;</code>
* @return The bytes for data.
*/
com
.
google
.
protobuf
.
ByteString
getDataBytes
();
}
/**
* Protobuf type {@code protocol.SocketResponse}
*/
public
static
final
class
SocketResponse
extends
com
.
google
.
protobuf
.
GeneratedMessage
implements
// @@protoc_insertion_point(message_implements:protocol.SocketResponse)
SocketResponseOrBuilder
{
private
static
final
long
serialVersionUID
=
0L
;
static
{
com
.
google
.
protobuf
.
RuntimeVersion
.
validateProtobufGencodeVersion
(
com
.
google
.
protobuf
.
RuntimeVersion
.
RuntimeDomain
.
PUBLIC
,
/* major= */
4
,
/* minor= */
31
,
/* patch= */
1
,
/* suffix= */
""
,
SocketResponse
.
class
.
getName
());
}
// Use SocketResponse.newBuilder() to construct.
private
SocketResponse
(
com
.
google
.
protobuf
.
GeneratedMessage
.
Builder
<?>
builder
)
{
super
(
builder
);
}
private
SocketResponse
()
{
msg_
=
""
;
data_
=
""
;
}
public
static
final
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptor
()
{
return
protocol
.
Response
.
internal_static_protocol_SocketResponse_descriptor
;
}
@java
.
lang
.
Override
protected
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internalGetFieldAccessorTable
()
{
return
protocol
.
Response
.
internal_static_protocol_SocketResponse_fieldAccessorTable
.
ensureFieldAccessorsInitialized
(
protocol
.
Response
.
SocketResponse
.
class
,
protocol
.
Response
.
SocketResponse
.
Builder
.
class
);
}
public
static
final
int
CODE_FIELD_NUMBER
=
1
;
private
int
code_
=
0
;
/**
* <code>int32 code = 1;</code>
* @return The code.
*/
@java
.
lang
.
Override
public
int
getCode
()
{
return
code_
;
}
public
static
final
int
MSG_FIELD_NUMBER
=
2
;
@SuppressWarnings
(
"serial"
)
private
volatile
java
.
lang
.
Object
msg_
=
""
;
/**
* <code>string msg = 2;</code>
* @return The msg.
*/
@java
.
lang
.
Override
public
java
.
lang
.
String
getMsg
()
{
java
.
lang
.
Object
ref
=
msg_
;
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
();
msg_
=
s
;
return
s
;
}
}
/**
* <code>string msg = 2;</code>
* @return The bytes for msg.
*/
@java
.
lang
.
Override
public
com
.
google
.
protobuf
.
ByteString
getMsgBytes
()
{
java
.
lang
.
Object
ref
=
msg_
;
if
(
ref
instanceof
java
.
lang
.
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
java
.
lang
.
String
)
ref
);
msg_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
public
static
final
int
MSGTYPE_FIELD_NUMBER
=
3
;
private
int
msgType_
=
0
;
/**
* <pre>
* </pre>
*
* <code>int32 msgType = 3;</code>
* @return The msgType.
*/
@java
.
lang
.
Override
public
int
getMsgType
()
{
return
msgType_
;
}
public
static
final
int
DATA_FIELD_NUMBER
=
4
;
@SuppressWarnings
(
"serial"
)
private
volatile
java
.
lang
.
Object
data_
=
""
;
/**
* <code>string data = 4;</code>
* @return The data.
*/
@java
.
lang
.
Override
public
java
.
lang
.
String
getData
()
{
java
.
lang
.
Object
ref
=
data_
;
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
();
data_
=
s
;
return
s
;
}
}
/**
* <code>string data = 4;</code>
* @return The bytes for data.
*/
@java
.
lang
.
Override
public
com
.
google
.
protobuf
.
ByteString
getDataBytes
()
{
java
.
lang
.
Object
ref
=
data_
;
if
(
ref
instanceof
java
.
lang
.
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
java
.
lang
.
String
)
ref
);
data_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
private
byte
memoizedIsInitialized
=
-
1
;
@java
.
lang
.
Override
public
final
boolean
isInitialized
()
{
byte
isInitialized
=
memoizedIsInitialized
;
if
(
isInitialized
==
1
)
return
true
;
if
(
isInitialized
==
0
)
return
false
;
memoizedIsInitialized
=
1
;
return
true
;
}
@java
.
lang
.
Override
public
void
writeTo
(
com
.
google
.
protobuf
.
CodedOutputStream
output
)
throws
java
.
io
.
IOException
{
if
(
code_
!=
0
)
{
output
.
writeInt32
(
1
,
code_
);
}
if
(!
com
.
google
.
protobuf
.
GeneratedMessage
.
isStringEmpty
(
msg_
))
{
com
.
google
.
protobuf
.
GeneratedMessage
.
writeString
(
output
,
2
,
msg_
);
}
if
(
msgType_
!=
0
)
{
output
.
writeInt32
(
3
,
msgType_
);
}
if
(!
com
.
google
.
protobuf
.
GeneratedMessage
.
isStringEmpty
(
data_
))
{
com
.
google
.
protobuf
.
GeneratedMessage
.
writeString
(
output
,
4
,
data_
);
}
getUnknownFields
().
writeTo
(
output
);
}
@java
.
lang
.
Override
public
int
getSerializedSize
()
{
int
size
=
memoizedSize
;
if
(
size
!=
-
1
)
return
size
;
size
=
0
;
if
(
code_
!=
0
)
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeInt32Size
(
1
,
code_
);
}
if
(!
com
.
google
.
protobuf
.
GeneratedMessage
.
isStringEmpty
(
msg_
))
{
size
+=
com
.
google
.
protobuf
.
GeneratedMessage
.
computeStringSize
(
2
,
msg_
);
}
if
(
msgType_
!=
0
)
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeInt32Size
(
3
,
msgType_
);
}
if
(!
com
.
google
.
protobuf
.
GeneratedMessage
.
isStringEmpty
(
data_
))
{
size
+=
com
.
google
.
protobuf
.
GeneratedMessage
.
computeStringSize
(
4
,
data_
);
}
size
+=
getUnknownFields
().
getSerializedSize
();
memoizedSize
=
size
;
return
size
;
}
@java
.
lang
.
Override
public
boolean
equals
(
final
java
.
lang
.
Object
obj
)
{
if
(
obj
==
this
)
{
return
true
;
}
if
(!(
obj
instanceof
protocol
.
Response
.
SocketResponse
))
{
return
super
.
equals
(
obj
);
}
protocol
.
Response
.
SocketResponse
other
=
(
protocol
.
Response
.
SocketResponse
)
obj
;
if
(
getCode
()
!=
other
.
getCode
())
return
false
;
if
(!
getMsg
()
.
equals
(
other
.
getMsg
()))
return
false
;
if
(
getMsgType
()
!=
other
.
getMsgType
())
return
false
;
if
(!
getData
()
.
equals
(
other
.
getData
()))
return
false
;
if
(!
getUnknownFields
().
equals
(
other
.
getUnknownFields
()))
return
false
;
return
true
;
}
@java
.
lang
.
Override
public
int
hashCode
()
{
if
(
memoizedHashCode
!=
0
)
{
return
memoizedHashCode
;
}
int
hash
=
41
;
hash
=
(
19
*
hash
)
+
getDescriptor
().
hashCode
();
hash
=
(
37
*
hash
)
+
CODE_FIELD_NUMBER
;
hash
=
(
53
*
hash
)
+
getCode
();
hash
=
(
37
*
hash
)
+
MSG_FIELD_NUMBER
;
hash
=
(
53
*
hash
)
+
getMsg
().
hashCode
();
hash
=
(
37
*
hash
)
+
MSGTYPE_FIELD_NUMBER
;
hash
=
(
53
*
hash
)
+
getMsgType
();
hash
=
(
37
*
hash
)
+
DATA_FIELD_NUMBER
;
hash
=
(
53
*
hash
)
+
getData
().
hashCode
();
hash
=
(
29
*
hash
)
+
getUnknownFields
().
hashCode
();
memoizedHashCode
=
hash
;
return
hash
;
}
public
static
protocol
.
Response
.
SocketResponse
parseFrom
(
java
.
nio
.
ByteBuffer
data
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
);
}
public
static
protocol
.
Response
.
SocketResponse
parseFrom
(
java
.
nio
.
ByteBuffer
data
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
,
extensionRegistry
);
}
public
static
protocol
.
Response
.
SocketResponse
parseFrom
(
com
.
google
.
protobuf
.
ByteString
data
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
);
}
public
static
protocol
.
Response
.
SocketResponse
parseFrom
(
com
.
google
.
protobuf
.
ByteString
data
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
,
extensionRegistry
);
}
public
static
protocol
.
Response
.
SocketResponse
parseFrom
(
byte
[]
data
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
);
}
public
static
protocol
.
Response
.
SocketResponse
parseFrom
(
byte
[]
data
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
,
extensionRegistry
);
}
public
static
protocol
.
Response
.
SocketResponse
parseFrom
(
java
.
io
.
InputStream
input
)
throws
java
.
io
.
IOException
{
return
com
.
google
.
protobuf
.
GeneratedMessage
.
parseWithIOException
(
PARSER
,
input
);
}
public
static
protocol
.
Response
.
SocketResponse
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
protocol
.
Response
.
SocketResponse
parseDelimitedFrom
(
java
.
io
.
InputStream
input
)
throws
java
.
io
.
IOException
{
return
com
.
google
.
protobuf
.
GeneratedMessage
.
parseDelimitedWithIOException
(
PARSER
,
input
);
}
public
static
protocol
.
Response
.
SocketResponse
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
protocol
.
Response
.
SocketResponse
parseFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
)
throws
java
.
io
.
IOException
{
return
com
.
google
.
protobuf
.
GeneratedMessage
.
parseWithIOException
(
PARSER
,
input
);
}
public
static
protocol
.
Response
.
SocketResponse
parseFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
return
com
.
google
.
protobuf
.
GeneratedMessage
.
parseWithIOException
(
PARSER
,
input
,
extensionRegistry
);
}
@java
.
lang
.
Override
public
Builder
newBuilderForType
()
{
return
newBuilder
();
}
public
static
Builder
newBuilder
()
{
return
DEFAULT_INSTANCE
.
toBuilder
();
}
public
static
Builder
newBuilder
(
protocol
.
Response
.
SocketResponse
prototype
)
{
return
DEFAULT_INSTANCE
.
toBuilder
().
mergeFrom
(
prototype
);
}
@java
.
lang
.
Override
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 protocol.SocketResponse}
*/
public
static
final
class
Builder
extends
com
.
google
.
protobuf
.
GeneratedMessage
.
Builder
<
Builder
>
implements
// @@protoc_insertion_point(builder_implements:protocol.SocketResponse)
protocol
.
Response
.
SocketResponseOrBuilder
{
public
static
final
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptor
()
{
return
protocol
.
Response
.
internal_static_protocol_SocketResponse_descriptor
;
}
@java
.
lang
.
Override
protected
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internalGetFieldAccessorTable
()
{
return
protocol
.
Response
.
internal_static_protocol_SocketResponse_fieldAccessorTable
.
ensureFieldAccessorsInitialized
(
protocol
.
Response
.
SocketResponse
.
class
,
protocol
.
Response
.
SocketResponse
.
Builder
.
class
);
}
// Construct using protocol.Response.SocketResponse.newBuilder()
private
Builder
()
{
}
private
Builder
(
com
.
google
.
protobuf
.
GeneratedMessage
.
BuilderParent
parent
)
{
super
(
parent
);
}
@java
.
lang
.
Override
public
Builder
clear
()
{
super
.
clear
();
bitField0_
=
0
;
code_
=
0
;
msg_
=
""
;
msgType_
=
0
;
data_
=
""
;
return
this
;
}
@java
.
lang
.
Override
public
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptorForType
()
{
return
protocol
.
Response
.
internal_static_protocol_SocketResponse_descriptor
;
}
@java
.
lang
.
Override
public
protocol
.
Response
.
SocketResponse
getDefaultInstanceForType
()
{
return
protocol
.
Response
.
SocketResponse
.
getDefaultInstance
();
}
@java
.
lang
.
Override
public
protocol
.
Response
.
SocketResponse
build
()
{
protocol
.
Response
.
SocketResponse
result
=
buildPartial
();
if
(!
result
.
isInitialized
())
{
throw
newUninitializedMessageException
(
result
);
}
return
result
;
}
@java
.
lang
.
Override
public
protocol
.
Response
.
SocketResponse
buildPartial
()
{
protocol
.
Response
.
SocketResponse
result
=
new
protocol
.
Response
.
SocketResponse
(
this
);
if
(
bitField0_
!=
0
)
{
buildPartial0
(
result
);
}
onBuilt
();
return
result
;
}
private
void
buildPartial0
(
protocol
.
Response
.
SocketResponse
result
)
{
int
from_bitField0_
=
bitField0_
;
if
(((
from_bitField0_
&
0x00000001
)
!=
0
))
{
result
.
code_
=
code_
;
}
if
(((
from_bitField0_
&
0x00000002
)
!=
0
))
{
result
.
msg_
=
msg_
;
}
if
(((
from_bitField0_
&
0x00000004
)
!=
0
))
{
result
.
msgType_
=
msgType_
;
}
if
(((
from_bitField0_
&
0x00000008
)
!=
0
))
{
result
.
data_
=
data_
;
}
}
@java
.
lang
.
Override
public
Builder
mergeFrom
(
com
.
google
.
protobuf
.
Message
other
)
{
if
(
other
instanceof
protocol
.
Response
.
SocketResponse
)
{
return
mergeFrom
((
protocol
.
Response
.
SocketResponse
)
other
);
}
else
{
super
.
mergeFrom
(
other
);
return
this
;
}
}
public
Builder
mergeFrom
(
protocol
.
Response
.
SocketResponse
other
)
{
if
(
other
==
protocol
.
Response
.
SocketResponse
.
getDefaultInstance
())
return
this
;
if
(
other
.
getCode
()
!=
0
)
{
setCode
(
other
.
getCode
());
}
if
(!
other
.
getMsg
().
isEmpty
())
{
msg_
=
other
.
msg_
;
bitField0_
|=
0x00000002
;
onChanged
();
}
if
(
other
.
getMsgType
()
!=
0
)
{
setMsgType
(
other
.
getMsgType
());
}
if
(!
other
.
getData
().
isEmpty
())
{
data_
=
other
.
data_
;
bitField0_
|=
0x00000008
;
onChanged
();
}
this
.
mergeUnknownFields
(
other
.
getUnknownFields
());
onChanged
();
return
this
;
}
@java
.
lang
.
Override
public
final
boolean
isInitialized
()
{
return
true
;
}
@java
.
lang
.
Override
public
Builder
mergeFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
if
(
extensionRegistry
==
null
)
{
throw
new
java
.
lang
.
NullPointerException
();
}
try
{
boolean
done
=
false
;
while
(!
done
)
{
int
tag
=
input
.
readTag
();
switch
(
tag
)
{
case
0
:
done
=
true
;
break
;
case
8
:
{
code_
=
input
.
readInt32
();
bitField0_
|=
0x00000001
;
break
;
}
// case 8
case
18
:
{
msg_
=
input
.
readStringRequireUtf8
();
bitField0_
|=
0x00000002
;
break
;
}
// case 18
case
24
:
{
msgType_
=
input
.
readInt32
();
bitField0_
|=
0x00000004
;
break
;
}
// case 24
case
34
:
{
data_
=
input
.
readStringRequireUtf8
();
bitField0_
|=
0x00000008
;
break
;
}
// case 34
default
:
{
if
(!
super
.
parseUnknownField
(
input
,
extensionRegistry
,
tag
))
{
done
=
true
;
// was an endgroup tag
}
break
;
}
// default:
}
// switch (tag)
}
// while (!done)
}
catch
(
com
.
google
.
protobuf
.
InvalidProtocolBufferException
e
)
{
throw
e
.
unwrapIOException
();
}
finally
{
onChanged
();
}
// finally
return
this
;
}
private
int
bitField0_
;
private
int
code_
;
/**
* <code>int32 code = 1;</code>
* @return The code.
*/
@java
.
lang
.
Override
public
int
getCode
()
{
return
code_
;
}
/**
* <code>int32 code = 1;</code>
* @param value The code to set.
* @return This builder for chaining.
*/
public
Builder
setCode
(
int
value
)
{
code_
=
value
;
bitField0_
|=
0x00000001
;
onChanged
();
return
this
;
}
/**
* <code>int32 code = 1;</code>
* @return This builder for chaining.
*/
public
Builder
clearCode
()
{
bitField0_
=
(
bitField0_
&
~
0x00000001
);
code_
=
0
;
onChanged
();
return
this
;
}
private
java
.
lang
.
Object
msg_
=
""
;
/**
* <code>string msg = 2;</code>
* @return The msg.
*/
public
java
.
lang
.
String
getMsg
()
{
java
.
lang
.
Object
ref
=
msg_
;
if
(!(
ref
instanceof
java
.
lang
.
String
))
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
java
.
lang
.
String
s
=
bs
.
toStringUtf8
();
msg_
=
s
;
return
s
;
}
else
{
return
(
java
.
lang
.
String
)
ref
;
}
}
/**
* <code>string msg = 2;</code>
* @return The bytes for msg.
*/
public
com
.
google
.
protobuf
.
ByteString
getMsgBytes
()
{
java
.
lang
.
Object
ref
=
msg_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
java
.
lang
.
String
)
ref
);
msg_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
/**
* <code>string msg = 2;</code>
* @param value The msg to set.
* @return This builder for chaining.
*/
public
Builder
setMsg
(
java
.
lang
.
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
msg_
=
value
;
bitField0_
|=
0x00000002
;
onChanged
();
return
this
;
}
/**
* <code>string msg = 2;</code>
* @return This builder for chaining.
*/
public
Builder
clearMsg
()
{
msg_
=
getDefaultInstance
().
getMsg
();
bitField0_
=
(
bitField0_
&
~
0x00000002
);
onChanged
();
return
this
;
}
/**
* <code>string msg = 2;</code>
* @param value The bytes for msg to set.
* @return This builder for chaining.
*/
public
Builder
setMsgBytes
(
com
.
google
.
protobuf
.
ByteString
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
checkByteStringIsUtf8
(
value
);
msg_
=
value
;
bitField0_
|=
0x00000002
;
onChanged
();
return
this
;
}
private
int
msgType_
;
/**
* <pre>
* </pre>
*
* <code>int32 msgType = 3;</code>
* @return The msgType.
*/
@java
.
lang
.
Override
public
int
getMsgType
()
{
return
msgType_
;
}
/**
* <pre>
* </pre>
*
* <code>int32 msgType = 3;</code>
* @param value The msgType to set.
* @return This builder for chaining.
*/
public
Builder
setMsgType
(
int
value
)
{
msgType_
=
value
;
bitField0_
|=
0x00000004
;
onChanged
();
return
this
;
}
/**
* <pre>
* </pre>
*
* <code>int32 msgType = 3;</code>
* @return This builder for chaining.
*/
public
Builder
clearMsgType
()
{
bitField0_
=
(
bitField0_
&
~
0x00000004
);
msgType_
=
0
;
onChanged
();
return
this
;
}
private
java
.
lang
.
Object
data_
=
""
;
/**
* <code>string data = 4;</code>
* @return The data.
*/
public
java
.
lang
.
String
getData
()
{
java
.
lang
.
Object
ref
=
data_
;
if
(!(
ref
instanceof
java
.
lang
.
String
))
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
java
.
lang
.
String
s
=
bs
.
toStringUtf8
();
data_
=
s
;
return
s
;
}
else
{
return
(
java
.
lang
.
String
)
ref
;
}
}
/**
* <code>string data = 4;</code>
* @return The bytes for data.
*/
public
com
.
google
.
protobuf
.
ByteString
getDataBytes
()
{
java
.
lang
.
Object
ref
=
data_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
java
.
lang
.
String
)
ref
);
data_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
/**
* <code>string data = 4;</code>
* @param value The data to set.
* @return This builder for chaining.
*/
public
Builder
setData
(
java
.
lang
.
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
data_
=
value
;
bitField0_
|=
0x00000008
;
onChanged
();
return
this
;
}
/**
* <code>string data = 4;</code>
* @return This builder for chaining.
*/
public
Builder
clearData
()
{
data_
=
getDefaultInstance
().
getData
();
bitField0_
=
(
bitField0_
&
~
0x00000008
);
onChanged
();
return
this
;
}
/**
* <code>string data = 4;</code>
* @param value The bytes for data to set.
* @return This builder for chaining.
*/
public
Builder
setDataBytes
(
com
.
google
.
protobuf
.
ByteString
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
checkByteStringIsUtf8
(
value
);
data_
=
value
;
bitField0_
|=
0x00000008
;
onChanged
();
return
this
;
}
// @@protoc_insertion_point(builder_scope:protocol.SocketResponse)
}
// @@protoc_insertion_point(class_scope:protocol.SocketResponse)
private
static
final
protocol
.
Response
.
SocketResponse
DEFAULT_INSTANCE
;
static
{
DEFAULT_INSTANCE
=
new
protocol
.
Response
.
SocketResponse
();
}
public
static
protocol
.
Response
.
SocketResponse
getDefaultInstance
()
{
return
DEFAULT_INSTANCE
;
}
private
static
final
com
.
google
.
protobuf
.
Parser
<
SocketResponse
>
PARSER
=
new
com
.
google
.
protobuf
.
AbstractParser
<
SocketResponse
>()
{
@java
.
lang
.
Override
public
SocketResponse
parsePartialFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
Builder
builder
=
newBuilder
();
try
{
builder
.
mergeFrom
(
input
,
extensionRegistry
);
}
catch
(
com
.
google
.
protobuf
.
InvalidProtocolBufferException
e
)
{
throw
e
.
setUnfinishedMessage
(
builder
.
buildPartial
());
}
catch
(
com
.
google
.
protobuf
.
UninitializedMessageException
e
)
{
throw
e
.
asInvalidProtocolBufferException
().
setUnfinishedMessage
(
builder
.
buildPartial
());
}
catch
(
java
.
io
.
IOException
e
)
{
throw
new
com
.
google
.
protobuf
.
InvalidProtocolBufferException
(
e
)
.
setUnfinishedMessage
(
builder
.
buildPartial
());
}
return
builder
.
buildPartial
();
}
};
public
static
com
.
google
.
protobuf
.
Parser
<
SocketResponse
>
parser
()
{
return
PARSER
;
}
@java
.
lang
.
Override
public
com
.
google
.
protobuf
.
Parser
<
SocketResponse
>
getParserForType
()
{
return
PARSER
;
}
@java
.
lang
.
Override
public
protocol
.
Response
.
SocketResponse
getDefaultInstanceForType
()
{
return
DEFAULT_INSTANCE
;
}
}
private
static
final
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
internal_static_protocol_SocketResponse_descriptor
;
private
static
final
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internal_static_protocol_SocketResponse_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\016response.proto\022\010protocol\"J\n\016SocketResp"
+
"onse\022\014\n\004code\030\001 \001(\005\022\013\n\003msg\030\002 \001(\t\022\017\n\007msgTy"
+
"pe\030\003 \001(\005\022\014\n\004data\030\004 \001(\tb\006proto3"
};
descriptor
=
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
.
internalBuildGeneratedFileFrom
(
descriptorData
,
new
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
[]
{
});
internal_static_protocol_SocketResponse_descriptor
=
getDescriptor
().
getMessageTypes
().
get
(
0
);
internal_static_protocol_SocketResponse_fieldAccessorTable
=
new
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
(
internal_static_protocol_SocketResponse_descriptor
,
new
java
.
lang
.
String
[]
{
"Code"
,
"Msg"
,
"MsgType"
,
"Data"
,
});
descriptor
.
resolveAllFeaturesImmutable
();
}
// @@protoc_insertion_point(outer_class_scope)
}
app/src/main/proto/response.proto
View file @
fecf07e4
syntax
=
"proto3"
;
package
com
.
sd.cavphmi
;
package
protocol
;
message
SocketResponse
{
int32
code
=
1
;
...
...
protoc-31.1-win64.zip
0 → 100644
View file @
fecf07e4
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment