Package org.epics.ca.impl
Class Messages
- java.lang.Object
-
- org.epics.ca.impl.Messages
-
public final class Messages extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Messages()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcalculateAlignedSize(int align, int nonAlignedSize)Calculate aligned message size.static voidcancelSubscriptionMessage(Transport transport, int dataType, int dataCount, int sid, int ioid)Cancel subscription (aka event add) message.static voidclearChannelMessage(Transport transport, int cid, int sid)Clear channel message.static voidcreateChannelMessage(Transport transport, java.lang.String channelName, int cid)Create channel message.static voidcreateSubscriptionMessage(Transport transport, int dataType, int dataCount, int sid, int ioid, int mask)Create subscription (aka event add) message.static voidgenerateEchoMessage(Transport transport, java.nio.ByteBuffer buffer)Generate echo message.static booleangenerateRepeaterRegistration(java.nio.ByteBuffer buffer)Generate repeater registration message.static booleangenerateSearchRequestMessage(Transport transport, java.nio.ByteBuffer buffer, java.lang.String name, int cid)Generate search request message.static voidgenerateVersionRequestMessage(Transport transport, java.nio.ByteBuffer buffer, short priority, int sequenceNumber, boolean isSequenceNumberValid)Generate version request message.static voidhostNameMessage(Transport transport, java.lang.String hostName)Hostname message.static voidreadNotifyMessage(Transport transport, int dataType, int dataCount, int sid, int ioid)Read notify message.static java.nio.ByteBufferstartCAMessage(Transport transport, short command, int payloadSize, short dataType, int dataCount, int parameter1, int parameter2)Start CA message.static voidsubscriptionUpdateMessage(Transport transport, int dataType, int dataCount, int sid, int ioid)Update subscription message.static voiduserNameMessage(Transport transport, java.lang.String userName)Username message.static voidversionMessage(Transport transport, short priority, int sequenceNumber, boolean isSequenceNumberValid)Version message.static <T> voidwriteMessage(Transport transport, int sid, int cid, TypeSupports.TypeSupport<T> typeSupport, T value, int count)Write (best-effort) message.static <T> voidwriteNotifyMessage(Transport transport, int sid, int ioid, TypeSupports.TypeSupport<T> typeSupport, T value, int count)Write notify message.
-
-
-
Method Detail
-
calculateAlignedSize
public static int calculateAlignedSize(int align, int nonAlignedSize)Calculate aligned message size.- Parameters:
align- alignment to be used.nonAlignedSize- current non-aligned size.- Returns:
- aligned size.
-
startCAMessage
public static java.nio.ByteBuffer startCAMessage(Transport transport, short command, int payloadSize, short dataType, int dataCount, int parameter1, int parameter2)
Start CA message.- Parameters:
transport- the transport,command- the CA commandpayloadSize- the size of the payload in bytes.dataType- the CA data type.dataCount- the CA element count.parameter1- CA additional parameter 1parameter2- CA additional parameter 2- Returns:
- filled buffer, if given buffer size is less that header size, then new buffer is allocated and returned.
-
generateRepeaterRegistration
public static final boolean generateRepeaterRegistration(java.nio.ByteBuffer buffer)
Generate repeater registration message. A special case implementation since message is sent via UDP.- Parameters:
buffer- the buffer.- Returns:
- result, always true.
-
generateSearchRequestMessage
public static final boolean generateSearchRequestMessage(Transport transport, java.nio.ByteBuffer buffer, java.lang.String name, int cid)
Generate search request message. A special case implementation since message is sent via UDP.- Parameters:
transport- the transport.buffer- the buffer.name- the name.cid- the CA client ID.- Returns:
- success status.
-
generateVersionRequestMessage
public static final void generateVersionRequestMessage(Transport transport, java.nio.ByteBuffer buffer, short priority, int sequenceNumber, boolean isSequenceNumberValid)
Generate version request message.- Parameters:
transport- the transport.buffer- the buffer.priority- the message priority.sequenceNumber- the CA sequence number.isSequenceNumberValid- boolean switch which determines whether sequence number or priority argument is used in the formatting of the message.
-
generateEchoMessage
public static final void generateEchoMessage(Transport transport, java.nio.ByteBuffer buffer)
Generate echo message.- Parameters:
transport- the transport.buffer- the buffer.
-
versionMessage
public static void versionMessage(Transport transport, short priority, int sequenceNumber, boolean isSequenceNumberValid)
Version message.- Parameters:
transport- the transport.priority- the message priority.sequenceNumber- the CA message sequence number.isSequenceNumberValid- boolean switch which determines whether sequence number or priority argument is used in the formatting of the message.
-
hostNameMessage
public static void hostNameMessage(Transport transport, java.lang.String hostName)
Hostname message.- Parameters:
transport- the transport.hostName- the IP or name of the host.
-
userNameMessage
public static void userNameMessage(Transport transport, java.lang.String userName)
Username message.- Parameters:
transport- the transport.userName- the username.
-
createChannelMessage
public static void createChannelMessage(Transport transport, java.lang.String channelName, int cid)
Create channel message.- Parameters:
transport- the transport.channelName- the channelcid- the CA client ID.
-
readNotifyMessage
public static void readNotifyMessage(Transport transport, int dataType, int dataCount, int sid, int ioid)
Read notify message.- Parameters:
transport- the transport.dataType- the CA data type.dataCount- the CA element count.sid- the CA Server ID.ioid- theCA message IOID.
-
createSubscriptionMessage
public static void createSubscriptionMessage(Transport transport, int dataType, int dataCount, int sid, int ioid, int mask)
Create subscription (aka event add) message.- Parameters:
transport- the transport.dataType- the CA data type.dataCount- the CA element count.sid- the CA Server ID.ioid- the CA message IOID.mask- the mask indicating which events are to be subscribed to.
-
cancelSubscriptionMessage
public static void cancelSubscriptionMessage(Transport transport, int dataType, int dataCount, int sid, int ioid)
Cancel subscription (aka event add) message.- Parameters:
transport- the transport.dataType- the CA data type.dataCount- the CA element count.sid- the CA Server ID.ioid- the CA message IOID.
-
clearChannelMessage
public static void clearChannelMessage(Transport transport, int cid, int sid)
Clear channel message.- Parameters:
transport- the transport.cid- the CA Client ID.sid- the CA Server ID.
-
subscriptionUpdateMessage
public static void subscriptionUpdateMessage(Transport transport, int dataType, int dataCount, int sid, int ioid)
Update subscription message.- Parameters:
transport- the transport.dataType- the CA data type.dataCount- the CA element count.sid- the CA Server ID.ioid- the CA message IOID.
-
writeMessage
public static <T> void writeMessage(Transport transport, int sid, int cid, TypeSupports.TypeSupport<T> typeSupport, T value, int count)
Write (best-effort) message.- Type Parameters:
T- the CA type to be transported.- Parameters:
transport- the transport.sid- the CA Server ID.cid- the CA Client ID.typeSupport- the type support object.value- the CA value.count- the CA data element count.
-
writeNotifyMessage
public static <T> void writeNotifyMessage(Transport transport, int sid, int ioid, TypeSupports.TypeSupport<T> typeSupport, T value, int count)
Write notify message.- Type Parameters:
T- the CA type to be transported.- Parameters:
transport- the transport.sid- the CA Server ID.ioid- the CA IOID.typeSupport- the type support object.value- the CA valuecount- the CA data element count.
-
-