diff --git a/platforms/ble/ble_client_adaptor.go b/platforms/ble/ble_client_adaptor.go index 700c0d5e..812678d4 100644 --- a/platforms/ble/ble_client_adaptor.go +++ b/platforms/ble/ble_client_adaptor.go @@ -8,10 +8,14 @@ import ( "time" blelib "github.com/currantlabs/ble" - "github.com/currantlabs/ble/examples/lib/dev" "github.com/pkg/errors" ) +// newBLEDevice is constructor about blelib HCI device connection +func newBLEDevice(impl string) (d blelib.Device, err error) { + return defaultDevice(impl) +} + // ClientAdaptor represents a Client Connection to a BLE Peripheral type ClientAdaptor struct { name string @@ -44,7 +48,7 @@ func (b *ClientAdaptor) Address() string { return b.address } // Connect initiates a connection to the BLE peripheral. Returns true on successful connection. func (b *ClientAdaptor) Connect() (err error) { - d, err := dev.NewDevice("default") + d, err := newBLEDevice("default") if err != nil { return errors.Wrap(err, "can't new device") } diff --git a/platforms/ble/ble_client_adaptor_darwin.go b/platforms/ble/ble_client_adaptor_darwin.go index e615ea31..18c91f41 100644 --- a/platforms/ble/ble_client_adaptor_darwin.go +++ b/platforms/ble/ble_client_adaptor_darwin.go @@ -1,9 +1,10 @@ package ble -// import ( -// "github.com/currantlabs/gatt" -// ) -// -// var DefaultClientOptions = []gatt.Option{ -// gatt.MacDeviceRole(gatt.CentralManager), -// } +import ( + blelib "github.com/currantlabs/ble" + "github.com/currantlabs/ble/darwin" +) + +func defaultDevice(impl string) (d blelib.Device, err error) { + return darwin.NewDevice() +} diff --git a/platforms/ble/ble_client_adaptor_linux.go b/platforms/ble/ble_client_adaptor_linux.go index b3286dc6..678de3b7 100644 --- a/platforms/ble/ble_client_adaptor_linux.go +++ b/platforms/ble/ble_client_adaptor_linux.go @@ -1,11 +1,10 @@ package ble -// import ( -// "github.com/currantlabs/gatt" -// ) -// -// // TODO: handle other OS defaults besides Linux -// var DefaultClientOptions = []gatt.Option{ -// gatt.LnxMaxConnections(1), -// gatt.LnxDeviceID(-1, false), -// } +import ( + blelib "github.com/currantlabs/ble" + "github.com/currantlabs/ble/linux" +) + +func defaultDevice(impl string) (d blelib.Device, err error) { + return linux.NewDevice() +}