dbus: Add dbus_iftype_to_string

This commit is contained in:
Denis Kenzior 2018-08-07 16:19:20 -05:00
parent 9c6f3ef5c0
commit 6e6797cbde
2 changed files with 22 additions and 1 deletions

View File

@ -30,9 +30,12 @@
#include <ell/ell.h>
#include <ell/dbus-private.h>
#include "src/dbus.h"
#include "linux/nl80211.h"
#include "src/agent.h"
#include "src/iwd.h"
#include "src/dbus.h"
struct l_dbus *g_dbus = 0;
@ -43,6 +46,22 @@ static void do_debug(const char *str, void *user_data)
l_info("%s%s", prefix, str);
}
const char *dbus_iftype_to_string(uint32_t iftype)
{
switch (iftype) {
case NL80211_IFTYPE_ADHOC:
return "ad-hoc";
case NL80211_IFTYPE_STATION:
return "station";
case NL80211_IFTYPE_AP:
return "ap";
default:
break;
}
return NULL;
}
struct l_dbus_message *dbus_error_busy(struct l_dbus_message *msg)
{
return l_dbus_message_new_error(msg, IWD_SERVICE ".InProgress",

View File

@ -44,6 +44,8 @@ struct l_dbus *dbus_get_bus(void);
void dbus_pending_reply(struct l_dbus_message **msg,
struct l_dbus_message *reply);
const char *dbus_iftype_to_string(unsigned int iftype);
struct l_dbus_message *dbus_error_busy(struct l_dbus_message *msg);
struct l_dbus_message *dbus_error_failed(struct l_dbus_message *msg);
struct l_dbus_message *dbus_error_aborted(struct l_dbus_message *msg);