Upgrade to ReachView v2.24.0

This commit is contained in:
2020-11-23 11:15:30 +01:00
parent b8a07953dd
commit e06aa5129a
16 changed files with 260 additions and 103 deletions

View File

@ -1,15 +1,18 @@
// Package updater provides an API to communicate with the ReachRS modules "Updater" application
package updater
import "forge.cadoles.com/Pyxis/orion/emlid"
import (
"forge.cadoles.com/Pyxis/orion/emlid"
"forge.cadoles.com/Pyxis/orion/emlid/common"
)
// Client is a ReachRS Updater client
type Client struct {
*emlid.Client
*common.Client
}
// NewClient returns a new ReachRS Updater client
func NewClient(opts ...emlid.OptionFunc) *Client {
client := emlid.NewClient(opts...)
client := common.NewClient(opts...)
return &Client{client}
}

View File

@ -1,21 +0,0 @@
package updater
import "context"
const (
eventGetReachViewVersion = "get reachview version"
eventReachViewVersionResults = "current reachview version"
)
type reachViewVersion struct {
Version string `json:"version"`
}
// ReachViewVersion returns the ReachRS module ReachView version
func (c *Client) ReachViewVersion(ctx context.Context) (string, error) {
res := &reachViewVersion{}
if err := c.ReqResp(ctx, eventGetReachViewVersion, nil, eventReachViewVersionResults, res); err != nil {
return "", err
}
return res.Version, nil
}

View File

@ -1,37 +0,0 @@
package updater
import (
"context"
"testing"
"time"
"forge.cadoles.com/Pyxis/orion/emlid"
)
func TestClientReachViewVersion(t *testing.T) {
if !*runUpdaterIntegrationTests {
t.Skip("To run this test, use: go test -updater-integration")
}
client := NewClient(
emlid.WithStandardLogger(),
emlid.WithEndpoint(*reachHost, 80),
)
if err := client.Connect(); err != nil {
t.Fatal(err)
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
version, err := client.ReachViewVersion(ctx)
if err != nil {
t.Error(err)
}
if version == "" {
t.Error("version should not be empty")
}
defer client.Close()
}