go-emlid/reach/client/protocol/set_base.go

50 lines
997 B
Go
Raw Permalink Normal View History

2024-07-30 14:28:39 +02:00
package protocol
type SetBaseOptions struct {
Mode *string
AntennaOffset *float64
Latitude *float64
Longitude *float64
Height *float64
}
type SetBaseOptionFunc func(opts *SetBaseOptions)
func NewSetBaseOptions(funcs ...SetBaseOptionFunc) *SetBaseOptions {
opts := &SetBaseOptions{}
for _, fn := range funcs {
fn(opts)
}
return opts
}
func WithBaseMode(value string) SetBaseOptionFunc {
return func(opts *SetBaseOptions) {
opts.Mode = &value
}
}
func WithBaseAntennaOffset(value float64) SetBaseOptionFunc {
return func(opts *SetBaseOptions) {
opts.AntennaOffset = &value
}
}
func WithBaseLatitude(value float64) SetBaseOptionFunc {
return func(opts *SetBaseOptions) {
opts.Latitude = &value
}
}
func WithBaseLongitude(value float64) SetBaseOptionFunc {
return func(opts *SetBaseOptions) {
opts.Longitude = &value
}
}
func WithBaseHeight(value float64) SetBaseOptionFunc {
return func(opts *SetBaseOptions) {
opts.Height = &value
}
}