-
Notifications
You must be signed in to change notification settings - Fork 0
/
datachannel.h
94 lines (63 loc) · 2.37 KB
/
datachannel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef DATACHANNEL_H
#define DATACHANNEL_H
#include <QNetworkInterface>
//#include <string>
//Constants
static const char* WIFI = "Wifi";
static const char* ETHERNET = "Ethernet";
static const char* PPP = "Ppp";
static const char* FDDI = "Fddi";
static const char* SLIP = "Slip";
static const char* LOOPBACK = "Loopback";
static const char* VIRTUAL = "Virtual";
static const char* CANBUS = "CanBus";
static const char* PHONET = "Phonet";
static const char* SIXLOWPAN = "SixLoWPAN";
static const char* IEEE802154 = "Ieee802154";
static const char* IEEE80216 = "Ieee80216";
static const char* IEEE1394 = "Ieee1394";
static const char* UNKNOWN = "Unknown";
class DataChannel
{
public:
/**
* @brief DataChannel constructor which configures the channel
* @param networkInterfaceType The network interface type
*/
DataChannel(QNetworkInterface::InterfaceType networkInterfaceType);
/**
* @brief ~DataChannel destructor of the class
*/
virtual ~DataChannel();
/**
* @brief configureChannel Configures the channel in order to be used
*/
virtual void configureChannel() = 0;
/**
* @brief restoreChannelConfiguration Restores the channel original configuration
*/
virtual void restoreChannelConfiguration() = 0;
/**
* @brief getIPWifiAddress looks for a IP address of the given type
* @param networkInterfaceType The type of the network (Wifi, Ethernet)
* @return The IP Address or null if the type is not found
*/
static QHostAddress getIpAddress(QNetworkInterface::InterfaceType networkInterfaceType);
/**
* @brief networkInterfaceTypeToString Transform the network interface type into a string
* @return The string related to the network type
*/
static const char* networkInterfaceTypeToString(QNetworkInterface::InterfaceType networkInterfaceType);
/**
* @brief getNetworkInterfaceNameByType returns the first found adapter's name for a given type
* @param networkInterfaceType The network interface type
* @return The network adapter's name
*/
static QString getNetworkInterfaceNameByType(QNetworkInterface::InterfaceType networkInterfaceType);
protected:
// The network interface type
QNetworkInterface::InterfaceType networkInterfaceType;
// The network interface name
QString networkInterfaceName;
};
#endif // DATACHANNEL_H