michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim:expandtab:shiftwidth=4:tabstop=4: michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /** michael@0: * Network link status monitoring service. michael@0: */ michael@0: [scriptable, uuid(f7d3be87-7403-4a1e-b89f-2797776e9b08)] michael@0: interface nsINetworkLinkService : nsISupports michael@0: { michael@0: /* Link type constants */ michael@0: const unsigned long LINK_TYPE_UNKNOWN = 0; michael@0: const unsigned long LINK_TYPE_ETHERNET = 1; michael@0: const unsigned long LINK_TYPE_USB = 2; michael@0: const unsigned long LINK_TYPE_WIFI = 3; michael@0: const unsigned long LINK_TYPE_WIMAX = 4; michael@0: const unsigned long LINK_TYPE_2G = 5; michael@0: const unsigned long LINK_TYPE_3G = 6; michael@0: const unsigned long LINK_TYPE_4G = 7; michael@0: michael@0: /** michael@0: * This is set to true when the system is believed to have a usable michael@0: * network connection. michael@0: * michael@0: * The link is only up when network connections can be established. For michael@0: * example, the link is down during DHCP configuration (unless there michael@0: * is another usable interface already configured). michael@0: * michael@0: * If the link status is not currently known, we generally assume that michael@0: * it is up. michael@0: */ michael@0: readonly attribute boolean isLinkUp; michael@0: michael@0: /** michael@0: * This is set to true when we believe that isLinkUp is accurate. michael@0: */ michael@0: readonly attribute boolean linkStatusKnown; michael@0: michael@0: /** michael@0: * The type of network connection. michael@0: */ michael@0: readonly attribute unsigned long linkType; michael@0: }; michael@0: michael@0: %{C++ michael@0: /** michael@0: * We send notifications through nsIObserverService with topic michael@0: * NS_NETWORK_LINK_TOPIC whenever one of isLinkUp or linkStatusKnown michael@0: * changes. We pass one of the NS_NETWORK_LINK_DATA_ constants below michael@0: * as the aData parameter of the notification. michael@0: */ michael@0: #define NS_NETWORK_LINK_TOPIC "network:link-status-changed" michael@0: michael@0: /** michael@0: * isLinkUp is now true, linkStatusKnown is true. michael@0: */ michael@0: #define NS_NETWORK_LINK_DATA_UP "up" michael@0: /** michael@0: * isLinkUp is now false, linkStatusKnown is true. michael@0: */ michael@0: #define NS_NETWORK_LINK_DATA_DOWN "down" michael@0: /** michael@0: * linkStatusKnown is now false. michael@0: */ michael@0: #define NS_NETWORK_LINK_DATA_UNKNOWN "unknown" michael@0: michael@0: /** michael@0: * We send notifications through nsIObserverService with topic michael@0: * NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type michael@0: * changes. We pass one of the valid connection type constants michael@0: * below as the aData parameter of the notification. michael@0: */ michael@0: #define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed" michael@0: michael@0: /** We were unable to determine the network connection type */ michael@0: #define NS_NETWORK_LINK_TYPE_UNKNOWN "unknown" michael@0: michael@0: /** A standard wired ethernet connection */ michael@0: #define NS_NETWORK_LINK_TYPE_ETHERNET "ethernet" michael@0: michael@0: /** A connection via a USB port */ michael@0: #define NS_NETWORK_LINK_TYPE_USB "usb" michael@0: michael@0: /** A connection via a WiFi access point (IEEE802.11) */ michael@0: #define NS_NETWORK_LINK_TYPE_WIFI "wifi" michael@0: michael@0: /** A connection via WiMax (IEEE802.16) */ michael@0: #define NS_NETWORK_LINK_TYPE_WIMAX "wimax" michael@0: michael@0: /** A '2G' mobile connection (e.g. GSM, GPRS, EDGE) */ michael@0: #define NS_NETWORK_LINK_TYPE_2G "2g" michael@0: michael@0: /** A '3G' mobile connection (e.g. UMTS, CDMA) */ michael@0: #define NS_NETWORK_LINK_TYPE_3G "3g" michael@0: michael@0: /** A '4G' mobile connection (e.g. LTE, UMB) */ michael@0: #define NS_NETWORK_LINK_TYPE_4G "4g" michael@0: %}