func (c *Conn) SendCommandInt(command ...string) (int, error) {
	resp, err := c.SendCommand(command...)
	if err != nil {
		return 0, err
	}
	i, err := strconv.Atoi(strings.TrimSpace(resp))
	if err != nil {
		return 0, err
	}
	return i, nil
}
SendCommandInt will send a command where the response is expected to be an integer
package wireless
import (
	"context"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net"
	"os"
	"strconv"
	"strings"
	"time"
)
type Conn struct {
	Interface string
	lsockname              string
	conn                   *net.UnixConn
	currentCommandResponse chan string
	subs []*Subscription
	log  *log.Logger
	quit chan bool
}
func Dial(iface string) (*Conn, error) {
	c := &Conn{Interface: iface, log: log.New(ioutil.Discard, "", log.LstdFlags)}
	err := c.init()
	if err != nil {
		return nil, err
	}
	return c, nil
}
func (c *Conn) WithLogOutput(w io.Writer) {
	c.log.SetOutput(w)
}
func (c *Conn) Close() error {
	close(c.quit)
	c.conn.Close()
	return os.Remove(c.lsockname)
}
func (c *Conn) listen() {
	buf := make([]byte, 2048)
	for {
		select {
		case <-c.quit:
			return
		default:
			bytesRead, err := c.conn.Read(buf)
			c.processMessage(bytesRead, buf, err)
		}
	}
}
func (c *Conn) processMessage(bytesRead int, data []byte, err error) {
	if err != nil {
		if !IsUseOfClosedNetworkConnectionError(err) {
			c.log.Println("Error:", err)
		}
		return
	}
	msg := string(data[:bytesRead])
	if msg[0] != '<' {
		c.currentCommandResponse <- msg
		return
	}
	var ev Event
	if strings.Index(msg, "<3>CTRL-") == 0 {
		ev, err = NewEventFromMsg(msg)
		if err != nil {
			c.log.Println("Error:", err)
			return
		}
	} else {
		ev.Name = "logs"
		ev.Arguments = map[string]string{"msg": msg[3:]}
	}
	c.publishEvent(ev)
}
func (c *Conn) init() error {
	addr, err := net.ResolveUnixAddr("unixgram", "/var/run/wpa_supplicant/"+c.Interface)
	if err != nil {
		return err
	}
	c.lsockname = fmt.Sprintf("/tmp/wpa_ctrl_%d", os.Getpid())
	laddr, err := net.ResolveUnixAddr("unixgram", c.lsockname)
	if err != nil {
		return err
	}
	c.conn, err = net.DialUnix("unixgram", laddr, addr)
	if err != nil {
		return err
	}
	c.log.Println("Local addr: ", c.conn.LocalAddr())
	c.currentCommandResponse = make(chan string, 1)
	c.quit = make(chan bool)
	go c.listen()
	err = c.SendCommandBool("ATTACH")
	if err != nil {
		return err
	}
	return nil  
}
func (c *Conn) SendCommand(command ...string) (string, error) {
	ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
	defer cancel()
	return c.SendCommandWithContext(ctx, command...)
}
func (c *Conn) SendCommandWithContext(ctx context.Context, command ...string) (string, error) {
	c.log.Println("<<<", command)
	_, err := c.conn.Write([]byte(strings.Join(command, " ")))
	if err != nil {
		return "", err
	}
	for {
		select {
		case resp := <-c.currentCommandResponse:
			c.log.Println(">>>", resp)
			return resp, nil
		case <-ctx.Done():
			return "", ErrCmdTimeout
		}
	}
}
func (c *Conn) SendCommandBool(command ...string) error {
	resp, err := c.SendCommand(command...)
	if err != nil {
		return err
	}
	if resp != "OK\n" {
		return errors.New(resp)
	}
	return nil
}