Package org.yamcs.tctm.ccsds
Class DownlinkTransferFrame
java.lang.Object
org.yamcs.tctm.ccsds.DownlinkTransferFrame
- Direct Known Subclasses:
AosTransferFrame
,TmTransferFrame
,UslpTransferFrame
Transfer frame is an interface covering the three CCSDS transfer frames types:
- TM (CCSDS 132.0-B-2)
- AOS (CCSDS 732.0-B-3)
- UNIFIED ( 732.1-B-1)
All three of them have the following structure:
- Primary Header
- Insert Zone/Secondary Header
- Data Field
- Operational Control Field (OCF)
- Error Control Field
Note that for USLP, the data field has also a header.
In the dataStart, and dataLength properties below, only the real data (i.e. excluding the data field header) is considered.
The idea is that the VcDownlinkHandler
that deals with the data, has to have all the information on how
to interpret the data part.
For the purpose of packet extraction each frame has defined three offsets:
dataStart <= firstSduStart < dataEnd
firstSduStart refers to the first SDU that starts in this frame.
The data in between dataStart and firstSduStart is part of a previous packet and will be used only if there is no discontinuity in the frame sequence count.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final byte[]
protected final int
protected final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getData()
int
The offset in the buffer where the data ends.int
Where in the byte array returned bygetData()
starts the data.int
Where in the byte array returned bygetData()
starts the first packet (assuming this is a frame containing packets).int
getOcf()
Get the 4 bytes operational control field.int
long
int
boolean
hasOcf()
int
lostFramesCount
(long prevFrameSeq) Returns the number of frames lost from the previous sequence to this one.void
setEearthRceptionTime
(Instant ertime) void
setOcf
(int ocf) void
setVcFrameSeq
(long seq) Set the virtual channel frame count
-
Field Details
-
spacecraftId
protected final int spacecraftId -
virtualChannelId
protected final int virtualChannelId -
data
protected final byte[] data
-
-
Constructor Details
-
DownlinkTransferFrame
public DownlinkTransferFrame(byte[] data, int spacecraftId, int virtualChannelId)
-
-
Method Details
-
getSpacecraftId
public int getSpacecraftId()- Returns:
- master channel id
-
getVirtualChannelId
public int getVirtualChannelId()- Returns:
- virtual channel id
-
lostFramesCount
public int lostFramesCount(long prevFrameSeq) Returns the number of frames lost from the previous sequence to this one. If no frame has been lost (i.e. if prevFrameSeq and getFrameSeq() are in order) then return 0. -1 means that a number of lost frames could not be determined - if there is some indication that the stream has been reset- Parameters:
prevFrameSeq
-- Returns:
-
setVcFrameSeq
public void setVcFrameSeq(long seq) Set the virtual channel frame count- Parameters:
seq
-
-
getVcFrameSeq
public long getVcFrameSeq()- Returns:
- virtual channel frame count
-
getData
public byte[] getData() -
getDataStart
public int getDataStart()Where in the byte array returned bygetData()
starts the data.- Returns:
-
getFirstHeaderPointer
public int getFirstHeaderPointer()Where in the byte array returned bygetData()
starts the first packet (assuming this is a frame containing packets). Returns -1 if there is no packet starting in this frame.- Returns:
- the offset of the first packet that starts in this frame or -1 if no packet starts in this frame
-
getDataEnd
public int getDataEnd()The offset in the buffer where the data ends.- Returns:
- data end
-
setOcf
public void setOcf(int ocf) -
getOcf
public int getOcf()Get the 4 bytes operational control field. This has a meaningful value only if thehasOcf()
returns true.- Returns:
- the Operational Control Field.
-
hasOcf
public boolean hasOcf()- Returns:
- true if this frame has an Operation Control Field set.
-
getEarthRceptionTime
- Returns:
- the earth reception time of the frame
-
setEearthRceptionTime
-