Use pointers to create partial configuration updates

This commit is contained in:
wpetit 2018-09-25 17:28:12 +02:00
parent 70ddfe49ed
commit 1dcd03e455
1 changed files with 43 additions and 43 deletions

View File

@ -14,26 +14,26 @@ type Configuration struct {
// 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"`
GLONASSARMode *string `mapstructure:"glonass ar mode,omitempty"`
UpdateRate *string `mapstructure:"update rate,omitempty"`
ElevationMaskAngle *string `mapstructure:"elevation mask angle,omitempty"`
MaxHorizontalAcceleration *string `mapstructure:"max horizontal acceleration,omitempty"`
SNRMask *string `mapstructure:"snr mask,omitempty"`
GPSARMode *string `mapstructure:"gps ar mode,omitempty"`
PositionningMode *string `mapstructure:"positioning mode,omitempty"`
PositioningSystems *PositionningSystems `mapstructure:"positioning systems,omitempty"`
MaxVerticalAcceleration string `mapstructure:"max vertical acceleration"`
MaxVerticalAcceleration *string `mapstructure:"max vertical acceleration,omitempty"`
}
// 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"`
GLONASS *bool `mapstructure:"glonass,omitempty"`
SBAS *bool `mapstructure:"sbas,omitempty"`
QZS *bool `mapstructure:"qzs,omitempty"`
QZSS *bool `mapstructure:"qzss,omitempty"`
Compass *bool `mapstructure:"compass,omitempty"`
Galileo *bool `mapstructure:"galileo,omitempty"`
GPS *bool `mapstructure:"gps,omitempty"`
}
// CorrectionInput -
@ -44,16 +44,16 @@ type CorrectionInput struct {
// Input -
type Input struct {
Path string `mapstructure:"path"`
Type string `mapstructure:"type"`
Enabled bool `mapstructure:"enabled"`
Format string `mapstructure:"format"`
Path *string `mapstructure:"path,omitempty"`
Type *string `mapstructure:"type,omitempty"`
Enabled *bool `mapstructure:"enabled,omitempty"`
Format *string `mapstructure:"format,omitempty"`
}
// Input2 -
type Input2 struct {
Input `mapstructure:",squash"`
SendPositionToBase string `mapstructure:"send position to base"`
SendPositionToBase *string `mapstructure:"send position to base,omitempty"`
}
// Input3 -
@ -71,10 +71,10 @@ type PositionOutput struct {
// Output -
type Output struct {
Path string `mapstructure:"path"`
Type string `mapstructure:"type"`
Enabled bool `mapstructure:"enabled"`
Format string `mapstructure:"format"`
Path *string `mapstructure:"path,omitempty"`
Type *string `mapstructure:"type,omitempty"`
Enabled *bool `mapstructure:"enabled,omitempty"`
Format *string `mapstructure:"format,omitempty"`
}
// BaseMode -
@ -86,18 +86,18 @@ type BaseMode struct {
// BaseCoordinates -
type BaseCoordinates struct {
Format string `mapstructure:"format"`
Format *string `mapstructure:"format,omitempty"`
AntennaOffset *AntennaOffset `mapstructure:"antenna offset,omitempty"`
Accumulation string `mapstructure:"accumulation"`
Coordinates []string `mapstructure:"coordinates"`
Mode string `mapstructure:"mode"`
Accumulation *string `mapstructure:"accumulation,omitempty"`
Coordinates *[]string `mapstructure:"coordinates,omitempty"`
Mode *string `mapstructure:"mode,omitempty"`
}
// AntennaOffset -
type AntennaOffset struct {
East string `mapstructure:"east"`
North string `mapstructure:"north"`
Up string `mapstructure:"up"`
East *string `mapstructure:"east,omitempty"`
North *string `mapstructure:"north,omitempty"`
Up *string `mapstructure:"up,omitempty"`
}
// RTCM3Messages -
@ -137,28 +137,28 @@ type Logging struct {
Solution *LoggingService `mapstructure:"solution,omitempty"`
Raw *LoggingService `mapstructure:"raw,omitempty"`
Base *LoggingService `mapstructure:"base,omitempty"`
Overwrite bool `mapstructure:"overwrite"`
Overwrite *bool `mapstructure:"overwrite,omitempty"`
}
// LoggingService -
type LoggingService struct {
Started bool `mapstructure:"started"`
Version string `mapstructure:"version"`
Format string `mapstructure:"format"`
Started *bool `mapstructure:"started,omitempty"`
Version *string `mapstructure:"version,omitempty"`
Format *string `mapstructure:"format,omitempty"`
}
// Bluetooth -
type Bluetooth struct {
Enabled bool `mapstructure:"enabled"`
Discoverable bool `mapstructure:"discoverable"`
Pin int `mapstructure:"pin"`
Enabled *bool `mapstructure:"enabled,omitempty"`
Discoverable *bool `mapstructure:"discoverable,omitempty"`
Pin *int `mapstructure:"pin,omitempty"`
}
// LoRa -
type LoRa struct {
AirRate float64 `mapstructure:"air rate"`
Frequency int `mapstructure:"frequency"`
OutputPower int `mapstructure:"output power"`
AirRate *string `mapstructure:"air rate,omitempty"`
Frequency *float64 `mapstructure:"frequency,omitempty"`
OutputPower *string `mapstructure:"output power,omitempty"`
}
// Constraints -
@ -173,6 +173,6 @@ type LoRaConstraints struct {
// LoRaFrequencyRange -
type LoRaFrequencyRange struct {
Min int `mapstructure:"min"`
Max int `mapstructure:"max"`
Min *int `mapstructure:"min,omitempty"`
Max *int `mapstructure:"max,omitempty"`
}