Advertisement
LordAro

BAPS3 Command structure

Oct 20th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. static const int PROTOCOL_VERSION = 3;
  2.  
  3. /**
  4.  * Lists all possible commands.
  5.  * @todo work out what commands are actually needed
  6.  */
  7. enum CommandType {
  8.     BAPS_HANDSHAKE, ///< Initialiser command.
  9.     BAPS_NULL,      ///< Null command, shouldn't be used.
  10. };
  11.  
  12. /**
  13.  * Stuff to send.
  14.  * @todo think of better documentation for this
  15.  */
  16. template <class TsendType>
  17. class Command {
  18.     CommandType cmd_type;
  19.     TsendType to_send;
  20.  
  21.     /* Psuedocode */
  22.     bool Send()
  23.     {
  24.         sendbytes(PROTOCOLVERSION);
  25.         sendbytes(cmd_type);
  26.         sendbytes(sizeof(to_send));
  27.         sendbytes(to_send);
  28.     }
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement