2012-02-20 07:15:19 -08:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=40: */
|
|
|
|
/* 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-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-07-17 20:41:54 -07:00
|
|
|
Create(nsPIDOMWindow* aOwner, const nsAString& name);
|
|
|
|
|
|
|
|
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-07-31 21:53:04 -07:00
|
|
|
BluetoothAdapter(nsPIDOMWindow* aOwner, const nsAString& aPath);
|
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);
|
|
|
|
|
|
|
|
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;
|
2012-07-31 21:53:04 -07:00
|
|
|
JSObject* mJsUuids;
|
|
|
|
JSObject* mJsDeviceAddresses;
|
|
|
|
bool mIsRooted;
|
|
|
|
|
2012-07-17 20:41:54 -07:00
|
|
|
NS_DECL_EVENT_HANDLER(propertychanged)
|
|
|
|
NS_DECL_EVENT_HANDLER(devicefound)
|
|
|
|
NS_DECL_EVENT_HANDLER(devicedisappeared)
|
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
|