Buteo::NetworkManager Class Reference

Class for managing network sessions. More...

`#include <NetworkManager.h>`

Inheritance diagram for Buteo::NetworkManager:

## Signals

void | statusChanged (bool aConnected, Sync::InternetConnectionType aType)
| This signal is emitted when the device's online status changes.
void | connectionSuccess ()
| This signal is emitted when a network session gets connected.
void | connectionError ()
| This signal is emitted when opening a network session fails.

## Public Member Functions

| NetworkManager (QObject *parent=nullptr)
| Constructor.
| ~NetworkManager ()
| Destructor.
bool | isOnline ()
| Returns if the device is currently online, i.e, a data sessions is possible.
Sync::InternetConnectionType | connectionType () const
| Returns the type of connection used by the device.
void | connectSession (bool connectInBackground=false)

Connects a new network session. If a session was already open, the signal connectionSuccess will be emitted immediately, else the function will return and the signal connectionSuccess or connectionError will be emitted accordingly. The caller can choose whether to show the network connectivity dialog, or just open the default network configuration in the background using the parameter connetInBackground.

void | disconnectSession ()
| Disconnects an open session.

## Detailed Description

Class for managing network sessions.

This class provides APIs to open and close network sessions. It internally uses QNetworkSession set of classes to manage network sessions. The user while creating a new session can choose whether to pop-up the internet connectivity dialog or not. The class also signals about online status of the device.

## Constructor & Destructor Documentation

## NetworkManager()

NetworkManager::NetworkManager | ( | QObject * | parent = nullptr | ) |

Constructor.

Parameters

  parent | Parent object

## Member Function Documentation

## connectionType()

Sync::InternetConnectionType NetworkManager::connectionType | ( |  | ) | const

Returns the type of connection used by the device.

Returns
  Sync::InternetConnectionType the type of connection.

## connectSession()

void NetworkManager::connectSession | ( | bool | connectInBackground = false | ) |

Connects a new network session. If a session was already open, the signal connectionSuccess will be emitted immediately, else the function will return and the signal connectionSuccess or connectionError will be emitted accordingly. The caller can choose whether to show the network connectivity dialog, or just open the default network configuration in the background using the parameter connetInBackground.

Parameters

  connectInBackground | If true, the connection is opened without popping up the connetion dialog

## isOnline()

bool NetworkManager::isOnline | ( |  | ) |

Returns if the device is currently online, i.e, a data sessions is possible.

Returns
  True if device is online, false if not

## statusChanged

void Buteo::NetworkManager::statusChanged | ( | bool | aConnected,
|  | Sync::InternetConnectionType | aType )

signal

This signal is emitted when the device's online status changes.

Parameters

  aConnected | If true, the device is online

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

- NetworkManager.h
- NetworkManager.cpp