diff --git a/modules/ble_options_darwin.go b/modules/ble_options_darwin.go deleted file mode 100644 index 854f79c8..00000000 --- a/modules/ble_options_darwin.go +++ /dev/null @@ -1,11 +0,0 @@ -package modules - -import "github.com/bettercap/gatt" - -var defaultBLEClientOptions = []gatt.Option{ - gatt.MacDeviceRole(gatt.CentralManager), -} - -var defaultBLEServerOptions = []gatt.Option{ - gatt.MacDeviceRole(gatt.PeripheralManager), -} diff --git a/modules/ble_recon.go b/modules/ble_recon.go index 1dc447b0..98d31b39 100644 --- a/modules/ble_recon.go +++ b/modules/ble_recon.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows !darwin package modules diff --git a/modules/ble_recon_sort.go b/modules/ble_recon_sort.go index a8d20e08..48723b00 100644 --- a/modules/ble_recon_sort.go +++ b/modules/ble_recon_sort.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows !darwin package modules diff --git a/modules/ble_recon_view.go b/modules/ble_recon_view.go index 2e9ed615..510f0e1f 100644 --- a/modules/ble_recon_view.go +++ b/modules/ble_recon_view.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows !darwin package modules diff --git a/modules/ble_recon_windows.go b/modules/ble_unsupported.go similarity index 70% rename from modules/ble_recon_windows.go rename to modules/ble_unsupported.go index 62e21320..503a156a 100644 --- a/modules/ble_recon_windows.go +++ b/modules/ble_unsupported.go @@ -1,3 +1,5 @@ +// +build windows darwin + package modules import ( @@ -10,6 +12,17 @@ type BLERecon struct { session.SessionModule } +/* +// darwin + +var defaultBLEClientOptions = []gatt.Option{ + gatt.MacDeviceRole(gatt.CentralManager), +} + +var defaultBLEServerOptions = []gatt.Option{ + gatt.MacDeviceRole(gatt.PeripheralManager), +} +*/ func NewBLERecon(s *session.Session) *BLERecon { d := &BLERecon{ SessionModule: session.NewSessionModule("ble.recon", s), @@ -43,13 +56,13 @@ func (d BLERecon) Author() string { } func (d *BLERecon) Configure() (err error) { - return fmt.Errorf("ble.recon is not supported on Windows") + return fmt.Errorf("ble.recon is not supported on Windows and macOS") } func (d *BLERecon) Start() error { - return fmt.Errorf("ble.recon is not supported on Windows") + return fmt.Errorf("ble.recon is not supported on Windows and macOS") } func (d *BLERecon) Stop() error { - return fmt.Errorf("ble.recon is not supported on Windows") + return fmt.Errorf("ble.recon is not supported on Windows and macOS") } diff --git a/network/ble.go b/network/ble.go index 3c6d73b9..efeb6e14 100644 --- a/network/ble.go +++ b/network/ble.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows !darwin package network diff --git a/network/ble_device.go b/network/ble_device.go index cadce4ce..d4198959 100644 --- a/network/ble_device.go +++ b/network/ble_device.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows !darwin package network diff --git a/network/ble_device_windows.go b/network/ble_device_windows.go deleted file mode 100644 index 4586f65a..00000000 --- a/network/ble_device_windows.go +++ /dev/null @@ -1,15 +0,0 @@ -package network - -import ( - "time" -) - -type BLEDevice struct { - LastSeen time.Time -} - -func NewBLEDevice() *BLEDevice { - return &BLEDevice{ - LastSeen: time.Now(), - } -} diff --git a/network/ble_windows.go b/network/ble_unsupported.go similarity index 78% rename from network/ble_windows.go rename to network/ble_unsupported.go index 9b585802..7c29f385 100644 --- a/network/ble_windows.go +++ b/network/ble_unsupported.go @@ -1,9 +1,22 @@ +// +build windows darwin + package network import ( "encoding/json" + "time" ) +type BLEDevice struct { + LastSeen time.Time +} + +func NewBLEDevice() *BLEDevice { + return &BLEDevice{ + LastSeen: time.Now(), + } +} + type BLEDevNewCallback func(dev *BLEDevice) type BLEDevLostCallback func(dev *BLEDevice)