AbstractNetworkService

AbstractNetworkService ⇐ Abstract

Kind: global abstract class
Extends: Abstract
Mixes: MServiceCache
Service:
Properties

NameTypeDescription
networkStatenumber

The network state

AbstractNetworkService()

A service to handle various Networking interfaces.

getConnectionStatus(options) ⇒ Promise.<number, Error>

Return the status of the network connection (i.e. if the device is connected or disconnected from the network)

Kind: instance method of AbstractNetworkService
Returns: Promise.<number, Error> - A promise returning an integer value as: #NETWORK_CONNECTION_STATUS_OK or #NETWORK_CONNECTION_STATUS_KO

ParamTypeDescription
optionsObject

additional options

options.namesArray.<String>

the names of the interfaces to check (defaulted to WIRED, WIRELESS)

getError(options) ⇒ Promise.<AbstractServiceError, Error>

Return the last error that is the most important

Kind: instance method of AbstractNetworkService
Returns: Promise.<AbstractServiceError, Error> - A promise resolved with the service error. @see AbstractServiceError

ParamTypeDescription
optionsObject

additional options

getInterfaceList() ⇒ Promise.<Array.<AbstractNetworkInterface>>

Get list of network interfaces

Kind: instance method of AbstractNetworkService
Returns: Promise.<Array.<AbstractNetworkInterface>> - A promise resolved with an array of AbstractNetworkInterface object.

getInterfaceDetails(nwInterface) ⇒ Promise.<AbstractNetworkInterfaceDetails>

Get details of interface given in arguments

Kind: instance method of AbstractNetworkService
Returns: Promise.<AbstractNetworkInterfaceDetails> - A promise resolved with AbstractNetworkInterfaceDetails object.

ParamTypeDescription
nwInterfaceString

A network interface identifier

setInterfaceDetails(interfaceDetails) ⇒ Promise

Set details of interface

Kind: instance method of AbstractNetworkService

ParamTypeDescription
interfaceDetailsAbstractNetworkInterfaceDetails

: object describing interface

getConnectedInterfacesDetails(options) ⇒ Promise.<Array.<AbstractNetworkInterfaceDetails>>

Return the details of the interfaces that are connected, ie enabled and up Usefull to know if you are connected to a network

Kind: instance method of AbstractNetworkService
Returns: Promise.<Array.<AbstractNetworkInterfaceDetails>> - A promise resolved with an array of AbstractNetworkInterfaceDetails object.

ParamTypeDescription
optionsObject

additional options

options.typesArray.<string>

the types of THE interfaces to check defaulted to "WIRED","WIRELESS"

options.filterfunction

your own function to check if the interface is connected (first arg is iface -the interface detail)

getAddressList(nwInterface) ⇒ Promise

Get list of interface address

Kind: instance method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

addAddress(nwInterface, networkAddress) ⇒ Promise

Add an address to interface

Kind: instance method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkAddressAbstractNetworkAddress

: address object

removeAddress(nwInterface, networkAddress) ⇒ Promise

Remove an address from interface

Kind: instance method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkAddressAbstractNetworkAddress

: id of address

editAddress(nwInterface, networkAddress) ⇒ Promise

Edit an address

Kind: instance method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkAddressAbstractNetworkAddress

: new address

getDnsServerList() ⇒ Promise

Get list of dns server

Kind: instance method of AbstractNetworkService

addDnsServer(networkDns) ⇒ Promise

Add a dns server to configuration

Kind: instance method of AbstractNetworkService

ParamTypeDescription
networkDnsAbstractNetworkDns

dns address

removeDnsServer(networkDns) ⇒ Promise

Remove a dns server from configuration

Kind: instance method of AbstractNetworkService

ParamTypeDescription
networkDnsAbstractNetworkDns

dns address id

editDnsServer(networkDns) ⇒ Promise

Edit a dns server

Kind: instance method of AbstractNetworkService

ParamTypeDescription
networkDnsAbstractNetworkDns

dns server

getNtpServerList() ⇒ Promise.<Array.<AbstractNetworkNtp>>

Get ntp server list

Kind: instance method of AbstractNetworkService

addNtpServer(networkNtp) ⇒ Promise

Add a ntp server

Kind: instance method of AbstractNetworkService

ParamTypeDescription
networkNtpAbstractNetworkNtp

ntp server address

removeNtpServer(networkNtp) ⇒ Promise

Remove a ntp server

Kind: instance method of AbstractNetworkService

ParamTypeDescription
networkNtpAbstractNetworkNtp

ntp server id

editNtpServer(networkNtp) ⇒ Promise

Edit a ntp server

Kind: instance method of AbstractNetworkService

ParamTypeDescription
networkNtpAbstractNetworkNtp

ntp server object

enableWifi(nwInterface) ⇒ Promise

Enable wifi interface

Kind: instance method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

