[gnome-bluetooth] lib: Add some new device types



commit 9d28b6c8d991691ca07f3fd10b774b1cdf4aef8f
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 11 13:57:42 2013 +0100

    lib: Add some new device types
    
    We're missing icons for the remote control, wearable and toy types.

 lib/bluetooth-client.c |    8 ++++++++
 lib/bluetooth-enums.h  |   12 +++++++++++-
 lib/bluetooth-utils.c  |   20 ++++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index e79b012..35f1949 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -284,6 +284,14 @@ icon_override (const char    *bdaddr,
                return "audio-speakers";
        case BLUETOOTH_TYPE_PHONE:
                return phone_oui_to_icon_name (bdaddr);
+       case BLUETOOTH_TYPE_DISPLAY:
+               return "video-display";
+       case BLUETOOTH_TYPE_SCANNER:
+               return "scanner";
+       case BLUETOOTH_TYPE_REMOTE_CONTROL:
+       case BLUETOOTH_TYPE_WEARABLE:
+       case BLUETOOTH_TYPE_TOY:
+               /* FIXME */
        default:
                return NULL;
        }
diff --git a/lib/bluetooth-enums.h b/lib/bluetooth-enums.h
index b6241e0..3251001 100644
--- a/lib/bluetooth-enums.h
+++ b/lib/bluetooth-enums.h
@@ -74,6 +74,11 @@ typedef enum {
  * @BLUETOOTH_TYPE_JOYPAD: a joypad, joystick, or other game controller
  * @BLUETOOTH_TYPE_TABLET: a drawing tablet
  * @BLUETOOTH_TYPE_VIDEO: a video device, such as a webcam
+ * @BLUETOOTH_TYPE_REMOTE_CONTROL: a remote control
+ * @BLUETOOTH_TYPE_SCANNER: a scanner
+ * @BLUETOOTH_TYPE_DISPLAY: a display
+ * @BLUETOOTH_TYPE_WEARABLE: a wearable computer
+ * @BLUETOOTH_TYPE_TOY: a toy or game
  *
  * The type of a Bluetooth device. See also %BLUETOOTH_TYPE_INPUT and %BLUETOOTH_TYPE_AUDIO
  **/
@@ -93,9 +98,14 @@ typedef enum {
        BLUETOOTH_TYPE_JOYPAD           = 1 << 12,
        BLUETOOTH_TYPE_TABLET           = 1 << 13,
        BLUETOOTH_TYPE_VIDEO            = 1 << 14,
+       BLUETOOTH_TYPE_REMOTE_CONTROL   = 1 << 15,
+       BLUETOOTH_TYPE_SCANNER          = 1 << 16,
+       BLUETOOTH_TYPE_DISPLAY          = 1 << 17,
+       BLUETOOTH_TYPE_WEARABLE         = 1 << 18,
+       BLUETOOTH_TYPE_TOY              = 1 << 19
 } BluetoothType;
 
-#define _BLUETOOTH_TYPE_NUM_TYPES 15
+#define _BLUETOOTH_TYPE_NUM_TYPES 20
 
 /**
  * BLUETOOTH_TYPE_INPUT:
diff --git a/lib/bluetooth-utils.c b/lib/bluetooth-utils.c
index fa1f9c9..00b040a 100644
--- a/lib/bluetooth-utils.c
+++ b/lib/bluetooth-utils.c
@@ -86,6 +86,16 @@ bluetooth_type_to_string (BluetoothType type)
                return _("Tablet");
        case BLUETOOTH_TYPE_VIDEO:
                return _("Video device");
+       case BLUETOOTH_TYPE_REMOTE_CONTROL:
+               return _("Remote control");
+       case BLUETOOTH_TYPE_SCANNER:
+               return _("Scanner");
+       case BLUETOOTH_TYPE_DISPLAY:
+               return _("Display");
+       case BLUETOOTH_TYPE_WEARABLE:
+               return _("Wearable");
+       case BLUETOOTH_TYPE_TOY:
+               return _("Toy");
        }
 
        return _("Unknown");
@@ -171,6 +181,8 @@ bluetooth_class_to_type (guint32 class)
                        case 0x01:
                        case 0x02:
                                return BLUETOOTH_TYPE_JOYPAD;
+                       case 0x03:
+                               return BLUETOOTH_TYPE_REMOTE_CONTROL;
                        }
                        break;
                case 0x01:
@@ -187,9 +199,17 @@ bluetooth_class_to_type (guint32 class)
        case 0x06:
                if (class & 0x80)
                        return BLUETOOTH_TYPE_PRINTER;
+               if (class & 0x40)
+                       return BLUETOOTH_TYPE_SCANNER;
                if (class & 0x20)
                        return BLUETOOTH_TYPE_CAMERA;
+               if (class & 0x10)
+                       return BLUETOOTH_TYPE_DISPLAY;
                break;
+       case 0x07:
+               return BLUETOOTH_TYPE_WEARABLE;
+       case 0x08:
+               return BLUETOOTH_TYPE_TOY;
        }
 
        return 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]