本文整理汇总了C++中dbus_message_get_interface函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_message_get_interface函数的具体用法?C++ dbus_message_get_interface怎么用?C++ dbus_message_get_interface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_message_get_interface函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Distrotech,项目名称:pulseaudio,代码行数:30,代码来源:server-lookup.c
示例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;
}
开发者ID:lathiat,项目名称:avahi,代码行数:56,代码来源:dbus-record-browser.c
示例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;
}
开发者ID:fgau,项目名称:cneo,代码行数:55,代码来源:cneod.c
示例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;
}
开发者ID:JoshuaPK,项目名称:bt2unix,代码行数:31,代码来源:c-simple-agent.c
示例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;
}
}
开发者ID:steafen,项目名称:dde,代码行数:32,代码来源:dbus_introspect.c
示例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;
}
开发者ID:d0b3rm4n,项目名称:usb-moded,代码行数:33,代码来源:usb_moded-devicelock.c
示例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;
}
开发者ID:593141477,项目名称:bluez-rda,代码行数:34,代码来源:object.c
示例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;
}
开发者ID:MDomagala,项目名称:bluez,代码行数:26,代码来源:object.c
示例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");
}
}
开发者ID:Pardus-Linux,项目名称:COMAR,代码行数:35,代码来源:loop.c
示例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;
}
开发者ID:tapiralec,项目名称:gnome-session,代码行数:31,代码来源:gsm-dbus-client.c
示例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;
}
开发者ID:AwxiVYTHUIiMOol,项目名称:bluez,代码行数:27,代码来源:client.c
示例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;
}
开发者ID:01org,项目名称:murphy,代码行数:32,代码来源:mainloop-test.c
示例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;
}
开发者ID:dtaht,项目名称:lem-dbus,代码行数:33,代码来源:dbus.c
示例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;
}
开发者ID:hideakihata,项目名称:mozilla-central.fgv,代码行数:29,代码来源:BluetoothDBusUtils.cpp
示例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");
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:32,代码来源:dbus-monitor.c
示例16:
static DBusHandlerResult
default_message_filter
( DBusConnection *connection,
DBusMessage *message,
void *p
)
{
DBusConnectionState *cs = p;
uint32_t type =dbus_message_get_type( message ),
serial =dbus_message_get_serial( message );
uint8_t reply =dbus_message_get_no_reply( message )==0;
const char
*path = dbus_message_get_path( message ),
*dest = dbus_message_get_destination( message ),
*member = dbus_message_get_member( message ),
*interface=dbus_message_get_interface( message ),
*sender =dbus_message_get_sender( message ),
*signature=dbus_message_get_signature( message );
connection = connection;
if(cs->mf)
return
(*(cs->mf))( cs, type, reply, serial, dest, path, member, interface, 0L,
sender, signature, message, 0L, 0L, 0L, cs->def_mf_obj
) ;
return HANDLED;
}
开发者ID:minghuadev,项目名称:minecraft-tests,代码行数:26,代码来源:threads-apple-dbus_service.c
示例17: dbus_connection_read_write
bool CUDisks2Provider::PumpDriveChangeEvents(IStorageEventsCallback *callback)
{
if (m_connection)
{
dbus_connection_read_write(m_connection, 0);
DBusMessagePtr msg(dbus_connection_pop_message(m_connection));
if (msg)
{
CLog::Log(LOGDEBUG, LOGDBUS, "UDisks2: Message received (interface: %s, member: %s)",
dbus_message_get_interface(msg.get()), dbus_message_get_member(msg.get()));
if (dbus_message_is_signal(msg.get(), DBUS_INTERFACE_OBJECT_MANAGER, "InterfacesAdded"))
{
HandleInterfacesAdded(msg.get());
return false;
}
else if (dbus_message_is_signal(msg.get(), DBUS_INTERFACE_OBJECT_MANAGER, "InterfacesRemoved"))
{
return HandleInterfacesRemoved(msg.get(), callback);
}
else if (dbus_message_is_signal(msg.get(), DBUS_INTERFACE_PROPERTIES, "PropertiesChanged"))
{
return HandlePropertiesChanged(msg.get(), callback);
}
}
}
return false;
}
开发者ID:68foxboris,项目名称:xbmc,代码行数:29,代码来源:UDisks2Provider.cpp
示例18: xdbus_filter_cb
static DBusHandlerResult
xdbus_filter_cb(DBusConnection *con,
DBusMessage *msg,
void *aptr)
{
(void)con; (void)aptr;
DBusHandlerResult res = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if( dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL )
goto EXIT;
const char *interface = dbus_message_get_interface(msg);
if( !interface )
goto EXIT;
const char *member = dbus_message_get_member(msg);
if( !member )
goto EXIT;
if( !strcmp(interface, MCE_SIGNAL_IF) )
{
if( !strcmp(member, MCE_DISPLAY_SIG) )
xdbus_handle_display_state_signal(msg);
}
EXIT:
return res;
}
开发者ID:mer-hybris,项目名称:unblank-restart-sensors,代码行数:29,代码来源:unblank-restart-sensors.c
示例19: c_bus_interface
//! Returns DBus message interface, used in scripts
static PyObject *
c_bus_interface(PyObject *self, PyObject *args)
{
const char *iface = dbus_message_get_interface(my_proc.bus_msg);
PyObject *py_str = PyString_FromString(iface);
Py_INCREF(py_str);
return py_str;
}
开发者ID:Pardus-Linux,项目名称:COMAR,代码行数:9,代码来源:script.c
示例20: main
/* main() */
int main(int argc, char *argv[])
{
DBusConnection *conn = NULL;
DBusMessage *msg_query = NULL;
DBusMessage *msg_reply = NULL;
DBusError error;
const char *xml_data = NULL;
int return_code;
/* Initialize the error state. */
dbus_error_init(&error);
/* Connect to user-session D-Bus */
fprintf(stdout, "Connecting to Session D-Bus\n");
conn = dbus_bus_get(DBUS_BUS_SESSION, &error);
exit_on_error("Failed to open user-session bus.\n", &error);
/* Print unique name */
fprintf(stdout, "D-Bus unique name: %s\n", \
dbus_bus_get_unique_name(conn));
/* Request well-know name on the session bus */
return_code = dbus_bus_request_name(conn, DBUS_CLIENT_NAME, \
DBUS_NAME_FLAG_REPLACE_EXISTING, \
&error);
exit_on_error("Failed to get well-known name.", &error);
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != return_code)
exit(EXIT_FAILURE);
/* Send "Introspect" message */
msg_query = dbus_message_new_method_call(DBUS_SERVER_NAME, /* Target */
DBUS_OBJECT_PATH, /* Object */
DBUS_IFACE_INTRO, /* Interface */
"Introspect"); /* Method name */
msg_reply = dbus_connection_send_with_reply_and_block(conn, msg_query, 1000, &error);
exit_on_error("Failed to send Introspect message.", &error);
/* Get the string argument from Introspect call */
dbus_message_get_args(msg_reply, &error, DBUS_TYPE_STRING, \
&xml_data, DBUS_TYPE_INVALID);
/* Print message information */
fprintf(stdout, "Object Path \t= %s\n", dbus_message_get_path(msg_query));
fprintf(stdout, "Interface \t= %s\n", dbus_message_get_interface(msg_query));
fprintf(stdout, "Message \t= %s\n", dbus_message_get_member(msg_query));
fprintf(stdout, "Introspect xml_data:\n%s\n", xml_data);
/* Free messages */
dbus_message_unref(msg_query);
dbus_message_unref(msg_reply);
/* Free the connection. */
dbus_connection_unref(conn);
return EXIT_SUCCESS;
}
开发者ID:erminpour,项目名称:junkcode,代码行数:59,代码来源:dbus-client.c
注:本文中的dbus_message_get_interface函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论