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 classSTouchProtocol.Buttonprivate static classSTouchProtocol.ButtonReaderWriterprivate static classSTouchProtocol.ByteReaderWriterPUT OBJECT PARSERS INTO THIS SECTION ***************** parsers should be private **************************** custom objects should be defined in the next section *private static classSTouchProtocol.CharacterRotateReaderWriterstatic classSTouchProtocol.Circleprivate static classSTouchProtocol.CircleReaderWriterprivate static classSTouchProtocol.ColorReaderWriterprivate static classSTouchProtocol.CommandReaderWriterstatic classSTouchProtocol.Coordinatesprivate static classSTouchProtocol.CoordinatesReaderWriterprivate static classSTouchProtocol.IntegerReaderWriterstatic classSTouchProtocol.MacAddressPUT COMMUNICATION OBJECTS INTO THIS SECTION *static classSTouchProtocol.MacAddressReaderWriterstatic interfaceSTouchProtocol.ObjectReaderWriter<T>Interface for parsing and processing commands.static classSTouchProtocol.Rectangleprivate static classSTouchProtocol.RectangleReaderWriterstatic classSTouchProtocol.RoundRectangleprivate static classSTouchProtocol.RoundRectangleReaderWriterprivate static classSTouchProtocol.ShortIntegerReaderWriterstatic classSTouchProtocol.STouchCommandEnum used to map the command ids used by the S-Touch protocol to display functionsstatic classSTouchProtocol.Symbolprivate static classSTouchProtocol.SymbolReaderWriterprivate static classSTouchProtocol.TextReaderWriterstatic classSTouchProtocol.TextRotateprivate static classSTouchProtocol.TextRotateReaderWriterstatic classSTouchProtocol.TextXYprivate static classSTouchProtocol.TextXYReaderWriter -
Field Summary
Fields Modifier and Type Field Description private static 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 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.Objectread(STouchProtocol.STouchCommand cmd, java.nio.ByteBuffer buffer)static <T> intwrite(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, ornullif no parser exists for the command
-
read
-
write
public static <T> int write(STouchProtocol.STouchCommand cmd, java.nio.ByteBuffer buffer, T object)
-