8000 The *darwin.Device type does not implement ble.DeviceOption · Issue #59 · go-ble/ble · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
The *darwin.Device type does not implement ble.DeviceOption #59
Closed
@peterhellberg

Description

@peterhellberg

Support for macOS was broken with the addition of the SetConnectedHandler and SetDisconnectedHandler methods to the ble.DeviceOption interface.

I’m aware that macOS isn’t actively maintained, but I thought it might be a good idea for it to at least compile.

(By doing something along these lines)

diff --git a/darwin/option.go b/darwin/option.go
index 1d86b7c..27d324f 100644
--- a/darwin/option.go
+++ b/darwin/option.go
@@ -5,8 +5,19 @@ import (
        "time"

        "github.com/go-ble/ble/linux/hci/cmd"
+       "github.com/go-ble/ble/linux/hci/evt"
 )

+// SetConnectedHandler sets handler to be called when new connection is established.
+func (d *Device) SetConnectedHandler(f func(evt.LEConnectionComplete)) error {
+       return errors.New("Not supported")
+}
+
+// SetDisconnectedHandler sets handler to be called on disconnect.
+func (d *Device) SetDisconnectedHandler(f func(evt.DisconnectionComplete)) error {
+       return errors.New("Not supported")
+}
+
 // SetPeripheralRole configures the device to perform Peripheral tasks.
 func (d *Device) SetPeripheralRole() error {
        d.role = 1

Unfortunately it seem like this doesn’t actually make this project work under macOS, so another idea would be to just remove the darwin package from this repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0