-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
288 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,44 @@ | ||
module github.com/yasuoza/switchbot | ||
module github.com/yasuoza/switchbot-ble-go/v2 | ||
|
||
go 1.14 | ||
go 1.17 | ||
|
||
require ( | ||
github.com/JuulLabs-OSS/ble v0.0.0-20200716215611-d4fcc9d598bb | ||
github.com/cenkalti/backoff/v4 v4.1.1 | ||
github.com/mitchellh/cli v1.1.2 | ||
github.com/olekukonko/tablewriter v0.0.5 | ||
github.com/yasuoza/switchbot v0.3.3 | ||
tinygo.org/x/bluetooth v0.3.0 | ||
) | ||
|
||
require ( | ||
github.com/JuulLabs-OSS/cbgo v0.0.2 // indirect | ||
github.com/Masterminds/goutils v1.1.0 // indirect | ||
github.com/Masterminds/semver v1.5.0 // indirect | ||
github.com/Masterminds/sprig v2.22.0+incompatible // indirect | ||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 // indirect | ||
github.com/bgentry/speakeasy v0.1.0 // indirect | ||
github.com/fatih/color v1.7.0 // indirect | ||
github.com/fatih/structs v1.1.0 // indirect | ||
github.com/go-ole/go-ole v1.2.4 // indirect | ||
github.com/godbus/dbus/v5 v5.0.3 // indirect | ||
github.com/google/uuid v1.1.2 // indirect | ||
github.com/hashicorp/errwrap v1.0.0 // indirect | ||
github.com/hashicorp/go-multierror v1.0.0 // indirect | ||
github.com/huandu/xstrings v1.3.2 // indirect | ||
github.com/imdario/mergo v0.3.11 // indirect | ||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect | ||
github.com/mattn/go-colorable v0.1.6 // indirect | ||
github.com/mattn/go-isatty v0.0.12 // indirect | ||
github.com/mattn/go-runewidth v0.0.9 // indirect | ||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect | ||
github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab // indirect | ||
github.com/mitchellh/copystructure v1.0.0 // indirect | ||
github.com/mitchellh/reflectwalk v1.0.0 // indirect | ||
github.com/muka/go-bluetooth v0.0.0-20200619025933-f6113f7141c5 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/posener/complete v1.1.1 // indirect | ||
github.com/sirupsen/logrus v1.6.0 // indirect | ||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect | ||
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package switchbot_test | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"time" | ||
|
||
"github.com/yasuoza/switchbot-ble-go/v2/pkg/switchbot" | ||
) | ||
|
||
func Example_press() { | ||
ctx := context.Background() | ||
timeout := 5 * time.Second | ||
|
||
// First, connect to SwitchBot. | ||
addr := "A0:00:0A:AA:00:00" | ||
log.Printf("Connecting to SwitchBot %s\n", addr) | ||
bot, err := switchbot.Connect(ctx, addr, timeout) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Trigger Press. | ||
log.Printf("Connected to SwitchBot %s. Trigger Press\n", addr) | ||
bot.Press(false) | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.