go-emlid/reach/client/protocol/operations.go

45 lines
1.3 KiB
Go
Raw Normal View History

2024-07-30 14:28:39 +02:00
package protocol
import "context"
type BaseInfo struct {
Mode string
AntennaOffset float64
Latitude float64
Longitude float64
Height float64
}
2024-07-30 14:28:39 +02:00
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)
2024-07-30 14:28:39 +02:00
// Reboot restarts the module
Reboot(ctx context.Context) error
}