public class VRTPacket
extends java.lang.Object
implements nxm.sys.inc.PacketHandler, java.lang.Cloneable
VRT Packet Word Placement 0 HDR Header (Type:4,C:1,T:1,RR:2,TSI:2,TSF:2,Seq:4,Size:16) 1 SID Stream ID 2 OUID Organizational Unique ID 3 CID Information Class : Packet Class 4 TSIS TimeStamp - Integer Seconds 6:5 TSFS TimeStamp - Fractional Seconds 7 TLR Trailer X Data Payload (X=360 qwords for 1500MTU) Packet qword 7 moved after payload at transmit Header Types: 0cxs c=Context x=Extension s=WithStreamID Packet Class (Pack:1,Type:2,Format:5,Resv:2,Size:6) Data Item Size = (bitsPerSample-1) Data Item Type 00 Real 01 Complex Cartesian 10 Complex Polar Data Item Format u0000 Fixed Point - u=Unsigned|Signed u0eee VRT float w/ e-bit exponent 01110 IEEE Single Precision Floating Point 01111 IEEE Double Precision Floating Point Information Class TimeStamp TSI 0=None 1=UTC 2=GPS 3=Other TSF 0=None 1=Count 2=pSec 3=FreeRunningCount
Modifier and Type | Field and Description |
---|---|
byte[] |
buf |
static java.lang.String |
flagsList |
static int |
FLG_BIGE |
static int |
FLG_NONE |
static int |
FLG_TRIM |
static int |
OUID_ICE |
static int |
TSF_CNT |
static int |
TSF_FRC |
static int |
TSF_NONE |
static int |
TSF_PSEC |
static int |
TSI_GPS |
static int |
TSI_NONE |
static int |
TSI_OTHER |
static int |
TSI_UTC |
Constructor and Description |
---|
VRTPacket() |
VRTPacket(java.lang.String format,
int flags) |
Modifier and Type | Method and Description |
---|---|
nxm.sys.inc.PacketHandler |
cloneOf()
Create a clone of this instance for propagation.
|
void |
close(nxm.sys.lib.DataFile df)
Finalize this instance.
|
double |
dataToPacketOffset(nxm.sys.lib.DataFile df,
double boffset)
Translate the data byte offset to packetized byte offset.
|
int |
getBits()
get the number of bits per sample
|
void |
getBuffer(byte[] buffer,
int boff)
copy bytes from the 64by header buffer into a user buffer
|
int |
getBytes()
get Size of data payload in bytes
|
int |
getCID()
gets Class ID
|
java.lang.String |
getConfiguration(nxm.sys.lib.DataFile df)
Get the configuration string needed to initialize this handler.
|
int |
getCount()
get the current packet count
|
java.lang.String |
getFormat()
get the current Format
|
int |
getICID()
gets Information Class ID
|
int |
getOUID()
gets Organizational Unique ID
|
byte |
getRep()
get representation of data payload
|
int |
getSID()
gets Stream ID
|
int |
getSize()
get Size of data payload in elements
|
nxm.sys.lib.Time |
getTC()
get timecode from ICE/VITA formatted header
|
boolean |
hasHeader()
Determine if the last read included a new packet header.
|
java.lang.String |
listHeader()
Lists the current packet header.
|
double |
naturalDataOffset(nxm.sys.lib.DataFile df,
double boffset)
Translate the data byte offset to byte offset at start of packet.
|
void |
open(nxm.sys.lib.DataFile df)
Initialize this instance.
|
double |
packetToDataOffset(nxm.sys.lib.DataFile df,
double boffset)
Translate the packetized byte offset to data byte offset.
|
int |
read(nxm.sys.lib.DataFile df,
byte[] buf,
int boff,
int bytes,
long lbuf)
Read data including packet header.
|
void |
seek(nxm.sys.lib.DataFile df,
double boffset)
Seek to the closest given data byte offset.
|
void |
setBits(int bits)
set number of bits per sample
|
void |
setBuffer(byte[] buffer,
int boff)
copy bytes from a user buffer into the 64by header buffer
|
void |
setBytes(int bytes)
sets the data payload size in bytes
|
void |
setCID(int cid)
sets Class ID
|
void |
setCount(int count)
packet number since start of xfer
|
void |
setFileName(nxm.sys.lib.DataFile df,
nxm.sys.lib.FileName filename)
Set the file name for a packets only file.
|
void |
setFlags(int flags)
sets the data payload representation
|
void |
setFormat(java.lang.String format)
set format/bits from Midas format digraph
|
void |
setICID(int icid)
sets Information Class ID
|
void |
setOUID(int ouid)
sets Organizational Unique ID
|
void |
setRep(byte rep)
sets the data payload representation
|
void |
setSID(int sid)
sets Stream ID
|
void |
setSize(int elem)
sets the data payload size int elements
|
void |
setTC(double wsec,
double fsec)
set timecode
|
void |
upCount()
up the count by one
|
int |
write(nxm.sys.lib.DataFile df,
byte[] buf,
int boff,
int bytes,
long lbuf)
Write data including packet header.
|
public static int OUID_ICE
public static int TSI_NONE
public static int TSI_UTC
public static int TSI_GPS
public static int TSI_OTHER
public static int TSF_NONE
public static int TSF_CNT
public static int TSF_PSEC
public static int TSF_FRC
public static java.lang.String flagsList
public static int FLG_NONE
public static int FLG_TRIM
public static int FLG_BIGE
public byte[] buf
public VRTPacket()
public VRTPacket(java.lang.String format, int flags)
public void setFlags(int flags)
public void setRep(byte rep)
public byte getRep()
public void setSize(int elem)
public int getSize()
public void setBytes(int bytes)
public int getBytes()
public void setSID(int sid)
public int getSID()
public void setOUID(int ouid)
public int getOUID()
public void setICID(int icid)
public int getICID()
public void setCID(int cid)
public int getCID()
public void setCount(int count)
public int getCount()
public void upCount()
public void setFormat(java.lang.String format)
public java.lang.String getFormat()
public void setBits(int bits)
public int getBits()
public void setTC(double wsec, double fsec)
public nxm.sys.lib.Time getTC()
public java.lang.String getConfiguration(nxm.sys.lib.DataFile df)
getConfiguration
in interface nxm.sys.inc.PacketHandler
df
- The data file to get the configuration for.public void setFileName(nxm.sys.lib.DataFile df, nxm.sys.lib.FileName filename)
setFileName
in interface nxm.sys.inc.PacketHandler
df
- The data file to set the name of.filename
- The file new name.public double naturalDataOffset(nxm.sys.lib.DataFile df, double boffset)
naturalDataOffset
in interface nxm.sys.inc.PacketHandler
df
- The data file the data-byte-offset is in relation to.boffset
- The data-byte-offset.public double dataToPacketOffset(nxm.sys.lib.DataFile df, double boffset)
dataToPacketOffset
in interface nxm.sys.inc.PacketHandler
df
- The data file the data-byte-offset is in relation to.boffset
- The data-byte-offset.PacketHandler.packetToDataOffset(DataFile,double)
public double packetToDataOffset(nxm.sys.lib.DataFile df, double boffset)
packetToDataOffset
in interface nxm.sys.inc.PacketHandler
df
- The data file the data-byte-offset is in relation to.boffset
- The packetized-byte-offset.PacketHandler.dataToPacketOffset(DataFile,double)
public void open(nxm.sys.lib.DataFile df)
open
in interface nxm.sys.inc.PacketHandler
df
- The data file to open.public void seek(nxm.sys.lib.DataFile df, double boffset)
seek
in interface nxm.sys.inc.PacketHandler
df
- The data file to seek to the byte offset in.boffset
- The byte offset into the file.public int read(nxm.sys.lib.DataFile df, byte[] buf, int boff, int bytes, long lbuf)
read
in interface nxm.sys.inc.PacketHandler
df
- The data file to read from.buf
- The buffer to read the data in to.boff
- The byte-offset into the buffer to start writing at.bytes
- The number of bytes to attempt to read.lbuf
- Native buffer location (0=Disable).public int write(nxm.sys.lib.DataFile df, byte[] buf, int boff, int bytes, long lbuf)
write
in interface nxm.sys.inc.PacketHandler
df
- The data file to write to.buf
- The buffer to write the data in from.boff
- The byte-offset into the buffer to start writing at.bytes
- The number of bytes to attempt to write.lbuf
- Native buffer location (0=Disable).public void close(nxm.sys.lib.DataFile df)
close
in interface nxm.sys.inc.PacketHandler
df
- The data file to close.public boolean hasHeader()
hasHeader
in interface nxm.sys.inc.PacketHandler
true
if the last read included a new packet header
and false
if it did not.public java.lang.String listHeader()
listHeader
in interface nxm.sys.inc.PacketHandler
public nxm.sys.inc.PacketHandler cloneOf()
cloneOf
in interface nxm.sys.inc.PacketHandler
public void setBuffer(byte[] buffer, int boff)
public void getBuffer(byte[] buffer, int boff)