gap: change signature for Addresser interface Set() function to accept string and then parse it as needed
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
f04c1cbe78
commit
281d195e75
2 changed files with 13 additions and 5 deletions
10
gap.go
10
gap.go
|
@ -30,8 +30,12 @@ func (mac MACAddress) SetRandom(val bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the address
|
// Set the address
|
||||||
func (mac MACAddress) Set(val interface{}) {
|
func (mac MACAddress) Set(val string) {
|
||||||
m := val.(MAC)
|
m, err := ParseMAC(val)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
mac.MAC = m
|
mac.MAC = m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +76,7 @@ type Addresser interface {
|
||||||
String() string
|
String() string
|
||||||
|
|
||||||
// Set the address
|
// Set the address
|
||||||
Set(val interface{})
|
Set(val string)
|
||||||
|
|
||||||
// Is this address a random address?
|
// Is this address a random address?
|
||||||
// Bluetooth addresses are roughly split in two kinds: public
|
// Bluetooth addresses are roughly split in two kinds: public
|
||||||
|
|
|
@ -24,8 +24,12 @@ func (ad Address) SetRandom(val bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the address
|
// Set the address
|
||||||
func (ad Address) Set(val interface{}) {
|
func (ad Address) Set(val string) {
|
||||||
ad.UUID = val.(UUID)
|
uuid, err := ParseUUID(val)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ad.UUID = uuid
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan starts a BLE scan. It is stopped by a call to StopScan. A common pattern
|
// Scan starts a BLE scan. It is stopped by a call to StopScan. A common pattern
|
||||||
|
|
Loading…
Reference in a new issue