diff options
Diffstat (limited to 'sources/protocols/implementations/VSDummyProtocol.java')
| -rw-r--r-- | sources/protocols/implementations/VSDummyProtocol.java | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/sources/protocols/implementations/VSDummyProtocol.java b/sources/protocols/implementations/VSDummyProtocol.java new file mode 100644 index 0000000..5797239 --- /dev/null +++ b/sources/protocols/implementations/VSDummyProtocol.java @@ -0,0 +1,101 @@ +/* + * VS is (c) 2008 by Paul C. Buetow + * vs@dev.buetow.org + */ +package protocols.implementations; + +import protocols.VSAbstractProtocol; +import core.VSMessage; + +/** + * The Class VSDummyProtocol. + */ +public class VSDummyProtocol extends VSAbstractProtocol { + private static final long serialVersionUID = 1L; + + /** + * Instantiates a new dummy protocol. + */ + public VSDummyProtocol() { + super(VSAbstractProtocol.HAS_ON_CLIENT_START); + setClassname(getClass().toString()); + } + + /* (non-Javadoc) + * @see events.VSAbstractProtocol#onClientInit() + */ + public void onClientInit() { + } + + /* (non-Javadoc) + * @see protocols.VSAbstractProtocol#onClientReset() + */ + public void onClientReset() { + logg("onClientReset()"); + } + + /* (non-Javadoc) + * @see protocols.VSAbstractProtocol#onClientStart() + */ + public void onClientStart() { + logg("onClientStart()"); + + VSMessage message = new VSMessage(); + message.setString("Greeting", "Hello World!"); + message.setInteger("A number", 1); + message.setBoolean("A boolean", true); + message.setFloat("A float", 1.2f); + sendMessage(message); + } + + /* (non-Javadoc) + * @see protocols.VSAbstractProtocol#onClientRecv(core.VSMessage) + */ + public void onClientRecv(VSMessage recvMessage) { + logg("onClientRecv("+recvMessage+")"); + + String s = recvMessage.getString("Greeting"); + int n = recvMessage.getInteger("A number"); + boolean b = recvMessage.getBoolean("A boolean"); + float f = recvMessage.getFloat("A float"); + } + + /* (non-Javadoc) + * @see protocols.VSAbstractProtocol#onClientSchedule() + */ + public void onClientSchedule() { + } + + /* (non-Javadoc) + * @see events.VSAbstractProtocol#onServerInit() + */ + public void onServerInit() { + } + + /* (non-Javadoc) + * @see protocols.VSAbstractProtocol#onServerReset() + */ + public void onServerReset() { + logg("onClientReset()"); + } + + /* (non-Javadoc) + * @see protocols.VSAbstractProtocol#onServerRecv(core.VSMessage) + */ + public void onServerRecv(VSMessage recvMessage) { + logg("onServerRecv("+recvMessage+")"); + } + + /* (non-Javadoc) + * @see protocols.VSAbstractProtocol#onServerSchedule() + */ + public void onServerSchedule() { + } + + /* (non-Javadoc) + * @see protocols.VSAbstractProtocol#toString() + */ + public String toString() { + return super.toString() + "; Dummy Test"; + } +} |
