Skip to content

Commit

Permalink
Added is_method function for SimpleDBus messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kdewald committed Sep 27, 2024
1 parent b19c46d commit 7cb0bdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions simpledbus/include/simpledbus/base/Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Message {
Type get_type() const;

bool is_signal(std::string interface, std::string signal_name);
bool is_method_call(const std::string& interface, const std::string& method);

static Message create_method_call(std::string bus_name, std::string path, std::string interface,
std::string method);
Expand Down
4 changes: 4 additions & 0 deletions simpledbus/src/base/Message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ bool Message::is_signal(std::string interface, std::string signal_name) {
return is_valid() && dbus_message_is_signal(_msg, interface.c_str(), signal_name.c_str());
}

bool Message::is_method_call(const std::string& interface, const std::string& method) {
return get_type() == Type::METHOD_CALL && get_interface() == interface && get_member() == method;
}

static const char* type_to_name(int message_type) {
switch (message_type) {
case DBUS_MESSAGE_TYPE_SIGNAL:
Expand Down

0 comments on commit 7cb0bdd

Please sign in to comment.