Package de.freaklamarsch.systarest
Class STouchProtocol
java.lang.Object
de.freaklamarsch.systarest.STouchProtocol
public class STouchProtocol
extends java.lang.Object
Contains all parsers for handling commands in the communication protocol used
by the S-Touch App. Each parser implements the
STouchProtocol.ObjectReaderWriter
interface and is responsible for parsing and processing a specific command.
This class also provides a centralized map of parsers, the
STouchProtocol.STouchCommand
enum, and utility methods like getCmdLen
.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
STouchProtocol.Button
private static class
STouchProtocol.ButtonReaderWriter
private static class
STouchProtocol.ByteReaderWriter
PUT OBJECT PARSERS INTO THIS SECTION ***************** parsers should be private **************************** custom objects should be defined in the next section *private static class
STouchProtocol.CharacterRotateReaderWriter
static class
STouchProtocol.Circle
private static class
STouchProtocol.CircleReaderWriter
private static class
STouchProtocol.ColorReaderWriter
private static class
STouchProtocol.CommandReaderWriter
static class
STouchProtocol.Coordinates
private static class
STouchProtocol.CoordinatesReaderWriter
private static class
STouchProtocol.IntegerReaderWriter
static class
STouchProtocol.MacAddress
PUT COMMUNICATION OBJECTS INTO THIS SECTION *static class
STouchProtocol.MacAddressReaderWriter
static interface
STouchProtocol.ObjectReaderWriter<T>
Interface for parsing and processing commands.static class
STouchProtocol.Rectangle
private static class
STouchProtocol.RectangleReaderWriter
static class
STouchProtocol.RoundRectangle
private static class
STouchProtocol.RoundRectangleReaderWriter
private static class
STouchProtocol.ShortIntegerReaderWriter
static class
STouchProtocol.STouchCommand
Enum used to map the command ids used by the S-Touch protocol to display functionsstatic class
STouchProtocol.Symbol
private static class
STouchProtocol.SymbolReaderWriter
private static class
STouchProtocol.TextReaderWriter
static class
STouchProtocol.TextRotate
private static class
STouchProtocol.TextRotateReaderWriter
static class
STouchProtocol.TextXY
private static class
STouchProtocol.TextXYReaderWriter
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<STouchProtocol.STouchCommand,STouchProtocol.ObjectReaderWriter<?>>
readerWriters
A map of command parsers, where the key is the command code and the value is the corresponding parser. -
Constructor Summary
Constructors Constructor Description STouchProtocol()
-
Method Summary
Modifier and Type Method Description static STouchProtocol.ObjectReaderWriter<?>
getParser(STouchProtocol.STouchCommand cmd)
Retrieves the parser for the given command code.static java.lang.Object
read(STouchProtocol.STouchCommand cmd, java.nio.ByteBuffer buffer)
static <T> int
write(STouchProtocol.STouchCommand cmd, java.nio.ByteBuffer buffer, T object)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
readerWriters
private static final java.util.Map<STouchProtocol.STouchCommand,STouchProtocol.ObjectReaderWriter<?>> readerWritersA map of command parsers, where the key is the command code and the value is the corresponding parser.
-
-
Constructor Details
-
STouchProtocol
public STouchProtocol()
-
-
Method Details
-
getParser
Retrieves the parser for the given command code.- Parameters:
cmd
- the STouchProtocol.STouchCommand- Returns:
- the corresponding
STouchProtocol.ObjectReaderWriter
, ornull
if no parser exists for the command
-
read
-
write
public static <T> int write(STouchProtocol.STouchCommand cmd, java.nio.ByteBuffer buffer, T object)
-