diff options
author | Szymon Janc <szymon.janc@tieto.com> | 2015-01-23 18:25:27 +0100 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2015-01-23 18:27:13 +0100 |
commit | 07b33109c0a39ff11c1facd030d43c6686fd7dc2 (patch) | |
tree | 414905f6a5fb19eb77aa2da05c495025132b552f /android/gatt.c | |
parent | 21b3f2df2a311b367df4d809c4e00ef34e4f5024 (diff) | |
download | bluez-07b33109c0a39ff11c1facd030d43c6686fd7dc2.tar.gz |
android/gatt: Use switch instead of if-else for enum
It is more commomn to use switch instead of if-else when handling
enums.
Diffstat (limited to 'android/gatt.c')
-rw-r--r-- | android/gatt.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/android/gatt.c b/android/gatt.c index 662b5a64b..ad7c7a8cd 100644 --- a/android/gatt.c +++ b/android/gatt.c @@ -894,11 +894,17 @@ static void disconnect_notify_by_device(void *data, void *user_data) if (dev != conn->device || !conn->app) return; - if (dev->state == DEVICE_CONNECTED) + switch (dev->state) { + case DEVICE_CONNECTED: send_app_disconnect_notify(conn, GATT_SUCCESS); - else if (dev->state == DEVICE_CONNECT_INIT || - dev->state == DEVICE_CONNECT_READY) + break; + case DEVICE_CONNECT_INIT: + case DEVICE_CONNECT_READY: send_app_connect_notify(conn, GATT_FAILURE); + break; + case DEVICE_DISCONNECTED: + break; + } } static void destroy_connection(void *data) |