dom/bluetooth/nsIDOMBluetoothAdapter.idl
author Gregory Szorc <gps@mozilla.com>
Tue, 06 Nov 2012 17:00:19 -0800
changeset 112403 f561a4ffeeb9f523fb59c678b7ac901763e32911
parent 110747 dfca7b8e5c7105bf5076fc218711854273f5b347
child 126546 e503b1458e77ac0cf97214876b668191b06200e8
permissions -rw-r--r--
Bug 808346 - Don't scan sys.path to discover mach commands; r=jhammel All mach modules are now explicitly listed in the mach driver.

/* -*- 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"

interface nsIDOMDOMRequest;
interface nsIDOMBlob;
interface nsIDOMBluetoothDevice;

[scriptable, builtinclass, uuid(6a4a9415-cda3-4a19-b79e-05d9bc2c2700)]
interface nsIDOMBluetoothAdapter : nsIDOMEventTarget
{
  readonly attribute DOMString address;
  [binaryname(AdapterClass)] readonly attribute unsigned long class;
  readonly attribute bool enabled;
  readonly attribute bool discovering;

  [implicit_jscontext]
  readonly attribute jsval devices;

  [implicit_jscontext]
  readonly attribute jsval uuids;
  
  readonly attribute DOMString name;
  readonly attribute bool discoverable;
  // Unit: sec
  readonly attribute unsigned long discoverableTimeout;

  nsIDOMDOMRequest setName(in DOMString name);
  nsIDOMDOMRequest setDiscoverable(in bool discoverable);
  nsIDOMDOMRequest setDiscoverableTimeout(in unsigned long timeout);
  nsIDOMDOMRequest startDiscovery();
  nsIDOMDOMRequest stopDiscovery();
  nsIDOMDOMRequest pair(in nsIDOMBluetoothDevice aDevice);
  nsIDOMDOMRequest unpair(in nsIDOMBluetoothDevice aDevice);
  nsIDOMDOMRequest getPairedDevices();
  nsIDOMDOMRequest setPinCode(in DOMString aDeviceAddress, in DOMString aPinCode);
  nsIDOMDOMRequest setPasskey(in DOMString aDeviceAddress, in unsigned long aPasskey);
  nsIDOMDOMRequest setPairingConfirmation(in DOMString aDeviceAddress, in bool aConfirmation);
  nsIDOMDOMRequest setAuthorization(in DOMString aDeviceAddress, in bool aAllow);

  /** 
   * Connect/Disconnect to a specific service of a target remote device. 
   * To check the value of service UUIDs, please check "Bluetooth Assigned 
   * Numbers" / "Service Discovery Protocol" for more information.
   *  
   * @param aDeviceAddress Remote device address
   * @param aProfile 2-octets service UUID
   */
  nsIDOMDOMRequest connect(in DOMString aDeviceAddress, in unsigned short aProfile);
  nsIDOMDOMRequest disconnect(in unsigned short aProfile);

  // One device can only send one file at a time
  nsIDOMDOMRequest sendFile(in DOMString aDeviceAddress, in nsIDOMBlob aBlob);
  nsIDOMDOMRequest stopSendingFile(in DOMString aDeviceAddress);
  nsIDOMDOMRequest confirmReceivingFile(in DOMString aDeviceAddress, in bool aConfirmation);

  // Fired when discoverying and any device is discovered.
  [implicit_jscontext] attribute jsval ondevicefound;
  // Fired when any device is out of discoverable range.
  [implicit_jscontext] attribute jsval ondevicedisappeared;
  // Fired when any device is created.
  [implicit_jscontext] attribute jsval ondevicecreated;
  // Fired when a property of the adapter is changed
  [implicit_jscontext] attribute jsval onpropertychanged;
  // Pairing related events
  [implicit_jscontext] attribute jsval onrequestconfirmation;
  [implicit_jscontext] attribute jsval onrequestpincode;
  [implicit_jscontext] attribute jsval onrequestpasskey;
  [implicit_jscontext] attribute jsval onauthorize;
  [implicit_jscontext] attribute jsval oncancel;
};