Class OpenIGTMessage

java.lang.Object
org.medcare.igtl.messages.OpenIGTMessage
Direct Known Subclasses:
CapabilityMessage, DataArrayMessage, GetCapabilityMessage, GetImageMessage, GetPositionMessage, GetStatusMessage, GetTransformMessage, ImageMessage, NDArrayMessage, PositionMessage, StatusMessage, StringMessage, TransformMessage

public abstract class OpenIGTMessage extends Object
** All messages will have to extend this class
  • Field Details

    • deviceName

      public String deviceName
    • bytesArray

      public BytesArray bytesArray
    • VERSION

      public static long VERSION
  • Constructor Details

    • OpenIGTMessage

      public OpenIGTMessage(String deviceName)
      ** Constructor to be used to create message to getBytes to send them **
      Parameters:
      deviceName - Device Name
    • OpenIGTMessage

      public OpenIGTMessage(Header header, byte[] body) throws Exception
      ** Constructor to be used to build messages from incoming bytes **
      Parameters:
      header - header of this message
      body - bytes array containing message body
      Throws:
      Exception
  • Method Details

    • Unpack

      public boolean Unpack() throws Exception
      ** To control the checksum and unpack the body

      **

      Returns:
      true if unpacking is ok
      Throws:
      Exception
    • unpackBody

      public abstract boolean unpackBody() throws Exception
      ** To create body from body array

      **

      Returns:
      true if unpacking is ok
      Throws:
      Exception
    • packBody

      public abstract byte[] packBody()
      ** To create body from image_header and image_data SetImageHeader and SetImageData must have called first

      **

      Returns:
      the bytes array containing the message
    • getDeviceName

      public String getDeviceName()
      ** Unique device name. **
      Returns:
      The name of the device
    • getHeader

      public Header getHeader()
      ** header. **
      Returns:
      bytes array containing the header of the message
    • getBody

      public byte[] getBody()
      ** body. **
      Returns:
      bytes array containing the body of the message
    • getBytes

      public byte[] getBytes()
      ** Bytes to be sent. **
      Returns:
      bytes array containing the message
    • toString

      public abstract String toString()
      ** To get message String **
      Overrides:
      toString in class Object
      Returns:
      the message String
    • setBody

      public void setBody(byte[] body)
    • setHeader

      public void setHeader(Header header)