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) |
getStatus
Description
Gets the current status of network connections (both Wi-Fi and wired) on the system. Apps can subscribe to it so that they are notified whenever the network status changes.
Parameters
Name | Required | Type | Description |
---|---|---|---|
subscribe | Optional | Boolean | Flag that decides whether to subscribe or not.
|
Call returns
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Flag that indicates success/failure of the request.
|
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.
|
isInternetConnectionAvailable | Required | Boolean | Flag that indicates whether internet connection is available or not.
|
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 Wi-Fi connection. |
wifiDirect | Required | Object | Object that contains information about the state of the Wi-Fi direct connection. |
Subscription Return
Name | Required | Type | Description |
---|---|---|---|
isInternetConnectionAvailable | Required | Boolean | Flag that indicates whether internet connection is available or not.
|
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 Wi-Fi connection. |
wifiDirect | Required | Object | Object that contains information about the state of the Wi-Fi direct connection. |
- In webOS TV 3.X, the subscription feature of getStatus() is not working correctly. In this case, use the following service URI for subscription: luna://com.webos.service.connectionmanager
- Regardless of the webOS TV version, you can easily monitor the network status using the following method in webOSTV.js: connection.getStatus
Error reference
Error Message | Error Description |
---|---|
Connman manager is not available | TheConnection 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": "123.456.789.180",
"ipAddress": "123.456.789.12",
"onInternet": "yes",
"method": "manual",
"state": "connected",
"gateway": "123.456.789.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 connected. If 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 netmask 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 Manual.If 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. TheonInternetwill contain one of the following values:
|
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 Wi-Fi connection is available it will be set to connected.If the Wi-Fi connection is not available, it will be set to disconnected . |
interfaceName | Optional | String | Name of the Wi-Fi Interface name in use. For example, eth0. |
ipAddress | Optional | String | The IP address associated with the Wi-Fi connection. |
netmask | Optional | String | The netmask value for the Wi-Fi connection. |
gateway | Optional | String | The IP address of the network gateway. |
dns1 | Optional | String | Primary DNS address for the Wi-Fi connection |
dns2 | Optional | String | Secondary DNS address for the Wi-Fi connection |
dns3 | Optional | String | Tertiary DNS address for the Wi-Fi connection |
method | Optional | String | If the IP address was assigned using the manual mode, method will contain Manual. If 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 Wi-Fi interface was set to stay up even when suspended, isWakeOnWiFiEnabled will contain true. If the Wi-Fi 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:
|
wifiDirect object
The wifidirect object provides details on the status of the Wi-Fi direct connection.Only if the Wi-Fi direct connection is available all the fields of this object will contain the relevant information. If the Wi-Fi 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 Wi-Fi connection is available it will be set to connected. If the Wi-Fi 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 (Wi-Fi Direct Info object)
This object contains information on the Wi-Fi Direct settings of a Wi-Fi Peer connection. It is used in Wi-Fi Peer Info and is only present when the connection uses Wi-Fi Direct.
{
"wfdCpSupport": Boolean,
"wfdDeviceType": String,
"wfdRtspPort": Number,
"wfdSessionAvail": Boolean,
}
Name | Required | Type | Description |
---|---|---|---|
wfdCpSupport | Required | Boolean | The flag that indicates whether the Wi-Fi Direct content protection is supported:
|
wfdDeviceType | Required | String | Wi-Fi Direct device type, one of:
|
wfdRtspPort | Required | Number | Control port forWi-Fi Direct session management |
wfdSessionAvail | Required | Boolean | The flag that indicates whether the session is available:
|