mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
fix: flagging as unsupported the BLE module on macOS as the GATT library support is not complete.
This commit is contained in:
parent
ee59fefbcd
commit
fe00cc707f
9 changed files with 34 additions and 34 deletions
46
network/ble_unsupported.go
Normal file
46
network/ble_unsupported.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
// +build windows darwin
|
||||
|
||||
package network
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
type BLEDevice struct {
|
||||
LastSeen time.Time
|
||||
}
|
||||
|
||||
func NewBLEDevice() *BLEDevice {
|
||||
return &BLEDevice{
|
||||
LastSeen: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
type BLEDevNewCallback func(dev *BLEDevice)
|
||||
type BLEDevLostCallback func(dev *BLEDevice)
|
||||
|
||||
type BLE struct {
|
||||
devices map[string]*BLEDevice
|
||||
newCb BLEDevNewCallback
|
||||
lostCb BLEDevLostCallback
|
||||
}
|
||||
|
||||
type bleJSON struct {
|
||||
Devices []*BLEDevice `json:"devices"`
|
||||
}
|
||||
|
||||
func NewBLE(newcb BLEDevNewCallback, lostcb BLEDevLostCallback) *BLE {
|
||||
return &BLE{
|
||||
devices: make(map[string]*BLEDevice),
|
||||
newCb: newcb,
|
||||
lostCb: lostcb,
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BLE) MarshalJSON() ([]byte, error) {
|
||||
doc := bleJSON{
|
||||
Devices: make([]*BLEDevice, 0),
|
||||
}
|
||||
return json.Marshal(doc)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue