binex

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CLIGHT float64 = 299792458
View Source
const DFRQ1_GLO float64 = 0.56250e6
View Source
const DFRQ2_GLO float64 = 0.43750e6
View Source
const PI float64 = 3.1415926535898

Variables

View Source
var ObsTypes = [16][32]ObsType{

	0: {
		0: {Code: "UU", Freq: 1575.42, System: 0},
		1: {Code: "1C", Freq: 1575.42, System: 0},
		2: {Code: "1P", Freq: 1575.42, System: 0},
		3: {Code: "1W", Freq: 1575.42, System: 0},
		4: {Code: "1Y", Freq: 1575.42, System: 0},
		5: {Code: "1M", Freq: 1575.42, System: 0},
		6: {Code: "1L", Freq: 1575.42, System: 0},
		7: {Code: "1N", Freq: 1575.42, System: 0},
		8: {Code: "1S", Freq: 1575.42, System: 0},
		9: {Code: "1X", Freq: 1575.42, System: 0},

		10: {Code: "UU", Freq: 1227.60, System: 0},
		11: {Code: "2C", Freq: 1227.60, System: 0},
		12: {Code: "2D", Freq: 1227.60, System: 0},
		13: {Code: "2S", Freq: 1227.60, System: 0},
		14: {Code: "2L", Freq: 1227.60, System: 0},
		15: {Code: "2X", Freq: 1227.60, System: 0},
		16: {Code: "2P", Freq: 1227.60, System: 0},
		17: {Code: "2W", Freq: 1227.60, System: 0},
		18: {Code: "2Y", Freq: 1227.60, System: 0},
		19: {Code: "2M", Freq: 1227.60, System: 0},
		20: {Code: "2N", Freq: 1227.60, System: 0},

		21: {Code: "RR", Freq: 1227.60, System: 0},
		22: {Code: "RR", Freq: 1227.60, System: 0},

		23: {Code: "UU", Freq: 1176.45, System: 0},
		24: {Code: "5I", Freq: 1176.45, System: 0},
		25: {Code: "5Q", Freq: 1176.45, System: 0},
		26: {Code: "5X", Freq: 1176.45, System: 0},

		27: {Code: "RR", Freq: 1176.45, System: 0},
		28: {Code: "RR", Freq: 1176.45, System: 0},
		29: {Code: "RR", Freq: 1176.45, System: 0},
		30: {Code: "RR", Freq: 1176.45, System: 0},
		31: {Code: "RR", Freq: 1176.45, System: 0},
	},

	1: {
		0: {Code: "UU", Freq: 1602.00, System: 1},
		1: {Code: "1C", Freq: 1602.00, System: 1},
		2: {Code: "1P", Freq: 1602.00, System: 1},

		3: {Code: "RR", Freq: 1602.00, System: 1},

		4: {Code: "UU", Freq: 1600.995, System: 1},
		5: {Code: "4A", Freq: 1600.995, System: 1},
		6: {Code: "4B", Freq: 1600.995, System: 1},
		7: {Code: "4X", Freq: 1600.995, System: 1},

		8: {Code: "RR", Freq: 1600.995, System: 1},
		9: {Code: "RR", Freq: 1600.995, System: 1},

		10: {Code: "UU", Freq: 1246.00, System: 1},
		11: {Code: "2C", Freq: 1246.00, System: 1},
		12: {Code: "2P", Freq: 1246.00, System: 1},

		13: {Code: "UU", Freq: 1202.025, System: 1},
		14: {Code: "3I", Freq: 1202.025, System: 1},
		15: {Code: "3Q", Freq: 1202.025, System: 1},
		16: {Code: "3X", Freq: 1202.025, System: 1},

		17: {Code: "RR", Freq: 1202.025, System: 1},
		18: {Code: "RR", Freq: 1202.025, System: 1},

		19: {Code: "UU", Freq: 1248.06, System: 1},
		20: {Code: "6A", Freq: 1248.06, System: 1},
		21: {Code: "6B", Freq: 1248.06, System: 1},
		22: {Code: "6X", Freq: 1248.06, System: 1},

		23: {Code: "RR", Freq: 1202.025, System: 1},
		24: {Code: "RR", Freq: 1202.025, System: 1},
		25: {Code: "RR", Freq: 1202.025, System: 1},
		26: {Code: "RR", Freq: 1202.025, System: 1},
		27: {Code: "RR", Freq: 1202.025, System: 1},
		28: {Code: "RR", Freq: 1202.025, System: 1},
		29: {Code: "RR", Freq: 1202.025, System: 1},
		30: {Code: "RR", Freq: 1202.025, System: 1},
		31: {Code: "RR", Freq: 1202.025, System: 1},
	},

	2: {

		0: {Code: "UU", Freq: 1575.42, System: 2},
		1: {Code: "1C", Freq: 1575.42, System: 2},

		2: {Code: "RR", Freq: 1575.42, System: 2},
		3: {Code: "RR", Freq: 1575.42, System: 2},
		4: {Code: "RR", Freq: 1575.42, System: 2},
		5: {Code: "RR", Freq: 1575.42, System: 2},

		6: {Code: "UU", Freq: 1176.45, System: 2},
		7: {Code: "5I", Freq: 1176.45, System: 2},
		8: {Code: "5Q", Freq: 1176.45, System: 2},
		9: {Code: "5X", Freq: 1176.45, System: 2},

		10: {Code: "RR", Freq: 1176.45, System: 2},
		11: {Code: "RR", Freq: 1176.45, System: 2},
		12: {Code: "RR", Freq: 1176.45, System: 2},
		13: {Code: "RR", Freq: 1176.45, System: 2},
		14: {Code: "RR", Freq: 1176.45, System: 2},
		15: {Code: "RR", Freq: 1176.45, System: 2},
		16: {Code: "RR", Freq: 1176.45, System: 2},
		17: {Code: "RR", Freq: 1176.45, System: 2},
		18: {Code: "RR", Freq: 1176.45, System: 2},
		19: {Code: "RR", Freq: 1176.45, System: 2},
		20: {Code: "RR", Freq: 1176.45, System: 2},
		21: {Code: "RR", Freq: 1176.45, System: 2},
		22: {Code: "RR", Freq: 1176.45, System: 2},
		23: {Code: "RR", Freq: 1176.45, System: 2},
		24: {Code: "RR", Freq: 1176.45, System: 2},
		25: {Code: "RR", Freq: 1176.45, System: 2},
		26: {Code: "RR", Freq: 1176.45, System: 2},
		27: {Code: "RR", Freq: 1176.45, System: 2},
		28: {Code: "RR", Freq: 1176.45, System: 2},
		29: {Code: "RR", Freq: 1176.45, System: 2},
		30: {Code: "RR", Freq: 1176.45, System: 2},
		31: {Code: "RR", Freq: 1176.45, System: 2},
	},

	3: {
		0: {Code: "UU", Freq: 1575.42, System: 3},
		1: {Code: "1A", Freq: 1575.42, System: 3},
		2: {Code: "1B", Freq: 1575.42, System: 3},
		3: {Code: "1C", Freq: 1575.42, System: 3},
		4: {Code: "1X", Freq: 1575.42, System: 3},
		5: {Code: "1Z", Freq: 1575.42, System: 3},

		6: {Code: "UU", Freq: 1176.45, System: 3},
		7: {Code: "5I", Freq: 1176.45, System: 3},
		8: {Code: "5Q", Freq: 1176.45, System: 3},
		9: {Code: "5X", Freq: 1176.45, System: 3},

		10: {Code: "UU", Freq: 1207.14, System: 3},
		11: {Code: "7I", Freq: 1207.14, System: 3},
		12: {Code: "7Q", Freq: 1207.14, System: 3},
		13: {Code: "7X", Freq: 1207.14, System: 3},

		14: {Code: "UU", Freq: 1191.795, System: 3},
		15: {Code: "8I", Freq: 1191.795, System: 3},
		16: {Code: "8Q", Freq: 1191.795, System: 3},
		17: {Code: "8X", Freq: 1191.795, System: 3},

		18: {Code: "UU", Freq: 1278.75, System: 3},
		19: {Code: "6A", Freq: 1278.75, System: 3},
		20: {Code: "6B", Freq: 1278.75, System: 3},
		21: {Code: "6C", Freq: 1278.75, System: 3},
		22: {Code: "6X", Freq: 1278.75, System: 3},
		23: {Code: "6Z", Freq: 1278.75, System: 3},

		24: {Code: "RR", Freq: 1278.75, System: 3},
		25: {Code: "RR", Freq: 1278.75, System: 3},
		26: {Code: "RR", Freq: 1278.75, System: 3},
		27: {Code: "RR", Freq: 1278.75, System: 3},
		28: {Code: "RR", Freq: 1278.75, System: 3},
		29: {Code: "RR", Freq: 1278.75, System: 3},
		30: {Code: "RR", Freq: 1278.75, System: 3},
		31: {Code: "RR", Freq: 1278.75, System: 3},
	},

	4: {
		0: {Code: "UU", Freq: 1561.098, System: 4},
		1: {Code: "2I", Freq: 1561.098, System: 4},
		2: {Code: "2Q", Freq: 1561.098, System: 4},
		3: {Code: "2X", Freq: 1561.098, System: 4},

		4: {Code: "UU", Freq: 1207.14, System: 4},
		5: {Code: "7I", Freq: 1207.14, System: 4},
		6: {Code: "7Q", Freq: 1207.14, System: 4},
		7: {Code: "7X", Freq: 1207.14, System: 4},

		8:  {Code: "UU", Freq: 1268.52, System: 4},
		9:  {Code: "6I", Freq: 1268.52, System: 4},
		10: {Code: "6Q", Freq: 1268.52, System: 4},
		11: {Code: "6X", Freq: 1268.52, System: 4},

		12: {Code: "UU", Freq: 1575.42, System: 4},
		13: {Code: "1D", Freq: 1575.42, System: 4},
		14: {Code: "1P", Freq: 1575.42, System: 4},
		15: {Code: "1X", Freq: 1575.42, System: 4},

		16: {Code: "UU", Freq: 1176.45, System: 4},
		17: {Code: "5D", Freq: 1176.45, System: 4},
		18: {Code: "5P", Freq: 1176.45, System: 4},
		19: {Code: "5X", Freq: 1176.45, System: 4},

		20: {Code: "1S", Freq: 1575.42, System: 4},
		21: {Code: "1L", Freq: 1575.42, System: 4},
		22: {Code: "1Z", Freq: 1575.42, System: 4},

		23: {Code: "7D", Freq: 1207.140, System: 4},
		24: {Code: "7P", Freq: 1207.140, System: 4},
		25: {Code: "7Z", Freq: 1207.140, System: 4},

		26: {Code: "8D", Freq: 1191.795, System: 4},
		27: {Code: "8P", Freq: 1191.795, System: 4},
		28: {Code: "8Z", Freq: 1191.795, System: 4},

		29: {Code: "6D", Freq: 1268.52, System: 4},
		30: {Code: "6P", Freq: 1268.52, System: 4},
		31: {Code: "6Z", Freq: 1268.52, System: 4},
	},

	5: {

		0: {Code: "UU", Freq: 1575.42, System: 5},
		1: {Code: "1C", Freq: 1575.42, System: 5},
		2: {Code: "1S", Freq: 1575.42, System: 5},
		3: {Code: "1L", Freq: 1575.42, System: 5},
		4: {Code: "1X", Freq: 1575.42, System: 5},
		5: {Code: "RR", Freq: 1575.42, System: 5},
		6: {Code: "RR", Freq: 1575.42, System: 5},

		7:  {Code: "UU", Freq: 1227.60, System: 5},
		8:  {Code: "2S", Freq: 1227.60, System: 5},
		9:  {Code: "2L", Freq: 1227.60, System: 5},
		10: {Code: "2X", Freq: 1227.60, System: 5},
		11: {Code: "RR", Freq: 1227.60, System: 5},
		12: {Code: "RR", Freq: 1227.60, System: 5},

		13: {Code: "UU", Freq: 1176.45, System: 5},
		14: {Code: "5I", Freq: 1176.45, System: 5},
		15: {Code: "5Q", Freq: 1176.45, System: 5},
		16: {Code: "5X", Freq: 1176.45, System: 5},

		17: {Code: "RR", Freq: 1176.45, System: 5},
		18: {Code: "RR", Freq: 1176.45, System: 5},

		19: {Code: "UU", Freq: 1278.75, System: 5},
		20: {Code: "6S", Freq: 1278.75, System: 5},
		21: {Code: "6L", Freq: 1278.75, System: 5},
		22: {Code: "6X", Freq: 1278.75, System: 5},
		23: {Code: "6E", Freq: 1278.75, System: 5},
		24: {Code: "6Z", Freq: 1278.75, System: 5},

		25: {Code: "5D", Freq: 1176.45, System: 5},
		26: {Code: "5P", Freq: 1176.45, System: 5},
		27: {Code: "5Z", Freq: 1176.45, System: 5},

		28: {Code: "RR", Freq: 1278.75, System: 5},
		29: {Code: "RR", Freq: 1278.75, System: 5},

		30: {Code: "1Z", Freq: 1575.42, System: 5},
		31: {Code: "1B", Freq: 1575.42, System: 5},
	},

	6: {

		0: {Code: "UU", Freq: 1176.45, System: 6},
		1: {Code: "5A", Freq: 1176.45, System: 6},
		2: {Code: "5B", Freq: 1176.45, System: 6},
		3: {Code: "5C", Freq: 1176.45, System: 6},
		4: {Code: "5X", Freq: 1176.45, System: 6},

		5: {Code: "UU", Freq: 2492.028, System: 6},
		6: {Code: "9A", Freq: 2492.028, System: 6},
		7: {Code: "9B", Freq: 2492.028, System: 6},
		8: {Code: "9C", Freq: 2492.028, System: 6},
		9: {Code: "9X", Freq: 2492.028, System: 6},
	},
}

