connectivity-cpp  0.0.1
com::ubuntu::connectivity::networking::Manager Class Referenceabstract

networking manager More...

#include <com/ubuntu/connectivity/networking/manager.h>

+ Collaboration diagram for com::ubuntu::connectivity::networking::Manager:

Public Types

enum  NetworkingStatus {
  NetworkingStatus::offline,
  NetworkingStatus::connecting,
  NetworkingStatus::online
}
 enum class for networking status More...
 

Public Member Functions

Manageroperator= (const Manager &)=delete
 
virtual ~Manager ()=default
 
 Manager (const Manager &)=delete
 
virtual const core::Property
< NetworkingStatus > & 
status ()=0
 
virtual const core::Property
< std::uint32_t > & 
characteristics ()=0
 

Static Public Member Functions

static std::unique_ptr< ManagercreateInstance ()
 Creates a new instance of a networking Manager. More...
 

Protected Member Functions

 Manager ()
 The default constructor is protected. More...
 

Detailed Description

networking manager

This is the top-level manager class for accessing networking information.

A new instance of this class can only be created using the static Manager::createInstance().

For system networking status, see Manager::status. For connection characteristics, see Manager::characteristics.

Examples:

Definition at line 53 of file manager.h.

Member Enumeration Documentation

enum class for networking status

Networking status may be accessed through the Manager::status property.

Enumerator
offline 

No Internet connection available.

connecting 

System is actively establising a connection.

online 

System is connected to the Internet.

Definition at line 90 of file manager.h.

Constructor & Destructor Documentation

virtual com::ubuntu::connectivity::networking::Manager::~Manager ( )
virtualdefault
com::ubuntu::connectivity::networking::Manager::Manager ( const Manager )
delete
com::ubuntu::connectivity::networking::Manager::Manager ( )
protected

The default constructor is protected.

To create an instance of the networking manager call Manager::createInstance().

Member Function Documentation

virtual const core::Property<std::uint32_t>& com::ubuntu::connectivity::networking::Manager::characteristics ( )
pure virtual

characteristics of the overall system networking

the value is a bitfield and the individial bits are defined in Link::Characteristics.

mgr->characteristics().changed().connect(
[](std::uint32_t characteristics)
{
std::cout << "System networking characteristics changed:" << std::endl;
if ((characteristics & networking::Link::Characteristics::has_monetary_costs) != 0) {
std::cout << " - has monetary costs" << std::endl;
}
if ((characteristics & networking::Link::Characteristics::is_bandwidth_limited) != 0) {
std::cout << " - is bandwith limited" << std::endl;
}
if ((characteristics & networking::Link::Characteristics::is_volume_limited) != 0) {
std::cout << " - is volume_limited" << std::endl;
}
});
static std::unique_ptr<Manager> com::ubuntu::connectivity::networking::Manager::createInstance ( )
static

Creates a new instance of a networking Manager.

Applications should call this function just once. If application needs to share the instance internally the std::unique_ptr can be transformed into a std::shared_ptr:

std::shared_ptr<Manager> mgr{std::move(Manager::createInstance())};
Note
This call may block.
Returns
std::unique_ptr to new instance of a networking manager.
Manager& com::ubuntu::connectivity::networking::Manager::operator= ( const Manager )
delete
virtual const core::Property<NetworkingStatus>& com::ubuntu::connectivity::networking::Manager::status ( )
pure virtual

status of the overall system networking

mgr->status().changed().connect(
{
switch(status) {
{
std::cout << "System networking status changed to: offline" << std::endl;
break;
}
{
std::cout << "System networking status changed to: connecting" << std::endl;
break;
}
{
std::cout << "System networking status changed to: online" << std::endl;
break;
}
}
});

The documentation for this class was generated from the following file: