chore(v1): deprecated
This commit is contained in:
@ -2,6 +2,7 @@ package v1
|
||||
|
||||
import "forge.cadoles.com/cadoles/go-emlid/reach/client/protocol"
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
func init() {
|
||||
protocol.Register(Identifier, func(opts *protocol.ProtocolOptions) (protocol.Protocol, error) {
|
||||
return &Protocol{
|
||||
|
@ -22,12 +22,14 @@ const (
|
||||
eventSettingsResetToDefault = "settings reset to default"
|
||||
)
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
type configurationApplied struct {
|
||||
Configuration *model.Configuration `mapstructure:"configuration,omitempty"`
|
||||
Result string `mapstructure:"result"`
|
||||
Constraints *model.Constraints `mapstructure:"constraints,omitempty"`
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
func (o *Operations) ApplyConfiguration(ctx context.Context, config *model.Configuration) (string, *model.Configuration, error) {
|
||||
o.logger.Debug("applying configuration", logger.Attr("configuration", spew.Sdump(config)))
|
||||
|
||||
@ -41,6 +43,7 @@ func (o *Operations) ApplyConfiguration(ctx context.Context, config *model.Confi
|
||||
return res.Result, res.Configuration, nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
func (o *Operations) RequestConfiguration(ctx context.Context) (*model.Configuration, error) {
|
||||
configuration := &model.Configuration{}
|
||||
if err := o.ReqResp(ctx, eventGetConfiguration, nil, eventCurrentConfiguration, configuration); err != nil {
|
||||
@ -49,6 +52,7 @@ func (o *Operations) RequestConfiguration(ctx context.Context) (*model.Configura
|
||||
return configuration, nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// ReqResp emits an event with the given data and waits for a response
|
||||
func (o *Operations) ReqResp(ctx context.Context,
|
||||
requestEvent string, requestData any,
|
||||
|
@ -1,5 +1,6 @@
|
||||
package model
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
var (
|
||||
// On -
|
||||
On = String("on")
|
||||
|
8
reach/client/protocol/v1/model/message.go
Normal file
8
reach/client/protocol/v1/model/message.go
Normal file
@ -0,0 +1,8 @@
|
||||
package model
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
type TaskMessage struct {
|
||||
Name string `json:"name"`
|
||||
State string `json:"state"`
|
||||
Payload map[string]interface{} `json:"payload"`
|
||||
}
|
@ -13,6 +13,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
type Operations struct {
|
||||
addr string
|
||||
client *socketio.Client
|
||||
@ -22,6 +23,7 @@ type Operations struct {
|
||||
dial protocol.DialFunc
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Close implements protocol.Operations.
|
||||
func (o *Operations) Close(ctx context.Context) error {
|
||||
o.mutex.Lock()
|
||||
@ -36,12 +38,14 @@ func (o *Operations) Close(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
const (
|
||||
// EventBrowserConnected is emitted after the initial connection to the
|
||||
// ReachView endpoint
|
||||
eventBrowserConnected = "browser connected"
|
||||
)
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Connect implements protocol.Operations.
|
||||
func (o *Operations) Connect(ctx context.Context) error {
|
||||
o.mutex.Lock()
|
||||
@ -80,6 +84,7 @@ func (o *Operations) Connect(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Emit implements protocol.Operations.
|
||||
func (o *Operations) Emit(ctx context.Context, mType string, message any) error {
|
||||
o.mutex.RLock()
|
||||
@ -96,6 +101,7 @@ func (o *Operations) Emit(ctx context.Context, mType string, message any) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// On implements protocol.Operations.
|
||||
func (o *Operations) On(ctx context.Context, event string) (chan any, error) {
|
||||
o.mutex.RLock()
|
||||
@ -136,6 +142,7 @@ func (o *Operations) On(ctx context.Context, event string) (chan any, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Alive implements protocol.Operations.
|
||||
func (o *Operations) Alive(ctx context.Context) (bool, error) {
|
||||
o.mutex.RLock()
|
||||
@ -148,6 +155,7 @@ func (o *Operations) Alive(ctx context.Context) (bool, error) {
|
||||
return o.client.Alive(), nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Configuration implements protocol.Operations.
|
||||
func (o *Operations) Configuration(ctx context.Context) (any, error) {
|
||||
config, err := o.RequestConfiguration(ctx)
|
||||
@ -162,6 +170,7 @@ const (
|
||||
eventReboot = "reboot"
|
||||
)
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Reboot implements protocol.Operations.
|
||||
func (o *Operations) Reboot(ctx context.Context) error {
|
||||
o.mutex.RLock()
|
||||
@ -212,6 +221,7 @@ const (
|
||||
configurationApplyFailed = "failed"
|
||||
)
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// SetBase implements protocol.Operations.
|
||||
func (o *Operations) SetBase(ctx context.Context, funcs ...protocol.SetBaseOptionFunc) error {
|
||||
rawConfig, err := o.Configuration(ctx)
|
||||
@ -297,6 +307,7 @@ func (o *Operations) SetBase(ctx context.Context, funcs ...protocol.SetBaseOptio
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// GetBaseInfo implements protocol.Operations.
|
||||
func (o *Operations) GetBaseInfo(ctx context.Context) (*protocol.BaseInfo, error) {
|
||||
rawConfig, err := o.Configuration(ctx)
|
||||
@ -353,6 +364,7 @@ type reachViewVersion struct {
|
||||
Stable bool `json:"bool"`
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Version implements protocol.Operations.
|
||||
func (o *Operations) Version(ctx context.Context) (string, bool, error) {
|
||||
res := &reachViewVersion{}
|
||||
@ -363,4 +375,24 @@ func (o *Operations) Version(ctx context.Context) (string, bool, error) {
|
||||
return strings.TrimSpace(res.Version), res.Stable, nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
func (o *Operations) AveragePosition(ctx context.Context) (*protocol.TaskMessage, error) {
|
||||
return nil, protocol.ErrUnimplemented
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
func (o *Operations) GetNTRIPMountPoint(ctx context.Context) error {
|
||||
return protocol.ErrUnimplemented
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
func (o *Operations) SetBaseCorrections(ctx context.Context, funcs ...protocol.SetBaseCorrectionsFunc) error {
|
||||
return protocol.ErrUnimplemented
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
func (o *Operations) SetModem(ctx context.Context, funcs ...protocol.SetModemOptionsFunc) error {
|
||||
return protocol.ErrUnimplemented
|
||||
}
|
||||
|
||||
var _ protocol.Operations = &Operations{}
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
const Identifier protocol.Identifier = "v1"
|
||||
|
||||
const compatibleVersionConstraint = "^2.24"
|
||||
@ -19,6 +20,7 @@ type Protocol struct {
|
||||
dial protocol.DialFunc
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Available implements protocol.Protocol.
|
||||
func (p *Protocol) Available(ctx context.Context, addr string) (bool, error) {
|
||||
ops := p.Operations(addr).(*Operations)
|
||||
@ -53,11 +55,13 @@ func (p *Protocol) Available(ctx context.Context, addr string) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Identifier implements protocol.Protocol.
|
||||
func (p *Protocol) Identifier() protocol.Identifier {
|
||||
return Identifier
|
||||
}
|
||||
|
||||
// Deprecated : is no longer maintained for modules in V1
|
||||
// Operations implements protocol.Protocol.
|
||||
func (p *Protocol) Operations(addr string) protocol.Operations {
|
||||
return &Operations{addr: addr, logger: p.logger, dial: p.dial}
|
||||
|
Reference in New Issue
Block a user