panda

package module
v0.0.0-...-1549436 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 21 Imported by: 10

Documentation

Index

Constants

View Source
const (
	TagPP = 0x06
	TagTM = 0x0B
)
View Source
const (
	HRDPHeaderLength   = 14
	HRDLSyncLength     = 8
	VMUHeaderLength    = 16
	IDHeaderLengthV1   = 72
	IDHeaderLengthV2   = 76
	SDHeaderLengthV2   = 56
	SDHeaderLengthV1   = 8
	CheckTrailerLength = 4
)
View Source
const (
	VMUProtocol1 = iota + 1
	VMUProtocol2
)
View Source
const (
	RUBUnit uint8 = 0x36
	Alv1          = 0x39
	Alv2          = 0x40
	SMDUnit       = 0x41
	LRSD          = 0x51
	LCP           = 0x90
)
View Source
const (
	CCSDSLength = 6
	ESALength   = 10
	UMILength   = 21
)
View Source
const UPILen = 32

Variables

View Source
var (
	GPS  = time.Date(1980, 1, 6, 0, 0, 0, 0, time.UTC)
	UNIX = time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)
)
View Source
var (
	ErrDone     = errors.New("done")
	ErrSkip     = errors.New("skip")
	ErrTooShort = errors.New("not enough bytes available")
)
View Source
var (
	MMA  = []byte("MMA ")
	CORR = []byte("CORR")
	SYNC = []byte("SYNC")
	RAW  = []byte("RAW ")
	Y800 = []byte("Y800")
	Y16B = []byte("Y16 ")
	Y16L = []byte("Y16L")
	I420 = []byte("I420")
	YUY2 = []byte("YUY2")
	RGB  = []byte("RGB ")
	JPEG = []byte("JPEG")
	PNG  = []byte("PNG ")
	H264 = []byte("H264")
	SVS  = []byte("SVS ")
	TIFF = []byte("TIFF")
)
View Source
var BufferSize = 1024 * 1024 * 4

Functions

func AcquisitionTimeFromEpoch

func AcquisitionTimeFromEpoch(s int64) int64

func AdjustAcquisitionTime

func AdjustAcquisitionTime(s int64) time.Time

func AdjustGenerationTime

func AdjustGenerationTime(s int64) time.Time

func AdjustTime

func AdjustTime(t time.Time, g bool) time.Time

func GenerationTimeFromEpoch

func GenerationTimeFromEpoch(s int64) int64

func Listen

func Listen(p, s string) (io.Reader, error)

func Valid

func Valid(p HRPacket) bool

func Walk

func Walk(p, s string) (io.Reader, error)

Types

type Bitmap

type Bitmap interface {
	Four
	X() uint16
	Y() uint16
}

type CCSDSHeader

type CCSDSHeader struct {
	Pid     uint16
	Segment uint16
	Length  uint16
}

func (CCSDSHeader) Apid

func (c CCSDSHeader) Apid() int

func (CCSDSHeader) Len

func (c CCSDSHeader) Len() int

func (CCSDSHeader) SegmentationFlag

func (c CCSDSHeader) SegmentationFlag() CCSDSPacketSegmentation

func (CCSDSHeader) Sequence

func (c CCSDSHeader) Sequence() int

type CCSDSPacketSegmentation

type CCSDSPacketSegmentation int
const (
	ContinuationPacket CCSDSPacketSegmentation = iota
	StartPacket
	StopPacket
	UnsegmentedPacket
)

func (CCSDSPacketSegmentation) String

func (c CCSDSPacketSegmentation) String() string

type CCSDSPacketType

type CCSDSPacketType int
const (
	SystemPacket CCSDSPacketType = iota
	PayloadPacket
)

type Channel

type Channel uint8
const (
	Video1 Channel = iota + 1
	Video2
	Science
)

func (Channel) String

func (c Channel) String() string

type Decoder

type Decoder interface {
	Decode([]byte) (int, Packet, error)
}

func DecodeHR

func DecodeHR(v int) (Decoder, error)

func DecodePP

func DecodePP() Decoder

func DecodeTM

func DecodeTM() Decoder

type DecoderFunc

type DecoderFunc func([]byte) (int, Packet, error)

func (DecoderFunc) Decode

func (d DecoderFunc) Decode(bs []byte) (int, Packet, error)

type ESAHeader

type ESAHeader struct {
	Coarse  uint32
	Fine    uint8
	Control uint8
	Sid     uint32
}

func (ESAHeader) PacketType

