Skip to content

Commit 4f54e74

Browse files
committed
Change if statement to switch statement
1 parent 4557b5d commit 4f54e74

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

gattc_linux.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,18 +262,17 @@ func (c DeviceCharacteristic) EnableNotifications(callback func(buf []byte)) err
262262
if sig.Name == "org.freedesktop.DBus.Properties.PropertiesChanged" {
263263
interfaceName := sig.Body[0].(string)
264264

265-
if interfaceName == "org.bluez.Device1" && sig.Path == devicePath {
265+
switch {
266+
case interfaceName == "org.bluez.Device1" && sig.Path == devicePath:
266267
changes := sig.Body[1].(map[string]dbus.Variant)
267268

268269
if connected, ok := changes["Connected"].Value().(bool); ok && !connected {
269270
c.EnableNotifications(nil)
270271
return
271272
}
272-
} else if interfaceName != "org.bluez.GattCharacteristic1" {
273+
case interfaceName != "org.bluez.GattCharacteristic1":
273274
continue
274-
}
275-
276-
if sig.Path != c.characteristic.Path() {
275+
case sig.Path != c.characteristic.Path():
277276
continue
278277
}
279278

0 commit comments

Comments
 (0)