Connection Manager

Service URI - luna://com.palm.connectionmanager

Provides the status of available Internet connections.

  

Connection manager provides methods for managing Internet connections. It enables apps to get the status of connections.

Methods

Method

Description

Supported in Emulator

getStatus Gets the current status of network connections (both WiFi and wired) on the system.  Partially
(Only Wired)

 

Open All


getStatus

Description

Gets the current status of network connections (both WiFi and wired) on the system. Apps can subscribe to it so that they are notified whenever the network status changes.

Syntax

getStatus([Boolean subscribe])

Parameters

Name

Required

Type

Description

subscribe Optional Boolean

Flag that decides whether to subscribe or not.

  • true: Subscribe.
  • false: Do not subscribe. Call the method only once. (Default)

Call Returns

Name

Required

Type

Description

returnValue Required Boolean Flag that indicates success/failure of the request.
  • true: Success
  • false: Failure
errorText Optional String

errorText contains the error text if the method fails. The method will return errorText only if it fails.

See the Error Codes Reference of this method for more details.

subscribed Optional Boolean

Flag that indicates whether the subscription is enabled or not.

  • true: Enabled
  • false: Not enabled.
isInternetConnectionAvailable Required Boolean

Flag that indicates whether internet connection is available or not.

  • true: Any internet connection is available.
  • false: No internet connections are available.
wired Required Object

Object that contains information about the state of the wired connection.

wifi Required Object

Object that contains information about the state of the WiFi connection.

wifiDirect Required Object Object that contains information about the state of the WiFi direct connection.

Subscription Return

Name

Required

Type

Description

isInternetConnectionAvailable Required Boolean

Flag that indicates whether internet connection is available or not.

  • true: Any internet connection is available.
  • false: No internet connections are available.
wired Required Object

Object that contains information about the state of the wired connection.

wifi Required Object

Object that contains information about the state of the WiFi connection.

wifiDirect Required Object Object that contains information about the state of the WiFi direct connection.

Currently, in webOS TV 3.0, the subscription feature of getStatus() is not working correctly. Use the following service URI  for subscription in webOS TV 3.0: luna://com.webos.service.connectionmanager

Error Reference

Error Message

Error Description

Connman manager is not available The Connection Manager (connman) process is not running, and the network status is not available at this time.

Example

// One-time call
var request = webOS.service.request("luna://com.palm.connectionmanager", {
    method: "getStatus",
    onSuccess: function (inResponse) {
        console.log("Result: " + JSON.stringify(inResponse));
        // To-Do something
    },
	onFailure: function (inError) {
		console.log("Failed to get network state");
		console.log("[" + inError.errorCode + "]: " + inError.errorText);
		// To-Do something
		return;
	}
});
 
// Subscription
var subscriptionHandle;
 
subscriptionHandle = webOS.service.request("luna://com.palm.connectionmanager", {
    method: "getStatus",
    parameters: { "subscribe": true },
    onSuccess: function (inResponse) {
        if (typeof(inResponse.subscribed) != 'undefined') {
            if (!inResponse.subscribed) {
                console.log("Failed to subscribe network state");
                return;
            }
        }

        console.log("Result: " + JSON.stringify(inResponse));
        // To-Do something
    },
	onFailure: function (inError) {
		console.log("Failed to get network state");
		console.log("[" + inError.errorCode + "]: " + inError.errorText);
		// To-Do something
		return;
	}
});
...
// If you need to unsubscribe the data, use cancel() method as below
subscriptionHandle.cancel();

Return Example

{
    "wired": {
        "netmask": "255.255.254.0",
        "dns1": "156.147.135.180",
        "ipAddress": "10.177.234.119",
        "onInternet": "yes",
        "method": "manual",
        "state": "connected",
        "gateway": "10.177.234.1",
        "interfaceName": "eth0"
    },
    "isInternetConnectionAvailable": true,
    "wifi": {
        "state": "disconnected"
    },
    "returnValue": true,
    "wifiDirect": {
        "state": "disconnected"
    }
}

See Also

none


Object

wired Object

The wired object provides details on the status of the wired connections.

Only if the wired connection is available will all the fields of this object contain the relevant information. If the wired connection is not available, the state​ field of this object will be set to disconnected and is the only value that is returned to the calling app.

{
    "state": String,
    "interfaceName": String,
    "ipAddress": String,
    "netmaks": String,
    "gateway": String,
    "dns1": String,
    "dns2": String,
    "dns2": String,
    "method": String,
    "onInternet": String
} 

Name

Required

Type

Description

state

Required String

If the wired connection is available it will be set to connectedIf the wired connection is not available, it will be set to disconnected​.

interfaceName

Optional String Name of the wired Interface name in use. For example, ppp0.

ipAddress

Optional String The IP address associated with the wired connection.

netmask

Optional String The net mask value for the wired connection.

gateway

Optional

String

The IP address of the network gateway.

dns1

Optional

String Primary DNS address for the wired connection

dns2

Optional

String

Secondary DNS address for the wired connection

dns3

Optional