ObsTypes - a double array containig

Functions

func CheckKthBitSet

func CheckKthBitSet(n, k byte) bool

CheckKthBitSet -

func Checksum8BitXOR

func Checksum8BitXOR(byteSlice []byte) (checksum byte)

Checksum8BitXOR -

func DeserializeRecord7F03

func DeserializeRecord7F03(buffer *bufio.Reader, sync byte) (e observation.Epoch, err error)

DeserializeRecord7F03 -

func DeserializeRecord7F05

func DeserializeRecord7F05(buffer *bufio.Reader, sync byte) (e observation.Epoch, err error)

DeserializeRecord7F05 -

func GPSWeekSowToTime

func GPSWeekSowToTime(gpsWeek uint16, tow int32) (dt time.Time)

GPSWeekSowToTime -

func GetEndian

func GetEndian(b byte) (binary.ByteOrder, error)

GetEndian - Get the endianness of the BINEX record

func GetKthBit

func GetKthBit(n, k byte) int

GetKthBit -

func PeekUbnxi

func PeekUbnxi(r *bufio.Reader, offset int) (n int, buf []byte, err error)

PeekUbnxi - peek the bytes storing an unsigned BINEX integer (1-4 bytes)

func ReadUbnxi

func ReadUbnxi(r *bufio.Reader) (buf []byte, err error)

