2025-05-27 16:22:36 +02:00

61 lines
1.9 KiB
Go

package protocol
import (
"context"
)
type BaseInfo struct {
Mode string
AntennaOffset float64
Latitude float64
Longitude float64
Height float64
}
type TaskMessage struct {
Name string `json:"name"`
State string `json:"state"`
Payload map[string]interface{} `json:"payload"`
}
type Operations interface {
// Connect initiates a new connection to the ReachView service
// It should be called before any other operation
Connect(ctx context.Context) error
// Close closes the current connection to the ReachView service
Close(ctx context.Context) error
// Alive returns true if the ReachView websocket connection is alive, false otherwise
Alive(ctx context.Context) (bool, error)
// Version returns the current ReachView version,
// true if the module uses the stable channel or an error
Version(ctx context.Context) (string, bool, error)
// On listens for messages of the given type on ReachView websocket connection
On(ctx context.Context, mType string) (chan any, error)
// Emit sends the given message on the ReachView websocket connection
Emit(ctx context.Context, mType string, message any) error
// Configuration retrieves the module's configuration
Configuration(ctx context.Context) (any, error)
// SetBase updates the base configuration
SetBase(ctx context.Context, funcs ...SetBaseOptionFunc) error
GetBaseInfo(ctx context.Context) (*BaseInfo, error)
// Reboot restarts the module
Reboot(ctx context.Context) error
// AveragePosition gathers data and computes the average position
AveragePosition(ctx context.Context) (*TaskMessage, error)
//GetNTRIPMountPoint retrieves availables mount point
GetNTRIPMountPoint(ctx context.Context) error
//SetBaseCorrections updates the corrections obtaining station
SetBaseCorrections(ctx context.Context, funcs ...SetBaseCorrectionsFunc) error
}