String

Tertiary DNS address for the wired connection

method

Optional

String

If the IP address was assigned using the manual mode, method will contain ManualIf the IP Address was assigned through DHCP, method will contain dhcp.

onInternet

Optional

String

The captive portal technique forces an HTTP client on a network to see a special web page (usually for authentication purposes) before using the Internet normally. Captive portals are used at most Wi-Fi hotspots.The onInternet will contain one of the following values:

  • yes​ - indicating the WiFi connection is connected to the Internet.
  • no - indicating the WiFi connection is not connected to the Internet.

wifi Object

The wifi object provides details on the status of the WiFi connection. Only if the WiFi connection is available all the fields of this object will contain the relevant information. If the WiFi connection is not available only the state​ field of this object will be set to disconnected, and is the only value that is returned to the calling app.

{
    "state": String,
    "interfaceName": String,
    "ipAddress": String,
    "netmaks": String,
    "gateway": String,
    "dns1": String,
    "dns2": String,
    "dns3": String,
    "method": String,
    "ssid": String,
    "isWakeOnWiFiEnabled": String,
    "onInternet": String
} 

Name

Required

Type

Description

state Required String

If the WiFi connection is available it will be set to connectedIf the WiFi connection is not available, it will be set to disconnected​.

interfaceName Optional String Name of the WiFi Interface name in use. For example, eth0.
ipAddress Optional String The IP address associated with the WiFi connection.
netmask Optional String The net mask value for the WiFi connection.
gateway Optional String The IP address of the network gateway.
dns1 Optional String Primary DNS address for the WiFi connection
dns2 Optional String Secondary DNS address for the WiFi connection
dns3 Optional String Tertiary DNS address for the Wifi connection
method Optional String If the IP address was assigned using the manual mode, method will contain ManualIf the IP Address was assigned through DHCP,method will contain dhcp.
ssid Optional String The SSID of the connected service (if known).
isWakeOnWiFiEnabled Optional Boolean

If the WiFi interface was set to stay up even when suspended, isWakeOnWiFiEnabled will contain trueIf the WiFi interface was not set to stay up when suspended, isWakeOnWiFiEnabled will contain false.

onInternet Optional String

The captive portal technique forces an HTTP client on a network to see a special web page (usually for authentication purposes) before using the Internet normally. Captive portals are used at most Wi-Fi hotspots.The onInternet will contain one of the following values:

  • yes​ - indicating the WiFi connection is connected to the Internet.
  • no - indicating the WiFi connection is not connected to the Internet.

wifiDirect Object

The wifidirect object provides details on the status of the WiFi direct connection. Only if the WiFi direct connection is available all the fields of this object will contain the relevant information. If the WiFi direct connection is not available only the state​ field of this object will be set to disconnected, and is the only value that is returned to the calling app.

{
    "state": String,
    "connectedPeers": WifiPeerInfo Object,
    "localIp": String,
} 

Name

Required

Type

Description

state Required String

If the WiFi connection is available it will be set to connectedIf the WiFi connection is not available, it will be set to disconnected​.

connectedPeers Optional Object Array A list of objects that provides information about connected peers. 
localIp Optional String The IP address of the local connection endpoint.

WifiPeerInfo Object

This object contains information on a peer-to-peer client.

{
    "deviceName": String,
    "deviceAddress": String,
    "groupOwner": Boolean,
    "configMethod": Number,
    "signalLevel": Number,
    "wfdInfo": WifiWfdInfo Object,
    "connected": Boolean,
    "peerIp": String,
    "invited": String,
    "serviceDiscoveryResponse": String
} 

Name

Required

Type

Description

deviceName

Required

String 

Device name

deviceAddress

Optional

String

Device address

groupOwner

Required

Boolean

Group owner

configMethod

Optional

Number

Configuration method

signalLevel

Required Number Signal level

wfdInfo

Optional Object WFD information

connected

Required Boolean Connection status

peerIp

Optional String IPv4 address
invited Optional String If the connection is available, this property will be set to true. if the connection is not available, this property will be set to false.
serviceDiscoveryResponse Optional String Service discovery response. Only sent on the first inquiry and never again.

WifiWfdInfo Object (WiFi Direct Info Object)

This object contains information on the WiFi Direct settings of a WiFi Peer connection. It is used in Wifi Peer Info and is only present when the connection uses WiFi Direct.

{
    "wfdCpSupport": Boolean,
    "wfdDeviceType": String,
    "wfdRtspPort": Number,
    "wfdSessionAvail": Boolean,
} 

Name

Required

Type

Description

wfdCpSupport

Required

Boolean

The flag that indicates whether the WiFi Direct content protection is supported:

  • true: Supported

  • false: Not supported.

wfdDeviceType

Required

String

WiFi Direct device type, one of:

  • source

  • primary-sink

  • secondary-sink

wfdRtspPort

Required

Number

Control port for WiFi Direct session management 

wfdSessionAvail

Required Boolean

The flag that indicates whether the session is available:

  • true: Available
  • false: Not available

 



Navigation