2012-02-20 19:15:19 +04:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
2012-08-17 06:53:45 +04:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-02-20 19:15:19 +04:00
|
|
|
/* 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"
|
2012-08-01 08:53:04 +04:00
|
|
|
#include "BluetoothPropertyContainer.h"
|
2012-07-18 07:41:54 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2012-02-23 19:55:48 +04:00
|
|
|
#include "nsDOMEventTargetHelper.h"
|
2012-02-20 19:15:19 +04:00
|
|
|
#include "nsIDOMBluetoothAdapter.h"
|
|
|
|
|
2012-03-05 07:54:01 +04:00
|
|
|
class nsIEventTarget;
|
2012-07-18 07:41:54 +04:00
|
|
|
class nsIDOMDOMRequest;
|
2012-03-05 07:54:01 +04:00
|
|
|
|
2012-02-20 19:15:19 +04:00
|
|
|
BEGIN_BLUETOOTH_NAMESPACE
|
|
|
|
|
2012-07-18 07:41:54 +04:00
|
|
|
class BluetoothSignal;
|
|
|
|
class BluetoothNamedValue;
|
2012-08-08 21:47:09 +04:00
|
|
|
class BluetoothValue;
|
2012-07-18 07:41:54 +04:00
|
|
|
|
2012-03-28 21:29:14 +04:00
|
|
|
class BluetoothAdapter : public nsDOMEventTargetHelper
|
|
|
|
, public nsIDOMBluetoothAdapter
|
2012-07-18 07:41:54 +04:00
|
|
|
, public BluetoothSignalObserver
|
2012-08-01 08:53:04 +04:00
|
|
|
, public BluetoothPropertyContainer
|
2012-02-20 19:15:19 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-05-24 08:02:23 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-02-20 19:15:19 +04:00
|
|
|
NS_DECL_NSIDOMBLUETOOTHADAPTER
|
|
|
|
|
2012-02-23 19:55:48 +04:00
|
|
|
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
|
|
|
|
|
2012-08-01 08:53:04 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(BluetoothAdapter,
|
|
|
|
nsDOMEventTargetHelper)
|
|
|
|
|
2012-06-02 22:23:16 +04:00
|
|
|
static already_AddRefed<BluetoothAdapter>
|
2012-08-08 21:47:09 +04:00
|
|
|
Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
|
2012-07-18 07:41:54 +04:00
|
|
|
|
|
|
|
void Notify(const BluetoothSignal& aParam);
|
|
|
|
|
|
|
|
nsIDOMEventTarget*
|
|
|
|
ToIDOMEventTarget() const
|
|
|
|
{
|
|
|
|
return static_cast<nsDOMEventTargetHelper*>(
|
|
|
|
const_cast<BluetoothAdapter*>(this));
|
|
|
|
}
|
2012-06-02 22:23:16 +04:00
|
|
|
|
2012-07-18 07:41:54 +04:00
|
|
|
nsISupports*
|
|
|
|
ToISupports() const
|
|
|
|
{
|
|
|
|
return ToIDOMEventTarget();
|
|
|
|
}
|
|
|
|
|
2012-08-01 08:53:04 +04:00
|
|
|
void Unroot();
|
|
|
|
virtual void SetPropertyByValue(const BluetoothNamedValue& aValue);
|
2012-06-02 22:23:16 +04:00
|
|
|
private:
|
2012-07-18 07:41:54 +04:00
|
|
|
|
2012-08-08 21:47:09 +04:00
|
|
|
BluetoothAdapter(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
|
2012-06-02 22:23:16 +04:00
|
|
|
~BluetoothAdapter();
|
2012-07-18 07:41:54 +04:00
|
|
|
|
2012-08-01 08:53:04 +04:00
|
|
|
void Root();
|
2012-07-18 07:41:54 +04:00
|
|
|
nsresult StartStopDiscovery(bool aStart, nsIDOMDOMRequest** aRequest);
|
2012-08-17 14:35:59 +04:00
|
|
|
nsresult PairUnpair(bool aPair,
|
|
|
|
nsIDOMBluetoothDevice* aDevice,
|
|
|
|
nsIDOMDOMRequest** aRequest);
|
2012-07-18 07:41:54 +04:00
|
|
|
|
|
|
|
nsString mAddress;
|
|
|
|
nsString mName;
|
|
|
|
bool mEnabled;
|
|
|
|
bool mDiscoverable;
|
|
|
|
bool mDiscovering;
|
|
|
|
bool mPairable;
|
|
|
|
bool mPowered;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mPairableTimeout;
|
|
|
|
uint32_t mDiscoverableTimeout;
|
|
|
|
uint32_t mClass;
|
2012-07-18 07:41:54 +04:00
|
|
|
nsTArray<nsString> mDeviceAddresses;
|
|
|
|
nsTArray<nsString> mUuids;
|
2012-08-01 08:53:04 +04:00
|
|
|
JSObject* mJsUuids;
|
|
|
|
JSObject* mJsDeviceAddresses;
|
|
|
|
bool mIsRooted;
|
2012-02-20 19:15:19 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
END_BLUETOOTH_NAMESPACE
|
2012-03-28 03:17:35 +04:00
|
|
|
|
2012-02-20 19:15:19 +04:00
|
|
|
#endif
|