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