Skip to content

Commit

Permalink
Fix issue 284
Browse files Browse the repository at this point in the history
  • Loading branch information
hu13 committed Feb 23, 2025
1 parent 642fa26 commit 35207e7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions adapter_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

// Adapter is a connection to BLE devices.
type Adapter struct {
id string
cmd *centralManagerDelegate
pmd *peripheralManagerDelegate
macAddress string
cmd *centralManagerDelegate
pmd *peripheralManagerDelegate

cm cbgo.CentralManager
pm cbgo.PeripheralManager
Expand All @@ -28,12 +28,13 @@ type Adapter struct {
connectHandler func(device Device, connected bool)
}

// NewAdapter creates a new Adapter with the given ID.
//
// NewAdapter creates a new Adapter with the given macAddress.
// this is to support a system with multiple bluetooth adapters.
// macAddress can be found by running `system_profiler SPBluetoothDataType`
// Make sure to call Enable() before using it to initialize the adapter.
func NewAdapter(id string) *Adapter {
func NewAdapter(macAddress string) *Adapter {
return &Adapter{
id: id,
macAddress: macAddress,
cm: cbgo.NewCentralManager(nil),
pm: cbgo.NewPeripheralManager(nil),
connectMap: sync.Map{},
Expand Down

0 comments on commit 35207e7

Please sign in to comment.