Documentation
¶
Index ¶
- func ByteSwap(vectorIn interface{}) error
- type HeadCounter
- type Packet
- func (p *Packet) Bytes() []byte
- func (p *Packet) ChannelInfo() (nchan, offset int)
- func (p *Packet) ClearData() error
- func (p *Packet) Frames() int
- func (p *Packet) IsExternalTrigger() bool
- func (p *Packet) Length() int
- func (p *Packet) MakePretendPacket(seqnum uint32, nchan int) *Packet
- func (p *Packet) NewData(data interface{}, dims []int16) error
- func (p *Packet) ReadValue(sample int) int
- func (p *Packet) ResetTimestamp() error
- func (p *Packet) SequenceNumber() uint32
- func (p *Packet) SetTimestamp(ts *PacketTimestamp) error
- func (p *Packet) String() string
- func (p *Packet) Timestamp() *PacketTimestamp
- type PacketTag
- type PacketTimestamp
- type PayloadLabel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HeadCounter ¶
HeadCounter represents a counter found in a packet header
type Packet ¶
type Packet struct { // The data payload Data interface{} // contains filtered or unexported fields }
Packet represents the header of an Abaco data packet
func NewPacket ¶
NewPacket generates a new packet with the given facts. No data are configured or stored.
func ReadPacket ¶
ReadPacket returns a Packet read from an io.reader
func ReadPacketPlusPad ¶
ReadPacketPlusPad reads a packet from data, then consumes the padding bytes that follow (if any) so that a multiple of stride bytes is read.
func (*Packet) ChannelInfo ¶
ChannelInfo returns the number of channels in this packet, and the first one
func (*Packet) IsExternalTrigger ¶ added in v0.3.1
IsExternalTrigger tests a packet for whether it (appears to) contain external trigger timestamps
func (*Packet) MakePretendPacket ¶
MakePretendPacket generates a copy of p with the given sequence number. Each channel will repeat the first value in p. Use it for making fake data to fill in where packets were dropped.
func (*Packet) NewData ¶
NewData adds data to the packet, and creates the format and shape TLV items to match.
func (*Packet) ReadValue ¶
ReadValue returns a single sample from the packet's data payload. Not efficient for reading the whole data slice.
func (*Packet) ResetTimestamp ¶
ResetTimestamp removes any timestamp from the header.
func (*Packet) SequenceNumber ¶
SequenceNumber returns the packet's internal sequenceNumber
func (*Packet) SetTimestamp ¶
func (p *Packet) SetTimestamp(ts *PacketTimestamp) error
SetTimestamp puts timestamp `ts` into the header.
func (*Packet) String ¶
String returns a string summarizing the packet's version, sequence number, and size.
func (*Packet) Timestamp ¶
func (p *Packet) Timestamp() *PacketTimestamp
Timestamp returns a copy of the first PacketTimestamp found in the header, or nil if none.
type PacketTimestamp ¶
type PacketTimestamp struct { T uint64 // Counter offset Rate float64 // Count rate, in counts per second }
PacketTimestamp represents a single timestamp in the header
func MakeTimestamp ¶
func MakeTimestamp(x uint16, y uint32, rate float64) *PacketTimestamp
MakeTimestamp creates a `PacketTimestamp` from data
type PayloadLabel ¶ added in v0.3.1
type PayloadLabel string
PayloadLabel represents the label (field names) for a payload's data section