Bug 786596 - v1: get device type information. r=qdot, sr=mrbkap
authorGina Yeh <gyeh@mozilla.com>
Thu, 30 Aug 2012 11:15:35 +0800
changeset 103861 5cc178c430258e62e465cef26c4c09dcd91de7c6
parent 103860 2855dfc9e789c23505b8bfe4adbeb199040d5483
child 103862 d009a6123bb8ac4f39c656df6724992cfdc77f03
push idunknown
push userunknown
push dateunknown
reviewersqdot, mrbkap
bugs786596
milestone18.0a1
Bug 786596 - v1: get device type information. r=qdot, sr=mrbkap
dom/bluetooth/BluetoothDevice.cpp
dom/bluetooth/BluetoothDevice.h
dom/bluetooth/nsIDOMBluetoothDevice.idl
--- a/dom/bluetooth/BluetoothDevice.cpp
+++ b/dom/bluetooth/BluetoothDevice.cpp
@@ -110,16 +110,18 @@ BluetoothDevice::SetPropertyByValue(cons
     if (!bs) {
       NS_WARNING("BluetoothService not available!");
       return;
     }
     // We can't actually set up our path until we know our address
     bs->GetDevicePath(mAdapterPath, mAddress, mPath);
   } else if (name.EqualsLiteral("Class")) {
     mClass = value.get_uint32_t();
+  } else if (name.EqualsLiteral("Icon")) {
+    mIcon = value.get_nsString();
   } else if (name.EqualsLiteral("Connected")) {
     mConnected = value.get_bool();
   } else if (name.EqualsLiteral("Paired")) {
     mPaired = value.get_bool();
   } else if (name.EqualsLiteral("UUIDs")) {
     mUuids = value.get_ArrayOfnsString();
     nsresult rv;
     nsIScriptContext* sc = GetContextForEventHandlers(&rv);
@@ -217,16 +219,23 @@ BluetoothDevice::GetAddress(nsAString& a
 NS_IMETHODIMP
 BluetoothDevice::GetName(nsAString& aName)
 {
   aName = mName;
   return NS_OK;
 }
 
 NS_IMETHODIMP
+BluetoothDevice::GetIcon(nsAString& aIcon)
+{
+  aIcon = mIcon;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 BluetoothDevice::GetDeviceClass(uint32_t* aClass)
 {
   *aClass = mClass;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BluetoothDevice::GetPaired(bool* aPaired)
--- a/dom/bluetooth/BluetoothDevice.h
+++ b/dom/bluetooth/BluetoothDevice.h
@@ -63,16 +63,17 @@ private:
   ~BluetoothDevice();
   void Root();
   
   JSObject* mJsUuids;
 
   nsString mAdapterPath;
   nsString mAddress;
   nsString mName;
+  nsString mIcon;
   uint32_t mClass;
   bool mConnected;
   bool mPaired;
   bool mIsRooted;
   nsTArray<nsString> mUuids;
 
   NS_DECL_EVENT_HANDLER(propertychanged)
   NS_DECL_EVENT_HANDLER(connected)
--- a/dom/bluetooth/nsIDOMBluetoothDevice.idl
+++ b/dom/bluetooth/nsIDOMBluetoothDevice.idl
@@ -1,21 +1,22 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIDOMEventTarget.idl"
 
-[scriptable, builtinclass, uuid(647bb64c-8d45-4642-b86b-b3b80d4c8c25)]
+[scriptable, builtinclass, uuid(4a271533-6a09-4a65-ae2b-086794c7852c)]
 interface nsIDOMBluetoothDevice : nsIDOMEventTarget
 {
   readonly attribute DOMString address;
   readonly attribute DOMString name;
+  readonly attribute DOMString icon;
   [binaryname(DeviceClass)] readonly attribute unsigned long class;
   [implicit_jscontext] readonly attribute jsval uuids;
   readonly attribute bool connected;
   readonly attribute bool paired;
   attribute nsIDOMEventListener onpropertychanged;
   attribute nsIDOMEventListener onconnected;
   attribute nsIDOMEventListener ondisconnected;
 };