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

Public Member Functions

 ConfigurableProtocolConverter (boolean includeDefaultProcessors)
 
void addTagValInProcessor (MessageField field, TagValProtocolIncomingMsgConverter processor)
 
void addRawInProcessor (MessageField field, RawProtocolIncomingMsgConverter processor)
 
MenuCommand fromChannel (ByteBuffer buffer) throws IOException
 
void toChannel (ByteBuffer buffer, MenuCommand cmd) throws TcProtocolException
 
CommandProtocol getProtocolForCmd (MenuCommand command)
 

Additional Inherited Members

- Public Attributes inherited from com.thecoderscorner.menu.remote.MenuCommandProtocol
byte PROTO_START_OF_MSG = 0x01
 
byte PROTO_END_OF_MSG = 0x02
 

Detailed Description

An implementation of the menu command protocol interface that is configurable, by default it can create all the regular tag value message processors so that regular embedCONTROL messages can be parsed and written. It is also possible to add extra command handlers for both TagVal protocol and also for binary format.

Member Function Documentation

◆ addRawInProcessor()

void com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.addRawInProcessor ( MessageField  field,
RawProtocolIncomingMsgConverter  processor 
)

This method adds an additional binary message processor that can convert an incoming wire message into a command. In this case the processor will take a byte buffer and length of the message in the buffer, it should convert this into a MenuCommand.

Parameters
fieldthe message type to convert
processorthe processor that can do the conversion

◆ addTagValInProcessor()

void com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.addTagValInProcessor ( MessageField  field,
TagValProtocolIncomingMsgConverter  processor 
)

This method adds an additional tag value message processor that can convert an incoming wire message into a command. In this case the processor will take a TagValTextParser and convert that into a MenuCommand.

Parameters
fieldthe message type to convert
processorthe processor that can do the conversion

◆ fromChannel()

MenuCommand com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.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

Implements com.thecoderscorner.menu.remote.MenuCommandProtocol.

◆ getProtocolForCmd()

CommandProtocol com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.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.

Implements com.thecoderscorner.menu.remote.MenuCommandProtocol.

◆ toChannel()

void com.thecoderscorner.menu.remote.protocol.ConfigurableProtocolConverter.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

Implements com.thecoderscorner.menu.remote.MenuCommandProtocol.


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