本文整理汇总了C++中dbus_message_get_args函数 的典型用法代码示例。如果您正苦于以下问题:C++ dbus_message_get_args函数的具体用法?C++ dbus_message_get_args怎么用?C++ dbus_message_get_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_message_get_args函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: a2j_proxy_map_jack_port
bool
a2j_proxy_map_jack_port(
const char * jack_port_name,
char ** alsa_client_name_ptr_ptr,
char ** alsa_port_name_ptr_ptr,
uint32_t * alsa_client_id_ptr)
{
DBusMessage * reply_ptr;
dbus_uint32_t alsa_client_id;
dbus_uint32_t alsa_port_id;
const char * alsa_client_name;
const char * alsa_port_name;
if (!cdbus_call(0, A2J_SERVICE, A2J_OBJECT, A2J_IFACE_CONTROL, "map_jack_port_to_alsa", "s", &jack_port_name, NULL, &reply_ptr))
{
log_error("a2j::map_jack_port_to_alsa() failed.");
return false;
}
if (!dbus_message_get_args(
reply_ptr,
&cdbus_g_dbus_error,
DBUS_TYPE_UINT32,
&alsa_client_id,
DBUS_TYPE_UINT32,
&alsa_port_id,
DBUS_TYPE_STRING,
&alsa_client_name,
DBUS_TYPE_STRING,
&alsa_port_name,
DBUS_TYPE_INVALID))
{
dbus_message_unref(reply_ptr);
dbus_error_free(&cdbus_g_dbus_error);
log_error("decoding reply of map_jack_port_to_alsa failed.");
return false;
}
*alsa_client_name_ptr_ptr = strdup(alsa_client_name);
if (*alsa_client_name_ptr_ptr == NULL)
{
dbus_message_unref(reply_ptr);
log_error("strdup() failed for a2j alsa client name string");
return false;
}
*alsa_port_name_ptr_ptr = strdup(alsa_port_name);
if (*alsa_port_name_ptr_ptr == NULL)
{
dbus_message_unref(reply_ptr);
log_error("strdup() failed for a2j alsa port name string");
free(*alsa_client_name_ptr_ptr);
return false;
}
*alsa_client_id_ptr = alsa_client_id;
dbus_message_unref(reply_ptr);
return true;
}
开发者ID:LADI, 项目名称:ladish, 代码行数:61, 代码来源:a2j_proxy.c
示例2: avahi_service_resolver_event
DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message) {
AvahiServiceResolver *r = NULL;
DBusError error;
const char *path;
AvahiStringList *strlst = NULL;
assert(client);
assert(message);
dbus_error_init (&error);
if (!(path = dbus_message_get_path(message)))
goto fail;
for (r = client->service_resolvers; r; r = r->service_resolvers_next)
if (strcmp (r->path, path) == 0)
break;
if (!r)
goto fail;
switch (event) {
case AVAHI_RESOLVER_FOUND: {
int j;
int32_t interface, protocol, aprotocol;
uint32_t flags;
char *name, *type, *domain, *host, *address;
uint16_t port;
DBusMessageIter iter, sub;
AvahiAddress a;
if (!dbus_message_get_args(
message, &error,
DBUS_TYPE_INT32, &interface,
DBUS_TYPE_INT32, &protocol,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
DBUS_TYPE_STRING, &host,
DBUS_TYPE_INT32, &aprotocol,
DBUS_TYPE_STRING, &address,
DBUS_TYPE_UINT16, &port,
DBUS_TYPE_INVALID) ||
dbus_error_is_set (&error)) {
fprintf(stderr, "Failed to parse resolver event.\n");
goto fail;
}
dbus_message_iter_init(message, &iter);
for (j = 0; j < 9; j++)
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_ARRAY) {
fprintf(stderr, "Error parsing service resolving message\n");
goto fail;
}
strlst = NULL;
dbus_message_iter_recurse(&iter, &sub);
for (;;) {
DBusMessageIter sub2;
int at;
const uint8_t *k;
int n;
if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID)
break;
assert(at == DBUS_TYPE_ARRAY);
if (dbus_message_iter_get_element_type(&sub) != DBUS_TYPE_BYTE) {
fprintf(stderr, "Error parsing service resolving message\n");
goto fail;
}
dbus_message_iter_recurse(&sub, &sub2);
k = NULL; n = 0;
dbus_message_iter_get_fixed_array(&sub2, &k, &n);
if (k && n > 0)
strlst = avahi_string_list_add_arbitrary(strlst, k, n);
dbus_message_iter_next(&sub);
}
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32) {
fprintf(stderr, "Failed to parse resolver event.\n");
goto fail;
}
dbus_message_iter_get_basic(&iter, &flags);
assert(address);
//.........这里部分代码省略.........
开发者ID:RidgeRun, 项目名称:eval-sdk-imx6-hummingboard, 代码行数:101, 代码来源:resolver.c
示例3: avahi_address_resolver_new
AvahiAddressResolver * avahi_address_resolver_new(
AvahiClient *client,
AvahiIfIndex interface,
AvahiProtocol protocol,
const AvahiAddress *a,
AvahiLookupFlags flags,
AvahiAddressResolverCallback callback,
void *userdata) {
DBusError error;
AvahiAddressResolver *r = NULL;
DBusMessage *message = NULL, *reply = NULL;
int32_t i_interface, i_protocol;
uint32_t u_flags;
char *path;
char addr[AVAHI_ADDRESS_STR_MAX], *address = addr;
assert(client);
assert(a);
dbus_error_init (&error);
if (!avahi_address_snprint (addr, sizeof(addr), a)) {
avahi_client_set_errno(client, AVAHI_ERR_INVALID_ADDRESS);
return NULL;
}
if (!avahi_client_is_connected(client)) {
avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
goto fail;
}
if (!(r = avahi_new(AvahiAddressResolver, 1))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
r->client = client;
r->callback = callback;
r->userdata = userdata;
r->path = NULL;
r->interface = interface;
r->protocol = protocol;
r->address = *a;
AVAHI_LLIST_PREPEND(AvahiAddressResolver, address_resolvers, client->address_resolvers, r);
if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "AddressResolverNew"))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
u_flags = (uint32_t) flags;
if (!(dbus_message_append_args(
message,
DBUS_TYPE_INT32, &i_interface,
DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &address,
DBUS_TYPE_UINT32, &u_flags,
DBUS_TYPE_INVALID))) {
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
dbus_error_is_set(&error)) {
avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
goto fail;
}
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
dbus_error_is_set(&error) ||
!path) {
avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
goto fail;
}
if (!(r->path = avahi_strdup(path))) {
/* FIXME: We don't remove the object on the server side */
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
dbus_message_unref(message);
dbus_message_unref(reply);
return r;
fail:
if (dbus_error_is_set(&error)) {
avahi_client_set_dbus_error(client, &error);
dbus_error_free(&error);
}
//.........这里部分代码省略.........
开发者ID:RidgeRun, 项目名称:eval-sdk-imx6-hummingboard, 代码行数:101, 代码来源:resolver.c
示例4: ccgi_dbus_eag_conf_vlanmaping
int ccgi_dbus_eag_conf_vlanmaping(DBusConnection *conn, dbus_vlan_conf vlan_conf)
{
DBusMessage *query, *reply;
DBusError err;
int ret_vlan = -1;
query = dbus_message_new_method_call(
EAG_AURO_SERVER,
EAG_AURO_CONF_OBJECT,
INTERFACE_AURO_VLANMAPING,
METHOD_VLANMAPING );
if (NULL == query) {
fprintf(stderr, "dbus_eag_conf_vlanmaping:dbus_message_new_method_call==Null\n");
}
dbus_error_init(&err);
//fprintf(stderr,"eag_auto_conf v_wlan_begin_id=%d,v_wlan_end_id=%d,v_wtp_begin_id=%u,v_wtp_end_id=%u",\
// vlan_conf.v_wlan_begin_id,vlan_conf.v_wlan_end_id,vlan_conf.v_wtp_begin_id,vlan_conf.v_wtp_end_id);
const char * tmp_wlan_begin_id = vlan_conf.v_wlan_begin_id;
const char * tmp_wlan_end_id = vlan_conf.v_wlan_end_id;
const char * tmp_wtp_begin_id = vlan_conf.v_wtp_begin_id;
const char * tmp_wtp_end_id = vlan_conf.v_wtp_end_id;
const char * nasportid = vlan_conf.nasportid;
const char * tmp_attz = vlan_conf.v_attz;
dbus_message_append_args( query,
DBUS_TYPE_INT32, &vlan_conf.v_flag,
DBUS_TYPE_INT32, &vlan_conf.v_strategy_id,
DBUS_TYPE_STRING, &tmp_wlan_begin_id,
DBUS_TYPE_STRING, &tmp_wlan_end_id,
DBUS_TYPE_STRING, &tmp_wtp_begin_id,
DBUS_TYPE_STRING, &tmp_wtp_end_id,
DBUS_TYPE_STRING, &nasportid,
DBUS_TYPE_STRING, &tmp_attz,
DBUS_TYPE_INVALID );
reply = dbus_connection_send_with_reply_and_block ( conn, query, -1, &err );
dbus_message_unref(query);
if ( NULL == reply )
{
if (dbus_error_is_set(&err))
{
//fprintf(stderr, "dbus_message_new_method_call Error:%s\n", err.message);
dbus_error_free(&err);
}
ret_vlan = ERR_DBUS_REPLY_NULL;
}
else
{
dbus_message_get_args( reply,
&err,
DBUS_TYPE_INT32, &ret_vlan,
DBUS_TYPE_INVALID );
dbus_message_unref(reply);
}
return ret_vlan;
}
开发者ID:inibir, 项目名称:daemongroup, 代码行数:61, 代码来源:ws_eag_auto_conf.c
示例5: tool_cmd_reset
//.........这里部分代码省略.........
switch (c) {
case 'h':
print_arg_list_help(reset_option_list, argv[0],
reset_cmd_syntax);
ret = ERRORCODE_HELP;
goto bail;
case 't':
timeout = strtol(optarg, NULL, 0);
break;
}
}
if (optind < argc) {
fprintf(stderr,
"%s: error: Unexpected extra argument: \"%s\"\n",
argv[0], argv[optind]);
ret = ERRORCODE_BADARG;
goto bail;
}
if (gInterfaceName[0] == 0) {
fprintf(stderr,
"%s: error: No WPAN interface set (use the `cd` command, or the `-I` argument for `wpanctl`).\n",
argv[0]);
ret = ERRORCODE_BADARG;
goto bail;
}
connection = dbus_bus_get(DBUS_BUS_STARTER, &error);
if (!connection) {
dbus_error_free(&error);
dbus_error_init(&error);
connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
}
require_string(connection != NULL, bail, error.message);
{
DBusMessageIter iter;
DBusMessageIter list_iter;
char path[DBUS_MAXIMUM_NAME_LENGTH+1];
char interface_dbus_name[DBUS_MAXIMUM_NAME_LENGTH+1];
ret = lookup_dbus_name_from_interface(interface_dbus_name, gInterfaceName);
if (ret != 0) {
goto bail;
}
snprintf(path,
sizeof(path),
"%s/%s",
WPANTUND_DBUS_PATH,
gInterfaceName);
message = dbus_message_new_method_call(
interface_dbus_name,
path,
WPANTUND_DBUS_APIv1_INTERFACE,
WPANTUND_IF_CMD_RESET
);
fprintf(stderr, "Resetting NCP. . .\n");
reply = dbus_connection_send_with_reply_and_block(
connection,
message,
timeout,
&error
);
if (!reply) {
fprintf(stderr, "%s: error: %s\n", argv[0], error.message);
ret = ERRORCODE_TIMEOUT;
goto bail;
}
dbus_message_get_args(reply, &error,
DBUS_TYPE_INT32, &ret,
DBUS_TYPE_INVALID
);
if (ret == 6)
ret = 0;
}
bail:
if (connection)
dbus_connection_unref(connection);
if (message)
dbus_message_unref(message);
if (reply)
dbus_message_unref(reply);
dbus_error_free(&error);
return ret;
}
开发者ID:ackermanc, 项目名称:wpantund, 代码行数:101, 代码来源:tool-cmd-reset.c
示例6: check_hello_from_self_reply
static void
check_hello_from_self_reply (DBusPendingCall *pcall,
void *user_data)
{
DBusMessage *reply;
DBusMessage *echo_message, *echo_reply = NULL;
DBusError error;
DBusConnection *connection;
int type;
dbus_error_init (&error);
connection = dbus_bus_get (DBUS_BUS_STARTER, &error);
if (connection == NULL)
{
fprintf (stderr, "*** Failed to open connection to activating message bus: %s\n",
error.message);
dbus_error_free (&error);
die("no memory");
}
echo_message = (DBusMessage *)user_data;
reply = dbus_pending_call_steal_reply (pcall);
type = dbus_message_get_type (reply);
if (type == DBUS_MESSAGE_TYPE_METHOD_RETURN)
{
const char *s;
printf ("Reply from HelloFromSelf received\n");
if (!dbus_message_get_args (echo_message,
&error,
DBUS_TYPE_STRING, &s,
DBUS_TYPE_INVALID))
{
echo_reply = dbus_message_new_error (echo_message,
error.name,
error.message);
if (echo_reply == NULL)
die ("No memory\n");
}
else
{
echo_reply = dbus_message_new_method_return (echo_message);
if (echo_reply == NULL)
die ("No memory\n");
if (!dbus_message_append_args (echo_reply,
DBUS_TYPE_STRING, &s,
DBUS_TYPE_INVALID))
die ("No memory");
}
if (!dbus_connection_send (connection, echo_reply, NULL))
die ("No memory\n");
dbus_message_unref (echo_reply);
}
else if (type == DBUS_MESSAGE_TYPE_ERROR)
{
dbus_set_error_from_message (&error, reply);
printf ("Error type in reply: %s\n", error.message);
if (strcmp (error.name, DBUS_ERROR_NO_MEMORY) != 0)
{
echo_reply = dbus_message_new_error (echo_reply,
error.name,
error.message);
if (echo_reply == NULL)
die ("No memory\n");
if (!dbus_connection_send (connection, echo_reply, NULL))
die ("No memory\n");
dbus_message_unref (echo_reply);
}
dbus_error_free (&error);
}
else
_dbus_assert_not_reached ("Unexpected message received\n");
hello_from_self_reply_received = TRUE;
dbus_message_unref (reply);
dbus_message_unref (echo_message);
dbus_pending_call_unref (pcall);
dbus_connection_unref (connection);
}
开发者ID:psunkari, 项目名称:spicebird, 代码行数:95, 代码来源:test-service.c
示例7: nds_filter_function
static DBusHandlerResult
nds_filter_function(DBusConnection *connection, DBusMessage *message,
void *user_data)
{
LibHalContext *ctx = user_data;
DBusMessage *reply;
DBusError error;
const char *member = dbus_message_get_member(message);
const char *path = dbus_message_get_path(message);
int rc = -1;
dbus_error_init(&error);
HAL_DEBUG(("DBus message: %s, %s ", member, path));
if (dbus_message_is_method_call(message,
DBUS_INTERFACE, "EnablePrinterScanningViaSNMP")) {
int interval = -1;
char *udi = getenv("UDI");
char *community = "public";
char *network = "0.0.0.0";
dbus_message_get_args(message, &error,
DBUS_TYPE_INT32, &interval,
DBUS_TYPE_STRING, &community,
DBUS_TYPE_STRING, &network,
DBUS_TYPE_INVALID);
if (strcmp(network, "0.0.0.0") == 0)
network = NULL;
rc = nds_EnablePrinterScanningViaSNMP(ctx, udi, interval,
community, network);
} else if (dbus_message_is_method_call(message,
DBUS_INTERFACE, "ScanForPrintersViaSNMP")) {
int interval = -1;
char *udi = getenv("UDI");
char *community = "public";
char *network = "0.0.0.0";
dbus_message_get_args(message, &error,
DBUS_TYPE_STRING, &community,
DBUS_TYPE_STRING, &network,
DBUS_TYPE_INVALID);
if (strcmp(network, "0.0.0.0") == 0)
network = NULL;
rc = nds_ScanForPrintersViaSNMP(ctx, udi, community, network);
} else if (dbus_message_is_method_call(message,
DBUS_INTERFACE, "DisablePrinterScanningViaSNMP")) {
rc = nds_DisablePrinterScanningViaSNMP(ctx);
} else {
/* bypass not-handled messages */
HAL_WARNING(("Unknown DBus message: %s, %s ", member, path));
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
}
if (dbus_error_is_set(&error))
dbus_error_free(&error);
if ((reply = dbus_message_new_method_return(message)) == NULL) {
HAL_WARNING(("Could not allocate memory for the DBus reply"));
return (FALSE);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &rc,
DBUS_TYPE_INVALID);
if (!dbus_connection_send(connection, reply, NULL)) {
HAL_WARNING(("Could not sent reply"));
}
dbus_connection_flush(connection);
dbus_message_unref(reply);
return (DBUS_HANDLER_RESULT_HANDLED);
}
开发者ID:AlainODea, 项目名称:illumos-gate, 代码行数:77, 代码来源:addon-network-discovery.c
示例8: cdbus_process_win_get
/**
* Process a win_get D-Bus request.
*/
static bool
cdbus_process_win_get(session_t *ps, DBusMessage *msg) {
cdbus_window_t wid = None;
const char *target = NULL;
DBusError err = { };
if (!dbus_message_get_args(msg, &err,
CDBUS_TYPE_WINDOW, &wid,
DBUS_TYPE_STRING, &target,
DBUS_TYPE_INVALID)) {
printf_errf("(): Failed to parse argument of \"win_get\" (%s).",
err.message);
dbus_error_free(&err);
return false;
}
win *w = find_win(ps, wid);
if (!w) {
printf_errf("(): Window %#010x not found.", wid);
cdbus_reply_err(ps, msg, CDBUS_ERROR_BADWIN, CDBUS_ERROR_BADWIN_S, wid);
return true;
}
#define cdbus_m_win_get_do(tgt, apdarg_func) \
if (!strcmp(MSTR(tgt), target)) { \
apdarg_func(ps, msg, w->tgt); \
return true; \
}
cdbus_m_win_get_do(id, cdbus_reply_wid);
// next
if (!strcmp("next", target)) {
cdbus_reply_wid(ps, msg, (w->next ? w->next->id: 0));
return true;
}
// map_state
if (!strcmp("map_state", target)) {
cdbus_reply_bool(ps, msg, w->a.map_state);
return true;
}
cdbus_m_win_get_do(mode, cdbus_reply_enum);
cdbus_m_win_get_do(client_win, cdbus_reply_wid);
cdbus_m_win_get_do(damaged, cdbus_reply_bool);
cdbus_m_win_get_do(destroyed, cdbus_reply_bool);
cdbus_m_win_get_do(window_type, cdbus_reply_enum);
cdbus_m_win_get_do(wmwin, cdbus_reply_bool);
cdbus_m_win_get_do(leader, cdbus_reply_wid);
// focused_real
if (!strcmp("focused_real", target)) {
cdbus_reply_bool(ps, msg, win_is_focused_real(ps, w));
return true;
}
cdbus_m_win_get_do(fade_force, cdbus_reply_enum);
cdbus_m_win_get_do(shadow_force, cdbus_reply_enum);
cdbus_m_win_get_do(focused_force, cdbus_reply_enum);
cdbus_m_win_get_do(invert_color_force, cdbus_reply_enum);
cdbus_m_win_get_do(name, cdbus_reply_string);
cdbus_m_win_get_do(class_instance, cdbus_reply_string);
cdbus_m_win_get_do(class_general, cdbus_reply_string);
cdbus_m_win_get_do(role, cdbus_reply_string);
cdbus_m_win_get_do(opacity, cdbus_reply_uint32);
cdbus_m_win_get_do(frame_opacity, cdbus_reply_double);
cdbus_m_win_get_do(left_width, cdbus_reply_uint32);
cdbus_m_win_get_do(right_width, cdbus_reply_uint32);
cdbus_m_win_get_do(top_width, cdbus_reply_uint32);
cdbus_m_win_get_do(bottom_width, cdbus_reply_uint32);
cdbus_m_win_get_do(shadow, cdbus_reply_bool);
cdbus_m_win_get_do(fade, cdbus_reply_bool);
cdbus_m_win_get_do(invert_color, cdbus_reply_bool);
cdbus_m_win_get_do(blur_background, cdbus_reply_bool);
#undef cdbus_m_win_get_do
printf_errf("(): " CDBUS_ERROR_BADTGT_S, target);
cdbus_reply_err(ps, msg, CDBUS_ERROR_BADTGT, CDBUS_ERROR_BADTGT_S, target);
return true;
}
开发者ID:smlx, 项目名称:package-compton, 代码行数:85, 代码来源:dbus.c
示例9: cdbus_process_win_set
/**
* Process a win_set D-Bus request.
*/
static bool
cdbus_process_win_set(session_t *ps, DBusMessage *msg) {
cdbus_window_t wid = None;
const char *target = NULL;
DBusError err = { };
if (!dbus_message_get_args(msg, &err,
CDBUS_TYPE_WINDOW, &wid,
DBUS_TYPE_STRING, &target,
DBUS_TYPE_INVALID)) {
printf_errf("(): Failed to parse argument of \"win_set\" (%s).",
err.message);
dbus_error_free(&err);
return false;
}
win *w = find_win(ps, wid);
if (!w) {
printf_errf("(): Window %#010x not found.", wid);
cdbus_reply_err(ps, msg, CDBUS_ERROR_BADWIN, CDBUS_ERROR_BADWIN_S, wid);
return true;
}
#define cdbus_m_win_set_do(tgt, type, real_type) \
if (!strcmp(MSTR(tgt), target)) { \
real_type val; \
if (!cdbus_msg_get_arg(msg, 2, type, &val)) \
return false; \
w->tgt = val; \
goto cdbus_process_win_set_success; \
}
if (!strcmp("shadow_force", target)) {
cdbus_enum_t val = UNSET;
if (!cdbus_msg_get_arg(msg, 2, CDBUS_TYPE_ENUM, &val))
return false;
win_set_shadow_force(ps, w, val);
goto cdbus_process_win_set_success;
}
if (!strcmp("fade_force", target)) {
cdbus_enum_t val = UNSET;
if (!cdbus_msg_get_arg(msg, 2, CDBUS_TYPE_ENUM, &val))
return false;
win_set_fade_force(ps, w, val);
goto cdbus_process_win_set_success;
}
if (!strcmp("focused_force", target)) {
cdbus_enum_t val = UNSET;
if (!cdbus_msg_get_arg(msg, 2, CDBUS_TYPE_ENUM, &val))
return false;
win_set_focused_force(ps, w, val);
goto cdbus_process_win_set_success;
}
if (!strcmp("invert_color_force", target)) {
cdbus_enum_t val = UNSET;
if (!cdbus_msg_get_arg(msg, 2, CDBUS_TYPE_ENUM, &val))
return false;
win_set_invert_color_force(ps, w, val);
goto cdbus_process_win_set_success;
}
#undef cdbus_m_win_set_do
printf_errf("(): " CDBUS_ERROR_BADTGT_S, target);
cdbus_reply_err(ps, msg, CDBUS_ERROR_BADTGT, CDBUS_ERROR_BADTGT_S, target);
return true;
cdbus_process_win_set_success:
if (!dbus_message_get_no_reply(msg))
cdbus_reply_bool(ps, msg, true);
return true;
}
开发者ID:smlx, 项目名称:package-compton, 代码行数:79, 代码来源:dbus.c
示例10: dp_unpack_pam_request
bool dp_unpack_pam_request(DBusMessage *msg, TALLOC_CTX *mem_ctx,
struct pam_data **new_pd, DBusError *dbus_error)
{
dbus_bool_t db_ret;
int ret;
struct pam_data pd;
uint32_t authtok_type;
int authtok_length;
uint8_t *authtok_data;
uint32_t new_authtok_type;
int new_authtok_length;
uint8_t *new_authtok_data;
int32_t pd_cmd;
int32_t pd_priv;
memset(&pd, 0, sizeof(pd));
db_ret = dbus_message_get_args(msg, dbus_error,
DBUS_TYPE_INT32, &pd_cmd,
DBUS_TYPE_STRING, &(pd.user),
DBUS_TYPE_STRING, &(pd.domain),
DBUS_TYPE_STRING, &(pd.service),
DBUS_TYPE_STRING, &(pd.tty),
DBUS_TYPE_STRING, &(pd.ruser),
DBUS_TYPE_STRING, &(pd.rhost),
DBUS_TYPE_UINT32, &authtok_type,
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
&authtok_data, &authtok_length,
DBUS_TYPE_UINT32, &new_authtok_type,
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
&new_authtok_data, &new_authtok_length,
DBUS_TYPE_INT32, &pd_priv,
DBUS_TYPE_UINT32, &(pd.cli_pid),
DBUS_TYPE_INVALID);
if (!db_ret) {
DEBUG(SSSDBG_CRIT_FAILURE, "dbus_message_get_args failed.\n");
return false;
}
pd.cmd = pd_cmd;
pd.priv = pd_priv;
ret = copy_pam_data(mem_ctx, &pd, new_pd);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, "copy_pam_data failed.\n");
return false;
}
ret = sss_authtok_set((*new_pd)->authtok, authtok_type,
authtok_data, authtok_length);
if (ret) {
DEBUG(SSSDBG_CRIT_FAILURE,
"Failed to set auth token: %d [%s]\n", ret, strerror(ret));
return false;
}
ret = sss_authtok_set((*new_pd)->newauthtok, new_authtok_type,
new_authtok_data, new_authtok_length);
if (ret) {
DEBUG(SSSDBG_CRIT_FAILURE,
"Failed to set auth token: %d [%s]\n", ret, strerror(ret));
return false;
}
return true;
}
开发者ID:3van, 项目名称:sssd, 代码行数:66, 代码来源:dp_auth_util.c
示例11: handle_gps_fix
static DBusHandlerResult handle_gps_fix (DBusMessage* message) {
DBusError error;
double temp_time;
dbus_error_init (&error);
dbus_message_get_args (message,
&error,
DBUS_TYPE_DOUBLE, &temp_time,
DBUS_TYPE_INT32, &gpsfix.mode,
DBUS_TYPE_DOUBLE, &gpsfix.ept,
DBUS_TYPE_DOUBLE, &gpsfix.latitude,
DBUS_TYPE_DOUBLE, &gpsfix.longitude,
DBUS_TYPE_DOUBLE, &gpsfix.eph,
DBUS_TYPE_DOUBLE, &gpsfix.altitude,
DBUS_TYPE_DOUBLE, &gpsfix.epv,
DBUS_TYPE_DOUBLE, &gpsfix.track,
DBUS_TYPE_DOUBLE, &gpsfix.epd,
DBUS_TYPE_DOUBLE, &gpsfix.speed,
DBUS_TYPE_DOUBLE, &gpsfix.eps,
DBUS_TYPE_DOUBLE, &gpsfix.climb,
DBUS_TYPE_DOUBLE, &gpsfix.epc,
DBUS_TYPE_INVALID);
gpsfix.time = floor(temp_time);
/*
* we have a fix there - log the point
*/
if ((gpsfix.time!=gpsfix.old_time)&&gpsfix.mode>1) {
struct tm time;
/* Make new track if the jump in time is above
* tracklimit. Handle jumps both forward and
* backwards in time. The clock sometimes jump
* backward when gpsd is submitting junk on the
* dbus. */
if (fabs(gpsfix.time - gpsfix.old_time) > tracklimit && !first) {
print_gpx_trk_end();
intrack = 0;
}
if (!intrack) {
print_gpx_trk_start();
intrack = 1;
if (first)
first = 0;
}
gpsfix.old_time = gpsfix.time;
fprintf (stdout, " <trkpt lat=\"%f\" lon=\"%f\">\n", gpsfix.latitude, gpsfix.longitude);
fprintf (stdout, " <ele>%f</ele>\n", gpsfix.altitude);
gmtime_r (&(gpsfix.time), &time);
fprintf (stdout, " <time>%04d-%02d-%02dT%02d:%02d:%02dZ</time>\n",
time.tm_year+1900, time.tm_mon+1, time.tm_mday,
time.tm_hour, time.tm_min, time.tm_sec);
if (gpsfix.mode==1)
fprintf (stdout, " <fix>none</fix>\n");
else
fprintf (stdout, " <fix>%dd</fix>\n", gpsfix.mode);
fprintf (stdout, " </trkpt>\n");
fflush (stdout);
}
return DBUS_HANDLER_RESULT_HANDLED;
}
开发者ID:Jalakas, 项目名称:libgarmin, 代码行数:64, 代码来源:dbusgps.c
示例12: dp_id_callback
void dp_id_callback(DBusPendingCall *pending, void *ptr)
{
DBusMessage *reply;
DBusError dbus_error;
dbus_bool_t ret;
dbus_uint16_t dp_ver;
int type;
dbus_error_init(&dbus_error);
reply = dbus_pending_call_steal_reply(pending);
if (!reply) {
/* reply should never be null. This function shouldn't be called
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
DEBUG(SSSDBG_FATAL_FAILURE,
"Severe error. A reply callback was called but no"
" reply was received and no timeout occurred\n");
/* FIXME: Destroy this connection ? */
goto done;
}
type = dbus_message_get_type(reply);
switch (type) {
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
ret = dbus_message_get_args(reply, &dbus_error,
DBUS_TYPE_UINT16, &dp_ver,
DBUS_TYPE_INVALID);
if (!ret) {
DEBUG(SSSDBG_CRIT_FAILURE, "Failed to parse message\n");
if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error);
/* FIXME: Destroy this connection ? */
goto done;
}
DEBUG(SSSDBG_CONF_SETTINGS,
"Got id ack and version (%d) from DP\n", dp_ver);
break;
case DBUS_MESSAGE_TYPE_ERROR:
DEBUG(SSSDBG_FATAL_FAILURE,"The Monitor returned an error [%s]\n",
dbus_message_get_error_name(reply));
/* Falling through to default intentionally*/
default:
/*
* Timeout or other error occurred or something
* unexpected happened.
* It doesn't matter which, because either way we
* know that this connection isn't trustworthy.
* We'll destroy it now.
*/
/* FIXME: Destroy this connection ? */
break;
}
done:
dbus_pending_call_unref(pending);
dbus_message_unref(reply);
}
开发者ID:3van, 项目名称:sssd, 代码行数:63, 代码来源:dp_auth_util.c
示例13: endpoint_reply
static void endpoint_reply(DBusPendingCall *call, void *user_data)
{
struct endpoint_request *request = user_data;
struct media_endpoint *endpoint = request->endpoint;
DBusMessage *reply;
DBusError err;
gboolean value;
void *ret = NULL;
int size = -1;
/* steal_reply will always return non-NULL since the callback
* is only called after a reply has been received */
reply = dbus_pending_call_steal_reply(call);
dbus_error_init(&err);
if (dbus_set_error_from_message(&err, reply)) {
error("Endpoint replied with an error: %s",
err.name);
/* Clear endpoint configuration in case of NO_REPLY error */
if (dbus_error_has_name(&err, DBUS_ERROR_NO_REPLY)) {
if (request->cb)
request->cb(endpoint, NULL, size,
request->user_data);
clear_endpoint(endpoint);
dbus_message_unref(reply);
dbus_error_free(&err);
return;
}
dbus_error_free(&err);
goto done;
}
if (dbus_message_is_method_call(request->msg, MEDIA_ENDPOINT_INTERFACE,
"SelectConfiguration")) {
DBusMessageIter args, array;
uint8_t *configuration;
dbus_message_iter_init(reply, &args);
dbus_message_iter_recurse(&args, &array);
dbus_message_iter_get_fixed_array(&array, &configuration, &size);
ret = configuration;
goto done;
} else if (!dbus_message_get_args(reply, &err, DBUS_TYPE_INVALID)) {
error("Wrong reply signature: %s", err.message);
dbus_error_free(&err);
goto done;
}
size = 1;
value = TRUE;
ret = &value;
done:
dbus_message_unref(reply);
if (request->cb)
request->cb(endpoint, ret, size, request->user_data);
endpoint->requests = g_slist_remove(endpoint->requests, request);
endpoint_request_free(request);
}
开发者ID:adityakamath, 项目名称:ArduHack, 代码行数:66, 代码来源:media.c
示例14: dispatch
OMXControlResult OMXControl::getEvent()
{
if (!bus)
return KeyConfig::ACTION_BLANK;
dispatch();
DBusMessage *m = dbus_connection_pop_message(bus);
if (m == NULL)
return KeyConfig::ACTION_BLANK;
CLog::Log(LOGDEBUG, "Popped message member: %s interface: %s type: %d path: %s", dbus_message_get_member(m), dbus_message_get_interface(m), dbus_message_get_type(m), dbus_message_get_path(m) );
if (dbus_message_is_method_call(m, OMXPLAYER_DBUS_INTERFACE_ROOT, "Quit"))
{
dbus_respond_ok(m);
return KeyConfig::ACTION_EXIT;
}
else if (dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "CanQuit")
|| dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "Fullscreen"))
{
dbus_respond_boolean(m, 1);
return KeyConfig::ACTION_BLANK;
}
else if (dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "CanSetFullscreen")
|| dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "CanRaise")
|| dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "HasTrackList"))
{
dbus_respond_boolean(m, 0);
return KeyConfig::ACTION_BLANK;
}
else if (dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "Identity"))
{
dbus_respond_string(m, "OMXPlayer");
return KeyConfig::ACTION_BLANK;
}
else if (dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "SupportedUriSchemes"))
{
const char *UriSchemes[] = {"file", "http"};
dbus_respond_array(m, UriSchemes, 2); // Array is of length 2
return KeyConfig::ACTION_BLANK;
}
else if (dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "SupportedMimeTypes"))
{
const char *MimeTypes[] = {}; // Needs supplying
dbus_respond_array(m, MimeTypes, 0);
return KeyConfig::ACTION_BLANK;
}
else if (dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "CanGoNext")
|| dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "CanGoPrevious"))
{
dbus_respond_boolean(m, 0);
return KeyConfig::ACTION_BLANK;
}
else if (dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "CanSeek"))
{
dbus_respond_boolean(m, reader->CanSeek());
return KeyConfig::ACTION_BLANK;
}
else if (dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "CanControl")
|| dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "CanPlay")
|| dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "CanPause"))
{
dbus_respond_boolean(m, 1);
}
else if (dbus_message_is_method_call(m, OMXPLAYER_DBUS_INTERFACE_PLAYER, "Next"))
{
dbus_respond_ok(m);
return KeyConfig::ACTION_NEXT_CHAPTER;
}
else if (dbus_message_is_method_call(m, OMXPLAYER_DBUS_INTERFACE_PLAYER, "Previous"))
{
dbus_respond_ok(m);
return KeyConfig::ACTION_PREVIOUS_CHAPTER;
}
else if (dbus_message_is_method_call(m, OMXPLAYER_DBUS_INTERFACE_PLAYER, "Pause")
|| dbus_message_is_method_call(m, OMXPLAYER_DBUS_INTERFACE_PLAYER, "PlayPause"))
{
dbus_respond_ok(m);
return KeyConfig::ACTION_PAUSE;
}
else if (dbus_message_is_method_call(m, OMXPLAYER_DBUS_INTERFACE_PLAYER, "Stop"))
{
dbus_respond_ok(m);
return KeyConfig::ACTION_EXIT;
}
else if (dbus_message_is_method_call(m, OMXPLAYER_DBUS_INTERFACE_PLAYER, "Seek"))
{
DBusError error;
dbus_error_init(&error);
int64_t offset;
dbus_message_get_args(m, &error, DBUS_TYPE_INT64, &offset, DBUS_TYPE_INVALID);
// Make sure a value is sent for seeking
if (dbus_error_is_set(&error))
{
CLog::Log(LOGWARNING, "Seek D-Bus Error: %s", error.message );
dbus_error_free(&error);
dbus_respond_ok(m);
//.........这里部分代码省略.........
开发者ID:AppleH264, 项目名称:omxplayer, 代码行数:101, 代码来源:OMXControl.cpp
示例15: dbus_error_init
/*******************************************************************************
* igmp_snp_dbus_igmp_snp_enable
*
* DESCRIPTION:
* config IGMP snoop enable
*
* INPUTS:
* conn - dbusconnection
* msg - dbusmessage
* user_data - dbus data
*
* OUTPUTS:
* null
*
* RETURNS:
* reply -
*
* COMMENTS:
*
**
********************************************************************************/
DBusMessage * igmp_snp_dbus_igmp_snp_enable
(
DBusConnection *conn,
DBusMessage *msg,
void *user_data
)
{
DBusMessage* reply;
DBusMessageIter iter = {0};
DBusError err;
unsigned int ret = IGMPSNP_RETURN_CODE_OK;
unsigned char enable = 0,ismld =0;
dbus_error_init( &err );
if( !(dbus_message_get_args( msg ,&err, \
DBUS_TYPE_BYTE, &enable, \
DBUS_TYPE_BYTE, &ismld,\
DBUS_TYPE_INVALID)))
{
igmp_snp_syslog_err("Unable to get input args\n");
if(dbus_error_is_set( &err ))
{
igmp_snp_syslog_err("%s raised:%s\n",err.name ,err.message);
dbus_error_free( &err );
}
return NULL;
}
/* here call igmp_snp or mld_snp api */
if(1 == ismld){/*mld enable or disable*/
if (0 == enable) {
ret = mld_snp_set_disable_dbus();
}
else if(1 == enable){
ret = mld_snp_set_enable_dbus();
}
else {
ret = IGMPSNP_RETURN_CODE_ERROR;
}
}
else{/*igmp enable or disable*/
if (0 == enable) {
ret = igmp_snp_set_disable_dbus();
}
else if(1 == enable){
ret = igmp_snp_set_enable_dbus();
}
else {
ret = IGMPSNP_RETURN_CODE_ERROR;
}
}
reply = dbus_message_new_method_return(msg);
if(NULL==reply)
{
igmp_snp_syslog_dbg("dbus add vlan no reply resource error!\n");
return reply;
}
dbus_message_iter_init_append (reply, &iter);
dbus_message_iter_append_basic (&iter,DBUS_TYPE_UINT32,&ret);
return reply;
}
开发者ID:inibir, 项目名称:daemongroup, 代码行数:88, 代码来源:igmp_snp_dbus.c
示例16: g_assert
DBusHandlerResult
HippoDBusIpcProviderImpl::handleMethod(DBusMessage *message)
{
g_assert(connection_ != NULL);
DBusMessage *reply = NULL;
const char *sender = dbus_message_get_sender(message);
const char *interface = dbus_message_get_interface(message);
const char *member = dbus_message_get_member(message);
const char *path = dbus_message_get_path(message);
g_debug("method call from %s %s.%s on %s", sender ? sender : "NULL",
interface ? interface : "NULL",
member ? member : "NULL",
path ? path : "NULL");
if (!path || strcmp(path, HIPPO_DBUS_STACKER_LISTENER_PATH) != 0)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (!interface || strcmp(interface, HIPPO_DBUS_STACKER_LISTENER_INTERFACE) != 0)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (strcmp(member, "UserJoin") == 0) {
dbus_uint64_t endpoint;
const char *chatId;
const char *userId;
dbus_bool_t participant;
if (dbus_message_get_args(message, NULL,
DBUS_TYPE_UINT64, &endpoint,
DBUS_TYPE_STRING, &chatId,
DBUS_TYPE_STRING, &userId,
DBUS_TYPE_BOOLEAN, &participant,
DBUS_TYPE_INVALID)) {
if (listener_)
listener_->onUserJoin(endpoint, chatId, userId, participant);
} else {
reply = dbus_message_new_error(message,
DBUS_ERROR_INVALID_ARGS,
_("Expected userJoin(uint64 endpoint, string chatId, string userId, boolean participant)"));
}
} else if (strcmp(member, "UserLeave") == 0) {
dbus_uint64_t endpoint;
const char *chatId;
const char *userId;
if (dbus_message_get_args(message, NULL,
DBUS_TYPE_UINT64, &endpoint,
DBUS_TYPE_STRING, &chatId,
DBUS_TYPE_STRING, &userId,
DBUS_TYPE_INVALID)) {
if (listener_)
listener_->onUserLeave(endpoint, chatId, userId);
} else {
reply = dbus_message_new_error(message,
DBUS_ERROR_INVALID_ARGS,
_("Expected userLeave(uint64 endpoint, string chatId, string userId)"));
}
} else if (strcmp(member, "Message") == 0) {
dbus_uint64_t endpoint;
const char *chatId;
const char *userId;
const char *text;
dbus_int32_t sentiment;
double timestamp;
int serial;
if (dbus_message_get_args(message, NULL,
DBUS_TYPE_UINT64, &endpoint,
DBUS_TYPE_STRING, &chatId,
DBUS_TYPE_STRING, &userId,
DBUS_TYPE_STRING, &text,
DBUS_TYPE_INT32, &sentiment,
DBUS_TYPE_DOUBLE, ×tamp,
DBUS_TYPE_INT32, &serial,
DBUS_TYPE_INVALID)) {
if (listener_)
listener_->onMessage(endpoint, chatId, userId, text, sentiment, timestamp, serial);
} else {
reply = dbus_message_new_error(message,
DBUS_ERROR_INVALID_ARGS,
_("Expected Messsage(uint64 endpoint, string chatId, string userId, string text, int32 sentiment, double timestamp, int32 serial)"));
}
} else if (strcmp(member, "UserInfo") == 0) {
dbus_uint64_t endpoint;
const char *userId;
const char *name;
const char *smallPhotoUrl;
const char *currentSong;
const char *currentArtist;
dbus_bool_t musicPlaying;
if (dbus_message_get_args(message, NULL,
DBUS_TYPE_UINT64, &endpoint,
DBUS_TYPE_STRING, &userId,
DBUS_TYPE_STRING, &name,
//.........这里部分代码省略.........
开发者ID:nihed, 项目名称:magnetism, 代码行数:101, 代码来源:hippo-dbus-ipc-provider.cpp
示例17: dbus_bus_get_unix_process_id
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:19262| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:10011| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8337| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8705| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8651| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9679| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8638| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:8008| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8673| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7544| 2022-11-06
请发表评论