-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve UID mapper #237
Improve UID mapper #237
Conversation
@@ -84,7 +84,7 @@ QtObject { | |||
sourceObject.destroy() | |||
sourceObject = null | |||
} | |||
sourceObject = _mqttImpl.createObject(root, { uid: _mqttUidHelper.mqttUid }) | |||
sourceObject = _mqttImpl.createObject(root, { uid: Qt.binding(function() { return _mqttUidHelper.mqttUid }) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would have to happen for _mqttUidHelper.mqttUid to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. pathForServiceNameChanged() if the provider gets new data for a service name we've already connected to (in the case where, at the time we first connected, the provider hadn't enumerated all of the values from the MQTT broker yet).
923332d
to
21ded2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some trouble building this -- it seems this references a version of velib that has already moved the VeQItem etc. to veutil, so then files like ve_qitem_dbus_publisher.hpp are no longer available, even though they are still referenced in gui-v2/CMakeLists.txt.
src/uidhelper.cpp
Outdated
if (path.endsWith(QStringLiteral("/ServiceName"))) { | ||
const QString serviceName = message.toString(); | ||
m_pathToServiceName.insert(path, serviceName); | ||
const QString devicePath = path.mid(0, path.length() - 11); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could put "/ServiceName" in a static const string and reference the string length here to make this more explicit?
Instead of listening to all active topics, only listen to specific service name to path mapping changes.
21ded2c
to
a892b42
Compare
I've now ported on top of veutil etc. So, until that PR is merged, the veutil submodule in this repo will point to the wrong sha1... |
#include "veutil/qt/ve_qitems_mqtt.hpp" | ||
#include "veutil/qt/ve_qitem_table_model.hpp" | ||
#include "veutil/qt/ve_qitem_sort_table_model.hpp" | ||
#include "veutil/qt/ve_qitem_child_model.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently register types into Victron.Velib, should we register them into Victron.Veutil instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that sounds best
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing this when running for MQTT:
expression for onCompleted@qrc:/data/mqtt/EssImpl.qml:90
Too many arguments, ignoring 2
expression for onCompleted@qrc:/data/mqtt/EssImpl.qml:95
Too many arguments, ignoring 2
expression for onCompleted@qrc:/data/mqtt/EssImpl.qml:101
Too many arguments, ignoring 2
expression for onCompleted@qrc:/data/mqtt/EssImpl.qml:107
Too many arguments, ignoring 2
In EssImpl, looks like the first two Component.onCompleted calls for veState and veHub4Mode do nothing, and can be removed. The second two for veMinimumSocLimit and veSocLimit could just have a Component.onCompleted that duplicates the functionality of their onValueChanged handlers.
There are a lot of warnings like this when running on device with dbus:
qt.core.qobject.connect: QObject::connect: No such signal VeQItemDbus::stateChanged(VeQItem*,State)
qt.core.qobject.connect: QObject::connect: (sender name: 'CustomName')
qt.core.qobject.connect: QObject::connect: No such signal VeQItemDbus::stateChanged(VeQItem*,State)
qt.core.qobject.connect: QObject::connect: (sender name: 'ProductName')
qt.core.qobject.connect: QObject::connect: Incompatible sender/receiver arguments
VeQItemDbus::valueChanged(QVariant) --> DBusService::updateDescription(VeQItem*,QVariant)
qt.core.qobject.connect: QObject::connect: Incompatible sender/receiver arguments
VeQItemDbus::initValue(QVariant) --> DBusService::updateDescription(VeQItem*,QVariant)
qt.core.qobject.connect: QObject::connect: Incompatible sender/receiver arguments
VeQItemDbus::valueChanged(QVariant) --> DBusService::updateDescription(VeQItem*,QVariant)
qt.core.qobject.connect: QObject::connect: Incompatible sender/receiver arguments
VeQItemDbus::initValue(QVariant) --> DBusService::updateDescription(VeQItem*,QVariant)
qt.core.qobject.connect: QObject::connect: No such signal VeQItemDbus::stateChanged(VeQItem*,State)
qt.core.qobject.connect: QObject::connect: (sender name: 'com.victronenergy.battery.ttyUSB0')
Looking at https://github.com/victronenergy/gui/blob/master/src/dbus_service.cpp#L16, src/gui-v1/dbus_service.cpp needs to be updated to connect to e.g. SIGNAL(stateChanged(VeQItem::State))
instead of SIGNAL(stateChanged(VeQItem*,State))
?
a48dd73
to
3eacd3a
Compare
Thanks, fixed all the warnings now as far as I know. |
@@ -2,7 +2,7 @@ | |||
#define ALARMMONITOR_H | |||
|
|||
#include <QObject> | |||
#include <velib/qt/ve_qitem.hpp> | |||
#include <veutil/qt/ve_qitem.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this #include could be replaced by a forward declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't changed these files, aside from search/replacing velib to veutil in the paths.
@@ -3,8 +3,8 @@ | |||
|
|||
#include <QObject> | |||
|
|||
#include <velib/qt/ve_qitem.hpp> | |||
#include <velib/qt/ve_qitem_table_model.hpp> | |||
#include <veutil/qt/ve_qitem.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this #include could be replaced with a forward declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, I don't want to change these files if possible, aside from updating paths from velib to veutil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, 2 nits
3eacd3a
to
b693fc8
Compare
I've now updated the veutil submodule sha1 to point to victronenergy/veutil#2 which is based in a "proper" branch there. Once that PR is merged, we'll have to update it again, but victronenergy/veutil#1 languished for over a month without any movement, so let's not wait longer. |
Instead of listening to all active topics, only listen to specific service name to path mapping changes.