RtdeRequestProtocolVersion.java 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. success = d.readBoolean();
  28. return this;
  29. }
  30. @Override
  31. public RtdeRequestProtocolVersion send(DataOutputStream dos) throws IOException {
  32. sendHeader(dos);
  33. dos.writeShort(RTDEClient.RTDE_PROTOCOL_VERSION);
  34. dos.flush();
  35. return this;
  36. }
  37. }