Closed filug closed 5 years ago
Just to elaborate a bit why this PR was created. In case when two interfaces are defined in xml file
<node>
<interface name="org.bluez.Adapter1">
<method name="StartDiscovery"/>
<method name="StopDiscovery"/>
</interface>
<interface name="org.bluez.Device1">
<method name="Connect"/>
<method name="Disconnect"/>
</interface>
</node>
Generated code (file ..._common.h
) looks like this (stripped unimportant parts)
class Adapter1MessageHelper {
public:
Adapter1MessageHelper (const Glib::RefPtr<Gio::DBus::MethodInvocation> msg):
m_message(msg) {}
// [...]
void ret() {
std::vector<Glib::VariantBase> vlist;
m_message->return_value(Glib::Variant<Glib::VariantBase>::create_tuple(vlist));
}
class Device1TypeWrap {
public:
template<typename T>
static void unwrapList(std::vector<T> &list, const Glib::VariantContainerBase &wrapped) {
for (uint i = 0; i < wrapped.get_n_children(); i++) {
Glib::Variant<T> item;
wrapped.get_child(item, i);
list.push_back(item.get());
}
}
// [...]
};
So class Adapter1MessageHelper
in incomplete and only the last ...Helper
in the file (here Device1MessageHelper
) is ended correctly
class Device1MessageHelper {
public:
Device1MessageHelper (const Glib::RefPtr<Gio::DBus::MethodInvocation> msg):
m_message(msg) {}
const Glib::RefPtr<Gio::DBus::MethodInvocation> getMessage() {
return m_message;
}
void ret(Glib::Error error) {
m_message->return_error(error);
}
void returnError(const Glib::ustring &domain, int code, const Glib::ustring &message) {
m_message->return_error(domain, code, message);
}
void ret() {
std::vector<Glib::VariantBase> vlist;
m_message->return_value(Glib::Variant<Glib::VariantBase>::create_tuple(vlist));
}
private:
Glib::RefPtr<Gio::DBus::MethodInvocation> m_message;
};
I'll update this commit in order to fix errors reported by travis.
Thanks Piotr, you are absolutely right! I'll wait for your next commit :-)
All ...MessageHelper were created without private section. In addition they were not closed by the last '}' so class definition was incomplete.