Bug 1015090 - Add BluetoothAdapterEvent.webidl and BluetoothAttributeEvent.webidl, r=bz
authorBen Tian <btian@mozilla.com>
Mon, 26 May 2014 09:40:28 +0800
changeset 192302 b1f349b0ee5fde087c623f099eae7b947d79d5db
parent 192301 10d8b548781f777cbe8dd98082cc5959d3fea9f1
child 192303 545c35907effa5b0335aa05991e8c29548042bdd
child 192337 d68e34ab4078ec66aee497f9b7116102c376c328
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-esr52@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1015090
milestone32.0a1
Bug 1015090 - Add BluetoothAdapterEvent.webidl and BluetoothAttributeEvent.webidl, r=bz
dom/bluetooth2/moz.build
dom/events/test/test_all_synthetic_events.html
dom/webidl/BluetoothAdapterEvent.webidl
dom/webidl/BluetoothAttributeEvent.webidl
dom/webidl/moz.build
--- a/dom/bluetooth2/moz.build
+++ b/dom/bluetooth2/moz.build
@@ -86,17 +86,20 @@ if CONFIG['MOZ_B2G_BT']:
         'ipc',
     ]
 
 EXPORTS.mozilla.dom.bluetooth.ipc += [
     'ipc/BluetoothMessageUtils.h',
 ]
 
 EXPORTS.mozilla.dom.bluetooth += [
+    'BluetoothAdapter.h',
     'BluetoothCommon.h',
+    'BluetoothDevice.h',
+    'BluetoothManager.h',
 ]
 
 IPDL_SOURCES += [
     'ipc/BluetoothTypes.ipdlh',
     'ipc/PBluetooth.ipdl',
     'ipc/PBluetoothRequest.ipdl',
 ]
 
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -39,16 +39,24 @@ const kEventConstructors = {
                                                          e.initEvent(aName, aProps.bubbles, aProps.cancelable);
                                                          return e;
                                                        },
                                              },
   BlobEvent:                                 { create: function (aName, aProps) {
                                                          return new BlobEvent(aName, aProps);
                                                        },
                                              },
+  BluetoothAdapterEvent:                     { create: function (aName, aProps) {
+                                                          return new BluetoothAdapterEvent(aName, aProps);
+                                                       },
+                                             },
+  BluetoothAttributeEvent:                   { create: function (aName, aProps) {
+                                                          return new BluetoothAttributeEvent(aName, aProps);
+                                                       },
+                                             },
   BluetoothDeviceEvent:                      { create: function (aName, aProps) {
                                                           return new BluetoothDeviceEvent(aName, aProps);
                                                        },
                                              },
   BluetoothDiscoveryStateChangedEvent:       { create: function (aName, aProps) {
                                                           return new BluetoothDiscoveryStateChangedEvent(aName, aProps);
                                                        },
                                              },
new file mode 100644
--- /dev/null
+++ b/dom/webidl/BluetoothAdapterEvent.webidl
@@ -0,0 +1,19 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/.
+ */
+
+[Func="Navigator::HasBluetoothSupport",
+ Constructor(DOMString type, optional BluetoothAdapterEventInit eventInitDict)]
+interface BluetoothAdapterEvent : Event
+{
+  readonly attribute BluetoothAdapter? adapter;
+  readonly attribute DOMString?        address;
+};
+
+dictionary BluetoothAdapterEventInit : EventInit
+{
+  BluetoothAdapter? adapter = null;
+  DOMString?        address = "";
+};
new file mode 100644
--- /dev/null
+++ b/dom/webidl/BluetoothAttributeEvent.webidl
@@ -0,0 +1,25 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/.
+ */
+
+[Func="Navigator::HasBluetoothSupport",
+ Constructor(DOMString type,
+             optional BluetoothAttributeEventInit eventInitDict)]
+interface BluetoothAttributeEvent : Event
+{
+  readonly attribute unsigned short   attr;
+  readonly attribute any              value;
+  // We don't support sequences in unions yet (Bug 767924)
+  /* readonly attribute (BluetoothAdapter or BluetoothAdapterState or
+   *                     BluetoothClassOfDevice or boolean or
+   *                     DOMString or sequence<DOMString>) value;
+   */
+};
+
+dictionary BluetoothAttributeEventInit : EventInit
+{
+  unsigned short attr  = 0;
+  any            value = null;
+};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -649,19 +649,28 @@ GENERATED_EVENTS_WEBIDL_FILES = [
 if CONFIG['MOZ_GAMEPAD']:
     GENERATED_EVENTS_WEBIDL_FILES += [
         'GamepadAxisMoveEvent.webidl',
         'GamepadButtonEvent.webidl',
         'GamepadEvent.webidl',
     ]
 
 if CONFIG['MOZ_B2G_BT']:
+    if CONFIG['MOZ_B2G_BT_API_V2']:
+        GENERATED_EVENTS_WEBIDL_FILES += [
+            'BluetoothAdapterEvent.webidl',
+            'BluetoothAttributeEvent.webidl',
+        ]
+    else:
+        GENERATED_EVENTS_WEBIDL_FILES += [
+            'BluetoothDiscoveryStateChangedEvent.webidl',
+        ]
+
     GENERATED_EVENTS_WEBIDL_FILES += [
         'BluetoothDeviceEvent.webidl',
-        'BluetoothDiscoveryStateChangedEvent.webidl',
         'BluetoothStatusChangedEvent.webidl',
     ]
 
 if CONFIG['MOZ_BUILD_APP'] in ['browser', 'xulrunner']:
     WEBIDL_FILES += [
         'BrowserFeedWriter.webidl',
     ]