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"
23 BEGIN_BLUETOOTH_NAMESPACE
25 class BluetoothClassOfDevice
;
26 class BluetoothNamedValue
;
28 class BluetoothSignal
;
29 class BluetoothSocket
;
31 class BluetoothDevice MOZ_FINAL
: public DOMEventTargetHelper
32 , public BluetoothSignalObserver
35 NS_DECL_ISUPPORTS_INHERITED
37 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BluetoothDevice
,
40 static already_AddRefed
<BluetoothDevice
>
41 Create(nsPIDOMWindow
* aOwner
, const BluetoothValue
& aValue
);
43 void Notify(const BluetoothSignal
& aParam
);
45 void GetAddress(nsString
& aAddress
) const
50 BluetoothClassOfDevice
* Cod() const
55 void GetName(nsString
& aName
) const
65 void GetUuids(nsTArray
<nsString
>& aUuids
) {
69 already_AddRefed
<Promise
> FetchUuids(ErrorResult
& aRv
);
71 void SetPropertyByValue(const BluetoothNamedValue
& aValue
);
73 BluetoothDeviceAttribute
74 ConvertStringToDeviceAttribute(const nsAString
& aString
);
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
91 virtual JSObject
* WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
92 virtual void DisconnectFromOwner() MOZ_OVERRIDE
;
95 BluetoothDevice(nsPIDOMWindow
* aOwner
, const BluetoothValue
& aValue
);
99 nsRefPtr
<BluetoothClassOfDevice
> mCod
;
102 nsTArray
<nsString
> mUuids
;
106 END_BLUETOOTH_NAMESPACE