public class SDDSPacket
extends java.lang.Object
implements nxm.sys.inc.PacketHandler, java.lang.Cloneable
07:00 ICE/UDP header 09:08 Format Identifier (bits,mode) 11:10 Frame Sequence 12:12 TimeTag Status 13:12 TimeTag 1ms pointer 15:14 TimeTag 1ms delta 23:16 TimeTag 250ps tics (normal precision) 27:24 TimeTag 250ps/2**32 tics (extended precision) 39:28 SSC Info 43:40 SSD Info 63:44 AAD InfoTimeTag Status byte 0x80 1ms PTR valid 0x40 Time Tag valid 0x20 SSC Valid Standard Format Identifiers are: 16 bit FID=0x1082 8 bit FID=0x0881 4 bit FID=0x0480
Modifier and Type | Field and Description |
---|---|
byte[] |
buf |
static int |
ICE |
static int |
UDP |
Constructor and Description |
---|
SDDSPacket() |
SDDSPacket(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 |
getAddress() |
java.lang.String |
getAddrStr() |
int |
getBits() |
void |
getBuffer(byte[] buffer,
int boff)
copy bytes from the 64by header buffer into a user buffer
|
int |
getBytes()
get Size of packet data in bytes
|
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 |
getPort() |
int |
getSize()
get Size of packet data in elements
|
nxm.sys.lib.Time |
getTC()
get timecode
|
static nxm.sys.lib.Time |
getTC(byte[] buf,
int off,
long lbuf)
get timecode from ICE/SDDS formatted header starting at off in buf[] or native lbuf
|
int |
getTCO()
get timecode offset
|
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 |
setAddress(int addr)
sets IP address in UDP header extension
|
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 |
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 |
setFormat(java.lang.String format)
set format/bits from Midas format digraph
|
void |
setICE(boolean state)
set ICE/UDP packet header mode
|
void |
setKeys(int key)
sets specified pattern in 1st 2 bytes of UDP header extension
|
void |
setPort(int port)
sets UDP port number in UDP header extension
|
void |
setTC(int offset,
double delta,
double wsec,
double fsec)
set timecode
|
void |
setUDP(boolean state)
set UDP packet header mode
|
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 final int UDP
public static final int ICE
public byte[] buf
public SDDSPacket()
public SDDSPacket(java.lang.String format, int flags)
public void setUDP(boolean state)
public void setICE(boolean state)
public void setAddress(int addr)
public int getAddress()
public java.lang.String getAddrStr()
public void setPort(int port)
public int getPort()
public void setKeys(int key)
public void setBits(int bits)
public int getBits()
public void setCount(int count)
public void upCount()
public void setFormat(java.lang.String format)
public void setTC(int offset, double delta, double wsec, double fsec)
public nxm.sys.lib.Time getTC()
public static nxm.sys.lib.Time getTC(byte[] buf, int off, long lbuf)
public int getTCO()
public int getCount()
public java.lang.String getFormat()
public int getSize()
public int getBytes()
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 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 void open(nxm.sys.lib.DataFile df)
open
in interface nxm.sys.inc.PacketHandler
df
- The data file to open.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)