mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
fix: allowing ble.discover to be restarted (ref #74)
This commit is contained in:
parent
7fe6cd232c
commit
2d148b2b24
1 changed files with 9 additions and 7 deletions
|
@ -71,12 +71,17 @@ func (d BLERecon) Author() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *BLERecon) Configure() (err error) {
|
func (d *BLERecon) Configure() (err error) {
|
||||||
// hey Paypal GATT library, could you please just STFU?!
|
if d.gattDevice == nil {
|
||||||
golog.SetOutput(ioutil.Discard)
|
// hey Paypal GATT library, could you please just STFU?!
|
||||||
|
golog.SetOutput(ioutil.Discard)
|
||||||
|
if d.gattDevice, err = gatt.NewDevice(defaultBLEClientOptions...); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if d.gattDevice, err = gatt.NewDevice(defaultBLEClientOptions...); err != nil {
|
d.gattDevice.Handle(gatt.PeripheralDiscovered(d.onPeriphDiscovered))
|
||||||
return err
|
d.gattDevice.Init(d.onStateChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,9 +124,6 @@ func (d *BLERecon) Start() error {
|
||||||
return d.SetRunning(true, func() {
|
return d.SetRunning(true, func() {
|
||||||
log.Debug("Initializing BLE device ...")
|
log.Debug("Initializing BLE device ...")
|
||||||
|
|
||||||
d.gattDevice.Handle(gatt.PeripheralDiscovered(d.onPeriphDiscovered))
|
|
||||||
d.gattDevice.Init(d.onStateChanged)
|
|
||||||
|
|
||||||
go d.pruner()
|
go d.pruner()
|
||||||
|
|
||||||
<-d.quit
|
<-d.quit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue