feat(CorrectionInput): method to configure the source of correction data

This commit is contained in:
2025-06-11 12:07:51 +02:00
parent abebc7d8c6
commit f560465364
7 changed files with 318 additions and 0 deletions

View File

@ -264,6 +264,78 @@ var testCases = []operationTestCase{
t.Logf("Task Message : %s", taskmessage)
},
},
{
Name: "SetBaseCorrections",
Run: func(t *testing.T, ops protocol.Operations) {
ctx := context.Background()
if err := ops.Connect(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
defer func() {
if err := ops.Close(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
}
}()
opts := []protocol.SetBaseCorrectionsFunc{
protocol.WithNTRIPAddress("crtk.net"),
protocol.WithNTRIPPort(2101),
protocol.WithNTRIPUsername("centipede"),
protocol.WithNTRIPPassword("centipede"),
protocol.WithNTRIPMountPoint("EPI21"),
protocol.WithSendPositionToBase(true),
}
if err := ops.SetBaseCorrections(ctx, opts...); err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
t.Logf("BaseCorrection Update")
},
},
{
Name: "GetNTRIPMountPoint",
Run: func(t *testing.T, ops protocol.Operations) {
ctx := context.Background()
if err := ops.Connect(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
defer func() {
if err := ops.Close(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
}
}()
if err := ops.GetNTRIPMountPoint(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
broadcastCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
messages, err := ops.On(broadcastCtx, "task_status")
if err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
count := 0
for m := range messages {
t.Logf("new message: %s", spew.Sdump(m))
count++
}
if e, g := 1, count; g < e {
t.Errorf("expected total messages > %d, got %d", e, g)
}
},
},
}
func TestOperations(t *testing.T, opsFactory OperationsFactoryFunc) {