ssgs

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

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

Go to latest
Published: Oct 28, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

README

SSGS - Add your ground station to the StellarStation platform

This application provides a simple way to add your ground station to the StellarStation network without the need to implement all of the APIs yourself.

It includes the following components:

  1. An interface to the StellarStation scheduling APIs
  2. A server for sending satellite data and receiving commands

To build:

$ go build cmd/ssgs/ssgs.go
$ go build cmd/sender/sender.go

Usage:

$ ssgs [-c config.yaml]

Example configuration:

station:
  name: "Test"
  id: "1"
  address: "test:443"
  key: "api-key.json"
  plan-update-interval: "5m"
ports:
  - name: "AX.25"
    address: ":5555"
    framing: "AX.25"
  - name: "Bitstream"
    address: ":5556"
    framing: "BITSTREAM"
schedulers:
  - name: "Everything"
    address: ":5554"

Notes on the station configuration:

  • The name value is used for logging purposes only.
  • The id value should be either the ground station ID as provided by StellarStation.
  • The address field should be the hostname (or IP address) and port number of the StarPass device.
  • The key field should be the file name of your API key.
  • The plan-update-interval field sets the interval for updating plan data.

Notes on the port configuration:

  • Each entry represents a data port.
  • Data sent to the data port will be forwarded on to StellarStation.
  • Commands received from StellarStation will be sent to connected clients.
  • The format for the either sending or receiving data is:
    • 4 bytes : Data length (LSB uint32)
    • N bytes : Data
  • The name value is used for logging purposes only.
  • The address field tells the server which address and port to listen to.
  • The framing field tells the server which data framing to use.
    • Valid values are: AX.25, BITSTREAM (default), WATERFALL, and IQ
  • The satellite field can be set to limit the data sent and received to a particular satellite.

Notes on the schedulers configuration:

  • Each entry represents a scheduling port.
  • Each scheduling port implements a REST API.
  • The next 24 hours worth of passes will be returned when GET / is called.
  • The name value is used for logging purposes only.
  • The address field tells the server which address and port to listen to.

Example of scheduler API: Scheduler API Output

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ByteOrder = binary.LittleEndian
View Source
var DefaultPlanUpdateInterval = time.Minute * 5

Functions

This section is empty.

Types

type Client

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

Client is a StellarStation Ground Station API client.

func NewClient

func NewClient() *Client

NewClient creates a new Client instance

func (*Client) Connect

func (c *Client) Connect(groundstation GroundStationConfig)

Connect connects to the ground station.

func (*Client) ListPlans

func (c *Client) ListPlans(start time.Time, end time.Time) ([]*api.Plan, error)

ListPlans gets upcoming plans for the given ground station

func (*Client) OpenGroundStationStream

OpenGroundStationStream returns a bidirectional streaming client.

func (*Client) Stop

func (c *Client) Stop()

Stop shuts down the client

func (*Client) TelemetryRequest

func (c *Client) TelemetryRequest(telemetry *api.SatelliteTelemetry) *api.GroundStationStreamRequest

TelemetryRequest wraps a telemetry message in a request object.

func (*Client) Wait

func (c *Client) Wait()

Wait waits for the client to shut down

type Config

type Config struct {
	// GroundStation contains the groundstation configuration.
	GroundStation GroundStationConfig `yaml:"station"`
	// Data contains the data server configurations
	Data []DataServerConfig `yaml:"ports"`
	// Schedulers contains the schedular configurations
	Schedulers []SchedulerConfig
}

Config contains all of the configuration for the application.

func LoadConfig

func LoadConfig(configFile string) (config *Config, err error)

LoadConfig loads a configuration file.

type DataServer

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

DataServer does all of the actual work.

func NewDataServer

func NewDataServer(gsConfig GroundStationConfig,
	config DataServerConfig,
	client *Client) *DataServer

NewDataServer creates a new DataServer instance

func (*DataServer) PlanStart

func (s *DataServer) PlanStart(plan *api.Plan)

PlanStart is executed when a plan starts

func (*DataServer) Stop

func (s *DataServer) Stop()

Stop will stop the dataServer

func (*DataServer) TelemetryRequest

func (s *DataServer) TelemetryRequest(plan *api.Plan, framing v1.Framing, data []byte) *api.GroundStationStreamRequest

