Add HostMAC in Discovery

This commit is contained in:
Florian Märkl 2019-08-15 22:14:24 +02:00
commit 1a4634f3c2
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
4 changed files with 14 additions and 1 deletions

View file

@ -18,6 +18,8 @@
#ifndef CHIAKI_DISCOVERYMANAGER_H
#define CHIAKI_DISCOVERYMANAGER_H
#include "host.h"
#include <QObject>
#include <QList>
@ -30,6 +32,8 @@ struct DiscoveryHost
#define STRING_MEMBER(name) QString name;
CHIAKI_DISCOVERY_HOST_STRING_FOREACH(STRING_MEMBER)
#undef STRING_MEMBER
HostMAC GetHostMAC() const;
};
Q_DECLARE_METATYPE(DiscoveryHost)

View file

@ -32,6 +32,7 @@ class HostMAC
HostMAC() { memset(mac, 0, sizeof(mac)); }
explicit HostMAC(const uint8_t mac[6]) { memcpy(this->mac, mac, sizeof(this->mac)); }
const uint8_t *GetMAC() const { return mac; }
QString ToString() const { return QByteArray((const char *)mac, sizeof(mac)).toHex(); }
};
static bool operator==(const HostMAC &a, const HostMAC &b) { return memcmp(a.GetMAC(), b.GetMAC(), 6) == 0; }