Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
penguinpowernz committed Feb 28, 2020
1 parent 46c02a3 commit 92b17c7
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Requires a running wpa_supplicant with control interface at `/var/run/wpa_suppli

# Usage

[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/theojulienne/go-wireless)

Get a list of wifi cards attached:

```golang
Expand All @@ -29,7 +31,23 @@ nets, err := wc.Networks()
fmt.Println(nets, err)
```

Subsscibe to events:
Connect to networks:

```golang
net := NewNetwork("FBI Surveillance Van #4", "secretpass")
net, err := wc.Connect(net)
```

Disable networks:

```golang
nets, err:= wc.Networks()
net, err := nets.Find("FBI Surveillance Van #4")
net.Disable(true)
net, err := wc.UpdateNetwork(net)
```

Subscribe to events:

```golang
sub := wc.Subscribe(wireless.EventConnected, wireless.EventAuthReject, wireless.EventDisconnected)
Expand All @@ -45,6 +63,13 @@ switch ev.Name {
}
```

Check the status of the connection:

```golang
st, err := wc.Status()
fmt.Printf("%+v\n", st)
```

# API

There is an API that can be used with [gin](https://github.com/gin-gonic/gin):
Expand Down

0 comments on commit 92b17c7

Please sign in to comment.