Implements full configuration model
This commit is contained in:
parent
6e9df8d386
commit
1a04caafdf
|
@ -5,35 +5,6 @@ const (
|
|||
eventCurrentConfiguration = "current configuration"
|
||||
)
|
||||
|
||||
// Configuration is a configuration
|
||||
type Configuration struct {
|
||||
RTKSettings *RTKSettings `mapstructure:"rtk settings,omitempty"`
|
||||
}
|
||||
|
||||
// RTKSettings -
|
||||
type RTKSettings struct {
|
||||
GLONASSARMode string `mapstructure:"glonass ar mode"`
|
||||
UpdateRate string `mapstructure:"update rate"`
|
||||
ElevationMaskAngle string `mapstructure:"elevation mask angle"`
|
||||
MaxHorizontalAcceleration string `mapstructure:"max horizontal acceleration"`
|
||||
SNRMask string `mapstructure:"snr mask"`
|
||||
GPSARMode string `mapstructure:"gps ar mode"`
|
||||
PositionningMode string `mapstructure:"positioning mode"`
|
||||
PositioningSystems *PositionningSystems `mapstructure:"positioning systems,omitempty"`
|
||||
MaxVerticalAcceleration string `mapstructure:"max vertical acceleration"`
|
||||
}
|
||||
|
||||
// PositionningSystems -
|
||||
type PositionningSystems struct {
|
||||
GLONASS bool `json:"glonass"`
|
||||
SBAS bool `json:"sbas"`
|
||||
QZS bool `json:"qzs"`
|
||||
QZSS bool `json:"qzss"`
|
||||
Compass bool `json:"compass"`
|
||||
Galileo bool `json:"galileo"`
|
||||
GPS bool `json:"gps"`
|
||||
}
|
||||
|
||||
// Configuration fetches and return the current configuration of the ReachRS module
|
||||
func (r *Client) Configuration() (*Configuration, error) {
|
||||
configuration := &Configuration{}
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
package reachview
|
||||
|
||||
// Configuration -
|
||||
type Configuration struct {
|
||||
RTKSettings *RTKSettings `mapstructure:"rtk settings,omitempty"`
|
||||
CorrectionInput *CorrectionInput `mapstructure:"correction input,omitempty"`
|
||||
PositionOutput *PositionOutput `mapstructure:"position output,omitempty"`
|
||||
BaseMode *BaseMode `mapstructure:"base mode,omitempty"`
|
||||
Logging *Logging `mapstructure:"logging,omitempty"`
|
||||
Bluetooth *Bluetooth `mapstructure:"bluetooth,omitempty"`
|
||||
LoRa *LoRa `mapstructure:"lora,omitempty"`
|
||||
Constraints *Constraints `mapstructure:"constraints,omitempty"`
|
||||
}
|
||||
|
||||
// RTKSettings -
|
||||
type RTKSettings struct {
|
||||
GLONASSARMode string `mapstructure:"glonass ar mode"`
|
||||
UpdateRate string `mapstructure:"update rate"`
|
||||
ElevationMaskAngle string `mapstructure:"elevation mask angle"`
|
||||
MaxHorizontalAcceleration string `mapstructure:"max horizontal acceleration"`
|
||||
SNRMask string `mapstructure:"snr mask"`
|
||||
GPSARMode string `mapstructure:"gps ar mode"`
|
||||
PositionningMode string `mapstructure:"positioning mode"`
|
||||
PositioningSystems *PositionningSystems `mapstructure:"positioning systems,omitempty"`
|
||||
MaxVerticalAcceleration string `mapstructure:"max vertical acceleration"`
|
||||
}
|
||||
|
||||
// PositionningSystems -
|
||||
type PositionningSystems struct {
|
||||
GLONASS bool `mapstructure:"glonass"`
|
||||
SBAS bool `mapstructure:"sbas"`
|
||||
QZS bool `mapstructure:"qzs"`
|
||||
QZSS bool `mapstructure:"qzss"`
|
||||
Compass bool `mapstructure:"compass"`
|
||||
Galileo bool `mapstructure:"galileo"`
|
||||
GPS bool `mapstructure:"gps"`
|
||||
}
|
||||
|
||||
// CorrectionInput -
|
||||
type CorrectionInput struct {
|
||||
Input2 *Input2 `mapstructure:"input2,omitempty"`
|
||||
Input3 *Input3 `mapstructure:"input3,omitempty"`
|
||||
}
|
||||
|
||||
// Input -
|
||||
type Input struct {
|
||||
Path string `mapstructure:"path"`
|
||||
Type string `mapstructure:"type"`
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
Format string `mapstructure:"format"`
|
||||
}
|
||||
|
||||
// Input2 -
|
||||
type Input2 struct {
|
||||
Input `mapstructure:",squash"`
|
||||
SendPositionToBase string `mapstructure:"send position to base"`
|
||||
}
|
||||
|
||||
// Input3 -
|
||||
type Input3 struct {
|
||||
Input `mapstructure:",squash"`
|
||||
}
|
||||
|
||||
// PositionOutput -
|
||||
type PositionOutput struct {
|
||||
Output1 *Output `mapstructure:"output1,omitempty"`
|
||||
Output2 *Output `mapstructure:"output2,omitempty"`
|
||||
Output3 *Output `mapstructure:"output3,omitempty"`
|
||||
Output4 *Output `mapstructure:"output4,omitempty"`
|
||||
}
|
||||
|
||||
// Output -
|
||||
type Output struct {
|
||||
Path string `mapstructure:"path"`
|
||||
Type string `mapstructure:"type"`
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
Format string `mapstructure:"format"`
|
||||
}
|
||||
|
||||
// BaseMode -
|
||||
type BaseMode struct {
|
||||
Output *Output `mapstructure:"output,omitempty"`
|
||||
BaseCoordinates *BaseCoordinates `mapstructure:"base coordinates,omitempty"`
|
||||
RTCM3Messages *RTCM3Messages `mapstructure:"rtcm3 messages,omitempty"`
|
||||
}
|
||||
|
||||
// BaseCoordinates -
|
||||
type BaseCoordinates struct {
|
||||
Format string `mapstructure:"format"`
|
||||
AntennaOffset *AntennaOffset `mapstructure:"antenna offset,omitempty"`
|
||||
Accumulation string `mapstructure:"accumulation"`
|
||||
Coordinates []string `mapstructure:"coordinates"`
|
||||
Mode string `mapstructure:"mode"`
|
||||
}
|
||||
|
||||
// AntennaOffset -
|
||||
type AntennaOffset struct {
|
||||
East string `mapstructure:"east"`
|
||||
North string `mapstructure:"north"`
|
||||
Up string `mapstructure:"up"`
|
||||
}
|
||||
|
||||
// RTCM3Messages -
|
||||
type RTCM3Messages struct {
|
||||
// GPS L1 code and phase and ambiguities and carrier-to-noise ratio
|
||||
Type1002 *RTCMMessageType `mapstructure:"1002,omitemtpy"`
|
||||
// Station coordinates XYZ for antenna reference point and antenna height.
|
||||
Type1006 *RTCMMessageType `mapstructure:"1006,omitemtpy"`
|
||||
// Antenna serial number.
|
||||
Type1008 *RTCMMessageType `mapstructure:"1008,omitemtpy"`
|
||||
// GLONASS L1 code and phase and ambiguities and carrier-to-noise ratio.
|
||||
Type1010 *RTCMMessageType `mapstructure:"1010,omitemtpy"`
|
||||
// GPS ephemeris.
|
||||
Type1019 *RTCMMessageType `mapstructure:"1019,omitemtpy"`
|
||||
// GLONASS ephemeris.
|
||||
Type1020 *RTCMMessageType `mapstructure:"1020,omitemtpy"`
|
||||
// The type 7 Multiple Signal Message format for Europe’s Galileo system
|
||||
Type1097 *RTCMMessageType `mapstructure:"1097,omitemtpy"`
|
||||
// Full SBAS pseudo-ranges, carrier phases, Doppler and signal strength (high resolution)
|
||||
Type1107 *RTCMMessageType `mapstructure:"1107,omitemtpy"`
|
||||
// Full QZSS pseudo-ranges, carrier phases, Doppler and signal strength (high resolution)
|
||||
Type1117 *RTCMMessageType `mapstructure:"1117,omitemtpy"`
|
||||
// Full BeiDou pseudo-ranges, carrier phases, Doppler and signal strength (high resolution)
|
||||
Type1127 *RTCMMessageType `mapstructure:"1127,omitemtpy"`
|
||||
}
|
||||
|
||||
// RTCMMessageType -
|
||||
type RTCMMessageType struct {
|
||||
Frequency string `mapstructure:"frequency"`
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
}
|
||||
|
||||
// Logging -
|
||||
type Logging struct {
|
||||
Correction *LoggingService `mapstructure:"correction,omitempty"`
|
||||
Interval int `mapstructure:"interval"`
|
||||
Solution *LoggingService `mapstructure:"solution,omitempty"`
|
||||
Raw *LoggingService `mapstructure:"raw,omitempty"`
|
||||
Base *LoggingService `mapstructure:"base,omitempty"`
|
||||
Overwrite bool `mapstructure:"overwrite"`
|
||||
}
|
||||
|
||||
// LoggingService -
|
||||
type LoggingService struct {
|
||||
Started bool `mapstructure:"started"`
|
||||
Version string `mapstructure:"version"`
|
||||
Format string `mapstructure:"format"`
|
||||
}
|
||||
|
||||
// Bluetooth -
|
||||
type Bluetooth struct {
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
Discoverable bool `mapstructure:"discoverable"`
|
||||
Pin int `mapstructure:"pin"`
|
||||
}
|
||||
|
||||
// LoRa -
|
||||
type LoRa struct {
|
||||
AirRate float64 `mapstructure:"air rate"`
|
||||
Frequency int `mapstructure:"frequency"`
|
||||
OutputPower int `mapstructure:"output power"`
|
||||
}
|
||||
|
||||
// Constraints -
|
||||
type Constraints struct {
|
||||
LoRa *LoRaConstraints `mapstructure:"lora,omitempty"`
|
||||
}
|
||||
|
||||
// LoRaConstraints -
|
||||
type LoRaConstraints struct {
|
||||
Frequency *LoRaFrequencyRange `mapstructure:"frequency,omitempty"`
|
||||
}
|
||||
|
||||
// LoRaFrequencyRange -
|
||||
type LoRaFrequencyRange struct {
|
||||
Min int `mapstructure:"min"`
|
||||
Max int `mapstructure:"max"`
|
||||
}
|
|
@ -4,6 +4,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"forge.cadoles.com/Pyxis/orion/emlid"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
)
|
||||
|
||||
func TestReachViewConfiguration(t *testing.T) {
|
||||
|
@ -33,6 +34,8 @@ func TestReachViewConfiguration(t *testing.T) {
|
|||
t.Fatal("config.RTKSettings should not be nil")
|
||||
}
|
||||
|
||||
spew.Dump(config)
|
||||
|
||||
defer client.Close()
|
||||
|
||||
}
|
||||
|
|
Reference in New Issue