From 394a4136918a67b51cd192a6dc3459a3333235f2 Mon Sep 17 00:00:00 2001 From: Rik Veenboer Date: Thu, 16 Jul 2015 15:55:55 +0100 Subject: [PATCH] Working code for bidirectional communication using protocol buffers --- .../arduino/implementation/Local.java | 1 + .../boukefalos/arduino/port/ParsingPort.java | 10 +- .../github/boukefalos/arduino/port/Port.java | 3 +- src/main/java/tm1638/Tm1638.java | 4626 ----------------- src/test/java/jlibarduino/Test.java | 24 - 5 files changed, 6 insertions(+), 4658 deletions(-) delete mode 100644 src/main/java/tm1638/Tm1638.java delete mode 100644 src/test/java/jlibarduino/Test.java diff --git a/src/main/java/com/github/boukefalos/arduino/implementation/Local.java b/src/main/java/com/github/boukefalos/arduino/implementation/Local.java index 148f03f..4984f46 100644 --- a/src/main/java/com/github/boukefalos/arduino/implementation/Local.java +++ b/src/main/java/com/github/boukefalos/arduino/implementation/Local.java @@ -37,6 +37,7 @@ public class Local extends AbstractArduino { public void send(byte[] buffer) throws ArduinoException { try { outputStream.write(buffer); + outputStream.flush(); } catch (IOException e) { throw new ArduinoException("Failed to write to arduino"); } diff --git a/src/main/java/com/github/boukefalos/arduino/port/ParsingPort.java b/src/main/java/com/github/boukefalos/arduino/port/ParsingPort.java index 49496a1..525f934 100644 --- a/src/main/java/com/github/boukefalos/arduino/port/ParsingPort.java +++ b/src/main/java/com/github/boukefalos/arduino/port/ParsingPort.java @@ -22,15 +22,11 @@ public class ParsingPort extends Port { public void serialEvent(SerialPortEvent event) { try { - Method m = messageClass.getMethod("parseDelimitedFrom", InputStream.class); - Object object = m.invoke(null, inputStream); + Method method = messageClass.getMethod("parseDelimitedFrom", InputStream.class); + Object object = method.invoke(null, inputStream); for (Listen listen : listenList) { listen.add(object); } - } catch (Exception e) { - logger.error("", e); - } catch (Throwable e) { - logger.error("", e); - } + } catch (Exception e) {} catch (Throwable e) {} finally {} } } diff --git a/src/main/java/com/github/boukefalos/arduino/port/Port.java b/src/main/java/com/github/boukefalos/arduino/port/Port.java index 21f5c3d..cd1c001 100644 --- a/src/main/java/com/github/boukefalos/arduino/port/Port.java +++ b/src/main/java/com/github/boukefalos/arduino/port/Port.java @@ -68,13 +68,14 @@ public class Port implements SerialPortEventListener { CommPortIdentifier portid = null; Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { - portid = (CommPortIdentifier)portEnum.nextElement(); + portid = (CommPortIdentifier) portEnum.nextElement(); if (portid != null) { System.out.println("Trying: " + portid.getName()); for ( String portName: PORT_NAMES) { if (portid.getName().equals(portName) || portid.getName().contains(portName)) { try { serialPort = (SerialPort) portid.open("", TIME_OUT); + serialPort.setSerialPortParams(19200, 8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); serialPort.setFlowControlMode( SerialPort.FLOWCONTROL_XONXOFF_IN + SerialPort.FLOWCONTROL_XONXOFF_OUT); diff --git a/src/main/java/tm1638/Tm1638.java b/src/main/java/tm1638/Tm1638.java deleted file mode 100644 index a6cadd1..0000000 --- a/src/main/java/tm1638/Tm1638.java +++ /dev/null @@ -1,4626 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: tm1638.proto - -package tm1638; - -public final class Tm1638 { - private Tm1638() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - } - /** - * Protobuf enum {@code tm1638.Color} - */ - public enum Color - implements com.google.protobuf.ProtocolMessageEnum { - /** - * GREEN = 1; - */ - GREEN(0, 1), - /** - * RED = 2; - */ - RED(1, 2), - /** - * BOTH = 3; - */ - BOTH(2, 3), - /** - * NONE = 4; - */ - NONE(3, 4), - ; - - /** - * GREEN = 1; - */ - public static final int GREEN_VALUE = 1; - /** - * RED = 2; - */ - public static final int RED_VALUE = 2; - /** - * BOTH = 3; - */ - public static final int BOTH_VALUE = 3; - /** - * NONE = 4; - */ - public static final int NONE_VALUE = 4; - - - public final int getNumber() { return value; } - - public static Color valueOf(int value) { - switch (value) { - case 1: return GREEN; - case 2: return RED; - case 3: return BOTH; - case 4: return NONE; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public Color findValueByNumber(int number) { - return Color.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return tm1638.Tm1638.getDescriptor().getEnumTypes().get(0); - } - - private static final Color[] VALUES = values(); - - public static Color valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private Color(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:tm1638.Color) - } - - /** - * Protobuf enum {@code tm1638.Module} - */ - public enum Module - implements com.google.protobuf.ProtocolMessageEnum { - /** - * TM1638 = 1; - */ - TM1638(0, 1), - /** - * InvertedTM1638 = 2; - */ - InvertedTM1638(1, 2), - /** - * TM1640 = 3; - */ - TM1640(2, 3), - ; - - /** - * TM1638 = 1; - */ - public static final int TM1638_VALUE = 1; - /** - * InvertedTM1638 = 2; - */ - public static final int InvertedTM1638_VALUE = 2; - /** - * TM1640 = 3; - */ - public static final int TM1640_VALUE = 3; - - - public final int getNumber() { return value; } - - public static Module valueOf(int value) { - switch (value) { - case 1: return TM1638; - case 2: return InvertedTM1638; - case 3: return TM1640; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public Module findValueByNumber(int number) { - return Module.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return tm1638.Tm1638.getDescriptor().getEnumTypes().get(1); - } - - private static final Module[] VALUES = values(); - - public static Module valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private Module(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:tm1638.Module) - } - - public interface CommandOrBuilder extends - // @@protoc_insertion_point(interface_extends:tm1638.Command) - com.google.protobuf.MessageOrBuilder { - - /** - * required .tm1638.Command.Type type = 1; - */ - boolean hasType(); - /** - * required .tm1638.Command.Type type = 1; - */ - tm1638.Tm1638.Command.Type getType(); - - /** - * optional .tm1638.Server server = 2; - */ - boolean hasServer(); - /** - * optional .tm1638.Server server = 2; - */ - tm1638.Tm1638.Server getServer(); - /** - * optional .tm1638.Server server = 2; - */ - tm1638.Tm1638.ServerOrBuilder getServerOrBuilder(); - - /** - * optional .tm1638.Ping ping = 3; - */ - boolean hasPing(); - /** - * optional .tm1638.Ping ping = 3; - */ - tm1638.Tm1638.Ping getPing(); - /** - * optional .tm1638.Ping ping = 3; - */ - tm1638.Tm1638.PingOrBuilder getPingOrBuilder(); - - /** - * optional .tm1638.Construct construct = 4; - */ - boolean hasConstruct(); - /** - * optional .tm1638.Construct construct = 4; - */ - tm1638.Tm1638.Construct getConstruct(); - /** - * optional .tm1638.Construct construct = 4; - */ - tm1638.Tm1638.ConstructOrBuilder getConstructOrBuilder(); - - /** - * optional .tm1638.SetLed setLed = 5; - */ - boolean hasSetLed(); - /** - * optional .tm1638.SetLed setLed = 5; - */ - tm1638.Tm1638.SetLed getSetLed(); - /** - * optional .tm1638.SetLed setLed = 5; - */ - tm1638.Tm1638.SetLedOrBuilder getSetLedOrBuilder(); - } - /** - * Protobuf type {@code tm1638.Command} - */ - public static final class Command extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:tm1638.Command) - CommandOrBuilder { - // Use Command.newBuilder() to construct. - private Command(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Command(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Command defaultInstance; - public static Command getDefaultInstance() { - return defaultInstance; - } - - public Command getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Command( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - tm1638.Tm1638.Command.Type value = tm1638.Tm1638.Command.Type.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - type_ = value; - } - break; - } - case 18: { - tm1638.Tm1638.Server.Builder subBuilder = null; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subBuilder = server_.toBuilder(); - } - server_ = input.readMessage(tm1638.Tm1638.Server.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(server_); - server_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000002; - break; - } - case 26: { - tm1638.Tm1638.Ping.Builder subBuilder = null; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - subBuilder = ping_.toBuilder(); - } - ping_ = input.readMessage(tm1638.Tm1638.Ping.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(ping_); - ping_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000004; - break; - } - case 34: { - tm1638.Tm1638.Construct.Builder subBuilder = null; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - subBuilder = construct_.toBuilder(); - } - construct_ = input.readMessage(tm1638.Tm1638.Construct.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(construct_); - construct_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000008; - break; - } - case 42: { - tm1638.Tm1638.SetLed.Builder subBuilder = null; - if (((bitField0_ & 0x00000010) == 0x00000010)) { - subBuilder = setLed_.toBuilder(); - } - setLed_ = input.readMessage(tm1638.Tm1638.SetLed.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(setLed_); - setLed_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000010; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Command_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Command_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Command.class, tm1638.Tm1638.Command.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Command parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Command(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - /** - * Protobuf enum {@code tm1638.Command.Type} - */ - public enum Type - implements com.google.protobuf.ProtocolMessageEnum { - /** - * SERVER = 1; - */ - SERVER(0, 1), - /** - * PING = 2; - */ - PING(1, 2), - /** - * CONSTRUCT = 3; - */ - CONSTRUCT(2, 3), - /** - * SET_LED = 4; - */ - SET_LED(3, 4), - ; - - /** - * SERVER = 1; - */ - public static final int SERVER_VALUE = 1; - /** - * PING = 2; - */ - public static final int PING_VALUE = 2; - /** - * CONSTRUCT = 3; - */ - public static final int CONSTRUCT_VALUE = 3; - /** - * SET_LED = 4; - */ - public static final int SET_LED_VALUE = 4; - - - public final int getNumber() { return value; } - - public static Type valueOf(int value) { - switch (value) { - case 1: return SERVER; - case 2: return PING; - case 3: return CONSTRUCT; - case 4: return SET_LED; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public Type findValueByNumber(int number) { - return Type.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return tm1638.Tm1638.Command.getDescriptor().getEnumTypes().get(0); - } - - private static final Type[] VALUES = values(); - - public static Type valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private Type(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:tm1638.Command.Type) - } - - private int bitField0_; - public static final int TYPE_FIELD_NUMBER = 1; - private tm1638.Tm1638.Command.Type type_; - /** - * required .tm1638.Command.Type type = 1; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required .tm1638.Command.Type type = 1; - */ - public tm1638.Tm1638.Command.Type getType() { - return type_; - } - - public static final int SERVER_FIELD_NUMBER = 2; - private tm1638.Tm1638.Server server_; - /** - * optional .tm1638.Server server = 2; - */ - public boolean hasServer() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional .tm1638.Server server = 2; - */ - public tm1638.Tm1638.Server getServer() { - return server_; - } - /** - * optional .tm1638.Server server = 2; - */ - public tm1638.Tm1638.ServerOrBuilder getServerOrBuilder() { - return server_; - } - - public static final int PING_FIELD_NUMBER = 3; - private tm1638.Tm1638.Ping ping_; - /** - * optional .tm1638.Ping ping = 3; - */ - public boolean hasPing() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .tm1638.Ping ping = 3; - */ - public tm1638.Tm1638.Ping getPing() { - return ping_; - } - /** - * optional .tm1638.Ping ping = 3; - */ - public tm1638.Tm1638.PingOrBuilder getPingOrBuilder() { - return ping_; - } - - public static final int CONSTRUCT_FIELD_NUMBER = 4; - private tm1638.Tm1638.Construct construct_; - /** - * optional .tm1638.Construct construct = 4; - */ - public boolean hasConstruct() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional .tm1638.Construct construct = 4; - */ - public tm1638.Tm1638.Construct getConstruct() { - return construct_; - } - /** - * optional .tm1638.Construct construct = 4; - */ - public tm1638.Tm1638.ConstructOrBuilder getConstructOrBuilder() { - return construct_; - } - - public static final int SETLED_FIELD_NUMBER = 5; - private tm1638.Tm1638.SetLed setLed_; - /** - * optional .tm1638.SetLed setLed = 5; - */ - public boolean hasSetLed() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - public tm1638.Tm1638.SetLed getSetLed() { - return setLed_; - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - public tm1638.Tm1638.SetLedOrBuilder getSetLedOrBuilder() { - return setLed_; - } - - private void initFields() { - type_ = tm1638.Tm1638.Command.Type.SERVER; - server_ = tm1638.Tm1638.Server.getDefaultInstance(); - ping_ = tm1638.Tm1638.Ping.getDefaultInstance(); - construct_ = tm1638.Tm1638.Construct.getDefaultInstance(); - setLed_ = tm1638.Tm1638.SetLed.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasType()) { - memoizedIsInitialized = 0; - return false; - } - if (hasServer()) { - if (!getServer().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasPing()) { - if (!getPing().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasConstruct()) { - if (!getConstruct().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasSetLed()) { - if (!getSetLed().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, server_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeMessage(3, ping_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeMessage(4, construct_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeMessage(5, setLed_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, server_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, ping_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, construct_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(5, setLed_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static tm1638.Tm1638.Command parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Command parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Command parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Command parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Command parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Command parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Command parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static tm1638.Tm1638.Command parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Command parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Command parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(tm1638.Tm1638.Command prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code tm1638.Command} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:tm1638.Command) - tm1638.Tm1638.CommandOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Command_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Command_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Command.class, tm1638.Tm1638.Command.Builder.class); - } - - // Construct using tm1638.Tm1638.Command.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getServerFieldBuilder(); - getPingFieldBuilder(); - getConstructFieldBuilder(); - getSetLedFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - type_ = tm1638.Tm1638.Command.Type.SERVER; - bitField0_ = (bitField0_ & ~0x00000001); - if (serverBuilder_ == null) { - server_ = tm1638.Tm1638.Server.getDefaultInstance(); - } else { - serverBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (pingBuilder_ == null) { - ping_ = tm1638.Tm1638.Ping.getDefaultInstance(); - } else { - pingBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - if (constructBuilder_ == null) { - construct_ = tm1638.Tm1638.Construct.getDefaultInstance(); - } else { - constructBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - if (setLedBuilder_ == null) { - setLed_ = tm1638.Tm1638.SetLed.getDefaultInstance(); - } else { - setLedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tm1638.Tm1638.internal_static_tm1638_Command_descriptor; - } - - public tm1638.Tm1638.Command getDefaultInstanceForType() { - return tm1638.Tm1638.Command.getDefaultInstance(); - } - - public tm1638.Tm1638.Command build() { - tm1638.Tm1638.Command result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public tm1638.Tm1638.Command buildPartial() { - tm1638.Tm1638.Command result = new tm1638.Tm1638.Command(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.type_ = type_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (serverBuilder_ == null) { - result.server_ = server_; - } else { - result.server_ = serverBuilder_.build(); - } - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - if (pingBuilder_ == null) { - result.ping_ = ping_; - } else { - result.ping_ = pingBuilder_.build(); - } - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - if (constructBuilder_ == null) { - result.construct_ = construct_; - } else { - result.construct_ = constructBuilder_.build(); - } - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - if (setLedBuilder_ == null) { - result.setLed_ = setLed_; - } else { - result.setLed_ = setLedBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tm1638.Tm1638.Command) { - return mergeFrom((tm1638.Tm1638.Command)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tm1638.Tm1638.Command other) { - if (other == tm1638.Tm1638.Command.getDefaultInstance()) return this; - if (other.hasType()) { - setType(other.getType()); - } - if (other.hasServer()) { - mergeServer(other.getServer()); - } - if (other.hasPing()) { - mergePing(other.getPing()); - } - if (other.hasConstruct()) { - mergeConstruct(other.getConstruct()); - } - if (other.hasSetLed()) { - mergeSetLed(other.getSetLed()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasType()) { - - return false; - } - if (hasServer()) { - if (!getServer().isInitialized()) { - - return false; - } - } - if (hasPing()) { - if (!getPing().isInitialized()) { - - return false; - } - } - if (hasConstruct()) { - if (!getConstruct().isInitialized()) { - - return false; - } - } - if (hasSetLed()) { - if (!getSetLed().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tm1638.Tm1638.Command parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tm1638.Tm1638.Command) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private tm1638.Tm1638.Command.Type type_ = tm1638.Tm1638.Command.Type.SERVER; - /** - * required .tm1638.Command.Type type = 1; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required .tm1638.Command.Type type = 1; - */ - public tm1638.Tm1638.Command.Type getType() { - return type_; - } - /** - * required .tm1638.Command.Type type = 1; - */ - public Builder setType(tm1638.Tm1638.Command.Type value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - type_ = value; - onChanged(); - return this; - } - /** - * required .tm1638.Command.Type type = 1; - */ - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000001); - type_ = tm1638.Tm1638.Command.Type.SERVER; - onChanged(); - return this; - } - - private tm1638.Tm1638.Server server_ = tm1638.Tm1638.Server.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.Server, tm1638.Tm1638.Server.Builder, tm1638.Tm1638.ServerOrBuilder> serverBuilder_; - /** - * optional .tm1638.Server server = 2; - */ - public boolean hasServer() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional .tm1638.Server server = 2; - */ - public tm1638.Tm1638.Server getServer() { - if (serverBuilder_ == null) { - return server_; - } else { - return serverBuilder_.getMessage(); - } - } - /** - * optional .tm1638.Server server = 2; - */ - public Builder setServer(tm1638.Tm1638.Server value) { - if (serverBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - server_ = value; - onChanged(); - } else { - serverBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .tm1638.Server server = 2; - */ - public Builder setServer( - tm1638.Tm1638.Server.Builder builderForValue) { - if (serverBuilder_ == null) { - server_ = builderForValue.build(); - onChanged(); - } else { - serverBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .tm1638.Server server = 2; - */ - public Builder mergeServer(tm1638.Tm1638.Server value) { - if (serverBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - server_ != tm1638.Tm1638.Server.getDefaultInstance()) { - server_ = - tm1638.Tm1638.Server.newBuilder(server_).mergeFrom(value).buildPartial(); - } else { - server_ = value; - } - onChanged(); - } else { - serverBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .tm1638.Server server = 2; - */ - public Builder clearServer() { - if (serverBuilder_ == null) { - server_ = tm1638.Tm1638.Server.getDefaultInstance(); - onChanged(); - } else { - serverBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - /** - * optional .tm1638.Server server = 2; - */ - public tm1638.Tm1638.Server.Builder getServerBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getServerFieldBuilder().getBuilder(); - } - /** - * optional .tm1638.Server server = 2; - */ - public tm1638.Tm1638.ServerOrBuilder getServerOrBuilder() { - if (serverBuilder_ != null) { - return serverBuilder_.getMessageOrBuilder(); - } else { - return server_; - } - } - /** - * optional .tm1638.Server server = 2; - */ - private com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.Server, tm1638.Tm1638.Server.Builder, tm1638.Tm1638.ServerOrBuilder> - getServerFieldBuilder() { - if (serverBuilder_ == null) { - serverBuilder_ = new com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.Server, tm1638.Tm1638.Server.Builder, tm1638.Tm1638.ServerOrBuilder>( - getServer(), - getParentForChildren(), - isClean()); - server_ = null; - } - return serverBuilder_; - } - - private tm1638.Tm1638.Ping ping_ = tm1638.Tm1638.Ping.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.Ping, tm1638.Tm1638.Ping.Builder, tm1638.Tm1638.PingOrBuilder> pingBuilder_; - /** - * optional .tm1638.Ping ping = 3; - */ - public boolean hasPing() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .tm1638.Ping ping = 3; - */ - public tm1638.Tm1638.Ping getPing() { - if (pingBuilder_ == null) { - return ping_; - } else { - return pingBuilder_.getMessage(); - } - } - /** - * optional .tm1638.Ping ping = 3; - */ - public Builder setPing(tm1638.Tm1638.Ping value) { - if (pingBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ping_ = value; - onChanged(); - } else { - pingBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .tm1638.Ping ping = 3; - */ - public Builder setPing( - tm1638.Tm1638.Ping.Builder builderForValue) { - if (pingBuilder_ == null) { - ping_ = builderForValue.build(); - onChanged(); - } else { - pingBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .tm1638.Ping ping = 3; - */ - public Builder mergePing(tm1638.Tm1638.Ping value) { - if (pingBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004) && - ping_ != tm1638.Tm1638.Ping.getDefaultInstance()) { - ping_ = - tm1638.Tm1638.Ping.newBuilder(ping_).mergeFrom(value).buildPartial(); - } else { - ping_ = value; - } - onChanged(); - } else { - pingBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .tm1638.Ping ping = 3; - */ - public Builder clearPing() { - if (pingBuilder_ == null) { - ping_ = tm1638.Tm1638.Ping.getDefaultInstance(); - onChanged(); - } else { - pingBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - /** - * optional .tm1638.Ping ping = 3; - */ - public tm1638.Tm1638.Ping.Builder getPingBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getPingFieldBuilder().getBuilder(); - } - /** - * optional .tm1638.Ping ping = 3; - */ - public tm1638.Tm1638.PingOrBuilder getPingOrBuilder() { - if (pingBuilder_ != null) { - return pingBuilder_.getMessageOrBuilder(); - } else { - return ping_; - } - } - /** - * optional .tm1638.Ping ping = 3; - */ - private com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.Ping, tm1638.Tm1638.Ping.Builder, tm1638.Tm1638.PingOrBuilder> - getPingFieldBuilder() { - if (pingBuilder_ == null) { - pingBuilder_ = new com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.Ping, tm1638.Tm1638.Ping.Builder, tm1638.Tm1638.PingOrBuilder>( - getPing(), - getParentForChildren(), - isClean()); - ping_ = null; - } - return pingBuilder_; - } - - private tm1638.Tm1638.Construct construct_ = tm1638.Tm1638.Construct.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.Construct, tm1638.Tm1638.Construct.Builder, tm1638.Tm1638.ConstructOrBuilder> constructBuilder_; - /** - * optional .tm1638.Construct construct = 4; - */ - public boolean hasConstruct() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional .tm1638.Construct construct = 4; - */ - public tm1638.Tm1638.Construct getConstruct() { - if (constructBuilder_ == null) { - return construct_; - } else { - return constructBuilder_.getMessage(); - } - } - /** - * optional .tm1638.Construct construct = 4; - */ - public Builder setConstruct(tm1638.Tm1638.Construct value) { - if (constructBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - construct_ = value; - onChanged(); - } else { - constructBuilder_.setMessage(value); - } - bitField0_ |= 0x00000008; - return this; - } - /** - * optional .tm1638.Construct construct = 4; - */ - public Builder setConstruct( - tm1638.Tm1638.Construct.Builder builderForValue) { - if (constructBuilder_ == null) { - construct_ = builderForValue.build(); - onChanged(); - } else { - constructBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000008; - return this; - } - /** - * optional .tm1638.Construct construct = 4; - */ - public Builder mergeConstruct(tm1638.Tm1638.Construct value) { - if (constructBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008) && - construct_ != tm1638.Tm1638.Construct.getDefaultInstance()) { - construct_ = - tm1638.Tm1638.Construct.newBuilder(construct_).mergeFrom(value).buildPartial(); - } else { - construct_ = value; - } - onChanged(); - } else { - constructBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000008; - return this; - } - /** - * optional .tm1638.Construct construct = 4; - */ - public Builder clearConstruct() { - if (constructBuilder_ == null) { - construct_ = tm1638.Tm1638.Construct.getDefaultInstance(); - onChanged(); - } else { - constructBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - /** - * optional .tm1638.Construct construct = 4; - */ - public tm1638.Tm1638.Construct.Builder getConstructBuilder() { - bitField0_ |= 0x00000008; - onChanged(); - return getConstructFieldBuilder().getBuilder(); - } - /** - * optional .tm1638.Construct construct = 4; - */ - public tm1638.Tm1638.ConstructOrBuilder getConstructOrBuilder() { - if (constructBuilder_ != null) { - return constructBuilder_.getMessageOrBuilder(); - } else { - return construct_; - } - } - /** - * optional .tm1638.Construct construct = 4; - */ - private com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.Construct, tm1638.Tm1638.Construct.Builder, tm1638.Tm1638.ConstructOrBuilder> - getConstructFieldBuilder() { - if (constructBuilder_ == null) { - constructBuilder_ = new com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.Construct, tm1638.Tm1638.Construct.Builder, tm1638.Tm1638.ConstructOrBuilder>( - getConstruct(), - getParentForChildren(), - isClean()); - construct_ = null; - } - return constructBuilder_; - } - - private tm1638.Tm1638.SetLed setLed_ = tm1638.Tm1638.SetLed.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.SetLed, tm1638.Tm1638.SetLed.Builder, tm1638.Tm1638.SetLedOrBuilder> setLedBuilder_; - /** - * optional .tm1638.SetLed setLed = 5; - */ - public boolean hasSetLed() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - public tm1638.Tm1638.SetLed getSetLed() { - if (setLedBuilder_ == null) { - return setLed_; - } else { - return setLedBuilder_.getMessage(); - } - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - public Builder setSetLed(tm1638.Tm1638.SetLed value) { - if (setLedBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - setLed_ = value; - onChanged(); - } else { - setLedBuilder_.setMessage(value); - } - bitField0_ |= 0x00000010; - return this; - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - public Builder setSetLed( - tm1638.Tm1638.SetLed.Builder builderForValue) { - if (setLedBuilder_ == null) { - setLed_ = builderForValue.build(); - onChanged(); - } else { - setLedBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000010; - return this; - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - public Builder mergeSetLed(tm1638.Tm1638.SetLed value) { - if (setLedBuilder_ == null) { - if (((bitField0_ & 0x00000010) == 0x00000010) && - setLed_ != tm1638.Tm1638.SetLed.getDefaultInstance()) { - setLed_ = - tm1638.Tm1638.SetLed.newBuilder(setLed_).mergeFrom(value).buildPartial(); - } else { - setLed_ = value; - } - onChanged(); - } else { - setLedBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000010; - return this; - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - public Builder clearSetLed() { - if (setLedBuilder_ == null) { - setLed_ = tm1638.Tm1638.SetLed.getDefaultInstance(); - onChanged(); - } else { - setLedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - public tm1638.Tm1638.SetLed.Builder getSetLedBuilder() { - bitField0_ |= 0x00000010; - onChanged(); - return getSetLedFieldBuilder().getBuilder(); - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - public tm1638.Tm1638.SetLedOrBuilder getSetLedOrBuilder() { - if (setLedBuilder_ != null) { - return setLedBuilder_.getMessageOrBuilder(); - } else { - return setLed_; - } - } - /** - * optional .tm1638.SetLed setLed = 5; - */ - private com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.SetLed, tm1638.Tm1638.SetLed.Builder, tm1638.Tm1638.SetLedOrBuilder> - getSetLedFieldBuilder() { - if (setLedBuilder_ == null) { - setLedBuilder_ = new com.google.protobuf.SingleFieldBuilder< - tm1638.Tm1638.SetLed, tm1638.Tm1638.SetLed.Builder, tm1638.Tm1638.SetLedOrBuilder>( - getSetLed(), - getParentForChildren(), - isClean()); - setLed_ = null; - } - return setLedBuilder_; - } - - // @@protoc_insertion_point(builder_scope:tm1638.Command) - } - - static { - defaultInstance = new Command(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:tm1638.Command) - } - - public interface ServerOrBuilder extends - // @@protoc_insertion_point(interface_extends:tm1638.Server) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string host = 1; - */ - boolean hasHost(); - /** - * optional string host = 1; - */ - java.lang.String getHost(); - /** - * optional string host = 1; - */ - com.google.protobuf.ByteString - getHostBytes(); - - /** - * required int32 port = 2; - */ - boolean hasPort(); - /** - * required int32 port = 2; - */ - int getPort(); - } - /** - * Protobuf type {@code tm1638.Server} - */ - public static final class Server extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:tm1638.Server) - ServerOrBuilder { - // Use Server.newBuilder() to construct. - private Server(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Server(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Server defaultInstance; - public static Server getDefaultInstance() { - return defaultInstance; - } - - public Server getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Server( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - host_ = bs; - break; - } - case 16: { - bitField0_ |= 0x00000002; - port_ = input.readInt32(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Server_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Server_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Server.class, tm1638.Tm1638.Server.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Server parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Server(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int HOST_FIELD_NUMBER = 1; - private java.lang.Object host_; - /** - * optional string host = 1; - */ - public boolean hasHost() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string host = 1; - */ - public java.lang.String getHost() { - java.lang.Object ref = host_; - 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(); - if (bs.isValidUtf8()) { - host_ = s; - } - return s; - } - } - /** - * optional string host = 1; - */ - public com.google.protobuf.ByteString - getHostBytes() { - java.lang.Object ref = host_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - host_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int PORT_FIELD_NUMBER = 2; - private int port_; - /** - * required int32 port = 2; - */ - public boolean hasPort() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required int32 port = 2; - */ - public int getPort() { - return port_; - } - - private void initFields() { - host_ = ""; - port_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasPort()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getHostBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt32(2, port_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getHostBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(2, port_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static tm1638.Tm1638.Server parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Server parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Server parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Server parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Server parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Server parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Server parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static tm1638.Tm1638.Server parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Server parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Server parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(tm1638.Tm1638.Server prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code tm1638.Server} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:tm1638.Server) - tm1638.Tm1638.ServerOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Server_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Server_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Server.class, tm1638.Tm1638.Server.Builder.class); - } - - // Construct using tm1638.Tm1638.Server.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - host_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - port_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tm1638.Tm1638.internal_static_tm1638_Server_descriptor; - } - - public tm1638.Tm1638.Server getDefaultInstanceForType() { - return tm1638.Tm1638.Server.getDefaultInstance(); - } - - public tm1638.Tm1638.Server build() { - tm1638.Tm1638.Server result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public tm1638.Tm1638.Server buildPartial() { - tm1638.Tm1638.Server result = new tm1638.Tm1638.Server(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.host_ = host_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.port_ = port_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tm1638.Tm1638.Server) { - return mergeFrom((tm1638.Tm1638.Server)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tm1638.Tm1638.Server other) { - if (other == tm1638.Tm1638.Server.getDefaultInstance()) return this; - if (other.hasHost()) { - bitField0_ |= 0x00000001; - host_ = other.host_; - onChanged(); - } - if (other.hasPort()) { - setPort(other.getPort()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasPort()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tm1638.Tm1638.Server parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tm1638.Tm1638.Server) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.lang.Object host_ = ""; - /** - * optional string host = 1; - */ - public boolean hasHost() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string host = 1; - */ - public java.lang.String getHost() { - java.lang.Object ref = host_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - host_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string host = 1; - */ - public com.google.protobuf.ByteString - getHostBytes() { - java.lang.Object ref = host_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - host_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string host = 1; - */ - public Builder setHost( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - host_ = value; - onChanged(); - return this; - } - /** - * optional string host = 1; - */ - public Builder clearHost() { - bitField0_ = (bitField0_ & ~0x00000001); - host_ = getDefaultInstance().getHost(); - onChanged(); - return this; - } - /** - * optional string host = 1; - */ - public Builder setHostBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - host_ = value; - onChanged(); - return this; - } - - private int port_ ; - /** - * required int32 port = 2; - */ - public boolean hasPort() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required int32 port = 2; - */ - public int getPort() { - return port_; - } - /** - * required int32 port = 2; - */ - public Builder setPort(int value) { - bitField0_ |= 0x00000002; - port_ = value; - onChanged(); - return this; - } - /** - * required int32 port = 2; - */ - public Builder clearPort() { - bitField0_ = (bitField0_ & ~0x00000002); - port_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:tm1638.Server) - } - - static { - defaultInstance = new Server(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:tm1638.Server) - } - - public interface PingOrBuilder extends - // @@protoc_insertion_point(interface_extends:tm1638.Ping) - com.google.protobuf.MessageOrBuilder { - - /** - * required int32 id = 1; - */ - boolean hasId(); - /** - * required int32 id = 1; - */ - int getId(); - } - /** - * Protobuf type {@code tm1638.Ping} - */ - public static final class Ping extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:tm1638.Ping) - PingOrBuilder { - // Use Ping.newBuilder() to construct. - private Ping(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Ping(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Ping defaultInstance; - public static Ping getDefaultInstance() { - return defaultInstance; - } - - public Ping getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Ping( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - id_ = input.readInt32(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Ping_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Ping_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Ping.class, tm1638.Tm1638.Ping.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Ping parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Ping(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int ID_FIELD_NUMBER = 1; - private int id_; - /** - * required int32 id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required int32 id = 1; - */ - public int getId() { - return id_; - } - - private void initFields() { - id_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasId()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, id_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, id_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static tm1638.Tm1638.Ping parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Ping parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Ping parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Ping parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Ping parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Ping parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Ping parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static tm1638.Tm1638.Ping parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Ping parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Ping parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(tm1638.Tm1638.Ping prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code tm1638.Ping} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:tm1638.Ping) - tm1638.Tm1638.PingOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Ping_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Ping_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Ping.class, tm1638.Tm1638.Ping.Builder.class); - } - - // Construct using tm1638.Tm1638.Ping.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - id_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tm1638.Tm1638.internal_static_tm1638_Ping_descriptor; - } - - public tm1638.Tm1638.Ping getDefaultInstanceForType() { - return tm1638.Tm1638.Ping.getDefaultInstance(); - } - - public tm1638.Tm1638.Ping build() { - tm1638.Tm1638.Ping result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public tm1638.Tm1638.Ping buildPartial() { - tm1638.Tm1638.Ping result = new tm1638.Tm1638.Ping(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tm1638.Tm1638.Ping) { - return mergeFrom((tm1638.Tm1638.Ping)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tm1638.Tm1638.Ping other) { - if (other == tm1638.Tm1638.Ping.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasId()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tm1638.Tm1638.Ping parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tm1638.Tm1638.Ping) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private int id_ ; - /** - * required int32 id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required int32 id = 1; - */ - public int getId() { - return id_; - } - /** - * required int32 id = 1; - */ - public Builder setId(int value) { - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - /** - * required int32 id = 1; - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000001); - id_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:tm1638.Ping) - } - - static { - defaultInstance = new Ping(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:tm1638.Ping) - } - - public interface EchoOrBuilder extends - // @@protoc_insertion_point(interface_extends:tm1638.Echo) - com.google.protobuf.MessageOrBuilder { - - /** - * required int32 id = 1; - */ - boolean hasId(); - /** - * required int32 id = 1; - */ - int getId(); - - /** - * optional string message = 2; - */ - boolean hasMessage(); - /** - * optional string message = 2; - */ - java.lang.String getMessage(); - /** - * optional string message = 2; - */ - com.google.protobuf.ByteString - getMessageBytes(); - } - /** - * Protobuf type {@code tm1638.Echo} - */ - public static final class Echo extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:tm1638.Echo) - EchoOrBuilder { - // Use Echo.newBuilder() to construct. - private Echo(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Echo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Echo defaultInstance; - public static Echo getDefaultInstance() { - return defaultInstance; - } - - public Echo getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Echo( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - id_ = input.readInt32(); - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - message_ = bs; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Echo_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Echo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Echo.class, tm1638.Tm1638.Echo.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Echo parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Echo(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int ID_FIELD_NUMBER = 1; - private int id_; - /** - * required int32 id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required int32 id = 1; - */ - public int getId() { - return id_; - } - - public static final int MESSAGE_FIELD_NUMBER = 2; - private java.lang.Object message_; - /** - * optional string message = 2; - */ - public boolean hasMessage() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string message = 2; - */ - public java.lang.String getMessage() { - java.lang.Object ref = message_; - 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(); - if (bs.isValidUtf8()) { - message_ = s; - } - return s; - } - } - /** - * optional string message = 2; - */ - public com.google.protobuf.ByteString - getMessageBytes() { - java.lang.Object ref = message_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - message_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - id_ = 0; - message_ = ""; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasId()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getMessageBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getMessageBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static tm1638.Tm1638.Echo parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Echo parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Echo parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Echo parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Echo parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Echo parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Echo parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static tm1638.Tm1638.Echo parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Echo parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Echo parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(tm1638.Tm1638.Echo prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code tm1638.Echo} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:tm1638.Echo) - tm1638.Tm1638.EchoOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Echo_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Echo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Echo.class, tm1638.Tm1638.Echo.Builder.class); - } - - // Construct using tm1638.Tm1638.Echo.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - id_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - message_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tm1638.Tm1638.internal_static_tm1638_Echo_descriptor; - } - - public tm1638.Tm1638.Echo getDefaultInstanceForType() { - return tm1638.Tm1638.Echo.getDefaultInstance(); - } - - public tm1638.Tm1638.Echo build() { - tm1638.Tm1638.Echo result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public tm1638.Tm1638.Echo buildPartial() { - tm1638.Tm1638.Echo result = new tm1638.Tm1638.Echo(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.message_ = message_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tm1638.Tm1638.Echo) { - return mergeFrom((tm1638.Tm1638.Echo)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tm1638.Tm1638.Echo other) { - if (other == tm1638.Tm1638.Echo.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasMessage()) { - bitField0_ |= 0x00000002; - message_ = other.message_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasId()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tm1638.Tm1638.Echo parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tm1638.Tm1638.Echo) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private int id_ ; - /** - * required int32 id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required int32 id = 1; - */ - public int getId() { - return id_; - } - /** - * required int32 id = 1; - */ - public Builder setId(int value) { - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - /** - * required int32 id = 1; - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000001); - id_ = 0; - onChanged(); - return this; - } - - private java.lang.Object message_ = ""; - /** - * optional string message = 2; - */ - public boolean hasMessage() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string message = 2; - */ - public java.lang.String getMessage() { - java.lang.Object ref = message_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - message_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string message = 2; - */ - public com.google.protobuf.ByteString - getMessageBytes() { - java.lang.Object ref = message_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - message_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string message = 2; - */ - public Builder setMessage( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - message_ = value; - onChanged(); - return this; - } - /** - * optional string message = 2; - */ - public Builder clearMessage() { - bitField0_ = (bitField0_ & ~0x00000002); - message_ = getDefaultInstance().getMessage(); - onChanged(); - return this; - } - /** - * optional string message = 2; - */ - public Builder setMessageBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - message_ = value; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:tm1638.Echo) - } - - static { - defaultInstance = new Echo(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:tm1638.Echo) - } - - public interface ConstructOrBuilder extends - // @@protoc_insertion_point(interface_extends:tm1638.Construct) - com.google.protobuf.MessageOrBuilder { - - /** - * required int32 dataPin = 1; - */ - boolean hasDataPin(); - /** - * required int32 dataPin = 1; - */ - int getDataPin(); - - /** - * required int32 clockPin = 2; - */ - boolean hasClockPin(); - /** - * required int32 clockPin = 2; - */ - int getClockPin(); - - /** - * optional int32 strobePin = 3; - */ - boolean hasStrobePin(); - /** - * optional int32 strobePin = 3; - */ - int getStrobePin(); - - /** - * optional bool activateDisplay = 4 [default = true]; - */ - boolean hasActivateDisplay(); - /** - * optional bool activateDisplay = 4 [default = true]; - */ - boolean getActivateDisplay(); - - /** - * optional int32 intensity = 5 [default = 7]; - */ - boolean hasIntensity(); - /** - * optional int32 intensity = 5 [default = 7]; - */ - int getIntensity(); - - /** - * optional .tm1638.Module module = 6 [default = TM1638]; - */ - boolean hasModule(); - /** - * optional .tm1638.Module module = 6 [default = TM1638]; - */ - tm1638.Tm1638.Module getModule(); - - /** - * optional int32 id = 7 [default = 0]; - */ - boolean hasId(); - /** - * optional int32 id = 7 [default = 0]; - */ - int getId(); - } - /** - * Protobuf type {@code tm1638.Construct} - */ - public static final class Construct extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:tm1638.Construct) - ConstructOrBuilder { - // Use Construct.newBuilder() to construct. - private Construct(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Construct(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Construct defaultInstance; - public static Construct getDefaultInstance() { - return defaultInstance; - } - - public Construct getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Construct( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - dataPin_ = input.readInt32(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - clockPin_ = input.readInt32(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - strobePin_ = input.readInt32(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - activateDisplay_ = input.readBool(); - break; - } - case 40: { - bitField0_ |= 0x00000010; - intensity_ = input.readInt32(); - break; - } - case 48: { - int rawValue = input.readEnum(); - tm1638.Tm1638.Module value = tm1638.Tm1638.Module.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(6, rawValue); - } else { - bitField0_ |= 0x00000020; - module_ = value; - } - break; - } - case 56: { - bitField0_ |= 0x00000040; - id_ = input.readInt32(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Construct_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Construct_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Construct.class, tm1638.Tm1638.Construct.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Construct parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Construct(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int DATAPIN_FIELD_NUMBER = 1; - private int dataPin_; - /** - * required int32 dataPin = 1; - */ - public boolean hasDataPin() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required int32 dataPin = 1; - */ - public int getDataPin() { - return dataPin_; - } - - public static final int CLOCKPIN_FIELD_NUMBER = 2; - private int clockPin_; - /** - * required int32 clockPin = 2; - */ - public boolean hasClockPin() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required int32 clockPin = 2; - */ - public int getClockPin() { - return clockPin_; - } - - public static final int STROBEPIN_FIELD_NUMBER = 3; - private int strobePin_; - /** - * optional int32 strobePin = 3; - */ - public boolean hasStrobePin() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional int32 strobePin = 3; - */ - public int getStrobePin() { - return strobePin_; - } - - public static final int ACTIVATEDISPLAY_FIELD_NUMBER = 4; - private boolean activateDisplay_; - /** - * optional bool activateDisplay = 4 [default = true]; - */ - public boolean hasActivateDisplay() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional bool activateDisplay = 4 [default = true]; - */ - public boolean getActivateDisplay() { - return activateDisplay_; - } - - public static final int INTENSITY_FIELD_NUMBER = 5; - private int intensity_; - /** - * optional int32 intensity = 5 [default = 7]; - */ - public boolean hasIntensity() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional int32 intensity = 5 [default = 7]; - */ - public int getIntensity() { - return intensity_; - } - - public static final int MODULE_FIELD_NUMBER = 6; - private tm1638.Tm1638.Module module_; - /** - * optional .tm1638.Module module = 6 [default = TM1638]; - */ - public boolean hasModule() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * optional .tm1638.Module module = 6 [default = TM1638]; - */ - public tm1638.Tm1638.Module getModule() { - return module_; - } - - public static final int ID_FIELD_NUMBER = 7; - private int id_; - /** - * optional int32 id = 7 [default = 0]; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * optional int32 id = 7 [default = 0]; - */ - public int getId() { - return id_; - } - - private void initFields() { - dataPin_ = 0; - clockPin_ = 0; - strobePin_ = 0; - activateDisplay_ = true; - intensity_ = 7; - module_ = tm1638.Tm1638.Module.TM1638; - id_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasDataPin()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasClockPin()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, dataPin_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt32(2, clockPin_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt32(3, strobePin_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBool(4, activateDisplay_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeInt32(5, intensity_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeEnum(6, module_.getNumber()); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeInt32(7, id_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, dataPin_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(2, clockPin_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(3, strobePin_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(4, activateDisplay_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(5, intensity_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(6, module_.getNumber()); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(7, id_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static tm1638.Tm1638.Construct parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Construct parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Construct parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.Construct parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.Construct parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Construct parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Construct parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static tm1638.Tm1638.Construct parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.Construct parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.Construct parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(tm1638.Tm1638.Construct prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code tm1638.Construct} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:tm1638.Construct) - tm1638.Tm1638.ConstructOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_Construct_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_Construct_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.Construct.class, tm1638.Tm1638.Construct.Builder.class); - } - - // Construct using tm1638.Tm1638.Construct.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - dataPin_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - clockPin_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - strobePin_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - activateDisplay_ = true; - bitField0_ = (bitField0_ & ~0x00000008); - intensity_ = 7; - bitField0_ = (bitField0_ & ~0x00000010); - module_ = tm1638.Tm1638.Module.TM1638; - bitField0_ = (bitField0_ & ~0x00000020); - id_ = 0; - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tm1638.Tm1638.internal_static_tm1638_Construct_descriptor; - } - - public tm1638.Tm1638.Construct getDefaultInstanceForType() { - return tm1638.Tm1638.Construct.getDefaultInstance(); - } - - public tm1638.Tm1638.Construct build() { - tm1638.Tm1638.Construct result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public tm1638.Tm1638.Construct buildPartial() { - tm1638.Tm1638.Construct result = new tm1638.Tm1638.Construct(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.dataPin_ = dataPin_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.clockPin_ = clockPin_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.strobePin_ = strobePin_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.activateDisplay_ = activateDisplay_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.intensity_ = intensity_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.module_ = module_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000040; - } - result.id_ = id_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tm1638.Tm1638.Construct) { - return mergeFrom((tm1638.Tm1638.Construct)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tm1638.Tm1638.Construct other) { - if (other == tm1638.Tm1638.Construct.getDefaultInstance()) return this; - if (other.hasDataPin()) { - setDataPin(other.getDataPin()); - } - if (other.hasClockPin()) { - setClockPin(other.getClockPin()); - } - if (other.hasStrobePin()) { - setStrobePin(other.getStrobePin()); - } - if (other.hasActivateDisplay()) { - setActivateDisplay(other.getActivateDisplay()); - } - if (other.hasIntensity()) { - setIntensity(other.getIntensity()); - } - if (other.hasModule()) { - setModule(other.getModule()); - } - if (other.hasId()) { - setId(other.getId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasDataPin()) { - - return false; - } - if (!hasClockPin()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tm1638.Tm1638.Construct parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tm1638.Tm1638.Construct) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private int dataPin_ ; - /** - * required int32 dataPin = 1; - */ - public boolean hasDataPin() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required int32 dataPin = 1; - */ - public int getDataPin() { - return dataPin_; - } - /** - * required int32 dataPin = 1; - */ - public Builder setDataPin(int value) { - bitField0_ |= 0x00000001; - dataPin_ = value; - onChanged(); - return this; - } - /** - * required int32 dataPin = 1; - */ - public Builder clearDataPin() { - bitField0_ = (bitField0_ & ~0x00000001); - dataPin_ = 0; - onChanged(); - return this; - } - - private int clockPin_ ; - /** - * required int32 clockPin = 2; - */ - public boolean hasClockPin() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required int32 clockPin = 2; - */ - public int getClockPin() { - return clockPin_; - } - /** - * required int32 clockPin = 2; - */ - public Builder setClockPin(int value) { - bitField0_ |= 0x00000002; - clockPin_ = value; - onChanged(); - return this; - } - /** - * required int32 clockPin = 2; - */ - public Builder clearClockPin() { - bitField0_ = (bitField0_ & ~0x00000002); - clockPin_ = 0; - onChanged(); - return this; - } - - private int strobePin_ ; - /** - * optional int32 strobePin = 3; - */ - public boolean hasStrobePin() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional int32 strobePin = 3; - */ - public int getStrobePin() { - return strobePin_; - } - /** - * optional int32 strobePin = 3; - */ - public Builder setStrobePin(int value) { - bitField0_ |= 0x00000004; - strobePin_ = value; - onChanged(); - return this; - } - /** - * optional int32 strobePin = 3; - */ - public Builder clearStrobePin() { - bitField0_ = (bitField0_ & ~0x00000004); - strobePin_ = 0; - onChanged(); - return this; - } - - private boolean activateDisplay_ = true; - /** - * optional bool activateDisplay = 4 [default = true]; - */ - public boolean hasActivateDisplay() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional bool activateDisplay = 4 [default = true]; - */ - public boolean getActivateDisplay() { - return activateDisplay_; - } - /** - * optional bool activateDisplay = 4 [default = true]; - */ - public Builder setActivateDisplay(boolean value) { - bitField0_ |= 0x00000008; - activateDisplay_ = value; - onChanged(); - return this; - } - /** - * optional bool activateDisplay = 4 [default = true]; - */ - public Builder clearActivateDisplay() { - bitField0_ = (bitField0_ & ~0x00000008); - activateDisplay_ = true; - onChanged(); - return this; - } - - private int intensity_ = 7; - /** - * optional int32 intensity = 5 [default = 7]; - */ - public boolean hasIntensity() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional int32 intensity = 5 [default = 7]; - */ - public int getIntensity() { - return intensity_; - } - /** - * optional int32 intensity = 5 [default = 7]; - */ - public Builder setIntensity(int value) { - bitField0_ |= 0x00000010; - intensity_ = value; - onChanged(); - return this; - } - /** - * optional int32 intensity = 5 [default = 7]; - */ - public Builder clearIntensity() { - bitField0_ = (bitField0_ & ~0x00000010); - intensity_ = 7; - onChanged(); - return this; - } - - private tm1638.Tm1638.Module module_ = tm1638.Tm1638.Module.TM1638; - /** - * optional .tm1638.Module module = 6 [default = TM1638]; - */ - public boolean hasModule() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * optional .tm1638.Module module = 6 [default = TM1638]; - */ - public tm1638.Tm1638.Module getModule() { - return module_; - } - /** - * optional .tm1638.Module module = 6 [default = TM1638]; - */ - public Builder setModule(tm1638.Tm1638.Module value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - module_ = value; - onChanged(); - return this; - } - /** - * optional .tm1638.Module module = 6 [default = TM1638]; - */ - public Builder clearModule() { - bitField0_ = (bitField0_ & ~0x00000020); - module_ = tm1638.Tm1638.Module.TM1638; - onChanged(); - return this; - } - - private int id_ ; - /** - * optional int32 id = 7 [default = 0]; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * optional int32 id = 7 [default = 0]; - */ - public int getId() { - return id_; - } - /** - * optional int32 id = 7 [default = 0]; - */ - public Builder setId(int value) { - bitField0_ |= 0x00000040; - id_ = value; - onChanged(); - return this; - } - /** - * optional int32 id = 7 [default = 0]; - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000040); - id_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:tm1638.Construct) - } - - static { - defaultInstance = new Construct(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:tm1638.Construct) - } - - public interface SetLedOrBuilder extends - // @@protoc_insertion_point(interface_extends:tm1638.SetLed) - com.google.protobuf.MessageOrBuilder { - - /** - * required .tm1638.Color color = 1; - */ - boolean hasColor(); - /** - * required .tm1638.Color color = 1; - */ - tm1638.Tm1638.Color getColor(); - - /** - * required int32 pos = 2; - */ - boolean hasPos(); - /** - * required int32 pos = 2; - */ - int getPos(); - - /** - * optional int32 id = 3 [default = 1]; - */ - boolean hasId(); - /** - * optional int32 id = 3 [default = 1]; - */ - int getId(); - } - /** - * Protobuf type {@code tm1638.SetLed} - */ - public static final class SetLed extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:tm1638.SetLed) - SetLedOrBuilder { - // Use SetLed.newBuilder() to construct. - private SetLed(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private SetLed(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final SetLed defaultInstance; - public static SetLed getDefaultInstance() { - return defaultInstance; - } - - public SetLed getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private SetLed( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - tm1638.Tm1638.Color value = tm1638.Tm1638.Color.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - color_ = value; - } - break; - } - case 16: { - bitField0_ |= 0x00000002; - pos_ = input.readInt32(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - id_ = input.readInt32(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_SetLed_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_SetLed_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.SetLed.class, tm1638.Tm1638.SetLed.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public SetLed parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new SetLed(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int COLOR_FIELD_NUMBER = 1; - private tm1638.Tm1638.Color color_; - /** - * required .tm1638.Color color = 1; - */ - public boolean hasColor() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required .tm1638.Color color = 1; - */ - public tm1638.Tm1638.Color getColor() { - return color_; - } - - public static final int POS_FIELD_NUMBER = 2; - private int pos_; - /** - * required int32 pos = 2; - */ - public boolean hasPos() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required int32 pos = 2; - */ - public int getPos() { - return pos_; - } - - public static final int ID_FIELD_NUMBER = 3; - private int id_; - /** - * optional int32 id = 3 [default = 1]; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional int32 id = 3 [default = 1]; - */ - public int getId() { - return id_; - } - - private void initFields() { - color_ = tm1638.Tm1638.Color.GREEN; - pos_ = 0; - id_ = 1; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasColor()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasPos()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, color_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt32(2, pos_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt32(3, id_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, color_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(2, pos_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(3, id_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static tm1638.Tm1638.SetLed parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.SetLed parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.SetLed parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static tm1638.Tm1638.SetLed parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static tm1638.Tm1638.SetLed parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.SetLed parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.SetLed parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static tm1638.Tm1638.SetLed parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static tm1638.Tm1638.SetLed parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static tm1638.Tm1638.SetLed parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(tm1638.Tm1638.SetLed prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code tm1638.SetLed} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:tm1638.SetLed) - tm1638.Tm1638.SetLedOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return tm1638.Tm1638.internal_static_tm1638_SetLed_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return tm1638.Tm1638.internal_static_tm1638_SetLed_fieldAccessorTable - .ensureFieldAccessorsInitialized( - tm1638.Tm1638.SetLed.class, tm1638.Tm1638.SetLed.Builder.class); - } - - // Construct using tm1638.Tm1638.SetLed.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - color_ = tm1638.Tm1638.Color.GREEN; - bitField0_ = (bitField0_ & ~0x00000001); - pos_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - id_ = 1; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return tm1638.Tm1638.internal_static_tm1638_SetLed_descriptor; - } - - public tm1638.Tm1638.SetLed getDefaultInstanceForType() { - return tm1638.Tm1638.SetLed.getDefaultInstance(); - } - - public tm1638.Tm1638.SetLed build() { - tm1638.Tm1638.SetLed result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public tm1638.Tm1638.SetLed buildPartial() { - tm1638.Tm1638.SetLed result = new tm1638.Tm1638.SetLed(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.color_ = color_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.pos_ = pos_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.id_ = id_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof tm1638.Tm1638.SetLed) { - return mergeFrom((tm1638.Tm1638.SetLed)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(tm1638.Tm1638.SetLed other) { - if (other == tm1638.Tm1638.SetLed.getDefaultInstance()) return this; - if (other.hasColor()) { - setColor(other.getColor()); - } - if (other.hasPos()) { - setPos(other.getPos()); - } - if (other.hasId()) { - setId(other.getId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasColor()) { - - return false; - } - if (!hasPos()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - tm1638.Tm1638.SetLed parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (tm1638.Tm1638.SetLed) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private tm1638.Tm1638.Color color_ = tm1638.Tm1638.Color.GREEN; - /** - * required .tm1638.Color color = 1; - */ - public boolean hasColor() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required .tm1638.Color color = 1; - */ - public tm1638.Tm1638.Color getColor() { - return color_; - } - /** - * required .tm1638.Color color = 1; - */ - public Builder setColor(tm1638.Tm1638.Color value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - color_ = value; - onChanged(); - return this; - } - /** - * required .tm1638.Color color = 1; - */ - public Builder clearColor() { - bitField0_ = (bitField0_ & ~0x00000001); - color_ = tm1638.Tm1638.Color.GREEN; - onChanged(); - return this; - } - - private int pos_ ; - /** - * required int32 pos = 2; - */ - public boolean hasPos() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required int32 pos = 2; - */ - public int getPos() { - return pos_; - } - /** - * required int32 pos = 2; - */ - public Builder setPos(int value) { - bitField0_ |= 0x00000002; - pos_ = value; - onChanged(); - return this; - } - /** - * required int32 pos = 2; - */ - public Builder clearPos() { - bitField0_ = (bitField0_ & ~0x00000002); - pos_ = 0; - onChanged(); - return this; - } - - private int id_ = 1; - /** - * optional int32 id = 3 [default = 1]; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional int32 id = 3 [default = 1]; - */ - public int getId() { - return id_; - } - /** - * optional int32 id = 3 [default = 1]; - */ - public Builder setId(int value) { - bitField0_ |= 0x00000004; - id_ = value; - onChanged(); - return this; - } - /** - * optional int32 id = 3 [default = 1]; - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000004); - id_ = 1; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:tm1638.SetLed) - } - - static { - defaultInstance = new SetLed(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:tm1638.SetLed) - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_tm1638_Command_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_tm1638_Command_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_tm1638_Server_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_tm1638_Server_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_tm1638_Ping_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_tm1638_Ping_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_tm1638_Echo_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_tm1638_Echo_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_tm1638_Construct_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_tm1638_Construct_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_tm1638_SetLed_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_tm1638_SetLed_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\014tm1638.proto\022\006tm1638\"\351\001\n\007Command\022\"\n\004ty" + - "pe\030\001 \002(\0162\024.tm1638.Command.Type\022\036\n\006server" + - "\030\002 \001(\0132\016.tm1638.Server\022\032\n\004ping\030\003 \001(\0132\014.t" + - "m1638.Ping\022$\n\tconstruct\030\004 \001(\0132\021.tm1638.C" + - "onstruct\022\036\n\006setLed\030\005 \001(\0132\016.tm1638.SetLed" + - "\"8\n\004Type\022\n\n\006SERVER\020\001\022\010\n\004PING\020\002\022\r\n\tCONSTR" + - "UCT\020\003\022\013\n\007SET_LED\020\004\"$\n\006Server\022\014\n\004host\030\001 \001" + - "(\t\022\014\n\004port\030\002 \002(\005\"\022\n\004Ping\022\n\n\002id\030\001 \002(\005\"#\n\004" + - "Echo\022\n\n\002id\030\001 \002(\005\022\017\n\007message\030\002 \001(\t\"\255\001\n\tCo" + - "nstruct\022\017\n\007dataPin\030\001 \002(\005\022\020\n\010clockPin\030\002 \002", - "(\005\022\021\n\tstrobePin\030\003 \001(\005\022\035\n\017activateDisplay" + - "\030\004 \001(\010:\004true\022\024\n\tintensity\030\005 \001(\005:\0017\022&\n\006mo" + - "dule\030\006 \001(\0162\016.tm1638.Module:\006TM1638\022\r\n\002id" + - "\030\007 \001(\005:\0010\"B\n\006SetLed\022\034\n\005color\030\001 \002(\0162\r.tm1" + - "638.Color\022\013\n\003pos\030\002 \002(\005\022\r\n\002id\030\003 \001(\005:\0011*/\n" + - "\005Color\022\t\n\005GREEN\020\001\022\007\n\003RED\020\002\022\010\n\004BOTH\020\003\022\010\n\004" + - "NONE\020\004*4\n\006Module\022\n\n\006TM1638\020\001\022\022\n\016Inverted" + - "TM1638\020\002\022\n\n\006TM1640\020\003" - }; - 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_tm1638_Command_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_tm1638_Command_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_tm1638_Command_descriptor, - new java.lang.String[] { "Type", "Server", "Ping", "Construct", "SetLed", }); - internal_static_tm1638_Server_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_tm1638_Server_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_tm1638_Server_descriptor, - new java.lang.String[] { "Host", "Port", }); - internal_static_tm1638_Ping_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_tm1638_Ping_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_tm1638_Ping_descriptor, - new java.lang.String[] { "Id", }); - internal_static_tm1638_Echo_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_tm1638_Echo_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_tm1638_Echo_descriptor, - new java.lang.String[] { "Id", "Message", }); - internal_static_tm1638_Construct_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_tm1638_Construct_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_tm1638_Construct_descriptor, - new java.lang.String[] { "DataPin", "ClockPin", "StrobePin", "ActivateDisplay", "Intensity", "Module", "Id", }); - internal_static_tm1638_SetLed_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_tm1638_SetLed_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_tm1638_SetLed_descriptor, - new java.lang.String[] { "Color", "Pos", "Id", }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/src/test/java/jlibarduino/Test.java b/src/test/java/jlibarduino/Test.java deleted file mode 100644 index 397d1b6..0000000 --- a/src/test/java/jlibarduino/Test.java +++ /dev/null @@ -1,24 +0,0 @@ -package jlibarduino; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.lang.reflect.Method; - -import tm1638.Tm1638.Echo; - -public class Test { - public static void main(String[] args) throws Exception { - Echo echo = Echo.newBuilder().setMessage("abc").setId(123).build(); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - echo.writeDelimitedTo(output); - byte[] buffer = output.toByteArray(); - ByteArrayInputStream input = new ByteArrayInputStream(buffer); - Class messageClass = Echo.class; - Method m = messageClass.getMethod("parseDelimitedFrom", InputStream.class); - Object object = m.invoke(null, input); - echo = (Echo) object; - System.out.println(echo.getMessage()); - System.out.println(echo.getId()); - } -}