2014-05-20 23:12:24 -07:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
2014-07-13 19:47:19 -07:00
|
|
|
[CheckPermissions="bluetooth"]
|
|
|
|
interface BluetoothDevice : EventTarget
|
|
|
|
{
|
|
|
|
readonly attribute DOMString address;
|
|
|
|
readonly attribute BluetoothClassOfDevice cod;
|
|
|
|
readonly attribute DOMString name;
|
|
|
|
readonly attribute boolean paired;
|
|
|
|
|
|
|
|
[Cached, Pure]
|
|
|
|
readonly attribute sequence<DOMString> uuids;
|
2014-05-20 23:12:24 -07:00
|
|
|
|
2014-09-10 19:03:40 -07:00
|
|
|
// Fired when attribute(s) of BluetoothDevice changed
|
2014-07-13 19:47:19 -07:00
|
|
|
attribute EventHandler onattributechanged;
|
2014-05-20 23:12:24 -07:00
|
|
|
|
2014-07-13 19:47:19 -07:00
|
|
|
/**
|
|
|
|
* Fetch the up-to-date UUID list of each bluetooth service that the device
|
|
|
|
* provides and refresh the cache value of attribute uuids if it is updated.
|
|
|
|
*
|
|
|
|
* If the operation succeeds, the promise will be resolved with up-to-date
|
|
|
|
* UUID list which is identical to attribute uuids.
|
|
|
|
*/
|
|
|
|
[NewObject, Throws]
|
2014-07-31 20:50:30 -07:00
|
|
|
Promise<sequence<DOMString>> fetchUuids();
|
2014-05-20 23:12:24 -07:00
|
|
|
};
|
2014-09-10 19:03:40 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Possible device attributes that attributechanged event reports.
|
|
|
|
* Note "address" is excluded since it never changes once BluetoothDevice
|
|
|
|
* is created.
|
|
|
|
*/
|
|
|
|
enum BluetoothDeviceAttribute
|
|
|
|
{
|
|
|
|
"unknown",
|
|
|
|
"cod",
|
|
|
|
"name",
|
|
|
|
"paired",
|
|
|
|
"uuids"
|
|
|
|
};
|
|
|
|
|