Compare commits

..

7 Commits

5 changed files with 28 additions and 47 deletions

0
.env
View File

View File

@ -17,14 +17,12 @@ var (
host string = "192.168.42.1" host string = "192.168.42.1"
filter string = "" filter string = ""
rawLogLevel string = "ERROR" rawLogLevel string = "ERROR"
messageType string = "broadcast"
) )
func init() { func init() {
flag.StringVar(&rawLogLevel, "log-level", rawLogLevel, "log level") flag.StringVar(&rawLogLevel, "log-level", rawLogLevel, "log level")
flag.StringVar(&host, "host", host, "the reachrs module host") flag.StringVar(&host, "host", host, "the reachrs module host")
flag.StringVar(&filter, "filter", filter, "filter the socket messages by name") flag.StringVar(&filter, "filter", filter, "filter the broadcast messages by name")
flag.StringVar(&messageType, "messageType", messageType, "socket messages by name")
} }
func main() { func main() {
@ -53,7 +51,7 @@ func main() {
} }
}() }()
broadcasts, err := reach.OnMessageType(ctx, client, messageType) broadcasts, err := reach.OnBroadcast(ctx, client)
if err != nil { if err != nil {
fmt.Printf("[FATAL] %+v", errors.WithStack(err)) fmt.Printf("[FATAL] %+v", errors.WithStack(err))
os.Exit(1) os.Exit(1)

View File

@ -2,7 +2,6 @@ package testsuite
import ( import (
"context" "context"
"fmt"
"math" "math"
"math/rand" "math/rand"
"os" "os"
@ -241,6 +240,30 @@ var testCases = []operationTestCase{
}, },
}, },
{
Name: "AveragePosition",
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))
}
}()
taskmessage, err := ops.AveragePosition(ctx)
if err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
t.Logf("Task Message : %s", taskmessage)
},
},
{ {
Name: "SetBaseModeAveragePosition", Name: "SetBaseModeAveragePosition",
Run: func(t *testing.T, ops protocol.Operations) { Run: func(t *testing.T, ops protocol.Operations) {
@ -266,7 +289,7 @@ var testCases = []operationTestCase{
protocol.WithBaseLongitude(longitude), protocol.WithBaseLongitude(longitude),
protocol.WithBaseHeight(height), protocol.WithBaseHeight(height),
protocol.WithBaseAntennaOffset(antennaOffset), protocol.WithBaseAntennaOffset(antennaOffset),
protocol.WithBaseMode(fmt.Sprintf("%s-and-hold", "fix")), protocol.WithBaseMode("fix-and-hold"),
} }
if err := ops.SetBase(ctx, opts...); err != nil { if err := ops.SetBase(ctx, opts...); err != nil {
@ -332,30 +355,6 @@ var testCases = []operationTestCase{
}, },
}, },
{
Name: "AveragePosition",
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))
}
}()
taskmessage, err := ops.AveragePosition(ctx)
if err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
fmt.Println(taskmessage)
},
},
{ {
Name: "GetNTRIPMountPoint", Name: "GetNTRIPMountPoint",
Run: func(t *testing.T, ops protocol.Operations) { Run: func(t *testing.T, ops protocol.Operations) {

View File

@ -1,16 +0,0 @@
package testsuite
import (
"testing"
"forge.cadoles.com/cadoles/go-emlid/reach/client"
"forge.cadoles.com/cadoles/go-emlid/reach/client/protocol"
)
func TestReachOperations(t *testing.T) {
opsFactory := func(addr string) (protocol.Operations, error) {
return client.NewClient(addr), nil
}
TestOperations(t, opsFactory)
}

View File

@ -347,7 +347,7 @@ func (o *Operations) SetBaseCorrections(ctx context.Context, funcs ...protocol.S
} }
config := &model.IOConfig{ config := &model.IOConfig{
// todo parametrage du type ???? // todo parametrage du type
IOType: "ntripcli", IOType: "ntripcli",
Settings: model.IOConfigSettings{ Settings: model.IOConfigSettings{
NTRIPCli: model.NTRIPCliConfig{ NTRIPCli: model.NTRIPCliConfig{