2014-05-21 10:12:24 +04: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-14 06:47:19 +04:00
|
|
|
[CheckPermissions="bluetooth"]
|
|
|
|
interface BluetoothDevice : EventTarget
|
|
|
|
{
|
|
|
|
readonly attribute DOMString address;
|
|
|
|
readonly attribute BluetoothClassOfDevice cod;
|
|
|
|
readonly attribute DOMString name;
|
|
|
|
readonly attribute boolean paired;
|
2014-09-11 06:03:52 +04:00
|
|
|
readonly attribute BluetoothDeviceType type;
|
2014-07-14 06:47:19 +04:00
|
|
|
|
2015-02-13 19:13:00 +03:00
|
|
|
/**
|
|
|
|
* Retrieve the BluetoothGatt interface to interact with remote BLE devices.
|
|
|
|
* This attribute is null if the device type is not dual or le.
|
|
|
|
*/
|
|
|
|
readonly attribute BluetoothGatt? gatt;
|
|
|
|
|
2014-07-14 06:47:19 +04:00
|
|
|
[Cached, Pure]
|
|
|
|
readonly attribute sequence<DOMString> uuids;
|
2014-05-21 10:12:24 +04:00
|
|
|
|
2014-09-11 06:03:40 +04:00
|
|
|
// Fired when attribute(s) of BluetoothDevice changed
|
2014-07-14 06:47:19 +04:00
|
|
|
attribute EventHandler onattributechanged;
|
2014-05-21 10:12:24 +04:00
|
|
|
|
2014-07-14 06:47:19 +04: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.
|
|
|
|
*/
|
2015-01-12 19:52:25 +03:00
|
|
|
[NewObject]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<sequence<DOMString>> fetchUuids();
|
2014-05-21 10:12:24 +04:00
|
|
|
};
|
2014-09-11 06:03:40 +04:00
|
|
|
|
2014-09-11 06:03:52 +04:00
|
|
|
enum BluetoothDeviceType
|
|
|
|
{
|
|
|
|
"unknown",
|
|
|
|
"classic",
|
|
|
|
"le",
|
|
|
|
"dual"
|
|
|
|
};
|
|
|
|
|
2014-09-11 06:03:40 +04:00
|
|
|
/*
|
|
|
|
* Possible device attributes that attributechanged event reports.
|
2014-09-11 06:03:52 +04:00
|
|
|
* Note "address" and "type" are excluded since they never change once
|
|
|
|
* BluetoothDevice is created.
|
2014-09-11 06:03:40 +04:00
|
|
|
*/
|
|
|
|
enum BluetoothDeviceAttribute
|
|
|
|
{
|
|
|
|
"unknown",
|
|
|
|
"cod",
|
|
|
|
"name",
|
|
|
|
"paired",
|
|
|
|
"uuids"
|
|
|
|
};
|
|
|
|
|