gecko/dom/bluetooth/BluetoothAdapter.h
Gina Yeh 8cc43cb957 Bug 777671 - Final version: add function getPairedDevices() in nsIDOMBluetoothAdapter, r=qdot, sr=mrbkap
---
 dom/bluetooth/BluetoothAdapter.cpp           |   97 +++++++++++++++++++++++++-
 dom/bluetooth/BluetoothAdapter.h             |    2 +-
 dom/bluetooth/BluetoothPropertyContainer.cpp |   32 +--------
 dom/bluetooth/BluetoothPropertyContainer.h   |   26 +------
 dom/bluetooth/BluetoothService.h             |   11 ++-
 dom/bluetooth/BluetoothUtils.cpp             |   48 ++++++++++++-
 dom/bluetooth/BluetoothUtils.h               |    9 ++-
 dom/bluetooth/linux/BluetoothDBusService.cpp |   93 +++++++++++++++++++++++-
 dom/bluetooth/linux/BluetoothDBusService.h   |    4 +-
 dom/bluetooth/nsIDOMBluetoothAdapter.idl     |    3 +-
 10 files changed, 261 insertions(+), 64 deletions(-)
2012-08-17 10:53:45 +08:00

91 lines
2.4 KiB
C++

/* -*- 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/. */
#ifndef mozilla_dom_bluetooth_bluetoothadapter_h__
#define mozilla_dom_bluetooth_bluetoothadapter_h__
#include "BluetoothCommon.h"
#include "BluetoothPropertyContainer.h"
#include "nsCOMPtr.h"
#include "nsDOMEventTargetHelper.h"
#include "nsIDOMBluetoothAdapter.h"
class nsIEventTarget;
class nsIDOMDOMRequest;
BEGIN_BLUETOOTH_NAMESPACE
class BluetoothSignal;
class BluetoothNamedValue;
class BluetoothValue;
class BluetoothAdapter : public nsDOMEventTargetHelper
, public nsIDOMBluetoothAdapter
, public BluetoothSignalObserver
, public BluetoothPropertyContainer
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMBLUETOOTHADAPTER
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(BluetoothAdapter,
nsDOMEventTargetHelper)
static already_AddRefed<BluetoothAdapter>
Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
void Notify(const BluetoothSignal& aParam);
nsIDOMEventTarget*
ToIDOMEventTarget() const
{
return static_cast<nsDOMEventTargetHelper*>(
const_cast<BluetoothAdapter*>(this));
}
nsISupports*
ToISupports() const
{
return ToIDOMEventTarget();
}
void Unroot();
virtual void SetPropertyByValue(const BluetoothNamedValue& aValue);
private:
BluetoothAdapter(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
~BluetoothAdapter();
void Root();
nsresult StartStopDiscovery(bool aStart, nsIDOMDOMRequest** aRequest);
nsString mAddress;
nsString mName;
bool mEnabled;
bool mDiscoverable;
bool mDiscovering;
bool mPairable;
bool mPowered;
PRUint32 mPairableTimeout;
PRUint32 mDiscoverableTimeout;
PRUint32 mClass;
nsTArray<nsString> mDeviceAddresses;
nsTArray<nsString> mUuids;
JSObject* mJsUuids;
JSObject* mJsDeviceAddresses;
bool mIsRooted;
NS_DECL_EVENT_HANDLER(propertychanged)
NS_DECL_EVENT_HANDLER(devicefound)
NS_DECL_EVENT_HANDLER(devicedisappeared)
};
END_BLUETOOTH_NAMESPACE
#endif