Public Member Functions | |
MenuCommand | fromChannel (ByteBuffer buffer) throws IOException |
void | toChannel (ByteBuffer buffer, MenuCommand cmd) throws TcProtocolException |
CommandProtocol | getProtocolForCmd (MenuCommand command) |
Public Attributes | |
byte | PROTO_START_OF_MSG = 0x01 |
byte | PROTO_END_OF_MSG = 0x02 |
This is a low level part of the API that most people don't need to deal, implementations will translate commands to and from a given protocol. If you want to add custom messages then see the configurable protocol converter com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter implementation.
MenuCommand com.thecoderscorner.menu.remote.MenuCommandProtocol.fromChannel | ( | ByteBuffer | buffer | ) | throws IOException |
Retrieves a message from the channel, or throws an exception if the message is not fully formed. It is assumed that the buffer has been suitably flipped ready for reading
Implemented in com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.
CommandProtocol com.thecoderscorner.menu.remote.MenuCommandProtocol.getProtocolForCmd | ( | MenuCommand | command | ) |
Checks the message and sees which protocol it will be processed with. For example the JOIN message would be processed using TagVal.
command | the command to check the protocol of |
Implemented in com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.
void com.thecoderscorner.menu.remote.MenuCommandProtocol.toChannel | ( | ByteBuffer | buffer, |
MenuCommand | cmd | ||
) | throws TcProtocolException |
Puts the command specified into the byte buffer, it is assumed that the callee will flip the channel once complete.
buffer | to write the data to |
cmd | the command to write |
Implemented in com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.