TelemetryRequest creates a telemetry request objet for the given plan and data.

func (*DataServer) Wait

func (s *DataServer) Wait()

Wait will wait for the dataServer to stop before returning

type DataServerConfig

type DataServerConfig struct {
	// Name should be a descriptive name.
	// This is mainly used for logging purposes. (required)
	Name string
	// Address is the TCP address and port number to listen to.
	// (required)
	Address string
	// Framing should match the framing type of the data.
	// Valid values are: Bitstream, AX.25, Waterfall, IQ
	// (default: BITSTREAM)
	Framing string
	// Format specifices the format of the data
	// Valid values are: LengthPrefix
	// (default: LengthPrefix)
	Format string
	// Satellite should match the satellite ID provided
	// by the StellarStation platform. (optional)
	Satellite string
	// Channel should match the communications channel
	// ID provided by the StellarStation platform.
	// (optional)
	Channel string
}

DataServerConfig represents the configuration for a single data server.

type GroundStationConfig

type GroundStationConfig struct {
	// Name should be a descriptive name.
	Name string
	// ID should match the ground station ID
	// provided by StellarStation.
	ID string
	// Address is the URL of the ground station.
	Address string
	// Key should be the filename of the API key to use.
	Key string
	// PlanUpdateInterval is the time between plan update checks.
	PlanUpdateInterval time.Duration `yaml:"plan-update-inteval"`
}

GroundStationConfig defines the configuration for the ground station.

type PlanEndFunction

type PlanEndFunction func(plan *api.Plan)

type PlanStartFunction

type PlanStartFunction func(plan *api.Plan)

type PlanWatcher

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

PlanWatcher periodically checks for plans for a ground station.

func NewPlanWatcher

func NewPlanWatcher(client *Client) *PlanWatcher

NewPlanWatcher creates a new PlanWatcher instance

func (*PlanWatcher) CheckPlanState

func (w *PlanWatcher) CheckPlanState(planStart PlanStartFunction, planEnd PlanEndFunction)

CheckPlanState checks for any plan state changes that occurred in the past second

func (*PlanWatcher) Start

func (w *PlanWatcher) Start(planCheckInterval time.Duration, planStart PlanStartFunction, planEnd PlanEndFunction)

Start begins checking for plans.

func (*PlanWatcher) Stop

func (w *PlanWatcher) Stop()

Stop stops checking for plans

func (*PlanWatcher) UpdatePlans

func (w *PlanWatcher) UpdatePlans(planStart PlanStartFunction, planEnd PlanEndFunction)

UpdatePlans updates the plan list for the current ground station

func (*PlanWatcher) Wait

func (w *PlanWatcher) Wait()

Wait will wait for the watcher to stop watching for plans

type Runner

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

Runner keeps track of whether or not something is running

func NewRunner

func NewRunner() *Runner

NewRunner creates a new Runner instance

func (*Runner) Done

func (r *Runner) Done() chan struct{}

Done returns the current done channel for use in select statements

func (*Runner) Start

func (r *Runner) Start(startFunction StartFunction, stopFunction StopFunction)

Start begins execution

func (*Runner) Stop

func (r *Runner) Stop()

Stop ends execution

func (*Runner) Wait

func (r *Runner) Wait()

Wait will wait for execution to end

type ScheduleServer

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

ScheduleServer provides a RESTful API for scheduling information

func NewScheduleServer

func NewScheduleServer(gsConfig GroundStationConfig,
	config SchedulerConfig,
	client *Client) *ScheduleServer

NewScheduleServer creates a new ScheduleServer instance

func (*ScheduleServer) Stop

func (s *ScheduleServer) Stop()

type SchedulerConfig

type SchedulerConfig struct {
	// Name should be a descriptive name.
	// This is mainly used for logging purposes. (required)
	Name string
	// Address is the TCP address and port number to listen to.
	// (required)
	Address string
	// Format specifices the format of the data
	// Valid values are: Tab
	// (default: Tab)
	Format string
	// Satellite should match the satellite ID provided
	// by the StellarStation platform. (optional)
	Satellite string
	// Channel should match the communications channel
	// ID provided by the StellarStation platform.
	// (optional)
	Channel string
}

type StartFunction

type StartFunction func(ctx context.Context)

type StopFunction

type StopFunction func()

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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