protocol

package
v0.0.0-...-2382a3d Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int

The kind of controll message that can be exchanged between satellites and the ground-station.

const (
	KindInvalid      Kind = iota
	KindOzoneLevel        // Messages of this kind contain an ozone reading for the current location.
	KindAdjustCourse      // Messages of this kind contain a new target location of a satellite.
)

type Location

type Location struct {
	Lat float64 `json:"lat"`
	Lng float64 `json:"lng"`
	Alt float64 `json:"alt"`
}

func (*Location) Distance

func (l *Location) Distance(loc Location) float64

Distance calculates the distance between two locations in km. Altitude is not taken into account.

type SpaceMessage

type SpaceMessage struct {
	Kind Kind `json:"kind"`

	SenderID int

	Location   Location `json:"loc"`
	OzoneLevel float64  `json:"ol"`
	Timestamp  time.Time
}

func (*SpaceMessage) MarshalSpaceMessage

func (m *SpaceMessage) MarshalSpaceMessage() ([]byte, error)

func (*SpaceMessage) UnmarshalSpaceMessage

func (m *SpaceMessage) UnmarshalSpaceMessage(data []byte) error

type SpaceMessageMarshaler

type SpaceMessageMarshaler interface {
	MarshalSpaceMessage() ([]byte, error)
}

Messages are really just marshalled into JSON when transmitted over the network.

type SpaceMessageUnmarshaler

type SpaceMessageUnmarshaler interface {
	UnmarshalSpaceMessage([]byte) error
}

Jump to

Keyboard shortcuts

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