Bumping manifests a=b2g-bump
[gecko.git] / dom / bluetooth2 / BluetoothDevice.h
blob8bc5fd4279fd34582a2068dca8433b66046a83e6
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_bluetooth_bluetoothdevice_h__
8 #define mozilla_dom_bluetooth_bluetoothdevice_h__
10 #include "mozilla/Attributes.h"
11 #include "mozilla/DOMEventTargetHelper.h"
12 #include "mozilla/dom/BluetoothDevice2Binding.h"
13 #include "BluetoothCommon.h"
14 #include "nsString.h"
15 #include "nsCOMPtr.h"
17 namespace mozilla {
18 namespace dom {
19 class Promise;
23 BEGIN_BLUETOOTH_NAMESPACE
25 class BluetoothClassOfDevice;
26 class BluetoothNamedValue;
27 class BluetoothValue;
28 class BluetoothSignal;
29 class BluetoothSocket;
31 class BluetoothDevice MOZ_FINAL : public DOMEventTargetHelper
32 , public BluetoothSignalObserver
34 public:
35 NS_DECL_ISUPPORTS_INHERITED
37 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BluetoothDevice,
38 DOMEventTargetHelper)
40 static already_AddRefed<BluetoothDevice>
41 Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
43 void Notify(const BluetoothSignal& aParam);
45 void GetAddress(nsString& aAddress) const
47 aAddress = mAddress;
50 BluetoothClassOfDevice* Cod() const
52 return mCod;
55 void GetName(nsString& aName) const
57 aName = mName;
60 bool Paired() const
62 return mPaired;
65 void GetUuids(nsTArray<nsString>& aUuids) {
66 aUuids = mUuids;
69 already_AddRefed<Promise> FetchUuids(ErrorResult& aRv);
71 void SetPropertyByValue(const BluetoothNamedValue& aValue);
73 BluetoothDeviceAttribute
74 ConvertStringToDeviceAttribute(const nsAString& aString);
76 bool
77 IsDeviceAttributeChanged(BluetoothDeviceAttribute aType,
78 const BluetoothValue& aValue);
80 void HandlePropertyChanged(const BluetoothValue& aValue);
82 void DispatchAttributeEvent(const nsTArray<nsString>& aTypes);
84 IMPL_EVENT_HANDLER(attributechanged);
86 nsPIDOMWindow* GetParentObject() const
88 return GetOwner();
91 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
92 virtual void DisconnectFromOwner() MOZ_OVERRIDE;
94 private:
95 BluetoothDevice(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
96 ~BluetoothDevice();
98 nsString mAddress;
99 nsRefPtr<BluetoothClassOfDevice> mCod;
100 nsString mName;
101 bool mPaired;
102 nsTArray<nsString> mUuids;
106 END_BLUETOOTH_NAMESPACE
108 #endif