Interface INetManager
interface INetManager
Extends com.amazon.apmf.IStandard
The INetManager interface provides APIs to manage network interfaces
in the system.
Using the API, a Kepler Native application can perform the following:
- Manage network interfaces (Wi-Fi, Ethernet, etc.)
- Query network status
- Monitor network connections and network events
Methods
addNetworkEventListener()
Register avoidaddNetworkEventListener(INetworkEventListener*listener)
INetworkEventListener to be notified of network events.
The caller must implement a INetworkEventListener to receive
notifications about changes in the network status and captive portal state.
Parameters
listener
INetworkEventListener* — Required
INetworkEventListener to register.
removeNetworkEventListener()
void removeNetworkEventListener()
Unregister INetworkEventListener.
getNetworkInterfaces()
Get network interfaces in the system. This is used to query network interfaces for the given network interface type. Ifcom.amazon.kepler.net.common.INetworkInterface*[]getNetworkInterfaces(com.amazon.kepler.net.common.NetworkInterfaceType*interfaceType)
NetworkInterfaceType.NONE is given, all network interfaces
in the system are returned.
Parameters
interfaceType
com.amazon.kepler.net.common.NetworkInterfaceType* — Required
NetworkInterfaceType to query.
NetworkInterfaceType.NONE can be used to query all network interfaces.
Returns
com.amazon.kepler.net.common.INetworkInterface*[]
the network interfaces that are matched with
the given NetworkInterfaceType.
getActiveNetworkInterface()
Get the default active network interface for Internet access.com.amazon.kepler.net.common.INetworkInterface?getActiveNetworkInterface()
Returns
com.amazon.kepler.net.common.INetworkInterface?
The return value is optional and might be absent.
the default active network interface.
enableNetworkInterface()
Enable or disable a network interface.voidenableNetworkInterface(u8networkInterfaceId,boolenable,boolpersist)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface to enable
or disable. Use Constants.DEFAULT_NETWORK_INTERFACE_ID_ID for
the default network interface.
enable
bool — Required
true to enable the network interface or false to disable.
persist
bool — Required
true to store the setting persistently after device restart.
Requires com.amazon.network.privilege.net-admin
isNetworkInterfaceEnabled()
Check whether the network interface is enabled.voidisNetworkInterfaceEnabled(u8networkInterfaceId, outbool*enable, outbool*persist)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface to check.
Use Constants.DEFAULT_NETWORK_INTERFACE_ID for the default network
interface.
enable (out)
bool* — Required
true if the network interface is enabled.
persist (out)
bool* — Required
true if the network interface is persistent after restart.
getIpConfig()
Get the specified network interface IP configuration.com.amazon.kepler.net.common.IIpConfiguration?getIpConfig(u8networkInterfaceId,com.amazon.kepler.net.common.IpVersion*ipVersion)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface.
Use Constants.DEFAULT_NETWORK_INTERFACE_ID for the default network
interface.
ipVersion
com.amazon.kepler.net.common.IpVersion* — Required
IpVersion.
Returns
com.amazon.kepler.net.common.IIpConfiguration?
The return value is optional and might be absent.
ipInfo IIpConfiguration that contains the IP information.
createIIpConfiguration()
Make a newcom.amazon.kepler.net.common.IIpConfiguration*createIIpConfiguration()
IIpConfiguration object to configure the network interface.
Returns
com.amazon.kepler.net.common.IIpConfiguration*
IIpConfiguration.
setIpConfig()
Set IP configuration on the specified network interface.voidsetIpConfig(u8networkInterfaceId,com.amazon.kepler.net.common.IIpConfiguration*ipConfiguration)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface.
Use Constants.DEFAULT_NETWORK_INTERFACE_ID for the default network
interface.
ipConfiguration
com.amazon.kepler.net.common.IIpConfiguration* — Required
IIpConfiguration that contains
the IP configuration to set on the network interface.
Requires com.amazon.network.privilege.net-admin
getNetworkState()
Get network state of the specified network interface.com.amazon.kepler.net.common.NetworkStategetNetworkState(u8networkInterfaceId,com.amazon.kepler.net.common.IpVersion*ipVersion)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface.
Use Constants.DEFAULT_NETWORK_INTERFACE_ID for the default network
interface.
ipVersion
com.amazon.kepler.net.common.IpVersion* — Required
ipVersion.
Returns
com.amazon.kepler.net.common.NetworkState
state NetworkState.
getMacAddress()
Get the MAC address of the specified network interface.stringgetMacAddress(u8networkInterfaceId)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface.
Use Constants.DEFAULT_NETWORK_INTERFACE_ID for the default network
interface.
Returns
string
the MAC address of the network interface.
Requires com.amazon.privilege.restricted-net-info
evaluateCaptivePortal()
Evaluate a captive portal asynchronously. onCaptivePortalEvaluated() is called back on registeredvoidevaluateCaptivePortal(u8networkInterfaceId)
NetworkEventCallback when the captive portal evaluation is completed.
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface.
Use Constants.DEFAULT_NETWORK_INTERFACE_ID for the default network
interface.
Requires com.amazon.network.privilege.net-admin
getCaptivePortalState()
Get the current captive portal state of the specified network interface. Return the current captive portal state without initiating a new captive portal evaluation.com.amazon.kepler.net.common.CaptivePortalStategetCaptivePortalState(u8networkInterfaceId)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface.
Use Constants.DEFAULT_NETWORK_INTERFACE_ID for the default network
interface.
Returns
com.amazon.kepler.net.common.CaptivePortalState
CaptivePortalState.
getNetworkCapabilities()
Get network capabilities of the specified network interface.com.amazon.kepler.net.common.NetworkCapabilities[]getNetworkCapabilities(u8networkInterfaceId)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface to get
network capabilities. Use Constants.DEFAULT_NETWORK_INTERFACE_ID for
the default network interface.
Returns
com.amazon.kepler.net.common.NetworkCapabilities[]
Upon success, an array of NetworkCapabilities is returned.
Upon failure, it throws an excpetion.
getLinkSpeed()
Get the link speed of the specified network interface in bps.u64getLinkSpeed(u8networkInterfaceId)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface to get
the link speed.
Returns
u64
the link speed in bps.
createNetworkProxyInfo()
Make a newcom.amazon.kepler.net.common.INetworkProxyInfo*createNetworkProxyInfo()
INetworkProxyInfo object.
Returns
com.amazon.kepler.net.common.INetworkProxyInfo*
INetworkProxyInfo.
setNetworkProxy()
Set network proxy configuration to the specified network interface.voidsetNetworkProxy(u8networkInterfaceId,com.amazon.kepler.net.common.INetworkProxyInfo*networkProxyInfo)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface.
Use Constants.DEFAULT_NETWORK_INTERFACE_ID for the default network
interface.
networkProxyInfo
com.amazon.kepler.net.common.INetworkProxyInfo* — Required
INetworkProxyInfo that contains
network proxy information to be set on the network interface
Requires com.amazon.network.privilege.net-admin
getNetworkProxy()
Get network proxy configuration of the specified network interface.com.amazon.kepler.net.common.INetworkProxyInfo?getNetworkProxy(u8networkInterfaceId)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface.
Use Constants.DEFAULT_NETWORK_INTERFACE_ID for the default network
interface.
Returns
com.amazon.kepler.net.common.INetworkProxyInfo?
The return value is optional and might be absent.
INetworkProxyInfo that contains network proxy configuration
of the specified network interface.
getNetworkSpeed()
Get the expected network throughput/speed of the specified network interface in bps.u64getNetworkSpeed(u8networkInterfaceId)
Parameters
networkInterfaceId
u8 — Required
the identifier of the network interface
to query.
Returns
u64
the expected network throughput/speed in bps.

