gdbus-codegen-glibmm
gdbus-codegen-glibmm copied to clipboard
Problem with signal sending.
Hi, I was successfully generated stubs with methods and signals. I am trying to implement the dbus server using them. As it is quite easy to me to use stubs to implement the methods and call them, I have problem with signals implementation using stubs. I would like to evoke signal when by some external function to populate the string with message that something happened to another process.
Could you please give me any hint how to play with that?
This is part generated stub.cpp I am using:
<signal name="EventNotification">
<arg name="EventString" type="s"/>
</signal>
void com::my::busname::Processor::EventNotification_emitter(std::string EventString) {
std::vector<Glib::VariantBase> paramsList;
paramsList.push_back(Glib::Variant<Glib::ustring >::create((EventString)));;
m_connection->emit_signal(
"/com/my/busname/Processor",
"com.my.busname.Processor",
"EventNotification",
Glib::ustring(),
Glib::Variant<std::vector<Glib::VariantBase> >::create_tuple(paramsList));
}
I am trying to call : EventNotification_emmiter("Sample STRING");
This compile but after execution I have Segmentation fault (problem with memory).
EDIT:
void com::my::busname::Processor::EventNotification_emitter(std::string EventString) {
std::vector<Glib::VariantBase> paramsList;
paramsList.push_back(Glib::Variant<Glib::ustring >::create((EventString)));;
std::cout << "tu jestem" << std::endl;
m_connection->emit_signal(
"/com/my/busname/Processor",
"com.my.busname.Processor",
"EventNotification",
Glib::ustring(),
Glib::Variant<std::vector<Glib::VariantBase> >::create_tuple(paramsList));
}
It seems that the debuger point those line as problematic:
Glib::Variant<std::vector<Glib::VariantBase> >::create_tuple(paramsList));
In Glib docs I am unable to find such a member function like create_tuple().
BR,
Krzysztof