Skip to content

Commit cf51caa

Browse files
ansoni-sanaykevl
authored andcommitted
gap/windows: Scan should set scanning mode to active to match other platforms
1 parent 8260f2f commit cf51caa

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

gap_windows.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ func (a *Adapter) Scan(callback func(*Adapter, ScanResult)) (err error) {
3636
a.watcher = nil
3737
}()
3838

39+
// Set scanning mode to active so we receive scan responses
40+
// from devices in advertising mode
41+
err = a.watcher.SetScanningMode(advertisement.BluetoothLEScanningModeActive)
42+
if err != nil {
43+
return
44+
}
45+
3946
// Listen for incoming BLE advertisement packets.
4047
// We need a TypedEventHandler<TSender, TResult> to listen to events, but since this is a parameterized delegate
4148
// its GUID depends on the classes used as sender and result, so we need to compute it:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/go-ole/go-ole v1.2.6
77
github.com/godbus/dbus/v5 v5.0.3
88
github.com/muka/go-bluetooth v0.0.0-20220830075246-0746e3a1ea53
9-
github.com/saltosystems/winrt-go v0.0.0-20230124093143-967a889c6c8f
9+
github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761
1010
github.com/sirupsen/logrus v1.9.0 // indirect
1111
github.com/tinygo-org/cbgo v0.0.4
1212
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
3636
github.com/sago35/go-bdf v0.0.0-20200313142241-6c17821c91c4/go.mod h1:rOebXGuMLsXhZAC6mF/TjxONsm45498ZyzVhel++6KM=
3737
github.com/saltosystems/winrt-go v0.0.0-20230124093143-967a889c6c8f h1:sxsy5XkcxSzkiUkYgx38V9JviWLL8wthO2TURCi0Lcs=
3838
github.com/saltosystems/winrt-go v0.0.0-20230124093143-967a889c6c8f/go.mod h1:UvKm1lyhg+8ehk99i8g5Q7AX1LXUJgks0lRyAkG/ahQ=
39+
github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761 h1:xEscoMxTrGSpdho1mP9VnGsK0DGhXKwm0qP7kYcjgrI=
40+
github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761/go.mod h1:UvKm1lyhg+8ehk99i8g5Q7AX1LXUJgks0lRyAkG/ahQ=
3941
github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=
4042
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
4143
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=

0 commit comments

Comments
 (0)