RtdeRequestProtocolVersion.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package at.acdp.urweb.rtde.packets;
  2. import at.acdp.urweb.rtde.CommandType;
  3. import at.acdp.urweb.rtde.RTDEClient;
  4. import java.io.DataInputStream;
  5. import java.io.DataOutputStream;
  6. import java.io.IOException;
  7. import static at.acdp.urweb.rtde.CommandType.RTDE_REQUEST_PROTOCOL_VERSION;
  8. public class RtdeRequestProtocolVersion implements IRtdeData {
  9. public boolean success;
  10. private int replySize;
  11. public RtdeRequestProtocolVersion() {
  12. }
  13. @Override
  14. public int getType() {
  15. return RTDE_REQUEST_PROTOCOL_VERSION;
  16. }
  17. @Override
  18. public int getSize() {
  19. return 5;
  20. }
  21. @Override
  22. public void setReplySize(int size) {
  23. this.replySize = size;
  24. }
  25. @Override
  26. public RtdeRequestProtocolVersion read(DataInputStream d) throws IOException {
  27. readHeader(d);
  28. success = d.readBoolean();
  29. return this;
  30. }
  31. @Override
  32. public RtdeRequestProtocolVersion send(DataOutputStream dos) throws IOException {
  33. sendHeader(dos);
  34. dos.writeShort(RTDEClient.RTDE_PROTOCOL_VERSION);
  35. dos.flush();
  36. return this;
  37. }
  38. }