Skip to content

Commit

Permalink
remove PnP ID characteristics, remove unneeded debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlich committed Feb 8, 2024
1 parent c51d0f4 commit 1e43a4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 124 deletions.
64 changes: 8 additions & 56 deletions src/deviceinfoservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
// #define INFO_MODEL_NO_UUID "00002A24-0000-1000-8000-00805F9B34FB"

DeviceInfoModelNoChrc::DeviceInfoModelNoChrc(AboutSettings* about, QDBusConnection bus, int index, Service *service) : Characteristic(bus, index, INFO_MODEL_NO_UUID, {"encrypt-authenticated-read"}, service) {

qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;

m_value = about->baseOperatingSystemName().toLocal8Bit(); // bass

Expand Down Expand Up @@ -65,7 +64,7 @@ void DeviceInfoModelNoChrc::emitPropertiesChanged()


DeviceInfoSerialNoChrc::DeviceInfoSerialNoChrc(AboutSettings* about, QDBusConnection bus, int index, Service *service) : Characteristic(bus, index, INFO_SERIAL_NO_UUID, {"encrypt-authenticated-read"}, service) {
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;

m_value = about->serial().toLocal8Bit(); // 504KPED0068620

Expand Down Expand Up @@ -97,7 +96,7 @@ void DeviceInfoSerialNoChrc::emitPropertiesChanged()


DeviceInfoFwRevisionChrc::DeviceInfoFwRevisionChrc(AboutSettings* about, QDBusConnection bus, int index, Service *service) : Characteristic(bus, index, INFO_FW_REVISION_UUID, {"encrypt-authenticated-read"}, service) {
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;

m_value = about->adaptationVersion().toLocal8Bit();

Expand Down Expand Up @@ -131,7 +130,7 @@ void DeviceInfoFwRevisionChrc::emitPropertiesChanged()


DeviceInfoHardwareRevChrc::DeviceInfoHardwareRevChrc(AboutSettings* about, QDBusConnection bus, int index, Service *service) : Characteristic(bus, index, INFO_HARDWARE_REV_UUID, {"encrypt-authenticated-read"}, service) {
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;

m_value = about->vendorVersion().toLocal8Bit();

Expand Down Expand Up @@ -162,7 +161,7 @@ void DeviceInfoHardwareRevChrc::emitPropertiesChanged()


DeviceInfoManufacturerChrc::DeviceInfoManufacturerChrc(AboutSettings* about, QDBusConnection bus, int index, Service *service) : Characteristic(bus, index, INFO_MANUFACTURER_UUID, {"encrypt-authenticated-read"}, service) {
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;

m_value = about->vendorName().toLocal8Bit();

Expand Down Expand Up @@ -192,7 +191,7 @@ void DeviceInfoManufacturerChrc::emitPropertiesChanged()


DeviceInfoSoftwareRevChrc::DeviceInfoSoftwareRevChrc(AboutSettings* about, QDBusConnection bus, int index, Service *service) : Characteristic(bus, index, INFO_SOFTWARE_REV_UUID, {"encrypt-authenticated-read"}, service) {
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;

m_value = about->softwareVersion().toLocal8Bit();

Expand Down Expand Up @@ -221,7 +220,7 @@ void DeviceInfoSoftwareRevChrc::emitPropertiesChanged()
// #define INFO_SYSTEM_ID_UUID "00002A23-0000-1000-8000-00805F9B34FB"

DeviceInfoSystemIdChrc::DeviceInfoSystemIdChrc(AboutSettings* about, QDBusConnection bus, int index, Service *service) : Characteristic(bus, index, INFO_SYSTEM_ID_UUID, {"encrypt-authenticated-read"}, service) {
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;

m_value = about->operatingSystemName().toLocal8Bit();

Expand All @@ -246,70 +245,23 @@ void DeviceInfoSystemIdChrc::emitPropertiesChanged()
if (!connection.send(message))
qDebug() << "Failed to send DBus property notification signal";
}
////////////////////////////////////////////////////////////////////////////////

// #define INFO_PNP_ID_UUID "00002A50-0000-1000-8000-00805F9B34FB"


DeviceInfoPnpIdChrc::DeviceInfoPnpIdChrc(AboutSettings* about, QDBusConnection bus, int index, Service *service) : Characteristic(bus, index, INFO_PNP_ID_UUID, {"encrypt-authenticated-read"}, service) {
qDebug() << Q_FUNC_INFO;

m_value = QString("DeviceInfoPnpId").toLocal8Bit();

connect(this, SIGNAL(valueChanged()), this, SLOT(emitPropertiesChanged()));

}

void DeviceInfoPnpIdChrc::emitPropertiesChanged()
{
QDBusConnection connection = QDBusConnection::systemBus();
QDBusMessage message = QDBusMessage::createSignal(getPath().path(),
"org.freedesktop.DBus.Properties",
"PropertiesChanged");

QVariantMap changedProperties;
changedProperties[QStringLiteral("Value")] = QVariant(m_value);

QList<QVariant> arguments;
arguments << QVariant(GATT_CHRC_IFACE) << QVariant(changedProperties) << QVariant(QStringList());
message.setArguments(arguments);

if (!connection.send(message))
qDebug() << "Failed to send DBus property notification signal";
}


////////////////////////////////////////////////////////////////////////////////

DeviceInfoService::DeviceInfoService(int index, QDBusConnection bus, QObject *parent) : Service(bus, index, INFO_UUID, parent)
{

qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;

m_about = new AboutSettings(this);


qDebug() << m_about->wlanMacAddress();
qDebug() << m_about->serial();
qDebug() << m_about->localizedOperatingSystemName();
qDebug() << m_about->baseOperatingSystemName();
qDebug() << m_about->operatingSystemName();
qDebug() << m_about->localizedSoftwareVersion();
qDebug() << m_about->softwareVersion();
qDebug() << m_about->softwareVersionId();
qDebug() << m_about->adaptationVersion();

qDebug() << m_about->vendorName();
qDebug() << m_about->vendorVersion();


addCharacteristic(new DeviceInfoModelNoChrc(m_about, bus, 0, this));
addCharacteristic(new DeviceInfoSerialNoChrc(m_about, bus, 1, this));
addCharacteristic(new DeviceInfoFwRevisionChrc(m_about, bus, 2, this));
addCharacteristic(new DeviceInfoHardwareRevChrc(m_about, bus, 3, this));
addCharacteristic(new DeviceInfoSoftwareRevChrc(m_about, bus, 4, this));
addCharacteristic(new DeviceInfoManufacturerChrc(m_about, bus, 5, this));
addCharacteristic(new DeviceInfoSystemIdChrc(m_about, bus, 6, this));
addCharacteristic(new DeviceInfoPnpIdChrc(m_about, bus, 7, this));

}
68 changes: 0 additions & 68 deletions src/deviceinfoservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ public slots:
return m_value;
}

void StartNotify() { qDebug() << Q_FUNC_INFO; }
void StopNotify() { qDebug() << Q_FUNC_INFO; }

private slots:
void emitPropertiesChanged();

Expand Down Expand Up @@ -89,10 +86,6 @@ public slots:
return m_value;
}

void StartNotify() { qDebug() << Q_FUNC_INFO;}
void StopNotify() { qDebug() << Q_FUNC_INFO;}


private slots:
void emitPropertiesChanged();

Expand Down Expand Up @@ -129,10 +122,6 @@ public slots:
return m_value;
}

void StartNotify() {}
void StopNotify() {}


private slots:
void emitPropertiesChanged();

Expand Down Expand Up @@ -169,10 +158,6 @@ public slots:
return m_value;
}

void StartNotify() {}
void StopNotify() {}


private slots:
void emitPropertiesChanged();

Expand Down Expand Up @@ -209,10 +194,6 @@ public slots:
return m_value;
}

void StartNotify() {}
void StopNotify() {}


private slots:
void emitPropertiesChanged();

Expand Down Expand Up @@ -249,10 +230,6 @@ public slots:
return m_value;
}

void StartNotify() {}
void StopNotify() {}


private slots:
void emitPropertiesChanged();

Expand Down Expand Up @@ -289,10 +266,6 @@ public slots:
return m_value;
}

void StartNotify() {}
void StopNotify() {}


private slots:
void emitPropertiesChanged();

Expand All @@ -306,47 +279,6 @@ private slots:
}

};
//////////////////////////////////////////////////////////////////////

// +#define INFO_PNP_ID_UUID "00002a50-0000-1000-8000-00805f9b34fb"


class DeviceInfoPnpIdChrc : public Characteristic
{
Q_OBJECT
Q_PROPERTY(QByteArray Value READ getValue NOTIFY valueChanged)

public:
DeviceInfoPnpIdChrc(AboutSettings* about, QDBusConnection bus, int index, Service *service);

signals:
void valueChanged();

public slots:
QByteArray ReadValue(QVariantMap)
{
qDebug() << Q_FUNC_INFO << m_value;
return m_value;
}

void StartNotify() {}
void StopNotify() {}


private slots:
void emitPropertiesChanged();

private:
QByteArray m_value;

QByteArray getValue()
{
qDebug() << Q_FUNC_INFO << m_value;
return m_value;
}

};


//////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit 1e43a4d

Please sign in to comment.