本文整理汇总了C++中dbus_connection_send_with_reply函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_connection_send_with_reply函数的具体用法?C++ dbus_connection_send_with_reply怎么用?C++ dbus_connection_send_with_reply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_connection_send_with_reply函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: xconnman_set_property_bool
/** Initiate asynchronous connman property change D-Bus method call
*
* @param key property name
* @param val value to set
*
* @return TRUE if the method call was initiated, or FALSE in case of errors
*/
static gboolean xconnman_set_property_bool(const char *key, gboolean val)
{
gboolean res = FALSE;
DBusMessage *req = 0;
DBusPendingCall *pc = 0;
dbus_bool_t dta = val;
DBusMessageIter miter, viter;
mce_log(LL_DEBUG, "%s = %s", key, val ? "true" : "false");
if( !(req = dbus_message_new_method_call(CONNMAN_SERVICE,
CONNMAN_OBJECT_PATH,
CONNMAN_INTERFACE,
CONNMAN_SET_PROPERTY_REQ)) )
goto EXIT;
dbus_message_iter_init_append(req, &miter);
dbus_message_iter_append_basic(&miter, DBUS_TYPE_STRING, &key);
if( !dbus_message_iter_open_container(&miter, DBUS_TYPE_VARIANT,
DBUS_TYPE_BOOLEAN_AS_STRING,
&viter) ) {
mce_log(LL_WARN, "container open failed");
goto EXIT;
}
dbus_message_iter_append_basic(&viter, DBUS_TYPE_BOOLEAN, &dta);
if( !dbus_message_iter_close_container(&miter, &viter) ) {
mce_log(LL_WARN, "container close failed");
goto EXIT;
}
if( !dbus_connection_send_with_reply(connman_bus, req, &pc, -1) )
goto EXIT;
if( !pc )
goto EXIT;
if( !dbus_pending_call_set_notify(pc, xconnman_set_property_cb, 0, 0) )
goto EXIT;
// success
res = TRUE;
EXIT:
if( pc ) dbus_pending_call_unref(pc);
if( req ) dbus_message_unref(req);
return res;
}
开发者ID:zchydem,项目名称:mce,代码行数:59,代码来源:radiostates.c
示例2: supplicant_dbus_property_get_all
int supplicant_dbus_property_get_all(const char *path, const char *interface,
supplicant_dbus_property_function function,
void *user_data)
{
struct property_get_data *data;
DBusMessage *message;
DBusPendingCall *call;
if (connection == NULL)
return -EINVAL;
if (path == NULL || interface == NULL)
return -EINVAL;
data = dbus_malloc0(sizeof(*data));
if (data == NULL)
return -ENOMEM;
message = dbus_message_new_method_call(SUPPLICANT_SERVICE, path,
DBUS_INTERFACE_PROPERTIES, "GetAll");
if (message == NULL) {
dbus_free(data);
return -ENOMEM;
}
dbus_message_set_auto_start(message, FALSE);
dbus_message_append_args(message, DBUS_TYPE_STRING, &interface, NULL);
if (dbus_connection_send_with_reply(connection, message,
&call, TIMEOUT) == FALSE) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
if (call == NULL) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
data->function = function;
data->user_data = user_data;
dbus_pending_call_set_notify(call, property_get_all_reply,
data, dbus_free);
dbus_message_unref(message);
return 0;
}
开发者ID:connectivity,项目名称:connman-stable,代码行数:52,代码来源:dbus.c
示例3: dbus_selector_process_post_send
static int dbus_selector_process_post_send( DBusConnection* conn, char * param,
DBusPendingCall** pendingargptr)
{ /* mostly a copy of query() */
DBusMessage* msg = NULL;
DBusMessageIter args = {0};
DBusError err = {0};
DBusPendingCall* pending = NULL;
int ret = 0;
* pendingargptr = NULL;
printf("Calling remote method with %s\n", param);
// initialiset the errors
dbus_error_init(&err);
msg = dbus_message_new_method_call(
"test.selector.server", // target for the method call
"/test/method/Object", // object to call on
"test.method.Type", // interface to call on
"Method"); // method name
if (NULL == msg) {
fprintf(stderr, "Message Null\n");
exit(1);
}
// append arguments
dbus_message_iter_init_append(msg, &args);
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, ¶m)) {
fprintf(stderr, "Out Of Memory!\n");
exit(1);
}
// send message and get a handle for a reply
if (!dbus_connection_send_with_reply (conn, msg, &pending, 300)) { // -1 is default timeout
fprintf(stderr, "Out Of Memory!\n");
exit(1);
}
if (NULL == pending) {
fprintf(stderr, "Pending Call Null\n");
exit(1);
}
printf("Request Sent\n");
dbus_connection_flush(conn); /* Note: block until write finishes */
printf("Request flushed\n");
// free message
dbus_message_unref(msg);
* pendingargptr = pending;
return ret;
}
开发者ID:minghuadev,项目名称:minecraft-tests,代码行数:52,代码来源:dbus-select.c
示例4: ldbus_connection_send_with_reply
static int ldbus_connection_send_with_reply(lua_State *L) {
DBusConnection *connection = check_DBusConnection(L, 1);
DBusMessage *message = check_DBusMessage(L, 2);
int timeout_milliseconds = lua_isnoneornil(L, 3) ? (-1) : (luaL_checknumber(L, 3) * 1000);
DBusPendingCall *pending;
if (!dbus_connection_send_with_reply(connection, message, &pending, timeout_milliseconds)) {
return luaL_error(L, LDBUS_NO_MEMORY);
}
push_DBusPendingCall(L, pending);
return 1;
}
开发者ID:dodo,项目名称:ldbus,代码行数:13,代码来源:connection.c
示例5: dc_quit
void dc_quit(struct razer_daemon_controller *controller)
{
DBusMessage *msg;
msg = dbus_message_new_method_call("org.voyagerproject.razer.daemon","/","org.voyagerproject.razer.daemon","quit");
if(!msg)
dc_error_close(controller,"Error creating Message\n");
if(!dbus_connection_send_with_reply(controller->dbus,msg,&controller->pending,-1))
dc_error_close(controller,"Out of memory!\n");
if(!controller->pending)
dc_error_close(controller,"No pending call\n");
dbus_connection_flush(controller->dbus);
dbus_message_unref(msg);
}
开发者ID:SublimeApple,项目名称:razer_blackwidow_chroma_driver,代码行数:13,代码来源:razer_daemon_controller.c
示例6: handle_run_hello_from_self
static DBusHandlerResult
handle_run_hello_from_self (DBusConnection *connection,
DBusMessage *message)
{
DBusError error;
DBusMessage *reply, *self_message;
DBusPendingCall *pcall;
char *s;
dbus_error_init (&error);
if (!dbus_message_get_args (message,
&error,
DBUS_TYPE_STRING, &s,
DBUS_TYPE_INVALID))
{
reply = dbus_message_new_error (message,
error.name,
error.message);
if (reply == NULL)
die ("No memory\n");
if (!dbus_connection_send (connection, reply, NULL))
die ("No memory\n");
dbus_message_unref (reply);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
printf ("Sending HelloFromSelf\n");
self_message = dbus_message_new_method_call ("org.freedesktop.DBus.GLib.TestEchoService",
"/org/freedesktop/DBus/GLib/TestSuite",
"org.freedesktop.DBus.GLib.TestSuite",
"HelloFromSelf");
if (self_message == NULL)
die ("No memory");
if (!dbus_connection_send_with_reply (connection, self_message, &pcall, -1))
die("No memory");
dbus_message_ref (message);
if (!dbus_pending_call_set_notify (pcall, check_hello_from_self_reply, (void *)message, NULL))
die("No memory");
printf ("Sent HelloFromSelf\n");
return DBUS_HANDLER_RESULT_HANDLED;
}
开发者ID:Distrotech,项目名称:dbus-glib,代码行数:50,代码来源:test-service.c
示例7: add_interface
static int add_interface(struct supplicant_task *task)
{
const char *driver = connman_option_get_string("wifi");
DBusMessage *message;
DBusMessageIter array, dict;
DBusPendingCall *call;
_DBG_SUPPLICANT("task %p", task);
message = dbus_message_new_method_call(SUPPLICANT_NAME, SUPPLICANT_PATH,
SUPPLICANT_INTF, "addInterface");
if (message == NULL)
return -ENOMEM;
dbus_message_set_auto_start(message, FALSE);
dbus_message_iter_init_append(message, &array);
dbus_message_iter_append_basic(&array,
DBUS_TYPE_STRING, &task->ifname);
dbus_message_iter_open_container(&array, DBUS_TYPE_ARRAY,
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
connman_dbus_dict_append_variant(&dict, "driver",
DBUS_TYPE_STRING, &driver);
dbus_message_iter_close_container(&array, &dict);
if (dbus_connection_send_with_reply(connection, message,
&call, TIMEOUT) == FALSE) {
connman_error("Failed to add interface");
dbus_message_unref(message);
return -EIO;
}
if (call == NULL) {
connman_error("D-Bus connection not available");
dbus_message_unref(message);
return -EIO;
}
dbus_pending_call_set_notify(call, add_interface_reply, task, NULL);
dbus_message_unref(message);
return -EINPROGRESS;
}
开发者ID:wenhann,项目名称:chromiumos,代码行数:50,代码来源:supplicant.c
示例8: _eldbus_connection_send
/*
* On success @param msg is unref'd or its ref is stolen by the returned
* Eldbus_Pending.
*/
Eldbus_Pending *
_eldbus_connection_send(Eldbus_Connection *conn, Eldbus_Message *msg, Eldbus_Message_Cb cb, const void *cb_data, double timeout)
{
Eldbus_Pending *pending;
Eldbus_Message *error_msg;
DBG("conn=%p, msg=%p, cb=%p, cb_data=%p, timeout=%f",
conn, msg, cb, cb_data, timeout);
if (!cb)
{
dbus_connection_send(conn->dbus_conn, msg->dbus_msg, NULL);
eldbus_message_unref(msg);
return NULL;
}
pending = calloc(1, sizeof(Eldbus_Pending));
EINA_SAFETY_ON_NULL_RETURN_VAL(pending, NULL);
pending->cb = cb;
pending->cb_data = cb_data;
pending->conn = conn;
pending->dest = eina_stringshare_add(dbus_message_get_destination(msg->dbus_msg));
pending->interface = eina_stringshare_add(dbus_message_get_interface(msg->dbus_msg));
pending->method = eina_stringshare_add(dbus_message_get_member(msg->dbus_msg));
pending->path = eina_stringshare_add(dbus_message_get_path(msg->dbus_msg));
/* Steal the reference */
pending->msg_sent = msg;
EINA_MAGIC_SET(pending, ELDBUS_PENDING_MAGIC);
if (!dbus_connection_send_with_reply(conn->dbus_conn,
msg->dbus_msg,
&pending->dbus_pending, timeout))
{
error_msg = eldbus_message_error_new(msg, "org.enlightenment.DBus.NoConnection",
"Eldbus_Connection was closed.");
eldbus_pending_dispatch(pending, error_msg);
return NULL;
}
if (dbus_pending_call_set_notify(pending->dbus_pending, cb_pending, pending, NULL))
return pending;
dbus_pending_call_cancel(pending->dbus_pending);
error_msg = eldbus_message_error_new(pending->msg_sent,
"org.enlightenment.DBus.Error",
"Error when try set callback to message.");
eldbus_pending_dispatch(pending, error_msg);
return NULL;
}
开发者ID:FlorentRevest,项目名称:EFL,代码行数:54,代码来源:eldbus_pending.c
示例9: test_uae
static void
test_uae (Fixture *f,
gconstpointer context)
{
const Config *config = context;
DBusMessage *m;
DBusPendingCall *pc;
DBusMessageIter args_iter;
DBusMessageIter arr_iter;
if (f->skip)
return;
m = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "UpdateActivationEnvironment");
if (m == NULL)
g_error ("OOM");
dbus_message_iter_init_append (m, &args_iter);
/* Append an empty a{ss} (string => string dictionary). */
if (!dbus_message_iter_open_container (&args_iter, DBUS_TYPE_ARRAY,
"{ss}", &arr_iter) ||
!dbus_message_iter_close_container (&args_iter, &arr_iter))
g_error ("OOM");
if (!dbus_connection_send_with_reply (f->conn, m, &pc,
DBUS_TIMEOUT_USE_DEFAULT) ||
pc == NULL)
g_error ("OOM");
dbus_message_unref (m);
m = NULL;
if (dbus_pending_call_get_completed (pc))
test_pending_call_store_reply (pc, &m);
else if (!dbus_pending_call_set_notify (pc, test_pending_call_store_reply,
&m, NULL))
g_error ("OOM");
while (m == NULL)
test_main_context_iterate (f->ctx, TRUE);
if (config->expect_success)
{
/* it succeeds */
g_assert_cmpint (dbus_message_get_type (m), ==,
DBUS_MESSAGE_TYPE_METHOD_RETURN);
}
开发者ID:MOBO-OSS,项目名称:systemd-relative,代码行数:50,代码来源:uid-permissions.c
示例10: hald_runner_run_method
/* Run a helper program using the commandline, with input as infomation on
* stdin */
void
hald_runner_run_method(HalDevice *device,
const gchar *command_line, char **extra_env,
gchar *input, gboolean error_on_stderr,
guint32 timeout,
HalRunTerminatedCB cb,
gpointer data1, gpointer data2) {
DBusMessage *msg;
DBusMessageIter iter;
DBusPendingCall *call;
HelperData *hd = NULL;
msg = dbus_message_new_method_call("org.freedesktop.HalRunner",
"/org/freedesktop/HalRunner",
"org.freedesktop.HalRunner",
"Run");
if (msg == NULL)
DIE(("No memory"));
dbus_message_iter_init_append(msg, &iter);
if (!add_first_part(&iter, device, command_line, extra_env))
goto error;
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &input);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &error_on_stderr);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &timeout);
if (!dbus_connection_send_with_reply(runner_connection,
msg, &call, INT_MAX))
DIE (("No memory"));
/* the connection was disconnected */
if (call == NULL)
goto error;
hd = malloc(sizeof(HelperData));
hd->d = device;
hd->cb = cb;
hd->data1 = data1;
hd->data2 = data2;
g_object_ref (device);
dbus_pending_call_set_notify(call, call_notify, hd, free);
dbus_message_unref(msg);
return;
error:
dbus_message_unref(msg);
free(hd);
cb(device, HALD_RUN_FAILED, 0, NULL, data1, data2);
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:52,代码来源:hald_runner.c
示例11: make_message
PendingCall StubBase::get_property_async(const char* name)
{
message_ptr_t msg = make_message(dbus_message_new_method_call(busname().c_str(), objectpath(), "org.freedesktop.DBus.Properties", "Get"));
DBusPendingCall* pending = nullptr;
DBusMessageIter iter;
dbus_message_iter_init_append(msg.get(), &iter);
encode(iter, iface(), name);
dbus_connection_send_with_reply(conn(), msg.get(), &pending, DBUS_TIMEOUT_USE_DEFAULT);
return PendingCall(dbus_message_get_serial(msg.get()), pending);
}
开发者ID:martinhaefner,项目名称:simppl,代码行数:14,代码来源:stubbase.cpp
示例12: get_device_properties
void get_device_properties(DBusConnection * conn, char dev[], int *type)
{
DBusMessage *msg;
DBusMessageIter args;
DBusPendingCall *pending;
const char *param1 = "org.freedesktop.NetworkManager.Device";
const char *param2 = "DeviceType";
msg = dbus_message_new_method_call("org.freedesktop.NetworkManager", /* Destination */
dev, /* Object Path */
"org.freedesktop.DBus.Properties", /* Interface */
"Get"); /* Method name */
if (NULL == msg) {
syslog(LOG_ERR, "Message Null\n");
syslog(LOG_ERR, "Message Null get_device_properties\n");
exit(1);
}
if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, ¶m1,
DBUS_TYPE_STRING, ¶m2,
DBUS_TYPE_INVALID)) {
syslog(LOG_ERR, "Out Of Memory!\n");
exit(1);
}
if (!dbus_connection_send_with_reply(conn, msg, &pending, -1)) {
syslog(LOG_ERR, "Out Of Memory!\n");
exit(1);
}
dbus_connection_flush(conn);
dbus_message_unref(msg);
dbus_pending_call_block(pending);
msg = dbus_pending_call_steal_reply(pending);
if (NULL == msg) {
syslog(LOG_ERR, "Reply Null\n");
exit(1);
}
dbus_pending_call_unref(pending);
if (!dbus_message_iter_init(msg, &args))
syslog(LOG_ERR, "Message has no arguments!\n");
else {
int arg_type = dbus_message_iter_get_arg_type(&args);
if (arg_type != DBUS_TYPE_INVALID)
read_variant(&args, type);
}
dbus_message_unref(msg);
}
开发者ID:mandarpradhan,项目名称:Project_Ambulet,代码行数:49,代码来源:paths.c
示例13: test_echo
static void
test_echo (Fixture *f,
gconstpointer context G_GNUC_UNUSED)
{
guint count = 2000;
guint sent;
guint received = 0;
double elapsed;
if (g_test_perf ())
count = 100000;
add_echo_filter (f);
g_test_timer_start ();
for (sent = 0; sent < count; sent++)
{
DBusMessage *m = dbus_message_new_method_call (
dbus_bus_get_unique_name (f->right_conn), "/",
"com.example", "Spam");
DBusPendingCall *pc;
if (m == NULL)
g_error ("OOM");
if (!dbus_connection_send_with_reply (f->left_conn, m, &pc,
DBUS_TIMEOUT_INFINITE) ||
pc == NULL)
g_error ("OOM");
if (dbus_pending_call_get_completed (pc))
pc_count (pc, &received);
else if (!dbus_pending_call_set_notify (pc, pc_count, &received,
NULL))
g_error ("OOM");
dbus_pending_call_unref (pc);
dbus_message_unref (m);
}
while (received < count)
g_main_context_iteration (NULL, TRUE);
elapsed = g_test_timer_elapsed ();
g_test_maximized_result (count / elapsed, "%u messages / %f seconds",
count, elapsed);
}
开发者ID:OmarBizreh,项目名称:Sliding_XZ,代码行数:49,代码来源:dbus-daemon.c
示例14: cras_bt_transport_set_volume
int cras_bt_transport_set_volume(struct cras_bt_transport *transport,
uint16_t volume)
{
const char *key = "Volume";
const char *interface = BLUEZ_INTERFACE_MEDIA_TRANSPORT;
DBusMessage *method_call;
DBusMessageIter message_iter, variant;
DBusPendingCall *pending_call;
method_call = dbus_message_new_method_call(
BLUEZ_SERVICE,
transport->object_path,
DBUS_INTERFACE_PROPERTIES,
"Set");
if (!method_call)
return -ENOMEM;
dbus_message_iter_init_append(method_call, &message_iter);
dbus_message_iter_append_basic(&message_iter, DBUS_TYPE_STRING,
&interface);
dbus_message_iter_append_basic(&message_iter, DBUS_TYPE_STRING, &key);
dbus_message_iter_open_container(&message_iter, DBUS_TYPE_VARIANT,
DBUS_TYPE_UINT16_AS_STRING, &variant);
dbus_message_iter_append_basic(&variant, DBUS_TYPE_UINT16, &volume);
dbus_message_iter_close_container(&message_iter, &variant);
if (!dbus_connection_send_with_reply(transport->conn, method_call,
&pending_call,
DBUS_TIMEOUT_USE_DEFAULT)) {
dbus_message_unref(method_call);
return -ENOMEM;
}
dbus_message_unref(method_call);
if (!pending_call)
return -EIO;
if (!dbus_pending_call_set_notify(pending_call,
on_transport_volume_set,
NULL, NULL)) {
dbus_pending_call_cancel(pending_call);
dbus_pending_call_unref(pending_call);
return -ENOMEM;
}
return 0;
}
开发者ID:dgreid,项目名称:adhd,代码行数:49,代码来源:cras_bt_transport.c
示例15: cka_clients_verify_name
/** Verify that a client exists via an asynchronous GetNameOwner method call
*
* @param name the dbus name who's owner we wish to know
*
* @return TRUE if the method call was initiated, or FALSE in case of errors
*/
static
gboolean
cka_clients_verify_name(const char *name)
{
gboolean res = FALSE;
DBusMessage *req = 0;
DBusPendingCall *pc = 0;
gchar *key = 0;
if( !(req = cka_dbusutil_create_GetNameOwner_req(name)) )
{
goto EXIT;
}
if( !dbus_connection_send_with_reply(cka_dbus_systembus, req, &pc, -1) )
{
goto EXIT;
}
if( !pc )
{
goto EXIT;
}
mce_dbus_pending_call_blocks_suspend(pc);
key = g_strdup(name);
if( !dbus_pending_call_set_notify(pc, cka_clients_verify_name_cb,
key, g_free) )
{
goto EXIT;
}
// key string is owned by pending call
key = 0;
// success
res = TRUE;
EXIT:
g_free(key);
if( pc ) dbus_pending_call_unref(pc);
if( req ) dbus_message_unref(req);
return res;
}
开发者ID:spiiroin,项目名称:mce,代码行数:55,代码来源:cpu-keepalive.c
示例16: get_properties
static void get_properties(struct supplicant_task *task)
{
DBusMessage *message;
char *path;
path = g_slist_nth_data(task->scan_results, 0);
if (path == NULL)
goto noscan;
message = dbus_message_new_method_call(SUPPLICANT_NAME, path,
SUPPLICANT_INTF ".BSSID",
"properties");
task->scan_results = g_slist_remove(task->scan_results, path);
g_free(path);
if (message == NULL)
goto noscan;
dbus_message_set_auto_start(message, FALSE);
if (dbus_connection_send_with_reply(connection, message,
&task->result_call, TIMEOUT) == FALSE) {
connman_error("Failed to get network properties");
dbus_message_unref(message);
goto noscan;
}
if (task->result_call == NULL) {
connman_error("D-Bus connection not available");
dbus_message_unref(message);
goto noscan;
}
dbus_pending_call_set_notify(task->result_call,
properties_reply, task, NULL);
dbus_message_unref(message);
return;
noscan:
task->result_call = NULL;
if (task->scanning == TRUE) {
connman_device_set_scanning(task->device, FALSE);
task->scanning = FALSE;
}
}
开发者ID:wenhann,项目名称:chromiumos,代码行数:49,代码来源:supplicant.c
示例17: server_register
static void server_register(const char *path, const char *uuid,
struct connman_technology *technology,
const char *bridge, connman_bool_t enabled)
{
DBusMessage *message;
DBusPendingCall *call;
char *command;
DBG("path %s enabled %d", path, enabled);
command = enabled ? REGISTER : UNREGISTER;
message = dbus_message_new_method_call(BLUEZ_SERVICE, path,
BLUEZ_NETWORK_SERVER, command);
if (message == NULL)
return;
dbus_message_set_auto_start(message, FALSE);
dbus_message_append_args(message, DBUS_TYPE_STRING, &uuid,
DBUS_TYPE_INVALID);
if (enabled == TRUE)
dbus_message_append_args(message, DBUS_TYPE_STRING, &bridge,
DBUS_TYPE_INVALID);
if (dbus_connection_send_with_reply(connection, message,
&call, TIMEOUT) == FALSE) {
connman_error("Failed to enable PAN server");
dbus_message_unref(message);
return;
}
if (call == NULL) {
connman_error("D-Bus connection not available");
dbus_message_unref(message);
return;
}
if (enabled == TRUE)
dbus_pending_call_set_notify(call, server_register_reply,
technology, NULL);
else
dbus_pending_call_set_notify(call, server_unregister_reply,
technology, NULL);
dbus_message_unref(message);
}
开发者ID:manjurajv,项目名称:connman,代码行数:48,代码来源:bluetooth_legacy.c
示例18: dbus_message_new_method_call
static struct pending_req *send_method_call(DBusConnection *connection,
const char *dest, const char *path,
const char *interface, const char *method,
DBusPendingCallNotifyFunction cb,
void *user_data, int type, ...)
{
DBusMessage *msg;
DBusPendingCall *call;
va_list args;
struct pending_req *req;
msg = dbus_message_new_method_call(dest, path, interface, method);
if (!msg) {
error("Unable to allocate new D-Bus %s message", method);
return NULL;
}
va_start(args, type);
if (!dbus_message_append_args_valist(msg, type, args)) {
dbus_message_unref(msg);
va_end(args);
return NULL;
}
va_end(args);
if (!cb) {
g_dbus_send_message(connection, msg);
return 0;
}
if (!dbus_connection_send_with_reply(connection, msg, &call, -1)) {
error("Sending %s failed", method);
dbus_message_unref(msg);
return NULL;
}
dbus_pending_call_set_notify(call, cb, user_data, NULL);
req = g_new0(struct pending_req, 1);
req->call = call;
req->user_data = user_data;
dbus_message_unref(msg);
return req;
}
开发者ID:KpuBopy4ka,项目名称:obexd-map,代码行数:48,代码来源:session.c
示例19: _libnm_glib_get_nm_state
static void
_libnm_glib_get_nm_state (libnm_glib_ctx *ctx)
{
DBusMessage * message;
DBusPendingCall * pcall = NULL;
g_return_if_fail (ctx != NULL);
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "state")))
{
dbus_connection_send_with_reply (ctx->dbus_con, message, &pcall, -1);
if (pcall)
dbus_pending_call_set_notify (pcall, _libnm_glib_nm_state_cb, ctx, NULL);
dbus_message_unref (message);
}
}
开发者ID:BtbN,项目名称:NetworkManager,代码行数:16,代码来源:libnm_glib.c
示例20: setCharacteristicPropertyNative
static jboolean setCharacteristicPropertyNative(JNIEnv *env, jobject object, jstring path, jstring property, void *value, jint type)
{
#ifdef HAVE_BLUETOOTH
LOGV("%s", __FUNCTION__);
native_data_t *nat = get_native_data(env, object);
if (nat) {
DBusMessage *msg;
DBusMessageIter iter;
DBusError err;
dbus_error_init(&err);
const char *c_path = env->GetStringUTFChars(path, NULL);
const char *c_key = env->GetStringUTFChars(property, NULL);
dbus_bool_t reply = JNI_FALSE;
LOGE("%s c_path=%s",__FUNCTION__, c_path);
msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC,
c_path, DBUS_CHAR_IFACE, "SetProperty");
if (!msg) {
LOGE("%s: Can't allocate new method call for device SetProperty!", __FUNCTION__);
env->ReleaseStringUTFChars(path, c_path);
env->ReleaseStringUTFChars(property, c_key);
return JNI_FALSE;
}
dbus_message_append_args(msg, DBUS_TYPE_STRING, &c_key, DBUS_TYPE_INVALID);
dbus_message_iter_init_append(msg, &iter);
append_variant(&iter, type, value);
reply = dbus_connection_send_with_reply(nat->conn, msg, NULL, -1);
if (!reply) {
if (dbus_error_is_set(&err)) {
LOG_AND_FREE_DBUS_ERROR(&err);
} else {
LOGE("DBus reply is NULL in function %s", __FUNCTION__);
}
}
dbus_message_unref(msg);
env->ReleaseStringUTFChars(path, c_path);
env->ReleaseStringUTFChars(property, c_key);
return reply ? JNI_TRUE : JNI_FALSE;
}
#endif
return JNI_FALSE;
}
开发者ID:richardxu,项目名称:panda-a4,代码行数:47,代码来源:com_ti_bluetooth_gatt_BluetoothGattClient.cpp
注:本文中的dbus_connection_send_with_reply函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论