ReadUbnxi - read the bytes storing an unsigned BINEX integer (1-4 bytes)

func RoundToNthDecimal

func RoundToNthDecimal(value float64, decimals int) float64

RoundToNthDecimal rounds a floating-point number to n decimal places

func TwosComplementUint2

func TwosComplementUint2(b uint8) int

TwosComplementUint2 - Calculate 2-bit two's complement

func UbnxiToUint

func UbnxiToUint(buf []byte, sync byte) (val int, err error)

UbnxiToUint - convert unsigned BINEX 1-4 bytes to int

func ValidID

func ValidID(idByte byte) bool

func ValidSync

func ValidSync(syncByte byte) bool

Types

type Frame

type Frame struct {
	Sync     byte
	Id       []byte
	Length   []byte
	Payload  []byte
	Checksum []byte
}

Frame - A struct for storing the contents of a BINEX frame

func DeserializeFrame

func DeserializeFrame(r *bufio.Reader) (frame Frame, err error)

DeserializeFrame - peeks/reads from the bufio reader. When it finds a sync byte, it tries to decode a BINEX frame. This decoder is currently limited to supporting BINEX records that start with the 0xe2 and 0xc2 sync bytes. The BINEX specification suppports several other sync byte values. See the following link for more details. https://www.unavco.org/data/gps-gnss/data-formats/binex/binex.html#synchronization_bytes Note: the other sync byte values are rarely impelmented if at all.

func (*Frame) DeserializeRecord00

func (frame *Frame) DeserializeRecord00() (r Record_0x00, err error)

DeserializeRecord00 - derserialize a 0x00 record

func (*Frame) DeserializeRecord01

func (frame *Frame) DeserializeRecord01() (r Record_0x01, err error)

func (*Frame) DeserializeRecord05

func (frame *Frame) DeserializeRecord05() (r Record_0x05, err error)

DeserializeRecord05 - derserialize a 0x05 record

func (*Frame) DeserializeRecord7D

func (frame *Frame) DeserializeRecord7D() (r Record_0x7D_0x00, err error)

DeserializeRecord7D decodes receiver information from BINEX record 0x7d

func (*Frame) DeserializeRecord7E

func (frame *Frame) DeserializeRecord7E() (r Record_0x7E, err error)

func (Frame) DeserializeRecord7F

func (frame Frame) DeserializeRecord7F() (e observation.Epoch, err error)

DeserializeRecord7F -

func (*Frame) DumpFrame

func (frame *Frame) DumpFrame() (buf []byte)

DumpFrame - concatenates all the bytes in the frame struct and returns a slice with those bytes

func (*Frame) GetChecksumBytes

func (frame *Frame) GetChecksumBytes() (buf []byte)

func (*Frame) GetChecksumLength

func (frame *Frame) GetChecksumLength() int

GetChecksumLength returns the number of bytes in the record ID, record length, and payload.

func (*Frame) GetId

func (frame *Frame) GetId() (int, error)

GetId returns the record id as an integer

func (*Frame) GetLength

func (frame *Frame) GetLength() (int, error)

GetLength returns the number of bytes in the payload as an integer

func (*Frame) GetSubrecrod

func (frame *Frame) GetSubrecrod() (int, error)

TODO support multi-byte subrecord IDs, when needed

func (*Frame) ToJSON

func (frame *Frame) ToJSON(w io.Writer) error

func (*Frame) Validate

func (frame *Frame) Validate() (bool, error)

func (*Frame) Write

func (frame *Frame) Write(w io.Writer) (int, error)

type ObsType

type ObsType struct {
	// RINEX Code
	Code string
	// Carrier Frequency
	// Nominal frequency for GLONASS CDMA sats
	Freq float64
	// BINEX system id
	System int
}

ObsType - maps BINEX system IDs and obscode

type RecordUnknown

type RecordUnknown struct{}

func (RecordUnknown) ToJSON

func (record RecordUnknown) ToJSON(w io.Writer) error

type Record_0x00

type Record_0x00 struct {
	// Time
	Time   time.Time
	Fields []Record_0x00_Field
}

Record_0x00 - 0x00: Metadata

func (Record_0x00) ToJSON

func (record Record_0x00) ToJSON(w io.Writer) error

type Record_0x00_Field

type Record_0x00_Field interface{}

type Record_0x00_Field_0x00

type Record_0x00_Field_0x00 struct {
	Source  uint8
	ID      int
	Length  int
	Comment []byte
}