func (e ESAHeader) PacketType() ESAPacketType

func (ESAHeader) Sum

func (e ESAHeader) Sum() bool

func (ESAHeader) Timestamp

func (e ESAHeader) Timestamp() time.Time

type ESAPacketTime

type ESAPacketTime int
const (
	TimeNotUsed ESAPacketTime = iota
	TimeGenerated
	TimeExecuted
	TimeInvalid
)

type ESAPacketType

type ESAPacketType int
const (
	Default ESAPacketType = iota
	DataDump
	DataSegment
	EssentialHk
	SystemHk
	PayloadHk
	ScienceData
	AncillaryData
	EssentialCmd
	SystemCmd
	PayloadCmd
	DataLoad
	Response
	Report
	Exception
	Acknowledge
)

func (ESAPacketType) String

func (e ESAPacketType) String() string

func (ESAPacketType) Type

func (e ESAPacketType) Type() string

type Exporter

type Exporter interface {
	Filename() string
	Export(io.Writer, string) error
	ExportRaw(io.Writer) error
}

type Four

type Four interface {
	FCC() uint32
}

type HRPacket

type HRPacket interface {
	Packet
	Exporter
	Stream() Channel
	Origin() string
	Format() string
	Sequence() uint32
	Version() int
	IsRealtime() bool
}

type IDHv1

type IDHv1 struct {
	XMLName xml.Name `xml:"metadata"`

	Sequence  uint32
	Coarse    uint32
	Fine      uint16
	Part      uint8
	Video     uint8
	Type      uint8
	Rate      float32
	Pixels    uint32
	Region    uint64
	LineDrop  uint8
	FrameDrop uint16
	Info      [32]byte
}

func (*IDHv1) FCC

func (i *IDHv1) FCC() uint32

func (*IDHv1) Format

func (i *IDHv1) Format() string

func (*IDHv1) MarshalXML

func (i *IDHv1) MarshalXML(e *xml.Encoder, s xml.StartElement) error

func (*IDHv1) Timestamp

func (i *IDHv1) Timestamp() time.Time

func (*IDHv1) X

func (i *IDHv1) X() uint16

func (*IDHv1) Y

func (i *IDHv1) Y() uint16

type IDHv2

type IDHv2 struct {
	XMLName     xml.Name `xml:"metadata"`
	Properties  uint8
	Sequence    uint16
	Originator  uint32
	Acquisition time.Duration
	Auxiliary   time.Duration
	Id          uint8
	Type        uint8
	Pixels      uint32
	Region      uint64
	Dropping    uint16
	Scaling     uint32
	Ratio       uint8
	Info        [32]byte
}

func (IDHv2) Acquire

func (i IDHv2) Acquire() (time.Time, time.Time)

func (*IDHv2) FCC

func (i *IDHv2) FCC() uint32

func (IDHv2) Format

func (i IDHv2) Format() string

func (*IDHv2) MarshalXML

func (i *IDHv2) MarshalXML(e *xml.Encoder, s xml.StartElement) error

func (IDHv2) Timestamp

func (i IDHv2) Timestamp() time.Time

func (*IDHv2) X

func (i *IDHv2) X() uint16

func (*IDHv2) Y

func (i *IDHv2) Y() uint16

type Image

type Image struct {
	*VMUHeader
	IDH  interface{}
	Data []byte
	Sum  uint32
}

func (*Image) Bytes

func (i *Image) Bytes() ([]byte, error)

func (*Image) Export

func (i *Image) Export(w io.Writer, f string) error

func (*Image) ExportRaw

func (i *Image) ExportRaw(w io.Writer) error

func (*Image) Filename

func (i *Image) Filename() string

func (*Image) Format

func (i *Image) Format() string

func (*Image) IsRealtime

func (i *Image) IsRealtime() bool

func (*Image) Origin

func (i *Image) Origin() string

func (*Image) Payload

func (i *Image) Payload() []byte

func (*Image) Sequence

func (i *Image) Sequence() uint32

func (*Image) Timestamp

func (i *Image) Timestamp() time.Time

func (*Image) Version

func (i *Image) Version() int

type Item

type Item struct {
	Label     string `json:"name"`
	Comment   string `json:"comment"`
	Type      string `json:"type"`
	Offset    int    `json:"position"`
	Length    int    `json:"length"`
	Ignore    bool   `json:"-"`
	Endianess string `json:"-"`

	Raw interface{} `json:"-"`
}

func (Item) Extract

