2012-05-23 21:02:23 -07:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
2012-08-20 20:21:24 -07:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-23 21:02:23 -07: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 09:15:48 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-05-23 21:02:23 -07:00
|
|
|
#include "BluetoothCommon.h"
|
2012-07-31 21:53:04 -07:00
|
|
|
#include "BluetoothPropertyContainer.h"
|
2012-05-23 21:02:23 -07:00
|
|
|
#include "nsDOMEventTargetHelper.h"
|
2012-08-29 23:08:50 -07:00
|
|
|
#include "mozilla/Observer.h"
|
2013-08-12 01:31:58 -07:00
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class DOMRequest;
|
|
|
|
}
|
|
|
|
}
|
2012-05-23 21:02:23 -07:00
|
|
|
|
|
|
|
BEGIN_BLUETOOTH_NAMESPACE
|
|
|
|
|
2012-07-31 21:53:04 -07:00
|
|
|
class BluetoothNamedValue;
|
|
|
|
|
2012-05-23 21:02:23 -07:00
|
|
|
class BluetoothManager : public nsDOMEventTargetHelper
|
2012-07-17 20:41:54 -07:00
|
|
|
, public BluetoothSignalObserver
|
2012-07-31 21:53:04 -07:00
|
|
|
, public BluetoothPropertyContainer
|
2012-05-23 21:02:23 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2013-07-12 07:36:32 -07:00
|
|
|
// Never returns null
|
2012-06-02 11:23:16 -07:00
|
|
|
static already_AddRefed<BluetoothManager>
|
2013-07-12 07:36:32 -07:00
|
|
|
Create(nsPIDOMWindow* aWindow);
|
|
|
|
static bool CheckPermission(nsPIDOMWindow* aWindow);
|
2012-07-17 20:41:54 -07:00
|
|
|
void Notify(const BluetoothSignal& aData);
|
2013-06-05 09:15:48 -07:00
|
|
|
virtual void SetPropertyByValue(const BluetoothNamedValue& aValue) MOZ_OVERRIDE;
|
2013-08-12 01:31:58 -07: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-23 21:02:23 -07:00
|
|
|
private:
|
2012-06-02 11:23:16 -07:00
|
|
|
BluetoothManager(nsPIDOMWindow* aWindow);
|
|
|
|
~BluetoothManager();
|
2012-05-23 21:02:23 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
END_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
#endif
|