dom/webidl/BluetoothAdapter.webidl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/webidl/BluetoothAdapter.webidl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,154 @@
     1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +// MediaMetadata and MediaPlayStatus are used to keep data from Applications.
    1.11 +// Please see specification of AVRCP 1.3 for more details.
    1.12 +dictionary MediaMetaData
    1.13 +{
    1.14 +  // track title
    1.15 +  DOMString   title = "";
    1.16 +  // artist name
    1.17 +  DOMString   artist = "";
    1.18 +  // album name
    1.19 +  DOMString   album = "";
    1.20 +  // track number
    1.21 +  long long   mediaNumber = -1;
    1.22 +  // number of tracks in the album
    1.23 +  long long   totalMediaCount = -1;
    1.24 +  // playing time (ms)
    1.25 +  long long   duration = -1;
    1.26 +};
    1.27 +
    1.28 +dictionary MediaPlayStatus
    1.29 +{
    1.30 +  // current track length (ms)
    1.31 +  long long   duration = -1;
    1.32 +  // playing time (ms)
    1.33 +  long long   position = -1;
    1.34 +  // one of 'STOPPED'/'PLAYING'/'PAUSED'/'FWD_SEEK'/'REV_SEEK'/'ERROR'
    1.35 +  DOMString   playStatus = "";
    1.36 +};
    1.37 +
    1.38 +interface BluetoothAdapter : EventTarget {
    1.39 +  readonly attribute DOMString      address;
    1.40 +  readonly attribute unsigned long  class;
    1.41 +  readonly attribute boolean        discovering;
    1.42 +  readonly attribute DOMString      name;
    1.43 +  readonly attribute boolean        discoverable;
    1.44 +  readonly attribute unsigned long  discoverableTimeout; // in seconds
    1.45 +
    1.46 +  // array of type BluetoothDevice[]
    1.47 +  [GetterThrows]
    1.48 +  readonly attribute any            devices;
    1.49 +
    1.50 +  // array of type DOMString[]
    1.51 +  [GetterThrows]
    1.52 +  readonly attribute any            uuids;
    1.53 +
    1.54 +           attribute EventHandler   ondevicefound;
    1.55 +
    1.56 +  // Fired when pairing process is completed
    1.57 +           attribute EventHandler   onpairedstatuschanged;
    1.58 +
    1.59 +  // Fired when a2dp connection status changed
    1.60 +           attribute EventHandler   ona2dpstatuschanged;
    1.61 +
    1.62 +  // Fired when handsfree connection status changed
    1.63 +           attribute EventHandler   onhfpstatuschanged;
    1.64 +
    1.65 +  // Fired when sco connection status changed
    1.66 +           attribute EventHandler   onscostatuschanged;
    1.67 +
    1.68 +  // Fired when remote devices query current media play status
    1.69 +           attribute EventHandler   onrequestmediaplaystatus;
    1.70 +
    1.71 +  [NewObject, Throws]
    1.72 +  DOMRequest setName(DOMString name);
    1.73 +  [NewObject, Throws]
    1.74 +  DOMRequest setDiscoverable(boolean discoverable);
    1.75 +  [NewObject, Throws]
    1.76 +  DOMRequest setDiscoverableTimeout(unsigned long timeout);
    1.77 +  [NewObject, Throws]
    1.78 +  DOMRequest startDiscovery();
    1.79 +  [NewObject, Throws]
    1.80 +  DOMRequest stopDiscovery();
    1.81 +  [NewObject, Throws]
    1.82 +  DOMRequest pair(DOMString deviceAddress);
    1.83 +  [NewObject, Throws]
    1.84 +  DOMRequest unpair(DOMString deviceAddress);
    1.85 +  [NewObject, Throws]
    1.86 +  DOMRequest getPairedDevices();
    1.87 +  [NewObject, Throws]
    1.88 +  DOMRequest getConnectedDevices(unsigned short serviceUuid);
    1.89 +  [NewObject, Throws]
    1.90 +  DOMRequest setPinCode(DOMString deviceAddress, DOMString pinCode);
    1.91 +  [NewObject, Throws]
    1.92 +  DOMRequest setPasskey(DOMString deviceAddress, unsigned long passkey);
    1.93 +  [NewObject, Throws]
    1.94 +  DOMRequest setPairingConfirmation(DOMString deviceAddress, boolean confirmation);
    1.95 +
    1.96 +  /**
    1.97 +   * Connect/Disconnect to a specific service of a target remote device.
    1.98 +   * To check the value of service UUIDs, please check "Bluetooth Assigned
    1.99 +   * Numbers" / "Service Discovery Protocol" for more information.
   1.100 +   *
   1.101 +   * Note that service UUID is optional. If it isn't passed when calling
   1.102 +   * Connect, multiple profiles are tried sequentially based on the class of
   1.103 +   * device (CoD). If it isn't passed when calling Disconnect, all connected
   1.104 +   * profiles are going to be closed.
   1.105 +   *
   1.106 +   * Reply success if the connection of any profile is successfully
   1.107 +   * established/released; reply error if we failed to connect/disconnect all
   1.108 +   * of the planned profiles.
   1.109 +   *
   1.110 +   * @param device Remote device
   1.111 +   * @param profile 2-octets service UUID. This is optional.
   1.112 +   */
   1.113 +  [NewObject, Throws]
   1.114 +  DOMRequest connect(BluetoothDevice device, optional unsigned short serviceUuid);
   1.115 +
   1.116 +  [NewObject, Throws]
   1.117 +  DOMRequest disconnect(BluetoothDevice device, optional unsigned short serviceUuid);
   1.118 +
   1.119 +  // One device can only send one file at a time
   1.120 +  [NewObject, Throws]
   1.121 +  DOMRequest sendFile(DOMString deviceAddress, Blob blob);
   1.122 +  [NewObject, Throws]
   1.123 +  DOMRequest stopSendingFile(DOMString deviceAddress);
   1.124 +  [NewObject, Throws]
   1.125 +  DOMRequest confirmReceivingFile(DOMString deviceAddress, boolean confirmation);
   1.126 +
   1.127 +  // Connect/Disconnect SCO (audio) connection
   1.128 +  [NewObject, Throws]
   1.129 +  DOMRequest connectSco();
   1.130 +  [NewObject, Throws]
   1.131 +  DOMRequest disconnectSco();
   1.132 +  [NewObject, Throws]
   1.133 +  DOMRequest isScoConnected();
   1.134 +
   1.135 +  /**
   1.136 +   * Additional HFP methods to handle CDMA network.
   1.137 +   *
   1.138 +   * In GSM network we observe call operations from RIL call state changes;
   1.139 +   * however in CDMA network RIL call states do not change under some call
   1.140 +   * operations, so we need these additional methods to be informed of these
   1.141 +   * operations from dialer.
   1.142 +   *
   1.143 +   * For more information please refer to bug 912005 and 925638.
   1.144 +   */
   1.145 +  [NewObject, Throws]
   1.146 +  DOMRequest answerWaitingCall();
   1.147 +  [NewObject, Throws]
   1.148 +  DOMRequest ignoreWaitingCall();
   1.149 +  [NewObject, Throws]
   1.150 +  DOMRequest toggleCalls();
   1.151 +
   1.152 +  // AVRCP 1.3 methods
   1.153 +  [NewObject,Throws]
   1.154 +  DOMRequest sendMediaMetaData(optional MediaMetaData mediaMetaData);
   1.155 +  [NewObject,Throws]
   1.156 +  DOMRequest sendMediaPlayStatus(optional MediaPlayStatus mediaPlayStatus);
   1.157 +};

mercurial