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 |
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.
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.
field | the message type to convert |
processor | the processor that can do the conversion |
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.
field | the message type to convert |
processor | the processor that can do the conversion |
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.
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.
command | the command to check the protocol of |
Implements com.thecoderscorner.menu.remote.MenuCommandProtocol.
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.
buffer | to write the data to |
cmd | the command to write |
Implements com.thecoderscorner.menu.remote.MenuCommandProtocol.