type Record_0x00_Field_0x01

type Record_0x00_Field_0x01 struct {
	Source  uint8
	ID      int
	Length  int
	Program []byte
}

type Record_0x00_Field_0x02

type Record_0x00_Field_0x02 struct {
	Source   uint8
	ID       int
	Length   int
	Operator []byte
}

type Record_0x00_Field_0x03

type Record_0x00_Field_0x03 struct {
	Source   uint8
	ID       int
	Length   int
	Location []byte
}

type Record_0x00_Field_0x04

type Record_0x00_Field_0x04 struct {
	Source   uint8
	ID       int
	Length   int
	SiteName []byte
}

type Record_0x00_Field_0x05

type Record_0x00_Field_0x05 struct {
	Source     uint8
	ID         int
	Length     int
	SiteNumber []byte
}

type Record_0x00_Field_0x06

type Record_0x00_Field_0x06 struct {
	Source       uint8
	ID           int
	Length       int
	MonumentName []byte
}

type Record_0x00_Field_0x07

type Record_0x00_Field_0x07 struct {
	Source         uint8
	ID             int
	Length         int
	MonumentNumber []byte
}

type Record_0x00_Field_0x08

type Record_0x00_Field_0x08 struct {
	Source     uint8
	ID         int
	Length     int
	MarkerName []byte
}

type Record_0x00_Field_0x09

type Record_0x00_Field_0x09 struct {
	Source       uint8
	ID           int
	Length       int
	MarkerNumber []byte
}

type Record_0x00_Field_0x0A

type Record_0x00_Field_0x0A struct {
	Source       uint8
	ID           int
	Length       int
	RefPointName []byte
}

type Record_0x00_Field_0x0B

type Record_0x00_Field_0x0B struct {
	Source         uint8
	ID             int
	Length         int
	RefPointNumber []byte
}

type Record_0x00_Field_0x17

type Record_0x00_Field_0x17 struct {
	Source      uint8
	ID          int
	Length      int
	AntennaType []byte
}

type Record_0x01

type Record_0x01 interface {
	// Serialize Record to JSON
	ToJSON(io.Writer) error
}

type Record_0x01_0x01

type Record_0x01_0x01 struct {
	// PRN minus one [0-31]
	Prn uint8
	// Week - GPS week of ToE = ToC (whole 604800-second weeks completed since 6.0 Jan 1980 UTC)
	Week uint16
	// ToW - Transmission time of week/time of message (seconds into GPS week),
	// adjusted by ±604800 seconds to refer to the specified GPS week,
	// if necessary (i.e. same as in the RINEX specification) transmission
	// time of week/time of message (seconds into GPS week), adjusted by
	// ±604800 seconds to refer to the specified GPS week, if necessary
	// (i.e. same as in the RINEX specification)
	Tow int32
	// ToC - time of clock = ToE, time of ephemeris (seconds into GPS week)
	Toc int32
	Tgd float32
	// IODC - Issue of Data/Clock
	Iodc int32
	// AF2 - SV clock drift rate (second/second^2)
	Af2 float32
	// AF1 - SV clock drift (second/second)
	Af1 float32
	// AF0 - SV clock bias (second)
	Af0 float32
	// IODE - Issue of Data/Ephemeris
	Iode int32
	// Delta N - (semicircles/second; multiply by exactly 3.1415926535898 to obtain radians/second)
	DeltaN float32 // (semicircles/second)
	// M0 - mean anomaly at reference time (radians)
	M0 float64
	// e - Eccentricity
	Ecc float64
	// SqrtA - Square root of semi-major axis (meters^0.5)
	SqrtA float64
	// Cic - pertubation harmonic (radians)
	Cic float32
	// Crc - pertubation harmonic (meters)
	Crc float32
	// Cis - pertubation harmonic (radians)
	Cis float32
	// Crs - pertubation harmonic (meters)
	Crs float32
	// Cuc - pertubation harmonic (radians)
	Cuc float32
	// Cus - pertubation harmonic (radians)
	Cus float32
	// OMEGA0 - lon. of asc. node (radians)
	Omega0 float64
	// omega - arg. of perigee (radians)
	Omega float64
	// i0 - inclination at reference time (radians)
	I0 float64
	// OMEGA dot - rate of right asc. (semicircles/second;
	// multiply by exactly 3.1415926535898 to obtain radians/second)
	OmegaDot float32 // (semicircles/second)
	// i dot - rate of inclination (semicircles/second;
	// multiply by exactly 3.1415926535898 to obtain radians/second)
	IDot float32 // (semicircles/second)
	// nominal URA (user range accuracy) value (decimeters; multiply by 0.1 to obtain meters)
	Ura float32
	// Health - 6-bit SV health (coded) = bits 0-5 = uint2 & 0x003f
	Health uint16
	// Misc - to hold three remaining pieces derived from the GPS navigation message in subframes 1-3:
	// curve fit interval, hours = bits 0-7 = uint2 & 0x00ff (value to be derived from the 1-bit fit interval
	// flag and the value of the IODC; see ICD-GPS-200 Table 20-XII for details)
	// 1-bit L2 P data flag = bit 8 = uint2 >> 8 & 0x01, if available (if not available, always set bit 8 = 0)
	// 2-bit codes on L2 channel = bits 9-10 = uint2 >> 9 & 0x03, if available (if not available, always set bits 9,10 = 0)
	// (upper 5 bits, 11-15, of this uint2 are reserved)
	Misc uint16
}

Record_0x01_0x01 - GPS Ephemeris

func DeserializeRecord0101

func DeserializeRecord0101(buffer *bufio.Reader, sync byte) (r Record_0x01_0x01, err error)

func (Record_0x01_0x01) SerializeGNSSEph

func (r Record_0x01_0x01) SerializeGNSSEph() (eph ephemeris.GenericEphemeris)

func (Record_0x01_0x01) SerializeToGPSLNAVMessage

func (r Record_0x01_0x01) SerializeToGPSLNAVMessage(edid string) (eph ephemeris.GPSLNAVMessage)

TODO: is this correct? SerializeToGPSLNAVMessage - serialize Record_0x01_0x01 to GPSLNAVMessage

func (Record_0x01_0x01) ToJSON

func (block Record_0x01_0x01) ToJSON(w io.Writer) error

type Record_0x01_0x02