disableWifi(nwInterface) ⇒ Promise

Disable wifi interface

Kind: instance method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

getAPStatus() ⇒ Promise.<boolean>

Kind: instance method of AbstractNetworkService
Returns: Promise.<boolean> - one of EXTENDER_STATUS_ON or EXTENDER_STATUS_OFF
Access: protected

setAPStatus(status) ⇒ Promise.<boolean>

Kind: instance method of AbstractNetworkService
Access: protected

ParamType
statusboolean

isWifiAPAvailable(nwInterface) ⇒ Promise.<boolean>

Kind: instance method of AbstractNetworkService
Access: protected

ParamType
nwInterfaceAbstractNetworkInterface

getAvailableWifiList(nwInterface) ⇒ Promise.<Array.<AbstractNetworkWifi>>

Get list of wifi

Kind: instance method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

getWifiProfileList(nwInterface) ⇒ Promise.<Array.<AbstractNetworkWifiProfile>>

Get list of wifi profile

Kind: instance method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

addWifiProfile(nwInterface, networkWifiProfile) ⇒ Promise

Add a profile to wifi

Kind: instance method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkWifiProfileAbstractNetworkWifiProfile

: network wifi profile

removeWifiProfile(nwInterface, networkWifiProfile) ⇒ Promise

Remove profile from wifi interface

Kind: instance method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkWifiProfileAbstractNetworkWifiProfile

: id of profile

editWifiProfile(nwInterface, networkWifiProfile) ⇒ Promise

Edit a wifi profile

Kind: instance method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkWifiProfilestring

network wifi profile

getWifiApConfig(nwInterface) ⇒ Promise

Get wifi access points configuration

Kind: instance method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

editWifiApConfig(nwInterface, networkApConfig) ⇒ Promise

Edit wifi access points configuration

Kind: instance method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkApConfigstring

: access points configuration

startWifiWps(nwInterface) ⇒ Promise.<Boolean, Error>

Launch WPS session.

Kind: instance method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

stopWifiWps(nwInterface) ⇒ Promise.<Boolean, Error>

Stop WPS session.

Kind: instance method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

setState(state)

Set network state

Kind: instance method of AbstractNetworkService

ParamTypeDescription
statenumber

network's state

getState() ⇒ boolean

Retrieve network state

Kind: instance method of AbstractNetworkService

_getConnectionStatus(options) ⇒ Promise.<number, Error>

This method comes with a default implementation, but you can override it in your vendor. This is the default implementation test if the given interfaces are up and enabled. If at least one is up and enabled then the connection status is okay status.

Kind: instance method of AbstractNetworkService
Returns: Promise.<number, Error> - One of AbstractNetworkService.NETWORK_CONNECTION_STATUS_OK or AbstractNetworkService.NETWORK_CONNECTION_STATUS_KO
Access: protected

ParamTypeDescription
optionsObject

additional options

options.namesArray.<String>

the names of the interfaces to check (defaulted to WIRED, WIRELESS)

_getError(options) ⇒ Promise.<AbstractServiceError>

Default implementation that returns a AbstractServiceError that has the ServiceErrorCodes.NO_ERROR code

Kind: instance method of AbstractNetworkService
Returns: Promise.<AbstractServiceError> - A promise resolved with the player error. @see AbstractServiceError

ParamTypeDescription
optionsObject

additional options

_getInterfaceList() ⇒ Promise

Get list of network interfaces

Kind: instance abstract method of AbstractNetworkService

_getInterfaceDetails(nwInterface) ⇒ Promise

Get details of interface given in arguments

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_setInterfaceDetails(interfaceDetails) ⇒ Promise

Set details of interface

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
interfaceDetailsObject

An object describing the network interface

_getAddressList(nwInterface) ⇒ Promise

Get list of interface address

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_addAddress(nwInterface, networkAddress) ⇒ Promise

Add an address to interface

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkAddressstring

An address object

_removeAddress(nwInterface, addressId) ⇒ Promise

Remove an address from interface

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
addressIdstring

An identifier of networking address

_editAddress(nwInterface, networkAddress) ⇒ Promise

Edit an address

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkAddressstring

A new networking address

_getDnsServerList() ⇒ Promise

Get list of DNS server

Kind: instance abstract method of AbstractNetworkService

_addDnsServer(networkDns) ⇒ Promise

Add a DNS server to configuration

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
networkDnsstring

A DNS address

_removeDnsServer(networkDnsId) ⇒ Promise

Remove a DNS server from configuration

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
networkDnsIdString

A given DNS address identifier

_editDnsServer(networkDns) ⇒ Promise

Edit a DNS server

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
networkDnsstring

A DNS server

_getNtpServerList() ⇒ Promise

Get NTP server list

Kind: instance abstract method of AbstractNetworkService

_addNtpServer(networkNtp) ⇒ Promise

