func (cl *Client) GetNetworkAttr(id int, attr string) (string, error) {
	s, err := cl.conn.SendCommand(CmdGetNetwork, strconv.Itoa(id), attr)
	if err != nil {
		return s, err
	}
	return strings.TrimSpace(s), nil
}
GetNetworkAttr will get the given attribute of the given network
package wireless
import (
	"errors"
	"io"
	"strconv"
	"strings"
	"time"
)
type WPAConn interface {
	SendCommand(...string) (string, error)
	SendCommandBool(...string) error
	SendCommandInt(...string) (int, error)
	io.Closer
	Subscribe(...string) *Subscription
}
type Client struct {
	conn WPAConn
}
func NewClient(iface string) (c *Client, err error) {
	c = new(Client)
	c.conn, err = Dial(iface)
	if err != nil {
		return
	}
	return
}
func NewClientFromConn(conn WPAConn) (c *Client) {
	c.conn = conn
	return
}
func (cl *Client) Close() {
	cl.conn.Close()
}
func (cl *Client) Conn() *Conn {
	return cl.conn.(*Conn)
}
func (cl *Client) Subscribe(topics ...string) *Subscription {
	return cl.conn.Subscribe(topics...)
}
func (cl *Client) Status() (State, error) {
	data, err := cl.conn.SendCommand(CmdStatus)
	if err != nil {
		return State{}, err
	}
	s := NewState(data)
	return s, nil
}
func (cl *Client) Scan() (nets APs, err error) {
	err = cl.conn.SendCommandBool(CmdScan)
	if err != nil {
		return
	}
	results := cl.conn.Subscribe(EventScanResults)
	failed := cl.conn.Subscribe(EventScanFailed)
	func() {
		for {
			select {
			case <-failed.Next():
				err = ErrScanFailed
				return
			case <-results.Next():
				return
			case <-time.NewTimer(time.Second * 2).C:
				return
			}
		}
	}()
	scanned, err := cl.conn.SendCommand(CmdScanResults)
	if err != nil {
		return
	}
	return parseAP([]byte(scanned))
}
func (cl *Client) Networks() (nets Networks, err error) {
	data, err := cl.conn.SendCommand(CmdListNetworks)
	if err != nil {
		return nil, err
	}
	nets, err = parseNetwork([]byte(data))
	if err != nil {
		return nil, err
	}
	for i := range nets {
		nets[i].Known = true
		(&nets[i]).populateAttrs(cl)
	}
	return nets, nil
}
func (cl *Client) Connect(net Network) (Network, error) {
	net, err := cl.AddOrUpdateNetwork(net)
	if err != nil {
		return net, err
	}
	sub := cl.conn.Subscribe(EventNetworkNotFound, EventAuthReject, EventConnected, EventDisconnected, EventAssocReject)
	if err := cl.EnableNetwork(net.ID); err != nil {
		return net, err
	}
	ev := <-sub.Next()
	switch ev.Name {
	case EventConnected:
		return net, cl.SaveConfig()
	case EventNetworkNotFound:
		return net, ErrSSIDNotFound
	case EventAuthReject:
		return net, ErrAuthFailed
	case EventDisconnected:
		return net, ErrDisconnected
	case EventAssocReject:
		return net, ErrAssocRejected
	}
	return net, errors.New("failed to catch event " + ev.Name)
}
func (cl *Client) AddOrUpdateNetwork(net Network) (Network, error) {
	if net.IDStr != "" {
		nets, err := cl.Networks()
		if err != nil {
			return net, err
		}
		for _, n := range nets {
			if n.IDStr == net.IDStr {
				return cl.UpdateNetwork(net)
			}
		}
	}
	return cl.AddNetwork(net)
}
func (cl *Client) UpdateNetwork(net Network) (Network, error) {
	if net.IDStr == "" {
		return net, ErrNoIdentifier
	}
	for _, cmd := range setCmds(net) {
		if err := cl.conn.SendCommandBool(cmd); err != nil {
			return net, err
		}
	}
	return net, nil
}
func (cl *Client) AddNetwork(net Network) (Network, error) {
	i, err := cl.conn.SendCommandInt(CmdAddNetwork)
	if err != nil {
		return net, err
	}
	net.ID = i
	if net.IDStr == "" {
		net.IDStr = net.SSID
	}
	for _, cmd := range setCmds(net) {
		if err := cl.conn.SendCommandBool(cmd); err != nil {
			return net, err
		}
	}
	net.Known = true
	return net, nil
}
func (cl *Client) RemoveNetwork(id int) error {
	return cl.conn.SendCommandBool(CmdRemoveNetwork, strconv.Itoa(id))
}
func (cl *Client) EnableNetwork(id int) error {
	return cl.conn.SendCommandBool(CmdEnableNetwork + " " + strconv.Itoa(id))
}
func (cl *Client) DisableNetwork(id int) error {
	return cl.conn.SendCommandBool(CmdDisableNetwork + " " + strconv.Itoa(id))
}
func (cl *Client) SaveConfig() error {
	return cl.conn.SendCommandBool(CmdSaveConfig)
}
func (cl *Client) LoadConfig() error {
	return cl.conn.SendCommandBool(CmdReconfigure)
}