type Record_0x01_0x02 struct {
	// SubrecordID             uint8   // subrecord ID, always 0x02
	SlotNumberMinusOne      uint8   // GLONASS slot # - 1 (offset ID, 0-23); or 255 for "unknown"
	DayNumber               uint16  // GLONASS day number
	TimeOfDay               uint32  // time of day (seconds)
	SVClockBias             float64 // SV clock bias (-TauN, seconds)
	SVRelativeFrequencyBias float64 // SV relative frequency bias (+GammaN)
	MessageFrameTime        uint32  // message frame time (tk, seconds)
	SVXPosition             float64 // SV X position (km)
	SVXVelocity             float64 // SV X velocity (km/second)
	SVXAcceleration         float64 // SV X acceleration (km/second/second)
	SVYPosition             float64 // SV Y position (km)
	SVYVelocity             float64 // SV Y velocity (km/second)
	SVYAcceleration         float64 // SV Y acceleration (km/second/second)
	SVZPosition             float64 // SV Z position (km)
	SVZVelocity             float64 // SV Z velocity (km/second)
	SVZAcceleration         float64 // SV Z acceleration (km/second/second)
	SVHealth                uint8   // SV health/operability
	FrequencyChannelNumber  int8    // frequency channel number for this slot #
	AgeOfOperation          uint8   // age of operation (days)
	LeapSeconds             uint8   // leap seconds since 6.0 Jan 1980
	A0                      float64 // A0 (= TauGPS) = GPS time - GLONASS time (seconds)
	L1L2Delta               float64 // L1L2Delta, estimate of L1/L2 group delay
}

Record_0x01_0x02 - GLONASS Ephemeris

func DeserializeRecord0102

func DeserializeRecord0102(buffer *bufio.Reader, sync byte) (r Record_0x01_0x02, err error)

func (Record_0x01_0x02) SerializeGNSSEph

func (r Record_0x01_0x02) SerializeGNSSEph() (eph ephemeris.GenericEphemeris, err error)

SerializeGNSSEph - serialize Record_0x01_0x02 to ephemeris.Ephemeris

func (Record_0x01_0x02) SerializeToGLONASSFDMA

func (r Record_0x01_0x02) SerializeToGLONASSFDMA(edid string, N4 int) (msg ephemeris.GLONASSFDMA, err error)

SerializeToGLONASSFDMA - serialize Record_0x01_0x02 to ephemeris.GLONASSFDMA

N4 is the 4-year period number (0-1023)
N4 is used to determine the correct 4-year period for the GLONASS day number
and seconds of day. The 4-year period is reset every 4 years on Jan 1st of
the last leap year (e.g. 2020, 2024, 2028, etc.)
If the current 4-year period is unknown, the day number is set to 0 and we
use the current time to determine the 4-year period.

func (Record_0x01_0x02) ToJSON

func (block Record_0x01_0x02) ToJSON(w io.Writer) error

type Record_0x01_0x03

type Record_0x01_0x03 struct {
	PRN             uint8   // SBAS PRN (full ID, 120-138)
	GPSWeek         uint16  // GPS week of ToE = ToC (whole 604800-second weeks completed since 6.0 Jan 1980 UTC)
	ToW             int32   // Transmission time of week/time of message (seconds into GPS week), adjusted by ±604800 seconds to refer to the specified GPS week, if necessary
	AGf0            float64 // SV clock bias (seconds) with respect to SBAS Network Time
	AGf1            float32 // SV clock drift (seconds/second) with respect to SBAS Network Time
	ToE             uint32  // Time of ephemeris (= ToC, time of clock) (seconds into GPS week)
	SVXPosition     float64 // SV X position (km)
	SVXVelocity     float64 // SV X velocity (km/second)
	SVXAcceleration float64 // SV X acceleration (km/second/second)
	SVYPosition     float64 // SV Y position (km)
	SVYVelocity     float64 // SV Y velocity (km/second)
	SVYAcceleration float64 // SV Y acceleration (km/second/second)
	SVZPosition     float64 // SV Z position (km)
	SVZVelocity     float64 // SV Z velocity (km/second)
	SVZAcceleration float64 // SV Z acceleration (km/second/second)
	HealthBits      uint8   // Bits 0-3 = 4 health bits in MT17; Bit 4 = 1 if MT17 health is unavailable, 0 otherwise; Bit 5 = 1 if the URA index is 15, 0 otherwise; Bits 6-7 reserved
	URAIndex        uint8   // Bits 0-3 = 4 bits URA index (ranges 0-15), bits 4-7 reserved
	IODN            uint8   // Issue of Data Navigation (DO229, first 8 bits after Message if MT9)
}

Record_0x01_0x03 - SBAS Ephemeris

func DeserializeRecord0103

func DeserializeRecord0103(buffer *bufio.Reader, sync byte) (r Record_0x01_0x03, err error)

func (Record_0x01_0x03) SerializeGNSSEph

func (r Record_0x01_0x03) SerializeGNSSEph() (eph ephemeris.GenericEphemeris)

func (Record_0x01_0x03) SerializeToSBAS

func (r Record_0x01_0x03) SerializeToSBAS(edid string) (eph ephemeris.SBASMessage)

func (Record_0x01_0x03) ToJSON

func (r Record_0x01_0x03) ToJSON(w io.Writer) error

type Record_0x01_0x05