Add a NTP server

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
networkNtpstring

NTP server address

_removeNtpServer(networkNtpId) ⇒ Promise

Remove a ntp server

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
networkNtpIdstring

NTP server identifier

_editNtpServer(networkNtp) ⇒ Promise

Edit a NTP server

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
networkNtpstring

A NTP server object

_enableWifi(nwInterface) ⇒ Promise

Enable WiFi interface

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_disableWifi(nwInterface) ⇒ Promise

Disable WiFi interface

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_getAvailableWifiList(nwInterface) ⇒ Promise

Get an available list of WiFi

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_getWifiProfileList(nwInterface) ⇒ Promise

Get a list of WiFi profiles

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_addWifiProfile(nwInterface, networkWifiProfile) ⇒ *

Add a WiFi profile

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkWifiProfilestring

: network wifi profile

_removeWifiProfile(nwInterface, profileId) ⇒ Promise

Remove a profile from the WiFi interface

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
profileIdstring

: id of profile

_editWifiProfile(nwInterface, networkWifiProfile) ⇒ Promise

Edit a WiFi profile

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkWifiProfilestring

nertwork wifi profile

_getWifiApConfig(nwInterface) ⇒ *

Get WiFi access points configuration

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_editWifiApConfig(nwInterface, networkApConfig) ⇒ Promise

Edit WiFi access points configuration

Kind: instance abstract method of AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface
networkApConfigstring

: access points configuration

_startWifiWps(nwInterface) ⇒ Promise.<Boolean, Error>

Launch WPS session implementation

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_getAPStatus() ⇒ Promise.<number, Error>

Get the access point status

Kind: instance abstract method of AbstractNetworkService

_setAPStatus(status) ⇒ Promise.<number, Error>

Set the access point status

Kind: instance abstract method of AbstractNetworkService

ParamType
statusboolean

_isWifiAPAvailable(nwInterface) ⇒ Promise.<number, Error>

Check if the Access point in Available

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_stopWifiWps(nwInterface) ⇒ Promise.<Boolean, Error>

Stop WPS session implementation

Kind: instance abstract method of AbstractNetworkService

ParamType
nwInterfaceAbstractNetworkInterface

_onInterfaceUp(nwInterface) ⇒ Promise

Event triggered when an interface gets connected

Kind: instance method of AbstractNetworkService
Access: protected

ParamTypeDescription
nwInterfaceAbstractNetworkInterface

Interface instance that just connected

_onInterfaceDown(nwInterface) ⇒ Promise

Event triggered when an interface gets disconnected

Kind: instance method of AbstractNetworkService
Access: protected

ParamTypeDescription
nwInterfaceAbstractNetworkInterface

Interface instance that just disconnected

_onWifiConnectionUp() ⇒ Promise

Event triggered when WiFi gets connected

Kind: instance method of AbstractNetworkService
Access: protected

_onWifiConnectionDown() ⇒ Promise

Event triggered when WiFi gets disconnected

Kind: instance method of AbstractNetworkService
Access: protected

_onWifiConnectionError() ⇒ Promise

Event triggered when WiFi goes into error (can not connect)

Kind: instance method of AbstractNetworkService
Access: protected

getWifiRepeaterConnectedDevices() ⇒ Promise.<Array.<Device>>

Get list of connected devices

Kind: instance method of AbstractNetworkService
Access: protected

_getWifiRepeaterConnectedDevices() ⇒ Promise.Promise.<Array.<Device>>

Get list of connected devices

Kind: instance method of AbstractNetworkService

“interfaceUp” (nwInterface)

Event triggered when an interface gets connected

Kind: event emitted by AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface

Interface instance that just connected

“interfaceDown” (nwInterface)

Event triggered when an interface gets disconnected

Kind: event emitted by AbstractNetworkService

ParamTypeDescription
nwInterfaceAbstractNetworkInterface

Interface instance that just disconnected

“wifiConnectionUp”

Event triggered when wifi gets connected

Kind: event emitted by AbstractNetworkService

“wifiConnectionDown”

Event triggered when wifi gets disconnected

Kind: event emitted by AbstractNetworkService

“wifiConnectionError”

Event triggered when wifi goes into error (can not connect)

Kind: event emitted by AbstractNetworkService

NETWORK_CONNECTION_STATUS_OK

The network connection is OK (device is connected to network)

Kind: static property of AbstractNetworkService
See: getConnectionStatus

NETWORK_CONNECTION_STATUS_KO

The network connection is OK (device is not connected to network)

Kind: static property of AbstractNetworkService
See: getConnectionStatus

EXTENDER_STATUS_ON

The network connection is OK (device is an extender)

Kind: static property of AbstractNetworkService
See: setAPStatus

EXTENDER_STATUS_OFF

The extender status is OFF (device is not an extender)

Kind: static property of AbstractNetworkService
See: setAPStatus