Package org.yamcs.tctm.ccsds
Class DownlinkTransferFrame
- java.lang.Object
-
- org.yamcs.tctm.ccsds.DownlinkTransferFrame
-
- Direct Known Subclasses:
AosTransferFrame,TmTransferFrame,UslpTransferFrame
public abstract class DownlinkTransferFrame extends Object
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
VcDownlinkHandlerthat 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 < dataEndfirstSduStart 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
Fields Modifier and Type Field Description protected byte[]dataprotected intspacecraftIdprotected intvirtualChannelId
-
Constructor Summary
Constructors Constructor Description DownlinkTransferFrame(byte[] data, int spacecraftId, int virtualChannelId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getData()intgetDataEnd()The offset in the buffer where the data ends.intgetDataStart()Where in the byte array returned bygetData()starts the data.longgetEarthRceptionTime()intgetFirstHeaderPointer()Where in the byte array returned bygetData()starts the first packet (assuming this is a frame containing packets).intgetOcf()Get the 4 bytes operational control field.intgetSpacecraftId()longgetVcFrameSeq()intgetVirtualChannelId()booleanhasOcf()intlostFramesCount(long prevFrameSeq)Returns the number of frames lost from the previous sequence to this one.voidsetEearthRceptionTime(long ertime)voidsetOcf(int ocf)voidsetVcFrameSeq(long seq)Set the virtual channel frame count
-
-
-
Method Detail
-
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
public long getEarthRceptionTime()
- Returns:
- the earth reception time of the frame
-
setEearthRceptionTime
public void setEearthRceptionTime(long ertime)
-
-