tcMenuJavaAPI
Public Member Functions | Public Attributes | List of all members
com.thecoderscorner.menu.remote.MenuCommandProtocol Interface Reference
Inheritance diagram for com.thecoderscorner.menu.remote.MenuCommandProtocol:
com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter

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
 

Detailed Description

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.

Member Function Documentation

◆ fromChannel()

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.

◆ getProtocolForCmd()

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.

Parameters
commandthe command to check the protocol of
Returns
the protocol that will be used.

Implemented in com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.

◆ toChannel()

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.

Parameters
bufferto write the data to
cmdthe command to write

Implemented in com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.


The documentation for this interface was generated from the following file: