diff --git a/gap.go b/gap.go index 50229b5..8f1adc1 100644 --- a/gap.go +++ b/gap.go @@ -15,6 +15,7 @@ var ( type MACAddress struct { // MAC address of the Bluetooth device. MAC + isRandom bool } @@ -30,7 +31,8 @@ func (mac MACAddress) SetRandom(val bool) { // Set the address func (mac MACAddress) Set(val interface{}) { - mac.MAC = val.(MAC) + m := val.(MAC) + mac.MAC = m } // AdvertisementOptions configures an advertisement instance. More options may diff --git a/gap_linux.go b/gap_linux.go index 5a6a912..f1359f2 100644 --- a/gap_linux.go +++ b/gap_linux.go @@ -219,8 +219,7 @@ func makeScanResult(props *device.Device1Properties) ScanResult { serviceUUIDs = append(serviceUUIDs, parsedUUID) } - a := Address{} - a.Set(addr) + a := &Address{MACAddress{MAC: addr}} a.SetRandom(props.AddressType == "random") return ScanResult{