mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 764682 - Implement wifi events in c++. r=smaug
This commit is contained in:
parent
a70c3b6954
commit
690cbd60df
@ -73,6 +73,12 @@ CPPSRCS = \
|
||||
nsDOMApplicationEvent.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_B2G_RIL
|
||||
CPPSRCS += \
|
||||
nsDOMWifiEvent.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
@ -94,6 +100,12 @@ LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../../../layout/xul/base/src/tree/src \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_B2G_RIL
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../../../dom/wifi \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
||||
ifdef MOZ_JSDEBUGGER
|
||||
|
168
content/events/src/nsDOMWifiEvent.cpp
Normal file
168
content/events/src/nsDOMWifiEvent.cpp
Normal file
@ -0,0 +1,168 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsDOMWifiEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
|
||||
// nsDOMMozWifiStatusChangeEvent
|
||||
|
||||
DOMCI_DATA(MozWifiStatusChangeEvent, nsDOMMozWifiStatusChangeEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMMozWifiStatusChangeEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMMozWifiStatusChangeEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNetwork)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMMozWifiStatusChangeEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNetwork)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMMozWifiStatusChangeEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozWifiStatusChangeEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozWifiStatusChangeEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMMozWifiStatusChangeEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMMozWifiStatusChangeEvent, nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMozWifiStatusChangeEvent::GetNetwork(nsIVariant** aNetwork)
|
||||
{
|
||||
NS_IF_ADDREF(*aNetwork = mNetwork);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMozWifiStatusChangeEvent::GetStatus(nsAString& aStatus)
|
||||
{
|
||||
aStatus = mStatus;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMozWifiStatusChangeEvent::InitMozWifiStatusChangeEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIVariant* aNetwork,
|
||||
const nsAString& aStatus)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mNetwork = aNetwork;
|
||||
mStatus = aStatus;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMMozWifiStatusChangeEvent::InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal)
|
||||
{
|
||||
mozilla::dom::MozWifiStatusChangeEventInit d;
|
||||
nsresult rv = d.Init(aCx, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return InitMozWifiStatusChangeEvent(aType, d.bubbles, d.cancelable, d.network, d.status);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewDOMMozWifiStatusChangeEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
nsDOMMozWifiStatusChangeEvent* e = new nsDOMMozWifiStatusChangeEvent(aPresContext, aEvent);
|
||||
return CallQueryInterface(e, aInstancePtrResult);
|
||||
}
|
||||
|
||||
// nsDOMMozWifiConnectionInfoEvent
|
||||
DOMCI_DATA(MozWifiConnectionInfoEvent, nsDOMMozWifiConnectionInfoEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMMozWifiConnectionInfoEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMMozWifiConnectionInfoEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNetwork)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMMozWifiConnectionInfoEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNetwork)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMMozWifiConnectionInfoEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozWifiConnectionInfoEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozWifiConnectionInfoEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMMozWifiConnectionInfoEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMMozWifiConnectionInfoEvent, nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMozWifiConnectionInfoEvent::GetNetwork(nsIVariant** aNetwork)
|
||||
{
|
||||
NS_IF_ADDREF(*aNetwork = mNetwork);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMozWifiConnectionInfoEvent::GetSignalStrength(PRInt16* aSignalStrength)
|
||||
{
|
||||
*aSignalStrength = mSignalStrength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMozWifiConnectionInfoEvent::GetRelSignalStrength(PRInt16* aRelSignalStrength)
|
||||
{
|
||||
*aRelSignalStrength = mRelSignalStrength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMozWifiConnectionInfoEvent::GetLinkSpeed(PRInt32* aLinkSpeed)
|
||||
{
|
||||
*aLinkSpeed = mLinkSpeed;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMozWifiConnectionInfoEvent::InitMozWifiConnectionInfoEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIVariant *aNetwork,
|
||||
PRInt16 aSignalStrength,
|
||||
PRInt16 aRelSignalStrength,
|
||||
PRInt32 aLinkSpeed)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mNetwork = aNetwork;
|
||||
mSignalStrength = aSignalStrength;
|
||||
mRelSignalStrength = aRelSignalStrength;
|
||||
mLinkSpeed = aLinkSpeed;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMMozWifiConnectionInfoEvent::InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal)
|
||||
{
|
||||
mozilla::dom::MozWifiConnectionInfoEventInit d;
|
||||
nsresult rv = d.Init(aCx, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return InitMozWifiConnectionInfoEvent(aType, d.bubbles, d.cancelable, d.network,
|
||||
d.signalStrength, d.relSignalStrength, d.linkSpeed);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewDOMMozWifiConnectionInfoEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
nsDOMMozWifiConnectionInfoEvent* e = new nsDOMMozWifiConnectionInfoEvent(aPresContext, aEvent);
|
||||
return CallQueryInterface(e, aInstancePtrResult);
|
||||
}
|
57
content/events/src/nsDOMWifiEvent.h
Normal file
57
content/events/src/nsDOMWifiEvent.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 nsDOMWifiEvent_h__
|
||||
#define nsDOMWifiEvent_h__
|
||||
|
||||
#include "nsIWifi.h"
|
||||
#include "nsIWifiEvents.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
class nsDOMMozWifiStatusChangeEvent : public nsDOMEvent,
|
||||
public nsIDOMMozWifiStatusChangeEvent
|
||||
{
|
||||
public:
|
||||
nsDOMMozWifiStatusChangeEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent) {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMMozWifiStatusChangeEvent, nsDOMEvent)
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
NS_DECL_NSIDOMMOZWIFISTATUSCHANGEEVENT
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal);
|
||||
private:
|
||||
nsCOMPtr<nsIVariant> mNetwork;
|
||||
nsString mStatus;
|
||||
};
|
||||
|
||||
class nsDOMMozWifiConnectionInfoEvent : public nsDOMEvent,
|
||||
public nsIDOMMozWifiConnectionInfoEvent
|
||||
{
|
||||
public:
|
||||
nsDOMMozWifiConnectionInfoEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent) {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMMozWifiConnectionInfoEvent, nsDOMEvent)
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
NS_DECL_NSIDOMMOZWIFICONNECTIONINFOEVENT
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal);
|
||||
private:
|
||||
nsCOMPtr<nsIVariant> mNetwork;
|
||||
PRInt16 mSignalStrength;
|
||||
PRInt16 mRelSignalStrength;
|
||||
PRInt32 mLinkSpeed;
|
||||
};
|
||||
|
||||
#endif // nsDOMWifiEvent_h__
|
@ -180,6 +180,11 @@
|
||||
#include "nsIDOMContactManager.h"
|
||||
#include "nsIDOMApplicationRegistry.h"
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "nsIWifi.h"
|
||||
#include "nsIWifiEvents.h"
|
||||
#endif
|
||||
|
||||
// includes needed for the prototype chain interfaces
|
||||
#include "nsIDOMNavigator.h"
|
||||
#include "nsIDOMBarProp.h"
|
||||
@ -1644,6 +1649,10 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DEFINE_CLASSINFO_DATA(MozWifiStatusChangeEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MozWifiConnectionInfoEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(Telephony, nsEventTargetSH,
|
||||
EVENTTARGET_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(TelephonyCall, nsEventTargetSH,
|
||||
@ -1723,6 +1732,10 @@ NS_DEFINE_EVENT_CTOR(MouseEvent)
|
||||
NS_DEFINE_EVENT_CTOR(DeviceLightEvent)
|
||||
NS_DEFINE_EVENT_CTOR(DeviceProximityEvent)
|
||||
NS_DEFINE_EVENT_CTOR(UserProximityEvent)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DEFINE_EVENT_CTOR(MozWifiStatusChangeEvent)
|
||||
NS_DEFINE_EVENT_CTOR(MozWifiConnectionInfoEvent)
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
NS_DOMStorageEventCtor(nsISupports** aInstancePtrResult)
|
||||
@ -1770,6 +1783,10 @@ static const nsConstructorFuncMapData kConstructorFuncMap[] =
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(UserProximityEvent)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(DeviceLightEvent)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(StorageEvent)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiStatusChangeEvent)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiConnectionInfoEvent)
|
||||
#endif
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozSmsFilter, sms::SmsFilter::NewSmsFilter)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XMLHttpRequest, NS_XMLHttpRequestCtor)
|
||||
};
|
||||
@ -4498,6 +4515,16 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozWifiStatusChangeEvent, nsIDOMMozWifiStatusChangeEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozWifiStatusChangeEvent)
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozWifiConnectionInfoEvent, nsIDOMMozWifiConnectionInfoEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozWifiConnectionInfoEvent)
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Telephony, nsIDOMTelephony)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMTelephony)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
|
@ -521,6 +521,8 @@ DOMCI_CLASS(MozContactChangeEvent)
|
||||
DOMCI_CLASS(MozApplicationEvent)
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
DOMCI_CLASS(MozWifiStatusChangeEvent)
|
||||
DOMCI_CLASS(MozWifiConnectionInfoEvent)
|
||||
DOMCI_CLASS(Telephony)
|
||||
DOMCI_CLASS(TelephonyCall)
|
||||
DOMCI_CLASS(CallEvent)
|
||||
|
@ -57,6 +57,7 @@ XPIDLSRCS = \
|
||||
nsIDOMHashChangeEvent.idl \
|
||||
nsIDOMCustomEvent.idl \
|
||||
nsIDOMCompositionEvent.idl \
|
||||
nsIWifiEventInits.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -269,6 +269,10 @@ NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPres
|
||||
nsresult
|
||||
NS_NewDOMMozContactChangeEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMMozWifiStatusChangeEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMMozWifiConnectionInfoEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMPopStateEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMHashChangeEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
|
23
dom/interfaces/events/nsIWifiEventInits.idl
Normal file
23
dom/interfaces/events/nsIWifiEventInits.idl
Normal file
@ -0,0 +1,23 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIDOMEventTarget.idl"
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
interface nsIVariant;
|
||||
|
||||
dictionary MozWifiStatusChangeEventInit : EventInit
|
||||
{
|
||||
nsIVariant network;
|
||||
DOMString status;
|
||||
};
|
||||
|
||||
dictionary MozWifiConnectionInfoEventInit : EventInit
|
||||
{
|
||||
nsIVariant network;
|
||||
short signalStrength;
|
||||
short relSignalStrength;
|
||||
long linkSpeed;
|
||||
};
|
@ -172,18 +172,24 @@ DOMWifiManager.prototype = {
|
||||
|
||||
_fireStatusChangeEvent: function StatusChangeEvent() {
|
||||
if (this._onStatusChange) {
|
||||
var event = new WifiStatusChangeEvent(this._currentNetwork,
|
||||
this._connectionStatus);
|
||||
debug("StatusChangeEvent");
|
||||
var event = new this._window.MozWifiStatusChangeEvent("statusChangeEvent",
|
||||
{ network: this._currentNetwork,
|
||||
status: this._connectionStatus
|
||||
});
|
||||
this._onStatusChange.handleEvent(event);
|
||||
}
|
||||
},
|
||||
|
||||
_fireConnectionInfoUpdate: function connectionInfoUpdate(info) {
|
||||
if (this._onConnectionInfoUpdate) {
|
||||
var evt = new ConnectionInfoUpdate(this._currentNetwork,
|
||||
info.signalStrength,
|
||||
info.relSignalStrength,
|
||||
info.linkSpeed);
|
||||
debug("ConnectionInfoEvent");
|
||||
var evt = new this._window.MozWifiConnectionInfoEvent("connectionInfoEvent",
|
||||
{ network: this._currentNetwork,
|
||||
signalStrength: info.signalStrength,
|
||||
relSignalStrength: info.relSignalStrength,
|
||||
linkSpeed: info.linkSpeed
|
||||
});
|
||||
this._onConnectionInfoUpdate.handleEvent(evt);
|
||||
}
|
||||
},
|
||||
@ -252,38 +258,6 @@ DOMWifiManager.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
function WifiStatusChangeEvent(network, status) {
|
||||
this.network = network;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
WifiStatusChangeEvent.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMWifiStatusChangeEvent]),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({classID: Components.ID("{f28c1ae7-4db7-4a4d-bb06-737eb04ad700}"),
|
||||
contractID: "@mozilla.org/wifi/statechange-event;1",
|
||||
interfaces: [Ci.nsIDOMWifiStatusChangeEvent],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "Wifi State Change Event"})
|
||||
};
|
||||
|
||||
function ConnectionInfoUpdate(network, signalStrength, relSignalStrength, linkSpeed) {
|
||||
this.network = network;
|
||||
this.signalStrength = signalStrength;
|
||||
this.relSignalStrength = relSignalStrength;
|
||||
this.linkSpeed = linkSpeed;
|
||||
}
|
||||
|
||||
ConnectionInfoUpdate.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMWifiConnectionInfoEvent]),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({classID: Components.ID("{aba4c481-7ea2-464a-b14c-7254a5c99454}"),
|
||||
contractID: "@mozilla.org/wifi/connectioninfo-event;1",
|
||||
interfaces: [Ci.nsIDOMWifiConnectionInfoEvent],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "Wifi Connection Info Event"})
|
||||
};
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([DOMWifiManager]);
|
||||
|
||||
let debug;
|
||||
|
@ -6,8 +6,11 @@
|
||||
#include "nsIDOMDOMRequest.idl"
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
interface nsIVariant;
|
||||
|
||||
[scriptable, uuid(abb936bc-ba81-4c23-8dfa-3e5d96557044)]
|
||||
interface nsIWifi : nsISupports {
|
||||
interface nsIWifi : nsISupports
|
||||
{
|
||||
/**
|
||||
* Shutdown the wifi system.
|
||||
*/
|
||||
@ -15,7 +18,8 @@ interface nsIWifi : nsISupports {
|
||||
};
|
||||
|
||||
[scriptable, uuid(e3d5a7d7-6abd-4ac2-83dc-5315ec08a1c3)]
|
||||
interface nsIDOMWifiManager : nsISupports {
|
||||
interface nsIDOMWifiManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* TODO Remove in favor of a settings API.
|
||||
* Activates or disactivates wifi.
|
||||
@ -77,14 +81,14 @@ interface nsIDOMWifiManager : nsISupports {
|
||||
|
||||
/**
|
||||
* A connectionInformation object with the same information found in an
|
||||
* nsIDOMWifiConnectionInfoEvent (but without the network).
|
||||
* nsIDOMMozWifiConnectionInfoEvent (but without the network).
|
||||
* If we are not currently connected to a network, this will be null.
|
||||
*/
|
||||
readonly attribute jsval connectionInformation;
|
||||
|
||||
/**
|
||||
* State notification listeners. These all take an
|
||||
* nsIDOMWifiStatusChangeEvent with the new status and a network (which
|
||||
* nsIDOMMozWifiStatusChangeEvent with the new status and a network (which
|
||||
* may be null).
|
||||
*
|
||||
* The possible statuses are:
|
||||
@ -100,36 +104,44 @@ interface nsIDOMWifiManager : nsISupports {
|
||||
* disconnected for any reason (transition: connected ->
|
||||
* disconnected).
|
||||
*/
|
||||
attribute nsIDOMEventListener onstatuschange;
|
||||
attribute nsIDOMEventListener onstatuschange;
|
||||
|
||||
/**
|
||||
* An event listener that is called with information about the signal
|
||||
* strength and link speed every 5 seconds.
|
||||
*/
|
||||
attribute nsIDOMEventListener connectionInfoUpdate;
|
||||
attribute nsIDOMEventListener connectionInfoUpdate;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(5b8eaf12-08fb-4cba-b641-4d0b6aac3505)]
|
||||
interface nsIDOMWifiStatusChangeEvent : nsIDOMEvent {
|
||||
[scriptable, builtinclass, uuid(ba1dab70-b70d-11e1-afa6-0800200c9a66)]
|
||||
interface nsIDOMMozWifiStatusChangeEvent : nsIDOMEvent
|
||||
{
|
||||
/**
|
||||
* Network object with a SSID field describing the network affected by
|
||||
* this change. This might be null.
|
||||
*/
|
||||
readonly attribute jsval network;
|
||||
readonly attribute nsIVariant network;
|
||||
|
||||
/**
|
||||
* String describing the current status of the wifi manager. See above for
|
||||
* the possible values.
|
||||
*/
|
||||
readonly attribute string status;
|
||||
readonly attribute DOMString status;
|
||||
|
||||
[noscript] void initMozWifiStatusChangeEvent(in DOMString aType,
|
||||
in boolean aCanBubble,
|
||||
in boolean aCancelable,
|
||||
in nsIVariant aNetwork,
|
||||
in DOMString status);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(effa623e-d758-4543-8d42-58334db64f8a)]
|
||||
interface nsIDOMWifiConnectionInfoEvent : nsIDOMEvent {
|
||||
[scriptable, builtinclass, uuid(b383e950-b70d-11e1-afa6-0800200c9a66)]
|
||||
interface nsIDOMMozWifiConnectionInfoEvent : nsIDOMEvent
|
||||
{
|
||||
/**
|
||||
* Network object with an SSID field.
|
||||
*/
|
||||
readonly attribute jsval network;
|
||||
readonly attribute nsIVariant network;
|
||||
|
||||
/**
|
||||
* Strength of the signal to network, in dBm between -55 and -100 dBm.
|
||||
@ -142,7 +154,15 @@ interface nsIDOMWifiConnectionInfoEvent : nsIDOMEvent {
|
||||
readonly attribute short relSignalStrength;
|
||||
|
||||
/**
|
||||
* Link spead in Mb/s.
|
||||
* Link speed in Mb/s.
|
||||
*/
|
||||
readonly attribute long linkSpeed;
|
||||
|
||||
[noscript] void initMozWifiConnectionInfoEvent(in DOMString aType,
|
||||
in boolean aCanBubble,
|
||||
in boolean aCancelable,
|
||||
in nsIVariant aNetwork,
|
||||
in short signalStrength,
|
||||
in short relSignalStrength,
|
||||
in long linkSpeed);
|
||||
};
|
||||
|
@ -19,6 +19,8 @@ dictionaries = [
|
||||
[ 'MutationObserverInit', 'nsIDOMMutationObserver.idl' ],
|
||||
[ 'SettingsEventInit', 'nsIDOMSettingsManager.idl' ],
|
||||
[ 'ContactChangeEventInit', 'nsIDOMContactManager.idl' ],
|
||||
[ 'WifiConnectionInfoEventInit', 'nsIWifiEventInits.idl' ],
|
||||
[ 'WifiStatusChangeEventInit', 'nsIWifiEventInits.idl' ],
|
||||
[ 'GeoPositionOptions', 'nsIDOMGeoGeolocation.idl' ],
|
||||
[ 'DeviceProximityEventInit', 'nsIDOMDeviceProximityEvent.idl' ],
|
||||
[ 'UserProximityEventInit', 'nsIDOMUserProximityEvent.idl' ],
|
||||
|
Loading…
Reference in New Issue
Block a user