mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -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) {
|
||||
// hey Paypal GATT library, could you please just STFU?!
|
||||
golog.SetOutput(ioutil.Discard)
|
||||
if d.gattDevice == nil {
|
||||
// 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 {
|
||||
return err
|
||||
d.gattDevice.Handle(gatt.PeripheralDiscovered(d.onPeriphDiscovered))
|
||||
d.gattDevice.Init(d.onStateChanged)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -119,9 +124,6 @@ func (d *BLERecon) Start() error {
|
|||
return d.SetRunning(true, func() {
|
||||
log.Debug("Initializing BLE device ...")
|
||||
|
||||
d.gattDevice.Handle(gatt.PeripheralDiscovered(d.onPeriphDiscovered))
|
||||
d.gattDevice.Init(d.onStateChanged)
|
||||
|
||||
go d.pruner()
|
||||
|
||||
<-d.quit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue