本文整理汇总了C++中dbus_message_get_interface函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_message_get_interface函数的具体用法?C++ dbus_message_get_interface怎么用?C++ dbus_message_get_interface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_message_get_interface函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: message_cb
static DBusHandlerResult message_cb(DBusConnection *conn, DBusMessage *msg, void *user_data) {
pa_dbusobj_server_lookup *sl = user_data;
pa_assert(conn);
pa_assert(msg);
pa_assert(sl);
/* pa_log("Got message! type = %s path = %s iface = %s member = %s dest = %s", dbus_message_type_to_string(dbus_message_get_type(msg)), dbus_message_get_path(msg), dbus_message_get_interface(msg), dbus_message_get_member(msg), dbus_message_get_destination(msg)); */
if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_METHOD_CALL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (dbus_message_is_method_call(msg, DBUS_INTERFACE_INTROSPECTABLE, "Introspect") ||
(!dbus_message_get_interface(msg) && dbus_message_has_member(msg, "Introspect")))
return handle_introspect(conn, msg, sl);
if (dbus_message_is_method_call(msg, DBUS_INTERFACE_PROPERTIES, "Get") ||
(!dbus_message_get_interface(msg) && dbus_message_has_member(msg, "Get")))
return handle_get(conn, msg, sl);
if (dbus_message_is_method_call(msg, DBUS_INTERFACE_PROPERTIES, "Set") ||
(!dbus_message_get_interface(msg) && dbus_message_has_member(msg, "Set")))
return handle_set(conn, msg, sl);
if (dbus_message_is_method_call(msg, DBUS_INTERFACE_PROPERTIES, "GetAll") ||
(!dbus_message_get_interface(msg) && dbus_message_has_member(msg, "GetAll")))
return handle_get_all(conn, msg, sl);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
示例2: avahi_dbus_msg_record_browser_impl
DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
DBusError error;
RecordBrowserInfo *i = userdata;
assert(c);
assert(m);
assert(i);
dbus_error_init(&error);
avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
dbus_message_get_interface(m),
dbus_message_get_path(m),
dbus_message_get_member(m));
/* Introspection */
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
return avahi_dbus_handle_introspect(c, m, "org.freedesktop.Avahi.RecordBrowser.xml");
/* Access control */
if (strcmp(dbus_message_get_sender(m), i->client->name))
return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "Free")) {
if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
avahi_log_warn("Error parsing RecordBrowser::Free message");
goto fail;
}
avahi_dbus_record_browser_free(i);
return avahi_dbus_respond_ok(c, m);
}
if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "Start")) {
if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
avahi_log_warn("Error parsing RecordBrowser::Start message");
goto fail;
}
avahi_dbus_record_browser_start(i);
return avahi_dbus_respond_ok(c, m);
}
avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
fail:
if (dbus_error_is_set(&error))
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
示例3: dbus_incoming_message
static DBusHandlerResult
dbus_incoming_message(DBusConnection *conn, DBusMessage *msg, void *user_data)
{
DBusMessage *reply;
if (strcmp(DBUS_IFACE, dbus_message_get_interface(msg)) == 0) {
DBusError error;
dbus_error_init(&error);
if (strcmp("SetAudioState", dbus_message_get_member(msg)) == 0)
reply_to_set_audio_state(msg, conn);
if (strcmp("SetBrightness", dbus_message_get_member(msg)) == 0)
reply_to_set_brightness(msg, conn);
if (strcmp("GetBrightness", dbus_message_get_member(msg)) == 0)
reply_to_get_brightness(msg, conn);
if (strcmp("Shutdown", dbus_message_get_member(msg)) == 0)
reply_to_shutdown(msg, conn);
if (strcmp("Suspend", dbus_message_get_member(msg)) == 0)
reply_to_suspend(msg, conn);
if (strcmp("Reboot", dbus_message_get_member(msg)) == 0)
reply_to_reboot(msg, conn);
if (strcmp("GetDevice", dbus_message_get_member(msg)) == 0)
reply_to_get_device(msg, conn);
else {
reply = dbus_message_new_error(msg,
"org.cneo.System.UnknownMethod",
"Unknown method");
dbus_connection_send(conn, reply, NULL);
dbus_message_unref(reply);
}
} else {
fprintf(stderr, "Ignoring message with %s.%s\n",
dbus_message_get_interface(msg),
dbus_message_get_member(msg));
reply = dbus_message_new_error(msg,
"org.cneo.System.UnknownMethod",
"Unknown method");
dbus_connection_send(conn, reply, NULL);
dbus_message_unref(reply);
}
return DBUS_HANDLER_RESULT_HANDLED;
}
示例4: message_handler
static DBusHandlerResult message_handler(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
const char *method = dbus_message_get_member(msg);
const char *iface = dbus_message_get_interface(msg);
if ((strcmp("Introspect", method) == 0) &&
(strcmp("org.freedesktop.DBus.Introspectable", iface) == 0))
return introspect(conn, msg);
if (strcmp("org.bluez.Agent", iface) != 0)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (strcmp("Release", method) == 0) {
g_main_loop_quit(main_loop);
return generic_message(conn, msg);
}
else if (strcmp("RequestPasskey", method) == 0)
return request_passkey_message(conn, msg);
else if (strcmp("Authorize", method) == 0)
return authorize_message(conn, msg);
else if (strcmp("ConfirmModeChange", method) == 0)
return confirm_mode_message(conn, msg);
else if (strcmp("Cancel", method) == 0)
return generic_message(conn, msg);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
示例5: watch_signal
DBusHandlerResult watch_signal(DBusConnection* connection, DBusMessage *msg,
void *no_use)
{
NOUSED(no_use);
if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (__sig_info_hash == NULL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
const char* iface = dbus_message_get_interface(msg);
const char* s_name = dbus_message_get_member(msg);
const char* path = dbus_message_get_path(msg);
char* server_id = dbus_connection_get_server_id(connection);
char* key = g_strdup_printf("%s:%s:%[email protected]%s", path, iface, s_name, server_id);
free(server_id);
GHashTable* cbs_info = g_hash_table_lookup(__sig_info_hash, key);
g_free(key);
if (cbs_info == NULL) {
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else {
struct HandleSignalInfo *t = g_new(struct HandleSignalInfo, 1);
t->cbs = cbs_info;
t->msg = dbus_message_ref(msg);
g_timeout_add(get_timeout(), delay_handle_signal, t);
return DBUS_HANDLER_RESULT_HANDLED;
}
}
示例6: devicelock_unlocked_cb
static DBusHandlerResult devicelock_unlocked_cb(DBusConnection *conn, DBusMessage *msg, void *user_data)
{
DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
const char *interface = dbus_message_get_interface(msg);
const char *member = dbus_message_get_member(msg);
const char *object = dbus_message_get_path(msg);
int type = dbus_message_get_type(msg);
int ret=0, ret1 = 0;
(void) user_data;
// sanity checks
if( !interface || !member || !object ) goto cleanup;
if( type != DBUS_MESSAGE_TYPE_SIGNAL ) goto cleanup;
if( strcmp(interface, DEVICELOCK_REQUEST_IF) ) goto cleanup;
if( strcmp(object, DEVICELOCK_REQUEST_PATH) ) goto cleanup;
// handle known signals
else if( !strcmp(member, "stateChanged") )
{
dbus_message_get_args(msg, NULL, DBUS_TYPE_INT32, &ret1, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
log_debug("Devicelock state changed. New state = %d\n", ret);
if(ret == 0 && get_usb_connection_state() == 1 )
{
if(!strcmp(get_usb_mode(), MODE_UNDEFINED) || !strcmp(get_usb_mode(), MODE_CHARGING))
set_usb_connected_state();
}
}
result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
cleanup:
return result;
}
示例7: generic_message
static DBusHandlerResult generic_message(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
struct generic_data *data = user_data;
struct interface_data *iface;
const GDBusMethodTable *method;
const char *interface;
interface = dbus_message_get_interface(message);
iface = find_interface(data->interfaces, interface);
if (iface == NULL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
for (method = iface->methods; method &&
method->name && method->function; method++) {
if (dbus_message_is_method_call(message, iface->name,
method->name) == FALSE)
continue;
if (dbus_message_has_signature(message,
method->signature) == FALSE)
continue;
if (check_privilege(connection, message, method,
iface->user_data) == TRUE)
return DBUS_HANDLER_RESULT_HANDLED;
return process_message(connection, message, method,
iface->user_data);
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
示例8: g_dbus_send_message
gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message)
{
dbus_bool_t result = FALSE;
if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL)
dbus_message_set_no_reply(message, TRUE);
else if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL) {
const char *path = dbus_message_get_path(message);
const char *interface = dbus_message_get_interface(message);
const char *name = dbus_message_get_member(message);
const GDBusArgInfo *args;
if (!check_signal(connection, path, interface, name, &args))
goto out;
}
/* Flush pending signal to guarantee message order */
g_dbus_flush(connection);
result = dbus_connection_send(connection, message, NULL);
out:
dbus_message_unref(message);
return result;
}
示例9: handle_core_message
void
handle_core_message(DBusMessage *bus_msg, const char *path, const char *iface, const char *method, const char *sender, PyObject *py_args)
{
if (strcmp(method, "setLocale") == 0) {
PyDict_SetItemString(PyDict_GetItemString(py_core, "locales"), sender, PyTuple_GetItem(py_args, 0));
bus_reply_object(bus_msg, Py_True, "b");
}
else if (strcmp(method, "cancel") == 0) {
log_debug("Cancel requested.\n");
int i;
int total = 0;
// Iterate over all child processes
for (i = 0; i < my_proc.nr_children; i++) {
struct ProcChild *child = &my_proc.children[i];
if (dbus_message_has_sender(child->bus_msg, sender)) {
kill(child->pid, SIGINT);
total++;
}
}
log_debug("Killed %d processes.\n", total);
bus_reply_object(bus_msg, PyInt_FromLong((long) total), "i");
}
else if (strcmp(method, "listRunning") == 0) {
int i;
PyObject *py_list = PyList_New(0);
// Iterate over all child processes
for (i = 0; i < my_proc.nr_children; i++) {
struct ProcChild *child = &my_proc.children[i];
if (PyTuple_GetItem(py_args, 0) == Py_True || dbus_message_has_sender(child->bus_msg, sender)) {
PyList_Append(py_list, PyString_FromFormat("%s.%s", dbus_message_get_interface(child->bus_msg), dbus_message_get_member(child->bus_msg)));
}
}
bus_reply_object(bus_msg, py_list, "as");
}
}
示例10: client_dbus_filter_function
static DBusHandlerResult
client_dbus_filter_function (DBusConnection *connection,
DBusMessage *message,
void *user_data)
{
GsmDBusClient *client = GSM_DBUS_CLIENT (user_data);
const char *path;
g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
path = dbus_message_get_path (message);
g_debug ("GsmDBusClient: obj_path=%s interface=%s method=%s",
dbus_message_get_path (message),
dbus_message_get_interface (message),
dbus_message_get_member (message));
if (dbus_message_is_method_call (message, SM_DBUS_CLIENT_PRIVATE_INTERFACE, "EndSessionResponse")) {
g_assert (gsm_client_peek_id (GSM_CLIENT (client)) != NULL);
if (path != NULL && strcmp (path, gsm_client_peek_id (GSM_CLIENT (client))) != 0) {
/* Different object path */
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
handle_end_session_response (client, message);
return DBUS_HANDLER_RESULT_HANDLED;
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
示例11: message_filter
static DBusHandlerResult message_filter(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
GDBusClient *client = user_data;
const char *sender, *path, *interface;
if (dbus_message_get_type(message) != DBUS_MESSAGE_TYPE_SIGNAL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
sender = dbus_message_get_sender(message);
if (sender == NULL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
path = dbus_message_get_path(message);
interface = dbus_message_get_interface(message);
if (g_str_has_prefix(path, client->base_path) == FALSE)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (g_str_equal(interface, DBUS_INTERFACE_PROPERTIES) == TRUE)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (client->signal_func)
client->signal_func(connection, message, client->signal_data);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
示例12: dispatch_method
static DBusHandlerResult dispatch_method(DBusConnection *c,
DBusMessage *msg, void *data)
{
#define SAFESTR(str) (str ? str : "<none>")
const char *path = dbus_message_get_path(msg);
const char *interface = dbus_message_get_interface(msg);
const char *member = dbus_message_get_member(msg);
const char *message;
char reply[1024];
MRP_UNUSED(data);
if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_METHOD_CALL || !member)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (strcmp(path, DBUS_PATH) ||
strcmp(interface, DBUS_IFACE) ||
strcmp(member, DBUS_METHOD))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
/*info("DBUS server: got call: path='%s', interface='%s', member='%s')...",
SAFESTR(path), SAFESTR(interface), SAFESTR(member));*/
if (dbus_message_get_args(msg, NULL,
DBUS_TYPE_STRING, &message, DBUS_TYPE_INVALID)) {
snprintf(reply, sizeof(reply), "ACK: got '%s'", message);
if (!send_dbus_reply(c, msg, reply))
fatal("failed to sent reply to DBUS message");
}
return DBUS_HANDLER_RESULT_HANDLED;
}
示例13: signal_handler
static DBusHandlerResult
signal_handler(lua_State *S, DBusMessage *msg)
{
lua_State *T;
const char *path = dbus_message_get_path(msg);
const char *interface = dbus_message_get_interface(msg);
const char *member = dbus_message_get_member(msg);
lem_debug("received signal\n %s\n %s\n %s(%s)",
path, interface, member,
dbus_message_get_signature(msg));
/* NOTE: this magic string representation of an
* incoming signal must match the one in the Lua code */
lua_pushfstring(S, "%s\n%s\n%s",
path ? path : "",
interface ? interface : "",
member ? member : "");
lua_rawget(S, LEM_DBUS_SIGNAL_TABLE);
if (lua_type(S, -1) != LUA_TFUNCTION) {
lua_settop(S, LEM_DBUS_TOP);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
/* create new thread */
T = lem_newthread();
lua_xmove(S, T, 1);
lem_queue(T, lem_dbus_push_arguments(T, msg));
return DBUS_HANDLER_RESULT_HANDLED;
}
示例14: EventFilter
// Called by dbus during WaitForAndDispatchEventNative()
// This function is called on the IOThread
static DBusHandlerResult
EventFilter(DBusConnection *aConn, DBusMessage *aMsg,
void *aData)
{
DBusError err;
dbus_error_init(&err);
if (dbus_message_get_type(aMsg) != DBUS_MESSAGE_TYPE_SIGNAL) {
LOG("%s: not interested (not a signal).\n", __FUNCTION__);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
LOG("%s: Received signal %s:%s from %s\n", __FUNCTION__,
dbus_message_get_interface(aMsg), dbus_message_get_member(aMsg),
dbus_message_get_path(aMsg));
// TODO: Parse DBusMessage* on the IOThread and return as a BluetoothEvent so
// we aren't passing the pointer at all, as well as offloading parsing (not
// that it's that heavy.)
nsCOMPtr<DistributeDBusMessageTask> t(new DistributeDBusMessageTask(aMsg));
if (NS_FAILED(NS_DispatchToMainThread(t))) {
NS_WARNING("Failed to dispatch to main thread!");
}
return DBUS_HANDLER_RESULT_HANDLED;
}
示例15: profile_print_with_attrs
static void
profile_print_with_attrs (const char *type, DBusMessage *message,
struct timeval *t, ProfileAttributeFlags attrs)
{
printf (PROFILE_TIMED_FORMAT, type, t->tv_sec, t->tv_usec);
if (attrs & PROFILE_ATTRIBUTE_FLAG_SERIAL)
printf ("\t%u", dbus_message_get_serial (message));
if (attrs & PROFILE_ATTRIBUTE_FLAG_REPLY_SERIAL)
printf ("\t%u", dbus_message_get_reply_serial (message));
if (attrs & PROFILE_ATTRIBUTE_FLAG_SENDER)
printf ("\t%s", TRAP_NULL_STRING (dbus_message_get_sender (message)));
if (attrs & PROFILE_ATTRIBUTE_FLAG_DESTINATION)
printf ("\t%s", TRAP_NULL_STRING (dbus_message_get_destination (message)));
if (attrs & PROFILE_ATTRIBUTE_FLAG_PATH)
printf ("\t%s", TRAP_NULL_STRING (dbus_message_get_path (message)));
if (attrs & PROFILE_ATTRIBUTE_FLAG_INTERFACE)
printf ("\t%s", TRAP_NULL_STRING (dbus_message_get_interface (message)));
if (attrs & PROFILE_ATTRIBUTE_FLAG_MEMBER)
printf ("\t%s", TRAP_NULL_STRING (dbus_message_get_member (message)));
if (attrs & PROFILE_ATTRIBUTE_FLAG_ERROR_NAME)
printf ("\t%s", TRAP_NULL_STRING (dbus_message_get_error_name (message)));
printf ("\n");
}