mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
9f5926bf5a
commit
2cdd3d22a5
1 changed files with 2 additions and 3 deletions
|
@ -17,6 +17,7 @@ func (mod *BLERecon) onStateChanged(dev gatt.Device, s gatt.State) {
|
||||||
dev.Scan([]gatt.UUID{}, true)
|
dev.Scan([]gatt.UUID{}, true)
|
||||||
}
|
}
|
||||||
case gatt.StatePoweredOff:
|
case gatt.StatePoweredOff:
|
||||||
|
mod.setCurrentDevice(nil)
|
||||||
mod.gattDevice = nil
|
mod.gattDevice = nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -29,12 +30,11 @@ func (mod *BLERecon) onPeriphDiscovered(p gatt.Peripheral, a *gatt.Advertisement
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *BLERecon) onPeriphDisconnected(p gatt.Peripheral, err error) {
|
func (mod *BLERecon) onPeriphDisconnected(p gatt.Peripheral, err error) {
|
||||||
|
mod.setCurrentDevice(nil)
|
||||||
if mod.Running() {
|
if mod.Running() {
|
||||||
// restore scanning
|
|
||||||
mod.Info("device disconnected, restoring discovery.")
|
mod.Info("device disconnected, restoring discovery.")
|
||||||
mod.gattDevice.Scan([]gatt.UUID{}, true)
|
mod.gattDevice.Scan([]gatt.UUID{}, true)
|
||||||
}
|
}
|
||||||
mod.setCurrentDevice(nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *BLERecon) onPeriphConnected(p gatt.Peripheral, err error) {
|
func (mod *BLERecon) onPeriphConnected(p gatt.Peripheral, err error) {
|
||||||
|
@ -42,7 +42,6 @@ func (mod *BLERecon) onPeriphConnected(p gatt.Peripheral, err error) {
|
||||||
mod.Warning("connected to %s but with error: %s", p.ID(), err)
|
mod.Warning("connected to %s but with error: %s", p.ID(), err)
|
||||||
return
|
return
|
||||||
} else if mod.currDevice == nil {
|
} else if mod.currDevice == nil {
|
||||||
// timed out
|
|
||||||
mod.Warning("connected to %s but after the timeout :(", p.ID())
|
mod.Warning("connected to %s but after the timeout :(", p.ID())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue