fix: using BLE company identifier if the vendor can't be detected by MAC

This commit is contained in:
evilsocket 2019-02-14 14:46:17 +01:00
commit 1915bb565c
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -27,10 +27,14 @@ type bleDeviceJSON struct {
}
func NewBLEDevice(p gatt.Peripheral, a *gatt.Advertisement, rssi int) *BLEDevice {
vendor := ManufLookup(NormalizeMac(p.ID()))
if vendor == "" && a != nil {
vendor = a.Company
}
return &BLEDevice{
LastSeen: time.Now(),
Device: p,
Vendor: ManufLookup(NormalizeMac(p.ID())),
Vendor: vendor,
Advertisement: a,
RSSI: rssi,
}