2012-05-24 08:02:23 +04:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
2012-08-21 07:21:24 +04:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-24 08:02:23 +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_bluetoothmanager_h__
|
|
|
|
#define mozilla_dom_bluetooth_bluetoothmanager_h__
|
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-05-24 08:02:23 +04:00
|
|
|
#include "BluetoothCommon.h"
|
2012-08-01 08:53:04 +04:00
|
|
|
#include "BluetoothPropertyContainer.h"
|
2012-05-24 08:02:23 +04:00
|
|
|
#include "nsDOMEventTargetHelper.h"
|
2012-08-30 10:08:50 +04:00
|
|
|
#include "mozilla/Observer.h"
|
2013-08-12 12:31:58 +04:00
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class DOMRequest;
|
|
|
|
}
|
|
|
|
}
|
2012-05-24 08:02:23 +04:00
|
|
|
|
|
|
|
BEGIN_BLUETOOTH_NAMESPACE
|
|
|
|
|
2012-08-01 08:53:04 +04:00
|
|
|
class BluetoothNamedValue;
|
|
|
|
|
2012-05-24 08:02:23 +04:00
|
|
|
class BluetoothManager : public nsDOMEventTargetHelper
|
2012-07-18 07:41:54 +04:00
|
|
|
, public BluetoothSignalObserver
|
2012-08-01 08:53:04 +04:00
|
|
|
, public BluetoothPropertyContainer
|
2012-05-24 08:02:23 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2013-07-12 18:36:32 +04:00
|
|
|
// Never returns null
|
2012-06-02 22:23:16 +04:00
|
|
|
static already_AddRefed<BluetoothManager>
|
2013-07-12 18:36:32 +04:00
|
|
|
Create(nsPIDOMWindow* aWindow);
|
|
|
|
static bool CheckPermission(nsPIDOMWindow* aWindow);
|
2012-07-18 07:41:54 +04:00
|
|
|
void Notify(const BluetoothSignal& aData);
|
2013-06-05 20:15:48 +04:00
|
|
|
virtual void SetPropertyByValue(const BluetoothNamedValue& aValue) MOZ_OVERRIDE;
|
2013-08-12 12:31:58 +04:00
|
|
|
|
|
|
|
bool GetEnabled(ErrorResult& aRv);
|
|
|
|
bool IsConnected(uint16_t aProfileId, ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<DOMRequest> GetDefaultAdapter(ErrorResult& aRv);
|
|
|
|
|
|
|
|
IMPL_EVENT_HANDLER(enabled);
|
|
|
|
IMPL_EVENT_HANDLER(disabled);
|
|
|
|
IMPL_EVENT_HANDLER(adapteradded);
|
|
|
|
|
|
|
|
nsPIDOMWindow* GetParentObject() const
|
|
|
|
{
|
|
|
|
return GetOwner();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual JSObject*
|
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
|
|
|
|
2012-05-24 08:02:23 +04:00
|
|
|
private:
|
2012-06-02 22:23:16 +04:00
|
|
|
BluetoothManager(nsPIDOMWindow* aWindow);
|
|
|
|
~BluetoothManager();
|
2012-05-24 08:02:23 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
END_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
#endif
|