type Record_0x01_0x05 struct {
	PRN uint8 // PRN (full ID, 1-37)
	// The BDT week number is a continuous number. The broadcast 13-bit BDS System Time
	// week has a roll-over after 8191. It started at zero at 1-Jan-2006, Hence BDT week = BDT
	// week_BRD + (n*8192) where (n: number of BDT roll-overs).
	WeekOfToE uint16  // Beidou/Compass week of ToE (whole 604800-second weeks completed since 1.0 Jan 2006 UTC)
	ToW       int32   // Transmission time of week (seconds in Beidou/Compass week)
	ToC       int32   // Time of clock (seconds in Beidou/Compass week)
	ToE       int32   // Time of ephemeris (seconds in Beidou/Compass week)
	Af2       float32 // SV clock drift rate (second/second^2)
	Af1       float32 // SV clock drift (second/second)
	Af0       float32 // SV clock bias (seconds)
	DeltaN    float32 // delta n (semicircles/second)
	M0        float64 // Mean anomaly at reference time (radians)
	E         float64 // Eccentricity
	SqrtA     float64 // Square root of semi-major axis (meters^0.5)
	Cic       float32 // Cic perturbation harmonic (radians)
	Crc       float32 // Crc perturbation harmonic (meters)
	Cis       float32 // Cis perturbation harmonic (radians)
	Crs       float32 // Crs perturbation harmonic (meters)
	Cuc       float32 // Cuc perturbation harmonic (radians)
	Cus       float32 // Cus perturbation harmonic (radians)
	OMEGA0    float64 // Longitude of ascending node (radians)
	Omega     float64 // Argument of perigee (radians)
	I0        float64 // Inclination at reference time (radians)
	OMEGADot  float32 // Rate of right ascension (semicircles/second)
	IDot      float32 // Rate of inclination (semicircles/second)
	// Flags1 containing health, IODC, IODE, and nav type information
	//   bit 0: 0 = healthy, 1 = unhealthy (SatH1)
	//   bits 1-5: IODC (Issue of Data, Clock)
	//   bits 6-10: IODE (Issue of Data, Ephemeris)
	//   bits 11-13: nav type
	//   0b000: unknown
	//   0b001: D1; IGSO or MEO
	//   0b010: D2; GEO
	//   other: reserved TODO: check this http://en.beidou.gov.cn/SYSTEMS/ICD/201902/P020190227702348791891.pdf
	Flags1 uint16 // Flags1 containing health, IODC, IODE, and nav type information

	// Flags2 containing URAI, TGD1, TGD2, and message source information
	//   bits 0-3: URA index
	//   bits 4-13: TGD1 (TGD1 = TGD1 * 2^-31 seconds)
	//   bits 14-23: TGD2 (TGD2 = TGD2 * 2^-31 seconds)
	//   bit 24: TGD2 flag (0 = available, 1 = use with care)
	//   bits 25-31: message source
	//   0b0000000: unknown
	//   0b0000001: B1I
	//   0b0000010: B1Q
	//   0b0000011: B2I
	//   0b0000100: B2Q
	//   0b0000101: B3I
	//   0b0000110: B3Q
	//   other: reserved TODO: check this http://en.beidou.gov.cn/SYSTEMS/ICD/201902/P020190227702348791891.pdf
	Flags2 uint32 // Flags2 containing URAI, TGD1, TGD2, TGD2 flag, and message source information
}

Record_0x01_05 - BDS Ephemeris

func DeserializeRecord0105

func DeserializeRecord0105(buffer *bufio.Reader, sync byte) (r Record_0x01_0x05, err error)

func (Record_0x01_0x05) SerializeGNSSEph

func (r Record_0x01_0x05) SerializeGNSSEph() (eph ephemeris.GenericEphemeris)

func (Record_0x01_0x05) SerializeToBeidouD1D2

func (r Record_0x01_0x05) SerializeToBeidouD1D2(edid string) (eph ephemeris.BeidouD1D2Message)

func (Record_0x01_0x05) TGD1

func (r Record_0x01_0x05) TGD1() float64

TGD1 extracts and returns the TGD1 value.

func (Record_0x01_0x05) TGD2

func (r Record_0x01_0x05) TGD2() float64

TGD2 extracts and returns the TGD2 value.

func (Record_0x01_0x05) ToJSON

func (block Record_0x01_0x05) ToJSON(w io.Writer) error

type Record_0x01_0x06

type Record_0x01_0x06 struct {
	FullPRN              uint8   // PRN (full ID, 193-202)
	GPSWeek              uint16  // GPS week of ToE = ToC (whole 604800-second weeks completed since 6.0 Jan 1980 UTC)
	TimeOfTransmission   int32   // Transmission time of week/time of message (seconds into GPS week)
	ToC                  int32   // Time of clock = ToE, time of ephemeris (seconds into GPS week)
	TGD                  float32 // TGD (seconds)
	IODC                 int32   // Issue of Data/Clock
	Af2                  float32 // SV clock drift rate (second/second^2)
	Af1                  float32 // SV clock drift (second/second)
	Af0                  float32 // SV clock bias (seconds)
	IODE                 int32   // Issue of Data/Ephemeris
	DeltaN               float32 // delta n (semicircles/second)
	M0                   float64 // Mean anomaly at reference time (radians)
	E                    float64 // Eccentricity
	SqrtA                float64 // Square root of semi-major axis (meters^0.5)
	Cic                  float32 // Cic perturbation harmonic (radians)
	Crc                  float32 // Crc perturbation harmonic (meters)
	Cis                  float32 // Cis perturbation harmonic (radians)
	Crs                  float32 // Crs perturbation harmonic (meters)
	Cuc                  float32 // Cuc perturbation harmonic (radians)
	Cus                  float32 // Cus perturbation harmonic (radians)
	OMEGA0               float64 // Longitude of ascending node (radians)
	Omega                float64 // Argument of perigee (radians)
	I0                   float64 // Inclination at reference time (radians)
	OMEGADot             float32 // Rate of right ascension (semicircles/second)
	IDot                 float32 // Rate of inclination (semicircles/second)
	SVAccuracy           float32 // SV accuracy (decimeters; multiply by 0.1 to obtain meters), rounded to the nearest decimeter
	SVHealth             uint16  // SV health, bits 17-22 w 3 sf 1
	CurveFitIntervalFlag uint16  // Curve fit interval flag derived from QZSS navigation message
}

Record_0x01_0x06 - QZSS NAV

func DeserializeRecord0106

func DeserializeRecord0106(buffer *bufio.Reader, sync byte) (r Record_0x01_0x06, err error)

func (Record_0x01_0x06) SerializeGNSSEph

func (r Record_0x01_0x06) SerializeGNSSEph() (eph ephemeris.GenericEphemeris)

func (Record_0x01_0x06) SerializeToQZSSLNAV

func (r Record_0x01_0x06) SerializeToQZSSLNAV(edid string) (eph ephemeris.QZSSLNAVMessage)

func (Record_0x01_0x06) ToJSON

func (r Record_0x01_0x06) ToJSON(w io.Writer) error

type Record_0x01_0x07

type Record_0x01_0x07 struct {
	PRN            uint8   // PRN (full ID, 1-7)
	IRNSSWeekOfToE uint16  // IRNSS week of ToE (whole 604800-second weeks completed since 13 seconds before 22.0 Aug 1999 UTC, i.e. GPS week - 1024)
	ToW            int32   // Transmission time of week/time of message (seconds into IRNSS week)
	ToC            int32   // Time of clock (seconds in IRNSS week)
	ToE            int32   // Time of ephemeris (seconds in IRNSS week)
	Af2            float32 // SV clock drift rate (second/second^2)
	Af1            float32 // SV clock drift (second/second)
	Af0            float32 // SV clock bias (seconds)
	DeltaN         float32 // delta n (semicircles/second)
	M0             float64 // Mean anomaly at reference time (radians)
	E              float64 // Eccentricity
	SqrtA          float64 // Square root of semi-major axis (meters^0.5)
	Cic            float32 // Cic perturbation harmonic (radians)
	Crc            float32 // Crc perturbation harmonic (meters)
	Cis            float32 // Cis perturbation harmonic (radians)
	Crs            float32 // Crs perturbation harmonic (meters)
	Cuc            float32 // Cuc perturbation harmonic (radians)
	Cus            float32 // Cus perturbation harmonic (radians)
	OMEGA0         float64 // Longitude of ascending node (radians)
	Omega          float64 // Argument of perigee (radians)
	I0             float64 // Inclination at reference time (radians)
	OMEGADot       float32 // Rate of right ascension (semicircles/second)
	IDot           float32 // Rate of inclination (semicircles/second)
	Flags1         uint8   // Flags for URA index and health bits
	Flags2         uint16  // Flags for IODEC and TGD
}

