This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
3 changed files with
104 additions and
2 deletions
|
|
@ -66,12 +66,12 @@ func TestReachViewApplyConfiguration(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
config.RTKSettings.PositionningMode = String("single")
|
|
|
|
config.RTKSettings.PositionningMode = String("single")
|
|
|
|
|
|
|
|
|
|
|
|
ctx, applyConfCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
|
|
ctx, applyConfCancel := context.WithTimeout(context.Background(), 10*time.Second)
|
|
|
|
defer applyConfCancel()
|
|
|
|
defer applyConfCancel()
|
|
|
|
|
|
|
|
|
|
|
|
result, config, err := client.ApplyConfiguration(ctx, config)
|
|
|
|
result, config, err := client.ApplyConfiguration(ctx, config)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if config == nil {
|
|
|
|
if config == nil {
|
|
|
|
|
|
@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
package reachview
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
|
|
eventCreateProject = "create project"
|
|
|
|
|
|
|
|
eventProjectCreated = "project created"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type ProjectID string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type Project struct {
|
|
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
|
|
Author string `json:"author"`
|
|
|
|
|
|
|
|
Comment string `json:"comment"`
|
|
|
|
|
|
|
|
Projection string `json:"projection"`
|
|
|
|
|
|
|
|
Length int `json:"length"`
|
|
|
|
|
|
|
|
Requirements *ProjectRequirements `json:"requirements"`
|
|
|
|
|
|
|
|
AntennaHeight string `json:"antenna height"`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type ProjectRequirements struct {
|
|
|
|
|
|
|
|
Fix *ProjectRequirementsEntry `json:"FIX"`
|
|
|
|
|
|
|
|
Float *ProjectRequirementsEntry `json:"FLOAT"`
|
|
|
|
|
|
|
|
Single *ProjectRequirementsEntry `json:"SINGLE"`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type ProjectRequirementsEntry struct {
|
|
|
|
|
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
|
|
|
|
DOP string `json:"DOP"`
|
|
|
|
|
|
|
|
Time int `json:"time"`
|
|
|
|
|
|
|
|
LateralRMS float64 `json:"lateral rms"`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Client) CreateProject(ctx context.Context, project *Project) (ProjectID, error) {
|
|
|
|
|
|
|
|
var projectID ProjectID
|
|
|
|
|
|
|
|
err := c.ReqResp(ctx, eventCreateProject, project, eventProjectCreated, &projectID)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return projectID, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return projectID, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Client) ListProjects() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Client) OpenProject(id ProjectID) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Client) DeleteProject() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Client) CloseProject() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
package reachview
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"forge.cadoles.com/Pyxis/orion/emlid"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestReachViewProjectCRUD(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if !*runReachViewIntegrationTests {
|
|
|
|
|
|
|
|
t.Skip("To run this test, use: go test -reachview-integration")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
client := NewClient(
|
|
|
|
|
|
|
|
emlid.WithStandardLogger(),
|
|
|
|
|
|
|
|
emlid.WithEndpoint(*reachHost, 80),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
if err := client.Connect(); err != nil {
|
|
|
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctx, cancelCreateProject := context.WithTimeout(context.Background(), 5*time.Second)
|
|
|
|
|
|
|
|
defer cancelCreateProject()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
project := &Project{
|
|
|
|
|
|
|
|
Name: fmt.Sprintf("Test-%d", time.Now().Unix()),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
projectID, err := client.CreateProject(ctx, project)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Error(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if projectID == "" {
|
|
|
|
|
|
|
|
t.Errorf("projectID should not be empty")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer client.Close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|