add micro controller for clients - right interface

This commit is contained in:
Martin Geno 2017-07-08 19:54:43 +02:00
parent a683b6b1ac
commit 37cf186d32
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
1 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ import (
) )
const ( const (
maxDB = 80 maxDB = -75
) )
type Controller struct { type Controller struct {
@ -49,7 +49,7 @@ func (c *Controller) Close() {
} }
func (c *Controller) tick() { func (c *Controller) tick() {
c.sshMgmt.RunEverywhere("if [ \"$(uci get wireless.radio0.hwmode | grep -c a)\" -ne 0 ]; then echo \"radio0\"; elif [ \"$(uci get wireless.radio1.hwmode | grep -c a)\" -ne 0 ]; then echo \"radio1\"; fi", ssh.SSHResultToStringHandler(func(ip string, iface string, err error) { c.sshMgmt.RunEverywhere("if [ \"$(uci get wireless.radio0.hwmode | grep -c a)\" -ne 0 ]; then echo \"client0\"; elif [ \"$(uci get wireless.radio1.hwmode | grep -c a)\" -ne 0 ]; then echo \"client1\"; fi", ssh.SSHResultToStringHandler(func(ip string, iface string, err error) {
if err != nil { if err != nil {
return return
} }
@ -68,7 +68,7 @@ func (c *Controller) tick() {
c.no24Ghz[mac] = true c.no24Ghz[mac] = true
if db > maxDB { if db < maxDB {
node, ok := c.node[ip] node, ok := c.node[ip]
if !ok { if !ok {
@ -91,7 +91,7 @@ func (c *Controller) tick() {
})) }))
c.sshMgmt.RunEverywhere("if [ \"$(uci get wireless.radio0.hwmode | grep -c g)\" -ne 0 ]; then echo \"radio0\"; elif [ \"$(uci get wireless.radio1.hwmode | grep -c g)\" -ne 0 ]; then echo \"radio1\"; fi", ssh.SSHResultToStringHandler(func(ip string, iface string, err error) { c.sshMgmt.RunEverywhere("if [ \"$(uci get wireless.radio0.hwmode | grep -c g)\" -ne 0 ]; then echo \"client0\"; elif [ \"$(uci get wireless.radio1.hwmode | grep -c g)\" -ne 0 ]; then echo \"client1\"; fi", ssh.SSHResultToStringHandler(func(ip string, iface string, err error) {
if err != nil { if err != nil {
return return
} }
@ -115,7 +115,7 @@ func (c *Controller) tick() {
c.sshMgmt.ExecuteOn(addr, cmd) c.sshMgmt.ExecuteOn(addr, cmd)
} }
if db > maxDB { if db < maxDB {
node, ok := c.node[ip] node, ok := c.node[ip]
if !ok { if !ok {