From df4bab17504996a773c59b5c14b152dcffd144b2 Mon Sep 17 00:00:00 2001 From: Rik Veenboer Date: Thu, 25 Jun 2015 15:56:42 +0100 Subject: [PATCH] Migrate to general jlibarduino --- .../boukefalos/arduino/AbstractArduino.java | 27 + .../github/boukefalos/arduino/Arduino.java | 13 + .../{tm1638 => arduino}/Loader.java | 30 +- .../com/github/boukefalos/arduino/Server.java | 64 + .../exception/ArduinoException.java | 2 +- .../implementation/Local.java | 16 +- .../implementation/Remote.java | 9 +- .../boukefalos/arduino/port/ParsingPort.java | 36 + .../Arduino.java => arduino/port/Port.java} | 81 +- .../boukefalos/tm1638/AbstractTM1638.java | 65 - .../com/github/boukefalos/tm1638/Server.java | 96 - .../com/github/boukefalos/tm1638/TM1638.java | 18 - src/main/java/tm1638/Tm1638.java | 4626 +++++++++++++++++ src/main/proto/tm1638.proto | 59 - src/test/java/jlibarduino/Test.java | 24 + src/test/java/test/TestLocal.java | 36 - .../java/test/TestRemoteImplementation.java | 35 - src/test/java/test/TestTcpImplementation.java | 28 - src/test/java/test/TestUdpImplementation.java | 22 - 19 files changed, 4860 insertions(+), 427 deletions(-) create mode 100644 src/main/java/com/github/boukefalos/arduino/AbstractArduino.java create mode 100644 src/main/java/com/github/boukefalos/arduino/Arduino.java rename src/main/java/com/github/boukefalos/{tm1638 => arduino}/Loader.java (69%) create mode 100644 src/main/java/com/github/boukefalos/arduino/Server.java rename src/main/java/com/github/boukefalos/{tm1638 => arduino}/exception/ArduinoException.java (80%) rename src/main/java/com/github/boukefalos/{tm1638 => arduino}/implementation/Local.java (63%) rename src/main/java/com/github/boukefalos/{tm1638 => arduino}/implementation/Remote.java (78%) create mode 100644 src/main/java/com/github/boukefalos/arduino/port/ParsingPort.java rename src/main/java/com/github/boukefalos/{tm1638/Arduino.java => arduino/port/Port.java} (63%) delete mode 100644 src/main/java/com/github/boukefalos/tm1638/AbstractTM1638.java delete mode 100644 src/main/java/com/github/boukefalos/tm1638/Server.java delete mode 100644 src/main/java/com/github/boukefalos/tm1638/TM1638.java create mode 100644 src/main/java/tm1638/Tm1638.java delete mode 100644 src/main/proto/tm1638.proto create mode 100644 src/test/java/jlibarduino/Test.java delete mode 100644 src/test/java/test/TestLocal.java delete mode 100644 src/test/java/test/TestRemoteImplementation.java delete mode 100644 src/test/java/test/TestTcpImplementation.java delete mode 100644 src/test/java/test/TestUdpImplementation.java diff --git a/src/main/java/com/github/boukefalos/arduino/AbstractArduino.java b/src/main/java/com/github/boukefalos/arduino/AbstractArduino.java new file mode 100644 index 0000000..cc7a36d --- /dev/null +++ b/src/main/java/com/github/boukefalos/arduino/AbstractArduino.java @@ -0,0 +1,27 @@ +package com.github.boukefalos.arduino; + +import java.util.ArrayList; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import base.work.Listen; +import base.worker.Worker; + +public abstract class AbstractArduino extends Listen implements Arduino { + public static final int BUFFER_SIZE = 1024; + protected Logger logger = LoggerFactory.getLogger(getClass()); + protected ArrayList> listenList; + + public AbstractArduino() { + super(Worker.Type.DIRECT); + } + + public void start() {} + + public void stop() {} + + public void exit() { + stop(); + } +} diff --git a/src/main/java/com/github/boukefalos/arduino/Arduino.java b/src/main/java/com/github/boukefalos/arduino/Arduino.java new file mode 100644 index 0000000..4ac9a45 --- /dev/null +++ b/src/main/java/com/github/boukefalos/arduino/Arduino.java @@ -0,0 +1,13 @@ +package com.github.boukefalos.arduino; + +import base.Control; +import base.work.Listen; + +import com.github.boukefalos.arduino.exception.ArduinoException; + +public interface Arduino extends Control { + public void register(Listen listen); + public void remove(Listen listen); + + public void send(byte[] buffer) throws ArduinoException; +} \ No newline at end of file diff --git a/src/main/java/com/github/boukefalos/tm1638/Loader.java b/src/main/java/com/github/boukefalos/arduino/Loader.java similarity index 69% rename from src/main/java/com/github/boukefalos/tm1638/Loader.java rename to src/main/java/com/github/boukefalos/arduino/Loader.java index dc7fbb4..8b7f271 100644 --- a/src/main/java/com/github/boukefalos/tm1638/Loader.java +++ b/src/main/java/com/github/boukefalos/arduino/Loader.java @@ -1,4 +1,4 @@ -package com.github.boukefalos.tm1638; +package com.github.boukefalos.arduino; import java.util.Properties; @@ -10,30 +10,32 @@ import org.picocontainer.parameters.ConstantParameter; import base.exception.LoaderException; import base.loader.AbstractLoader; -import com.github.boukefalos.tm1638.exception.ArduinoException; -import com.github.boukefalos.tm1638.implementation.Local; -import com.github.boukefalos.tm1638.implementation.Remote; +import com.github.boukefalos.arduino.exception.ArduinoException; +import com.github.boukefalos.arduino.implementation.Local; +import com.github.boukefalos.arduino.implementation.Remote; public class Loader extends AbstractLoader { - protected static final String PROPERTIES_FILE = "TM1638.properties"; + protected static final String PROPERTIES_FILE = "arduino.properties"; - public Loader(Properties properties) throws LoaderException { - super(); + public Loader(Properties properties) throws LoaderException { + this(Local.class, Remote.class, Server.class, properties); + } + public Loader(Class localClass, Class remoteClass, Class serverClass, Properties properties) throws LoaderException { /* Add implementation */ switch (properties.getProperty("implementation")) { case "local": - pico.addComponent(TM1638.class, Local.class); + pico.addComponent(localClass); break; case "remote": - pico.addComponent(TM1638.class, Remote.class); + pico.addComponent(remoteClass); /* Add remote duplex implementation */ try { - String protocol = properties.getOrDefault("server.protocol", "tcp").toString(); + String protocol = properties.getOrDefault("protocol", "tcp").toString(); String implementation = properties.getOrDefault("tcp.implementation", "socket").toString(); String host = properties.getProperty("remote.host"); - int port = Integer.valueOf(properties.getProperty("remote.port")); + int port = Integer.valueOf(properties.getProperty("remote.port")); addClientDuplex(protocol, implementation, host, port); } catch (NumberFormatException e) { throw new LoaderException("Failed to parse remote.port"); @@ -44,7 +46,7 @@ public class Loader extends AbstractLoader { /* Add server */ if (properties.getProperty("server") != null) { boolean direct = Boolean.parseBoolean(properties.getOrDefault("server.direct", Server.DIRECT).toString()); - pico.addComponent(Server.class, Server.class, new Parameter[] { + pico.addComponent(serverClass, serverClass, new Parameter[] { new ComponentParameter(), new ComponentParameter(), new ConstantParameter(direct)}); @@ -61,9 +63,9 @@ public class Loader extends AbstractLoader { } } - public TM1638 getTM1638() throws ArduinoException { + public Arduino getArduino() throws ArduinoException { try { - return pico.getComponent(TM1638.class); + return (Arduino) pico.getComponent(Arduino.class); } catch (PicoCompositionException e) { throw new ArduinoException("Failed to load"); } diff --git a/src/main/java/com/github/boukefalos/arduino/Server.java b/src/main/java/com/github/boukefalos/arduino/Server.java new file mode 100644 index 0000000..5867927 --- /dev/null +++ b/src/main/java/com/github/boukefalos/arduino/Server.java @@ -0,0 +1,64 @@ +package com.github.boukefalos.arduino; + +import java.io.IOException; + +import base.Control; +import base.Duplex; +import base.Receiver; +import base.exception.worker.ActivateException; +import base.exception.worker.DeactivateException; +import base.work.Listen; + +import com.github.boukefalos.arduino.exception.ArduinoException; + +public class Server extends Listen implements Control, Receiver { + protected static final boolean DIRECT = false; + + protected Arduino arduino; + protected Duplex duplex; + protected boolean direct; + + public Server(Arduino arduino, Duplex duplex) { + this(arduino, duplex, DIRECT); + } + + public Server(Arduino tm1638, Duplex duplex, boolean direct) { + this.arduino = tm1638; + this.duplex = duplex; + this.direct = direct; + arduino.register(this); // Arduino > [input()] + duplex.register(this); // Client > [receive()] + } + + public void activate() throws ActivateException { + duplex.start(); + super.activate(); + } + + public void deactivate() throws DeactivateException { + duplex.stop(); + super.deactivate(); + } + + public void receive(byte[] buffer) { + // Client > [Server] > Arduino + if (direct) { + try { + arduino.send(buffer); + } catch (ArduinoException e) { + logger.error("", e); + } + } else { + // option to decode() in derivatives? + } + } + + public void input(byte[] buffer) { + // Arduino > [Server] > Client + try { + duplex.send(buffer); + } catch (IOException e) { + logger.error("", e); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/boukefalos/tm1638/exception/ArduinoException.java b/src/main/java/com/github/boukefalos/arduino/exception/ArduinoException.java similarity index 80% rename from src/main/java/com/github/boukefalos/tm1638/exception/ArduinoException.java rename to src/main/java/com/github/boukefalos/arduino/exception/ArduinoException.java index 5b58d1c..440d0df 100644 --- a/src/main/java/com/github/boukefalos/tm1638/exception/ArduinoException.java +++ b/src/main/java/com/github/boukefalos/arduino/exception/ArduinoException.java @@ -1,4 +1,4 @@ -package com.github.boukefalos.tm1638.exception; +package com.github.boukefalos.arduino.exception; import java.io.IOException; diff --git a/src/main/java/com/github/boukefalos/tm1638/implementation/Local.java b/src/main/java/com/github/boukefalos/arduino/implementation/Local.java similarity index 63% rename from src/main/java/com/github/boukefalos/tm1638/implementation/Local.java rename to src/main/java/com/github/boukefalos/arduino/implementation/Local.java index dfe84b4..148f03f 100644 --- a/src/main/java/com/github/boukefalos/tm1638/implementation/Local.java +++ b/src/main/java/com/github/boukefalos/arduino/implementation/Local.java @@ -1,23 +1,23 @@ -package com.github.boukefalos.tm1638.implementation; +package com.github.boukefalos.arduino.implementation; import java.io.IOException; import java.io.OutputStream; import base.work.Listen; -import com.github.boukefalos.tm1638.AbstractTM1638; -import com.github.boukefalos.tm1638.Arduino; -import com.github.boukefalos.tm1638.exception.ArduinoException; +import com.github.boukefalos.arduino.AbstractArduino; +import com.github.boukefalos.arduino.exception.ArduinoException; +import com.github.boukefalos.arduino.port.Port; -public class Local extends AbstractTM1638 { - protected Arduino arduino; +public class Local extends AbstractArduino { + protected Port arduino; protected OutputStream outputStream; public Local() throws Exception { - this(Arduino.getInstance()); + this(Port.getInstance()); } - public Local(Arduino arduino) throws ArduinoException { + public Local(Port arduino) throws ArduinoException { this.arduino = arduino; outputStream = arduino.getOutputStream(); } diff --git a/src/main/java/com/github/boukefalos/tm1638/implementation/Remote.java b/src/main/java/com/github/boukefalos/arduino/implementation/Remote.java similarity index 78% rename from src/main/java/com/github/boukefalos/tm1638/implementation/Remote.java rename to src/main/java/com/github/boukefalos/arduino/implementation/Remote.java index 18be0b6..fab5a44 100644 --- a/src/main/java/com/github/boukefalos/tm1638/implementation/Remote.java +++ b/src/main/java/com/github/boukefalos/arduino/implementation/Remote.java @@ -1,4 +1,4 @@ -package com.github.boukefalos.tm1638.implementation; +package com.github.boukefalos.arduino.implementation; import java.io.IOException; import java.util.ArrayList; @@ -7,12 +7,11 @@ import base.Duplex; import base.Receiver; import base.work.Listen; -import com.github.boukefalos.tm1638.AbstractTM1638; -import com.github.boukefalos.tm1638.exception.ArduinoException; +import com.github.boukefalos.arduino.AbstractArduino; +import com.github.boukefalos.arduino.exception.ArduinoException; -public class Remote extends AbstractTM1638 implements Receiver { +public class Remote extends AbstractArduino implements Receiver { protected Duplex duplex; - protected ArrayList> listenList; public Remote(Duplex duplex) { this.duplex = duplex; diff --git a/src/main/java/com/github/boukefalos/arduino/port/ParsingPort.java b/src/main/java/com/github/boukefalos/arduino/port/ParsingPort.java new file mode 100644 index 0000000..49496a1 --- /dev/null +++ b/src/main/java/com/github/boukefalos/arduino/port/ParsingPort.java @@ -0,0 +1,36 @@ +package com.github.boukefalos.arduino.port; + +import java.io.InputStream; +import java.lang.reflect.Method; + +import purejavacomm.SerialPortEvent; +import base.work.Listen; + +public class ParsingPort extends Port { + protected Class messageClass; + + protected ParsingPort(Class messageClass) { + this.messageClass = messageClass; + } + + public static Port getInstance(Class messageClass) { + if (port == null) { + port = new ParsingPort(messageClass); + } + return port; + } + + public void serialEvent(SerialPortEvent event) { + try { + Method m = messageClass.getMethod("parseDelimitedFrom", InputStream.class); + Object object = m.invoke(null, inputStream); + for (Listen listen : listenList) { + listen.add(object); + } + } catch (Exception e) { + logger.error("", e); + } catch (Throwable e) { + logger.error("", e); + } + } +} diff --git a/src/main/java/com/github/boukefalos/tm1638/Arduino.java b/src/main/java/com/github/boukefalos/arduino/port/Port.java similarity index 63% rename from src/main/java/com/github/boukefalos/tm1638/Arduino.java rename to src/main/java/com/github/boukefalos/arduino/port/Port.java index c3cb458..21f5c3d 100644 --- a/src/main/java/com/github/boukefalos/tm1638/Arduino.java +++ b/src/main/java/com/github/boukefalos/arduino/port/Port.java @@ -1,4 +1,5 @@ -package com.github.boukefalos.tm1638; +package com.github.boukefalos.arduino.port; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -15,12 +16,11 @@ import purejavacomm.SerialPort; import purejavacomm.SerialPortEvent; import purejavacomm.SerialPortEventListener; import purejavacomm.UnsupportedCommOperationException; -import tm1638.Tm1638.Echo; import base.work.Listen; -import com.github.boukefalos.tm1638.exception.ArduinoException; +import com.github.boukefalos.arduino.exception.ArduinoException; -public class Arduino implements SerialPortEventListener { +public class Port implements SerialPortEventListener { public static final int BUFFER_SIZE = 1024; public static final int TIME_OUT = 1000; public static final String PORT_NAMES[] = { @@ -31,35 +31,37 @@ public class Arduino implements SerialPortEventListener { "COM3", // Windows }; - protected static Logger logger = LoggerFactory.getLogger(Arduino.class); - protected static Arduino arduino; + protected static Logger logger = LoggerFactory.getLogger(Port.class); + protected static Port port; protected int bufferSize; - protected SerialPort port = null; + protected SerialPort serialPort = null; protected InputStream inputStream = null; protected ArrayList> listenList = new ArrayList>(); - protected Arduino(int bufferSize) { + protected Port() {} + + protected Port(int bufferSize) { this.bufferSize = bufferSize; } public void register(Listen listen) { listenList.add(listen); } - + public void remove(Listen listen) { listenList.remove(listen); } - public static Arduino getInstance() { + public static Port getInstance() { return getInstance(BUFFER_SIZE); } - public static Arduino getInstance(int bufferSize) { - if (arduino == null) { - arduino = new Arduino(bufferSize); + public static Port getInstance(int bufferSize) { + if (port == null) { + port = new Port(bufferSize); } - return arduino; + return port; } protected void connect() throws ArduinoException { @@ -72,17 +74,17 @@ public class Arduino implements SerialPortEventListener { for ( String portName: PORT_NAMES) { if (portid.getName().equals(portName) || portid.getName().contains(portName)) { try { - port = (SerialPort) portid.open("", TIME_OUT); - port.setFlowControlMode( + serialPort = (SerialPort) portid.open("", TIME_OUT); + serialPort.setFlowControlMode( SerialPort.FLOWCONTROL_XONXOFF_IN + SerialPort.FLOWCONTROL_XONXOFF_OUT); - inputStream = port.getInputStream(); - System.out.println( "Connected on port: " + portid.getName()); - port.addEventListener(this); + inputStream = serialPort.getInputStream(); + System.out.println("Connected on port: " + portid.getName()); + serialPort.addEventListener(this); } catch (UnsupportedCommOperationException | PortInUseException | IOException | TooManyListenersException e) { throw new ArduinoException("Failed to connect"); } - port.notifyOnDataAvailable(true); + serialPort.notifyOnDataAvailable(true); return; } } @@ -92,47 +94,46 @@ public class Arduino implements SerialPortEventListener { } public void serialEvent(SerialPortEvent event) { - try { - switch (event.getEventType()) { - case SerialPortEvent.DATA_AVAILABLE: - // Where should this be parsed, or should byte[] be passed directly? - Echo echo = Echo.parseDelimitedFrom(inputStream); - System.err.println(echo.getMessage()); - for (Listen listen : listenList) { - listen.add(echo); - } - break; - default: - break; - } - } catch (IOException e) { - logger.error("", e); + switch (event.getEventType()) { + case SerialPortEvent.DATA_AVAILABLE: + byte[] buffer = new byte[bufferSize]; + try { + inputStream.read(buffer); + for (Listen listen : listenList) { + listen.add(buffer); + } + } catch (IOException e) { + logger.error("", e); + } + break; + default: + break; } } public InputStream getInputStream() throws ArduinoException { - if (port == null) { + if (serialPort == null) { connect(); } try { - return port.getInputStream(); + return serialPort.getInputStream(); } catch (IOException e) { throw new ArduinoException("Failed to get inputstream"); } } public OutputStream getOutputStream() throws ArduinoException { - if (port == null) { + if (serialPort == null) { connect(); } try { - return port.getOutputStream(); + return serialPort.getOutputStream(); } catch (IOException e) { throw new ArduinoException("Failed to get inputstream"); } } public void close() { - port.close(); + serialPort.close(); } } \ No newline at end of file diff --git a/src/main/java/com/github/boukefalos/tm1638/AbstractTM1638.java b/src/main/java/com/github/boukefalos/tm1638/AbstractTM1638.java deleted file mode 100644 index 389f185..0000000 --- a/src/main/java/com/github/boukefalos/tm1638/AbstractTM1638.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.github.boukefalos.tm1638; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import tm1638.Tm1638.Color; -import tm1638.Tm1638.Command; -import tm1638.Tm1638.Command.Type; -import tm1638.Tm1638.Construct; -import tm1638.Tm1638.Ping; -import tm1638.Tm1638.SetLed; -import base.Sender; - -public abstract class AbstractTM1638 implements TM1638, Sender { - public static final int BUFFER_SIZE = 1024; - protected Logger logger = LoggerFactory.getLogger(getClass()); - - public void start() {} - - public void stop() {} - - public void exit() { - stop(); - } - - public void command(Command command) { - ByteArrayOutputStream output = new ByteArrayOutputStream(BUFFER_SIZE); - try { - command.writeDelimitedTo(output); - byte[] buffer = output.toByteArray(); - send(buffer); - } catch (IOException e) { - logger.error("Failed to send command"); - } - } - - public void construct(int dataPin, int clockPin, int strobePin) { - command(Command.newBuilder() - .setType(Type.CONSTRUCT) - .setConstruct( - Construct.newBuilder() - .setDataPin(dataPin) - .setClockPin(clockPin) - .setStrobePin(strobePin).build()).build()); - } - - public void ping(int id) { - command(Command.newBuilder() - .setType(Type.PING) - .setPing(Ping.newBuilder() - .setId(id)).build()); - } - - public void setLed(Color color, int pos) { - command(Command.newBuilder() - .setType(Type.SET_LED) - .setSetLed( - SetLed.newBuilder() - .setColor(color) - .setPos(pos).build()).build()); - } -} diff --git a/src/main/java/com/github/boukefalos/tm1638/Server.java b/src/main/java/com/github/boukefalos/tm1638/Server.java deleted file mode 100644 index d9d6a13..0000000 --- a/src/main/java/com/github/boukefalos/tm1638/Server.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.github.boukefalos.tm1638; - -import java.io.ByteArrayInputStream; -import java.io.IOException; - -import tm1638.Tm1638.Color; -import tm1638.Tm1638.Command; -import tm1638.Tm1638.Ping; -import tm1638.Tm1638.SetLed; -import base.Control; -import base.Duplex; -import base.Receiver; -import base.exception.worker.ActivateException; -import base.exception.worker.DeactivateException; -import base.work.Listen; - -import com.github.boukefalos.tm1638.exception.ArduinoException; - -public class Server extends Listen implements Control, Receiver { - protected static final boolean DIRECT = false; - - protected TM1638 tm1638; - protected Duplex duplex; - protected boolean direct; - - public Server(TM1638 tm1638, Duplex duplex) { - this(tm1638, duplex, DIRECT); - } - - public Server(TM1638 tm1638, Duplex duplex, boolean direct) { - this.tm1638 = tm1638; - this.duplex = duplex; - this.direct = direct; - tm1638.register(this); // Arduino > [input()] - duplex.register(this); // Client > [receive()] - } - - public void activate() throws ActivateException { - duplex.start(); - super.activate(); - } - - public void deactivate() throws DeactivateException { - duplex.stop(); - super.deactivate(); - } - - public void receive(byte[] buffer) { - // Client > [Server] > Arduino - if (direct) { - try { - tm1638.send(buffer); - } catch (ArduinoException e) { - logger.error("", e); - } - } else { - ByteArrayInputStream input = new ByteArrayInputStream(buffer); - try { - Command command = Command.parseDelimitedFrom(input); - logger.debug("Command type = " + command.getType().name()); - switch (command.getType()) { - case PING: - Ping ping = command.getPing(); - tm1638.ping(ping.getId()); - break; - case SET_LED: - SetLed setLed = command.getSetLed(); - logger.debug("Color = " + setLed.getColor().name()); - switch (setLed.getColor()) { - case RED: - tm1638.setLed(Color.RED, 1); - case GREEN: - tm1638.setLed(Color.GREEN, 1); - default: - break; - } - break; - default: - break; - } - } catch (IOException e) { - logger.error("Failed to parse input"); - return; - } - } - } - - public void input(byte[] buffer) { - // Arduino > [Server] > Client - try { - duplex.send(buffer); - } catch (IOException e) { - logger.error("", e); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/github/boukefalos/tm1638/TM1638.java b/src/main/java/com/github/boukefalos/tm1638/TM1638.java deleted file mode 100644 index 5f63768..0000000 --- a/src/main/java/com/github/boukefalos/tm1638/TM1638.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.github.boukefalos.tm1638; - -import com.github.boukefalos.tm1638.exception.ArduinoException; - -import tm1638.Tm1638.Color; -import base.Control; -import base.work.Listen; - -public interface TM1638 extends Control { - public void register(Listen listen); - public void remove(Listen listen); - - public void send(byte[] buffer) throws ArduinoException; - - public void construct(int dataPin, int clockPin, int strobePin); - public void ping(int i); - public void setLed(Color color, int pos); -} \ No newline at end of file diff --git a/src/main/java/tm1638/Tm1638.java b/src/main/java/tm1638/Tm1638.java new file mode 100644 index 0000000..a6cadd1 --- /dev/null +++ b/src/main/java/tm1638/Tm1638.java @@ -0,0 +1,4626 @@ +// 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/main/proto/tm1638.proto b/src/main/proto/tm1638.proto deleted file mode 100644 index 8aae2f4..0000000 --- a/src/main/proto/tm1638.proto +++ /dev/null @@ -1,59 +0,0 @@ -package tm1638; - -enum Color { - GREEN = 1; - RED = 2; - BOTH = 3; - NONE = 4; -} - -enum Module { - TM1638 = 1; - InvertedTM1638 = 2; - TM1640 = 3; -} - -message Command { - enum Type { - SERVER = 1; - PING = 2; - CONSTRUCT = 3; - SET_LED = 4; - } - - required Type type = 1; - optional Server server = 2; - optional Ping ping = 3; - optional Construct construct = 4; - optional SetLed setLed = 5; -} - -message Server { - optional string host = 1; - required int32 port = 2; -} - -message Ping { - required int32 id = 1; -} - -message Echo { - required int32 id = 1; - optional string message = 2; -} - -message Construct { - required int32 dataPin = 1; - required int32 clockPin = 2; - optional int32 strobePin = 3; - optional bool activateDisplay = 4 [default = true]; - optional int32 intensity = 5 [default = 7]; - optional Module module = 6 [default = TM1638]; - optional int32 id = 7 [default = 0]; -} - -message SetLed { - required Color color = 1; - required int32 pos = 2; - optional int32 id = 3 [default = 1]; -} \ No newline at end of file diff --git a/src/test/java/jlibarduino/Test.java b/src/test/java/jlibarduino/Test.java new file mode 100644 index 0000000..397d1b6 --- /dev/null +++ b/src/test/java/jlibarduino/Test.java @@ -0,0 +1,24 @@ +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()); + } +} diff --git a/src/test/java/test/TestLocal.java b/src/test/java/test/TestLocal.java deleted file mode 100644 index 31aec65..0000000 --- a/src/test/java/test/TestLocal.java +++ /dev/null @@ -1,36 +0,0 @@ -package test; - -import tm1638.Tm1638.Color; -import tm1638.Tm1638.Echo; -import base.work.Listen; - -import com.github.boukefalos.tm1638.TM1638; -import com.github.boukefalos.tm1638.implementation.Local; - -public class TestLocal extends Listen { - public static void main(String[] args) throws Exception { - TM1638 TM1638 = new Local(); - main(TM1638); - } - - public static void main(TM1638 TM1638) throws InterruptedException { - TM1638.register(new TestLocal()); - TM1638.construct(8, 9, 7); - - int i = 123; - while (i < 10000) { - TM1638.ping(i++); - TM1638.setLed(i % 3 == 0 ? Color.GREEN : Color.RED, i % 7); - Thread.sleep(1000); - } - } - - public TestLocal() { - super(); - start(); - } - - public void input(Echo echo) { - System.out.println("> " + echo.getMessage() + " " + echo.getId()); - } -} diff --git a/src/test/java/test/TestRemoteImplementation.java b/src/test/java/test/TestRemoteImplementation.java deleted file mode 100644 index a45a743..0000000 --- a/src/test/java/test/TestRemoteImplementation.java +++ /dev/null @@ -1,35 +0,0 @@ -package test; - -import java.util.Properties; - -import base.exception.worker.ActivateException; - -import com.github.boukefalos.tm1638.Loader; -import com.github.boukefalos.tm1638.Server; -import com.github.boukefalos.tm1638.TM1638; -import com.github.boukefalos.tm1638.exception.ArduinoException; - -public class TestRemoteImplementation extends TestLocal { - protected TM1638 tm1638; - - public TestRemoteImplementation(Loader loader) throws ArduinoException { - tm1638 = loader.getTM1638(); - tm1638.register(this); - } - - public void activate() throws ActivateException { - tm1638.start(); - super.activate(); - } - - public static void main(Properties localProperties, Properties remoteProperties) throws Exception { - Loader localLoader = new Loader(localProperties); - Loader remoteLoader = new Loader(remoteProperties); - - Server server = localLoader.getServer(); - server.start(); - - TM1638 TM1638 = remoteLoader.getTM1638(); - main(TM1638); - } -} diff --git a/src/test/java/test/TestTcpImplementation.java b/src/test/java/test/TestTcpImplementation.java deleted file mode 100644 index 04cb845..0000000 --- a/src/test/java/test/TestTcpImplementation.java +++ /dev/null @@ -1,28 +0,0 @@ -package test; - -import java.util.Properties; - -import com.github.boukefalos.tm1638.exception.ArduinoException; - -public class TestTcpImplementation { - public static void main(String[] args) throws Exception { - Properties localProperties = new Properties(); - localProperties.setProperty("implementation", "local"); - localProperties.setProperty("server", "true"); - localProperties.setProperty("server.direct", "false"); - localProperties.setProperty("server.port", "8883"); - localProperties.setProperty("server.protocol", "tcp"); - - Properties remoteProperties = new Properties(); - remoteProperties.setProperty("implementation", "remote"); - remoteProperties.setProperty("protocol", "tcp"); - remoteProperties.setProperty("remote.host", "localhost"); - remoteProperties.setProperty("remote.port", "8883"); - - try { - TestRemoteImplementation.main(localProperties, remoteProperties); - } catch (ArduinoException e) { - System.err.println(e.getMessage()); - } - } -} \ No newline at end of file diff --git a/src/test/java/test/TestUdpImplementation.java b/src/test/java/test/TestUdpImplementation.java deleted file mode 100644 index 23c6b91..0000000 --- a/src/test/java/test/TestUdpImplementation.java +++ /dev/null @@ -1,22 +0,0 @@ -package test; - -import java.util.Properties; - -public class TestUdpImplementation { - public static void main(String[] args) throws Exception { - Properties localProperties = new Properties(); - localProperties.setProperty("implementation", "local"); - localProperties.setProperty("server", "true"); - localProperties.setProperty("server.direct", "false"); - localProperties.setProperty("server.port", "8883"); - localProperties.setProperty("server.protocol", "udp"); - - Properties remoteProperties = new Properties(); - remoteProperties.setProperty("implementation", "remote"); - remoteProperties.setProperty("protocol", "udp"); - remoteProperties.setProperty("remote.host", "localhost"); - remoteProperties.setProperty("remote.port", "8883"); - - TestRemoteImplementation.main(localProperties, remoteProperties); - } -}