misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2019-03-23 15:21:19 +01:00
commit 38c94cb105
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -5,6 +5,8 @@ package network
import ( import (
"encoding/json" "encoding/json"
"time" "time"
"github.com/evilsocket/islazy/data"
) )
type BLEDevice struct { type BLEDevice struct {
@ -22,6 +24,7 @@ type BLEDevNewCallback func(dev *BLEDevice)
type BLEDevLostCallback func(dev *BLEDevice) type BLEDevLostCallback func(dev *BLEDevice)
type BLE struct { type BLE struct {
aliases *data.UnsortedKV
devices map[string]*BLEDevice devices map[string]*BLEDevice
newCb BLEDevNewCallback newCb BLEDevNewCallback
lostCb BLEDevLostCallback lostCb BLEDevLostCallback
@ -31,8 +34,9 @@ type bleJSON struct {
Devices []*BLEDevice `json:"devices"` Devices []*BLEDevice `json:"devices"`
} }
func NewBLE(newcb BLEDevNewCallback, lostcb BLEDevLostCallback) *BLE { func NewBLE(aliases *data.UnsortedKV, newcb BLEDevNewCallback, lostcb BLEDevLostCallback) *BLE {
return &BLE{ return &BLE{
aliases: aliases,
devices: make(map[string]*BLEDevice), devices: make(map[string]*BLEDevice),
newCb: newcb, newCb: newcb,
lostCb: lostcb, lostCb: lostcb,