func DeserializeRecord0107

func DeserializeRecord0107(buffer *bufio.Reader, sync byte) (r Record_0x01_0x07, err error)

func (Record_0x01_0x07) Health

func (r Record_0x01_0x07) Health() int

func (Record_0x01_0x07) IODEC

func (r Record_0x01_0x07) IODEC() int

func (Record_0x01_0x07) SerializeGNSSEph

func (r Record_0x01_0x07) SerializeGNSSEph() ephemeris.GenericEphemeris

func (Record_0x01_0x07) SerializeNavICLNAV

func (r Record_0x01_0x07) SerializeNavICLNAV(edid string) ephemeris.NavICLNAVMessage

func (Record_0x01_0x07) TGD

func (r Record_0x01_0x07) TGD() int

func (Record_0x01_0x07) ToJSON

func (r Record_0x01_0x07) ToJSON(w io.Writer) error

func (Record_0x01_0x07) URA

func (r Record_0x01_0x07) URA() float64

type Record_0x01_0x14

type Record_0x01_0x14 struct {
	// PRN - 1
	PrnMinusOne uint8
	// Galileo Week (ToE)
	//  Whole 604800-second weeks completed since 6.0
	//  Jan 1980 UTC, so therefore aligned to and identical
	//  to the GPS week value.
	GALWeek uint16
	// ToW
	//  transmission time of message - seconds in Galileo week == GPS week
	//  derived from WN and ToW of page type 1, adjusted by ±604800 seconds to
	//  refer to the specified Galileo week, if necessary
	Tow int32
	// Time of clock (seconds of week)
	//  adjusted by ±604800 seconds to refer to the specified week, if necessary
	Toc int32
	// Time of ephemeris (seconds of week)
	ToE int32
	// BGD E5a/E1 (seconds)
	//  If bit 0 or bit 2 of data sources is set, E1-B DVS & HS,
	//  E5b DVS & HS and both BGDs are valid. If bit 1 of data sources
	//  is set, E5a DVS & HS and BGD E5a/E1 are valid. Non-valid parameters
	//  are set to 0 and to be ignored.
	BGDE5AE1 float32
	// BGD E5b/E1 (seconds); set to 0 (zero) if from F/NAV message
	//  If bit 0 or bit 2 of data sources is set, E1-B DVS & HS,
	//  E5b DVS & HS and both BGDs are valid. If bit 1 of data sources
	//  is set, E5a DVS & HS and BGD E5a/E1 are valid. Non-valid parameters
	//  are set to 0 and to be ignored.
	BGDE5BE1 float32
	// Issue of data of the nav batch
	IODnav int32
	// Clock Drift Rate (second/second^2)
	Af2 float32
	// Clock Drift (second/second)
	Af1 float32
	// Clock Bias (seconds)
	Af0 float64
	// delta n (semicircles/second)
	DeltaN float32
	// mean anomaly at reference time (radians)
	M0  float64
	Ecc float64
	// square root of semi-major axis (meters^0.5)
	SqrtA float64
	// Cic pertubation harmonic (radians)
	Cic float32
	// Crc pertubation harmonic (meters)
	Crc float32
	// Cis pertubation harmonic (radians)
	Cis float32
	// Crs pertubation harmonic (meters)
	Crs float32
	// Cuc pertubation harmonic (radians)
	Cuc float32
	// Cus pertubation harmonic (radians)
	Cus float32
	// OMEGA0, lon. of asc. node (radians)
	Omega0 float64
	// omega, arg. of perigee (radians)
	Omega float64
	// i0, inclination at reference time (radians)
	I0 float64
	// OMEGA dot, rate of right asc. (semicircles/second)
	OmegaDot float32
	// i dot, rate of inclination (semicircles/second)
	IDot float32
	// SISA, Signal in space accuracy: if negative, this is
	//  -(SISA index + 1) for SISA index = 0-255; a positive
	//  value is the accuracy in distance in meters for SISA
	//  index = 0-125 as defined in the Galileo OS-SIS-ICD
	Sisa float32
	//  SV health (note 1 below):
	// bit 0: E1B DVS
	// bit 1,2: E1B HS
	// bit 3: E5a DVS
	// bit 4,5: E5a HS
	// bit 6: E5b DVS
	// bit 7,8: E5b HS
	Health uint16
	// data sources:
	//     bit 0: I/NAV E1-B
	//     bit 1: F/NAV E5a-I
	//     bit 2: I/NAV E5b-I
	//     bit 8: af0-af2, ToC are for E5a,E1
	//     bit 9: af0-af2, ToC are for E5b,E1
	// although only specific combinations are valid, i.e.
	//     0x102 (258) for F/NAV from E5a
	//     0x201 (513) for I/NAV from E1
	//     0x204 (516) for I/NAV from E5b
	//     0x205 (517) for I/NAV from E1+E5b
	// and all other values are considered illegal and invalid.
	DataSources uint16
}

Record_0x01_0x14 - GAL Ephemeris

func DeserializeRecord0114

func DeserializeRecord0114(buffer *bufio.Reader, sync byte) (r Record_0x01_0x14, err error)

DeeserializeRecord0114 - Deserialize GAL Me

func (Record_0x01_0x14) DataSource

func (r Record_0x01_0x14) DataSource() (string, error)

func (Record_0x01_0x14) SerializeGNSSEph

func (r Record_0x01_0x14) SerializeGNSSEph() (eph ephemeris.GenericEphemeris, err error)

func (Record_0x01_0x14) SerializeToGalileoINAVFNAV

func (r Record_0x01_0x14) SerializeToGalileoINAVFNAV(edid string) (ephemeris.GalileoINAVFNAVMessage, error)

func (Record_0x01_0x14) ToJSON

func (block Record_0x01_0x14) ToJSON(w io.Writer) error

type Record_0x05

type Record_0x05 struct {
	// each 0x05 record contains a timestamp
	Time time.Time
	// can contain 1 or more field
	Fields []Record_0x05_Field
}

a struct containing one or more 0x05 fields

func (Record_0x05) ToJSON

func (record Record_0x05) ToJSON(w io.Writer) error

type Record_0x05_Field

type Record_0x05_Field interface {
	FieldID() int
}

an interface for any field type

type Record_0x05_Field0x01

type Record_0x05_Field0x01 struct {
	Id        int
	Ellipsoid string
	X         float64
	Y         float64
	Z         float64
}

Record_0x05_Field0x01 - antenna ECEF xyz position

func (*Record_0x05_Field0x01) FieldID

func (f *Record_0x05_Field0x01) FieldID() int

type Record_0x05_Field0x02

type Record_0x05_Field0x02 struct {
	Id        int
	Ellipsoid string
	E         float64
	N         float64
	U         float64
}

Record_0x05_Field0x02 - antenna geodetic position

func (*Record_0x05_Field0x02) FieldID

func (f *Record_0x05_Field0x02) FieldID() int

type Record_0x05_Field0x03

type Record_0x05_Field0x03 struct {
	Id   int
	Xdot float64
	Ydot float64
	Zdot float64
}

Record_0x05_Field0x03 antenna ECEF xyz velocity

func (*Record_0x05_Field0x03) FieldID

func (f *Record_0x05_Field0x03) FieldID() int

type Record_0x05_Field0x04

type Record_0x05_Field0x04 struct {
	Id   int
	Ndot float64
	Edot float64
	Udot float64
}

Record_0x05_Field0x04 antenna local geodetic velocity

func (*Record_0x05_Field0x04) FieldID

func (f *Record_0x05_Field0x04) FieldID() int

type Record_0x05_Field0x06

type Record_0x05_Field0x06 struct {
	Id int
	// receiver clock bias in seconds
	RcvClkBias float64
}

Record_0x05_Field0x06 - receiver clock bias relative to system

func (*Record_0x05_Field0x06) FieldID

func (f *Record_0x05_Field0x06) FieldID() int

type Record_0x05_Field0x07

type Record_0x05_Field0x07 struct {
	Id int
	// receiver clock bias in seconds
	RcvClkBias float64
	// receiver clock drift in ppm
	RcvClkDrift float32
}

Record_0x05_Field0x07 - receiver clock bias and drift

func (*Record_0x05_Field0x07) FieldID

func (f *Record_0x05_Field0x07) FieldID() int

type Record_0x05_Field0x7F

type Record_0x05_Field0x7F struct {
	Id   int
	Note string
}

Record_0x05_Field0x7F - notes or additional information

func (*Record_0x05_Field0x7F) FieldID

func (f *Record_0x05_Field0x7F) FieldID() int

type Record_0x05_Field_0x00

type Record_0x05_Field_0x00 struct {
	Id      int
	Comment string
}

Record_0x05_Field_0x00 - comment

func (*Record_0x05_Field_0x00) FieldID

func (f *Record_0x05_Field_0x00) FieldID() int

FieldID returns the field id

type Record_0x05_Field_0x05

type Record_0x05_Field_0x05 struct {
	Id int
	// System 0:GPS, 1:GAL, 2:GLO, 3:BDS, 4-255:reserved
	System uint8
}

Record_0x05_Field_0x05 receiver time system

func (*Record_0x05_Field_0x05) FieldID

func (f *Record_0x05_Field_0x05) FieldID() int

type Record_0x7D_0x00

type Record_0x7D_0x00 struct {
	// time
	Time time.Time `json:"time"`
	// obs type flags
	ObsTypes uint8 `json:"obs_type_flags"`
	// receiver internal temperature
	ReceiverTemp float64 `json:"receiver_temp"`
	// receiver primary external power supply voltage
	ReceiverExtPwr1 float64 `json:"receiver_ext_pwr_1"`
	// receiver secondary external power supply voltage
	ReceiverExtPwr2 float64 `json:"receiver_ext_pwr_2"`
	// receiver primary internal battery power supply voltage
	ReceiverIntPwr1 float64 `json:"receiver_int_pwr_1"`
	// receiver secondary internal battery power supply voltage
	ReceiverIntPwr2 float64 `json:"receiver_int_pwr_2"`
	// reserved 1
	Reserved1 float64 `json:"reserved_1"`
	// reserved 2
	Reserved2 float64 `json:"reserved_2"`
}

func (Record_0x7D_0x00) ToJSON

func (record Record_0x7D_0x00) ToJSON(w io.Writer) error

type Record_0x7E

type Record_0x7E interface{}

type Record_0x7E_0x00

type Record_0x7E_0x00 struct{}

Record_0x7E_0x00 - placeholder for site meteorological data

func DeserializeRecord7E00

func DeserializeRecord7E00(buffer *bufio.Reader, sync byte) (r Record_0x7E_0x00, err error)

DeserializeRecord7E00 - placeholder for site meteorological data

type Record_0x7E_0x01

type Record_0x7E_0x01 struct {
	Time        time.Time `json:"time"`
	Length      int       `json:"length"`
	ASCIIString string    `json:"ascii_string"`
}

Record_0x7E_0x01 - subrecord for holding raw ASCII strings returned from external devices

func DeserializeRecord7E01

func DeserializeRecord7E01(buffer *bufio.Reader, sync byte) (r Record_0x7E_0x01, err error)

DeserializeRecord7E01 - subrecord for holding raw ASCII strings returned from external devices

type Scanner

type Scanner struct {
	Reader *bufio.Reader
	Sync   byte
}

Scanner - holds the bufio.Reader and BINEX sync byte

func NewScanner

func NewScanner(r io.Reader) Scanner

NewScanner - creates a new binex.Scanner TODO - think about making the buffer size a settable param

func (Scanner) NextFrame

func (scanner Scanner) NextFrame() (frame Frame, err error)

NextFrame - scans to the end of the next frame Will return errors in the following cases: if the bufio.Reader is empty (io.EOF), if the frame bytes stored in bufio.Reader are incomplete, if the sync byte is invalid, and if the checksum is invalid.

type TimeTag

type TimeTag struct {
	Minutes uint32
	Millis  uint16
}

TimeTag is a BINEX time tag with milli-seconds

func (TimeTag) ToTime

func (t TimeTag) ToTime() time.Time

convert BINEX time tag to time.Time

type TimeTagQsec

type TimeTagQsec struct {
	Minutes uint32
	Qsec    uint8
}

TimeTagQsec - timetag w/ quarter-seconds

func (TimeTagQsec) ToTime

func (t TimeTagQsec) ToTime() time.Time

convert BINEX time tag to time.Time

Jump to

Keyboard shortcuts

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