func (i Item) Extract(b *buffer.Buffer) (Item, error)

func (Item) Position

func (i Item) Position() int

type Packet

type Packet interface {
	Timestamp() time.Time

	Bytes() ([]byte, error)
	Payload() []byte
}

type Parameter

type Parameter struct {
	UMIHeader
	Data []byte
}

func (Parameter) Bytes

func (p Parameter) Bytes() ([]byte, error)

func (Parameter) Payload

func (p Parameter) Payload() []byte

func (Parameter) Value

func (p Parameter) Value() interface{}

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(r io.Reader, d Decoder) *Reader

func NewReaderWithSize

func NewReaderWithSize(r io.Reader, s int, d Decoder) *Reader

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Read

func (r *Reader) Read() (Packet, error)

type SDHv1

type SDHv1 struct {
	Sequence uint32
}

func (SDHv1) FCC

func (s SDHv1) FCC() uint32

func (SDHv1) Format

func (s SDHv1) Format() string

type SDHv2

type SDHv2 struct {
	Properties  uint8
	Sequence    uint16
	Originator  uint32
	Acquisition time.Duration
	Auxiliary   time.Duration
	Id          uint8
	Info        [32]byte
}

func (SDHv2) Acquire

func (s SDHv2) Acquire() (time.Time, time.Time)

func (SDHv2) FCC

func (s SDHv2) FCC() uint32

func (SDHv2) Format

func (s SDHv2) Format() string

func (SDHv2) Timestamp

func (s SDHv2) Timestamp() time.Time

type Schema

type Schema struct {
	Name    string   `json:"name"`
	Offset  int64    `json:"offset"`
	Sources []uint32 `json:"sources"`
	Apid    uint16   `json:"apid"`
	Items   []Item   `json:"parameters"`

	Lastmod time.Time `json:"lastmod"`
	Sum     string    `json:"md5sum"`
}

func (Schema) Extract

func (s Schema) Extract(p Telemetry) ([]Item, error)

type Table

type Table struct {
	*VMUHeader
	SDH  interface{}
	Data []byte
	Sum  uint32
}

func (*Table) Bytes

func (t *Table) Bytes() ([]byte, error)

func (*Table) Export

func (t *Table) Export(w io.Writer, _ string) error

func (*Table) ExportRaw

func (t *Table) ExportRaw(w io.Writer) error

func (*Table) Filename

func (t *Table) Filename() string

func (*Table) Format

func (t *Table) Format() string

func (*Table) IsRealtime

func (t *Table) IsRealtime() bool

func (*Table) Origin

func (t *Table) Origin() string

func (*Table) Payload

func (t *Table) Payload() []byte

func (*Table) Sequence

func (t *Table) Sequence() uint32

func (*Table) Timestamp

func (t *Table) Timestamp() time.Time

func (*Table) Version

func (t *Table) Version() int

type Telemetry

type Telemetry struct {
	CCSDSHeader
	ESAHeader
	Data []byte
	Sum  uint16
}

func (Telemetry) Bytes

func (t Telemetry) Bytes() ([]byte, error)

func (Telemetry) Payload

func (t Telemetry) Payload() []byte

type UMIDataType

type UMIDataType uint8
const (
	Int32 UMIDataType = iota + 1
	Float64
	Binary8
	Reference
	String8
	Long
	Decimal
	Real
	Exponent
	Time
	DateTime
	StringN
	BinaryN
	Bit
)

func (UMIDataType) String

func (u UMIDataType) String() string

type UMIHeader

type UMIHeader struct {
	State  UMIPacketState
	Orbit  [4]byte
	Code   [6]byte
	Type   UMIDataType
	Unit   uint16
	Coarse uint32
	Fine   uint8
	Length uint16
}

func (UMIHeader) Timestamp

func (u UMIHeader) Timestamp() time.Time

type UMIPacketState

type UMIPacketState uint8
const (
	NoValue UMIPacketState = iota
	SameValue
	NewValue
	LatestValue
	ErrorValue
)

func (UMIPacketState) String

func (u UMIPacketState) String() string

type VMUHeader

type VMUHeader struct {
	Channel  Channel
	Source   uint8
	Sequence uint32
	Coarse   uint32
	Fine     uint16
}

func (*VMUHeader) Generated

func (v *VMUHeader) Generated() time.Time

func (*VMUHeader) Stream

func (v *VMUHeader) Stream() Channel

func (*VMUHeader) Timestamp

func (v *VMUHeader) Timestamp() time.Time

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL