feat(CorrectionInput): method to configure the source of correction data
This commit is contained in:
@ -296,4 +296,70 @@ func (o *Operations) AveragePosition(ctx context.Context) (*protocol.TaskMessage
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// GetNTRIPMountPoint implements protocol.Operations.
|
||||
func (o *Operations) GetNTRIPMountPoint(ctx context.Context) error {
|
||||
var err error
|
||||
|
||||
config, err := o.GetConfiguration(ctx)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
err = ctx.Err()
|
||||
}()
|
||||
|
||||
payload := map[string]any{
|
||||
"address": config.CorrectionInput.BaseCorrections.Settings.Ntripcli.Address,
|
||||
"port": config.CorrectionInput.BaseCorrections.Settings.Ntripcli.Port,
|
||||
}
|
||||
|
||||
if err = o.client.Emit("task", &model.Action{Name: "get_ntrip_mountpoints", Paylaod: payload}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SetBaseCorrections implements protocol.Operations.
|
||||
func (o *Operations) SetBaseCorrections(ctx context.Context, funcs ...protocol.SetBaseCorrectionsFunc) error {
|
||||
opts := protocol.NewSetBaseCorrectionsOptions(funcs...)
|
||||
if opts.Address == nil {
|
||||
return errors.New("NTRIP address is required")
|
||||
}
|
||||
if opts.Port == nil {
|
||||
return errors.New("NTRIP port is required")
|
||||
}
|
||||
if opts.Username == nil {
|
||||
return errors.New("NTRIP username is required")
|
||||
}
|
||||
if opts.Password == nil {
|
||||
return errors.New("NTRIP password is required")
|
||||
}
|
||||
if opts.MountPoint == nil {
|
||||
return errors.New("NTRIP mount point is required")
|
||||
}
|
||||
|
||||
config := &model.IOConfig{
|
||||
// todo parametrage du type
|
||||
IOType: "ntripcli",
|
||||
Settings: model.IOConfigSettings{
|
||||
NTRIPCli: model.NTRIPCliConfig{
|
||||
Address: *opts.Address,
|
||||
Port: *opts.Port,
|
||||
Username: *opts.Username,
|
||||
Password: *opts.Password,
|
||||
MountPoint: *opts.MountPoint,
|
||||
SendPositionToBase: opts.SendPositionToBase != nil && *opts.SendPositionToBase,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := o.PostBaseCorrection(ctx, config); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
var _ protocol.Operations = &Operations{}
|
||||
|
Reference in New Issue
Block a user