wifisettings
This commit is contained in:
parent
719cf13f87
commit
e98c479cf3
|
@ -48,24 +48,19 @@ func (api *ApiAliases) cleaner() {
|
|||
count -= 1
|
||||
}
|
||||
}
|
||||
if nodeinfo.Settings != nil {
|
||||
if nodeinfo.Settings.Freq24 != nil {
|
||||
count += 2
|
||||
if alias.Freq24.TxPower == nodeinfo.Settings.Freq24.TxPower {
|
||||
count -= 1
|
||||
}
|
||||
if alias.Freq24.Channel == nodeinfo.Settings.Freq24.Channel {
|
||||
count -= 1
|
||||
}
|
||||
if nodeinfo.Wireless != nil {
|
||||
count += 4
|
||||
if alias.Wireless.Channel24 == nodeinfo.Wireless.Channel24 {
|
||||
count -= 1
|
||||
}
|
||||
if nodeinfo.Settings.Freq5 != nil {
|
||||
count += 2
|
||||
if alias.Freq5.TxPower == nodeinfo.Settings.Freq5.TxPower {
|
||||
count -= 1
|
||||
}
|
||||
if alias.Freq5.Channel == nodeinfo.Settings.Freq5.Channel {
|
||||
count -= 1
|
||||
}
|
||||
if alias.Wireless.TxPower24 == nodeinfo.Wireless.TxPower24 {
|
||||
count -= 1
|
||||
}
|
||||
if alias.Wireless.Channel5 == nodeinfo.Wireless.Channel5 {
|
||||
count -= 1
|
||||
}
|
||||
if alias.Wireless.TxPower5 == nodeinfo.Wireless.TxPower5 {
|
||||
count -= 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package data
|
||||
|
||||
type Frequence struct {
|
||||
TxPower uint32 `json:"txpower"`
|
||||
Channel uint32 `json:"channel"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
Freq24 *Frequence `json:"freq24,omitempty"`
|
||||
Freq5 *Frequence `json:"freq5,omitempty"`
|
||||
type Wireless struct {
|
||||
TxPower24 uint32 `json:"txpower24"`
|
||||
Channel24 uint32 `json:"channel24"`
|
||||
TxPower5 uint32 `json:"txpower5"`
|
||||
Channel5 uint32 `json:"channel5"`
|
||||
}
|
||||
type SwitchPort struct {
|
||||
Speed uint32 `json:"speed"`
|
||||
|
|
|
@ -10,7 +10,7 @@ type NodeInfo struct {
|
|||
Software Software `json:"software"`
|
||||
Hardware Hardware `json:"hardware"`
|
||||
VPN bool `json:"vpn"`
|
||||
Settings *Settings `json:"settings,omitempty"`
|
||||
Wireless *Wireless `json:"wireless,omitempty"`
|
||||
}
|
||||
type BatInterface struct {
|
||||
Interfaces struct {
|
||||
|
|
|
@ -11,10 +11,9 @@ import (
|
|||
)
|
||||
|
||||
type Alias struct {
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Location *data.Location `json:"location,omitempty"`
|
||||
Freq24 *data.Frequence `json:"freq24,omitempty"`
|
||||
Freq5 *data.Frequence `json:"freq5,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Location *data.Location `json:"location,omitempty"`
|
||||
Wireless *data.Wireless `json:"wireless,omitempty"`
|
||||
}
|
||||
|
||||
// Nodes struct: cache DB of Node's structs
|
||||
|
|
|
@ -29,13 +29,11 @@ func GenerateAnsible(nodes *Nodes, aliases map[string]*Alias) *Ansible {
|
|||
Address: node.Nodeinfo.Network.Addresses[0],
|
||||
Hostname: alias.Hostname,
|
||||
}
|
||||
if alias.Freq24 != nil {
|
||||
vars.Channel24 = alias.Freq24.Channel
|
||||
vars.TxPower24 = alias.Freq24.TxPower
|
||||
}
|
||||
if alias.Freq5 != nil {
|
||||
vars.Channel5 = alias.Freq5.Channel
|
||||
vars.TxPower5 = alias.Freq5.TxPower
|
||||
if alias.Wireless != nil {
|
||||
vars.Channel24 = alias.Wireless.Channel24
|
||||
vars.TxPower24 = alias.Wireless.TxPower24
|
||||
vars.Channel5 = alias.Wireless.Channel5
|
||||
vars.TxPower5 = alias.Wireless.TxPower5
|
||||
}
|
||||
if alias.Location != nil {
|
||||
vars.GeoLatitude = alias.Location.Latitude
|
||||
|
|
Loading…
Reference in New Issue