Add nymea-data package and install mac-addresses.db
This commit is contained in:
parent
9b65f6a41e
commit
aaa09162a5
19
debian/control
vendored
19
debian/control
vendored
@ -70,7 +70,8 @@ Depends: libqt5network5,
|
|||||||
libnymea1 (= ${binary:Version}),
|
libnymea1 (= ${binary:Version}),
|
||||||
${shlibs:Depends},
|
${shlibs:Depends},
|
||||||
${misc:Depends}
|
${misc:Depends}
|
||||||
Recommends: nymea-cli,
|
Recommends: nymea-cli,
|
||||||
|
nymea-data,
|
||||||
network-manager,
|
network-manager,
|
||||||
nymea-update-plugin-impl,
|
nymea-update-plugin-impl,
|
||||||
nymea-system-plugin-impl,
|
nymea-system-plugin-impl,
|
||||||
@ -86,6 +87,22 @@ Description: An open source IoT server - daemon
|
|||||||
This package will install the daemon.
|
This package will install the daemon.
|
||||||
|
|
||||||
|
|
||||||
|
Package: nymea-data
|
||||||
|
Section: misc
|
||||||
|
Architecture: all
|
||||||
|
Depends: ${misc:Depends}
|
||||||
|
Recommends: nymea
|
||||||
|
Description: Optional data for extending functionality in nymea daemon
|
||||||
|
The nymea daemon is a plugin based IoT (Internet of Things) server. The
|
||||||
|
server works like a translator for devices, things and services and
|
||||||
|
allows them to interact.
|
||||||
|
With the powerful rule engine you are able to connect any device available
|
||||||
|
in the system and create individual scenes and behaviors for your environment.
|
||||||
|
.
|
||||||
|
This package provides the MAC address database for nymead and for the plugins in
|
||||||
|
order to get the manufacturer name for a given MAC address.
|
||||||
|
|
||||||
|
|
||||||
Package: nymea-doc
|
Package: nymea-doc
|
||||||
Section: doc
|
Section: doc
|
||||||
Architecture: all
|
Architecture: all
|
||||||
|
|||||||
2
debian/nymea-data.install
vendored
Normal file
2
debian/nymea-data.install
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
data/mac-database/mac-addresses.db usr/share/nymea/
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ QString MacAddressDatabase::lookupMacAddressVendorInternal(const QString &macAdd
|
|||||||
|
|
||||||
// Found to many results, lets add a value until we find the matching vendor
|
// Found to many results, lets add a value until we find the matching vendor
|
||||||
length += 1;
|
length += 1;
|
||||||
if (length > fullMacAddressString)
|
if (length > fullMacAddressString.length())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Search with one addition digit
|
// Search with one addition digit
|
||||||
|
|||||||
@ -43,7 +43,6 @@
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
#include <QtEndian>
|
#include <QtEndian>
|
||||||
#include <QHostInfo>
|
|
||||||
|
|
||||||
NYMEA_LOGGING_CATEGORY(dcPing, "Ping")
|
NYMEA_LOGGING_CATEGORY(dcPing, "Ping")
|
||||||
NYMEA_LOGGING_CATEGORY(dcPingTraffic, "PingTraffic")
|
NYMEA_LOGGING_CATEGORY(dcPingTraffic, "PingTraffic")
|
||||||
@ -350,23 +349,15 @@ void Ping::onSocketReadyRead(int socketDescriptor)
|
|||||||
timeValueSubtract(&receiveTimeValue, &reply->m_startTime);
|
timeValueSubtract(&receiveTimeValue, &reply->m_startTime);
|
||||||
reply->m_duration = qRound((receiveTimeValue.tv_sec * 1000 + (double)receiveTimeValue.tv_usec / 1000) * 100) / 100.0;
|
reply->m_duration = qRound((receiveTimeValue.tv_sec * 1000 + (double)receiveTimeValue.tv_usec / 1000) * 100) / 100.0;
|
||||||
|
|
||||||
QHostInfo::lookupHost(senderAddress.toString(), this, [=](const QHostInfo &info){
|
// Note: due to a Qt bug < 5.9 we need to use old SLOT style and cannot make use of lambda here
|
||||||
if (info.error() != QHostInfo::NoError) {
|
int lookupId = QHostInfo::lookupHost(senderAddress.toString(), this, SLOT(onHostLookupFinished(const QHostInfo &info)));
|
||||||
qCWarning(dcPing()) << "Failed to look up hostname after successfull ping" << senderAddress.toString() << info.error();
|
m_pendingHostLookups.insert(lookupId, reply);
|
||||||
} else {
|
|
||||||
qCDebug(dcPing()) << "********Looked up hostname after successfull ping" << senderAddress.toString() << info.hostName();
|
|
||||||
if (info.hostName() != senderAddress.toString()) {
|
|
||||||
reply->m_hostName = info.hostName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
qCDebug(dcPingTraffic()) << "Received ICMP response" << reply->targetHostAddress().toString() << ICMP_PACKET_SIZE << "[Bytes]"
|
qCDebug(dcPingTraffic()) << "Received ICMP response" << reply->targetHostAddress().toString() << ICMP_PACKET_SIZE << "[Bytes]"
|
||||||
<< "ID:" << QString("0x%1").arg(responsePacket->icmp_id, 4, 16, QChar('0'))
|
<< "ID:" << QString("0x%1").arg(responsePacket->icmp_id, 4, 16, QChar('0'))
|
||||||
<< "Sequence:" << htons(responsePacket->icmp_seq)
|
<< "Sequence:" << htons(responsePacket->icmp_seq)
|
||||||
<< "Time:" << reply->duration() << "[ms]" << info.hostName();
|
<< "Time:" << reply->duration() << "[ms]";
|
||||||
|
|
||||||
finishReply(reply, PingReply::ErrorNoError);
|
|
||||||
});
|
|
||||||
} else if (responsePacket->icmp_type == ICMP_DEST_UNREACH) {
|
} else if (responsePacket->icmp_type == ICMP_DEST_UNREACH) {
|
||||||
|
|
||||||
// Get the sending package
|
// Get the sending package
|
||||||
@ -409,3 +400,23 @@ void Ping::onSocketReadyRead(int socketDescriptor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ping::onHostLookupFinished(const QHostInfo &info)
|
||||||
|
{
|
||||||
|
PingReply *reply = m_pendingHostLookups.value(info.lookupId());
|
||||||
|
if (!reply) {
|
||||||
|
qCWarning(dcPing()) << "Could not find reply after host lookup.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.error() != QHostInfo::NoError) {
|
||||||
|
qCWarning(dcPing()) << "Failed to look up hostname after successfull ping" << reply->targetHostAddress().toString() << info.error();
|
||||||
|
} else {
|
||||||
|
qCDebug(dcPing()) << "********Looked up hostname after successfull ping" << reply->targetHostAddress().toString() << info.hostName();
|
||||||
|
if (info.hostName() != reply->targetHostAddress().toString()) {
|
||||||
|
reply->m_hostName = info.hostName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finishReply(reply, PingReply::ErrorNoError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
#include <QQueue>
|
#include <QQueue>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QHostInfo>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
#include <QSocketNotifier>
|
#include <QSocketNotifier>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
@ -88,6 +89,7 @@ private:
|
|||||||
QQueue<PingReply *> m_replyQueue;
|
QQueue<PingReply *> m_replyQueue;
|
||||||
QTimer *m_queueTimer = nullptr;
|
QTimer *m_queueTimer = nullptr;
|
||||||
void sendNextReply();
|
void sendNextReply();
|
||||||
|
QHash<int, PingReply *> m_pendingHostLookups;
|
||||||
|
|
||||||
//Error performPing(const QString &address);
|
//Error performPing(const QString &address);
|
||||||
void performPing(PingReply *reply);
|
void performPing(PingReply *reply);
|
||||||
@ -103,6 +105,7 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSocketReadyRead(int socketDescriptor);
|
void onSocketReadyRead(int socketDescriptor);
|
||||||
|
void onHostLookupFinished(const QHostInfo &info);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user