本文整理汇总了C++中dbus_message_new_method_return函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_message_new_method_return函数的具体用法?C++ dbus_message_new_method_return怎么用?C++ dbus_message_new_method_return使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_message_new_method_return函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: connman_agent_reply_identity
int connman_agent_reply_identity(const char *identity, const char *passphrase)
{
DBusMessageIter arg, dict;
DBusMessage *reply;
if (agent_if == NULL || agent_if->pending_reply == NULL)
return 0;
if (identity == NULL || passphrase == NULL)
return -EINVAL;
reply = dbus_message_new_method_return(agent_if->pending_reply);
if (reply == NULL)
return -ENOMEM;
dbus_message_iter_init_append(reply, &arg);
if (cui_dbus_open_dict(&arg, &dict) == FALSE)
goto error;
cui_dbus_append_dict_entry_basic(&dict, "Identity",
DBUS_TYPE_STRING, &identity);
cui_dbus_append_dict_entry_basic(&dict, "Passphrase",
DBUS_TYPE_STRING, &passphrase);
dbus_message_iter_close_container(&dict, &arg);
send_agent_reply(reply);
return 0;
error:
dbus_message_unref(reply);
dbus_message_unref(agent_if->pending_reply);
agent_if->pending_reply = NULL;
return -ENOMEM;
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-connman-ui,代码行数:39,代码来源:agent.c
示例2: connman_agent_reply_login
int connman_agent_reply_login(const char *username, const char *password)
{
DBusMessageIter arg, dict;
DBusMessage *reply;
if (agent_if == NULL || agent_if->pending_reply == NULL)
return 0;
if (username == NULL && password == NULL)
return -EINVAL;
reply = dbus_message_new_method_return(agent_if->pending_reply);
if (reply == NULL)
return -ENOMEM;
dbus_message_iter_init_append(reply, &arg);
if (cui_dbus_open_dict(&arg, &dict) == FALSE)
goto error;
cui_dbus_append_dict_entry_basic(&dict, "Username",
DBUS_TYPE_STRING, &username);
cui_dbus_append_dict_entry_basic(&dict, "Password",
DBUS_TYPE_STRING, &password);
dbus_message_iter_close_container(&dict, &arg);
send_agent_reply(reply);
return 0;
error:
dbus_message_unref(reply);
dbus_message_unref(agent_if->pending_reply);
agent_if->pending_reply = NULL;
return -ENOMEM;
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-connman-ui,代码行数:39,代码来源:agent.c
示例3: btd_error_not_supported
static DBusMessage *hrcp_reset(DBusConnection *conn, DBusMessage *msg,
void *data)
{
struct heartrate *hr = data;
uint8_t value;
char *vmsg;
if (!hr->hrcp_val_handle)
return btd_error_not_supported(msg);
if (!hr->attrib)
return btd_error_not_available(msg);
value = 0x01;
vmsg = g_strdup("Reset Control Point");
gatt_write_char(hr->attrib, hr->hrcp_val_handle, &value,
sizeof(value), char_write_cb, vmsg);
DBG("Energy Expended Value has been reset");
return dbus_message_new_method_return(msg);
}
开发者ID:LegacySlimXperia,项目名称:android_hardware_semc,代码行数:22,代码来源:heartrate.c
示例4: server_make_reply
static
DBusMessage *
server_make_reply(DBusMessage *msg, int type, ...)
{
DBusMessage *rsp = 0;
va_list va;
va_start(va, type);
if( (rsp = dbus_message_new_method_return(msg)) != 0 )
{
if( !dbus_message_append_args_valist(rsp, type, va) )
{
dbus_message_unref(rsp), rsp = 0;
}
}
va_end(va);
return rsp;
}
开发者ID:android-808,项目名称:profiled,代码行数:22,代码来源:server.c
示例5: profile_handler
static DBusHandlerResult profile_handler(DBusConnection *c, DBusMessage *m, void *userdata) {
pa_bluetooth_backend *b = userdata;
DBusMessage *r = NULL;
const char *path, *interface, *member;
pa_assert(b);
path = dbus_message_get_path(m);
interface = dbus_message_get_interface(m);
member = dbus_message_get_member(m);
pa_log_debug("dbus: path=%s, interface=%s, member=%s", path, interface, member);
if (!pa_streq(path, HSP_AG_PROFILE) && !pa_streq(path, HSP_HS_PROFILE))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
const char *xml = PROFILE_INTROSPECT_XML;
pa_assert_se(r = dbus_message_new_method_return(m));
pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
} else if (dbus_message_is_method_call(m, BLUEZ_PROFILE_INTERFACE, "Release")) {
pa_log_debug("Release not handled");
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_method_call(m, BLUEZ_PROFILE_INTERFACE, "RequestDisconnection")) {
r = profile_request_disconnection(c, m, userdata);
} else if (dbus_message_is_method_call(m, BLUEZ_PROFILE_INTERFACE, "NewConnection"))
r = profile_new_connection(c, m, userdata);
else
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (r) {
pa_assert_se(dbus_connection_send(pa_dbus_connection_get(b->connection), r, NULL));
dbus_message_unref(r);
}
return DBUS_HANDLER_RESULT_HANDLED;
}
开发者ID:plbossart,项目名称:pulseaudio,代码行数:39,代码来源:backend-native.c
示例6: pull_phonebook_callback
static void pull_phonebook_callback(struct obc_session *session,
GError *err, void *user_data)
{
struct obc_transfer *transfer = obc_session_get_transfer(session);
struct pbap_data *pbap = user_data;
DBusMessage *reply;
const char *buf;
int size;
if (pbap->msg == NULL)
goto done;
if (err) {
reply = g_dbus_create_error(pbap->msg,
"org.openobex.Error.Failed",
"%s", err->message);
goto send;
}
reply = dbus_message_new_method_return(pbap->msg);
buf = obc_transfer_get_buffer(transfer, &size);
if (size == 0)
buf = "";
dbus_message_append_args(reply,
DBUS_TYPE_STRING, &buf,
DBUS_TYPE_INVALID);
obc_transfer_clear_buffer(transfer);
send:
g_dbus_send_message(conn, reply);
dbus_message_unref(pbap->msg);
pbap->msg = NULL;
done:
obc_transfer_unregister(transfer);
}
开发者ID:Sork007,项目名称:obexd,代码行数:39,代码来源:pbap.c
示例7: g_dbus_create_error
static DBusMessage *assign_agent(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
struct session_data *session = user_data;
const gchar *sender, *path;
if (dbus_message_get_args(message, NULL,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID) == FALSE)
return g_dbus_create_error(message,
"org.openobex.Error.InvalidArguments",
"Invalid arguments in method call");
sender = dbus_message_get_sender(message);
if (session_set_agent(session, sender, path) < 0)
return g_dbus_create_error(message,
"org.openobex.Error.AlreadyExists",
"Already exists");
return dbus_message_new_method_return(message);
}
开发者ID:Commers,项目名称:obexd,代码行数:22,代码来源:session.c
示例8: dbus_message_new_method_return
static DBusMessage *get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
DBusMessageIter iter;
DBusMessageIter dict;
DBusMessage *reply = NULL;
const char *linkloss_level, *immalert_level;
struct btd_device *device = data;
reply = dbus_message_new_method_return(msg);
if (!reply)
return NULL;
linkloss_level = link_loss_get_alert_level(device);
immalert_level = imm_alert_get_level(device);
dbus_message_iter_init_append(reply, &iter);
if (!dbus_message_iter_open_container(&iter, 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))
goto err;
dict_append_entry(&dict, "LinkLossAlertLevel", DBUS_TYPE_STRING,
&linkloss_level);
dict_append_entry(&dict, "ImmediateAlertLevel", DBUS_TYPE_STRING,
&immalert_level);
if (!dbus_message_iter_close_container(&iter, &dict))
goto err;
return reply;
err:
if (reply)
dbus_message_unref(reply);
return btd_error_failed(msg, "not enough memory");
}
开发者ID:BalintBanyasz,项目名称:bluez-rda,代码行数:39,代码来源:reporter.c
示例9: impl_GetSize
static DBusMessage *
impl_GetSize (DBusConnection * bus, DBusMessage * message, void *user_data)
{
AtkComponent *component = (AtkComponent *) user_data;
gint iwidth = 0, iheight = 0;
dbus_int32_t width, height;
DBusMessage *reply;
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
droute_not_yet_handled_error (message));
atk_component_get_size (component, &iwidth, &iheight);
width = iwidth;
height = iheight;
reply = dbus_message_new_method_return (message);
if (reply)
{
dbus_message_append_args (reply, DBUS_TYPE_INT32, &width,
DBUS_TYPE_INT32, &height, DBUS_TYPE_INVALID);
}
return reply;
}
开发者ID:tbsaunde,项目名称:at-spi2-atk,代码行数:22,代码来源:component-adaptor.c
示例10: invalid_args
static DBusMessage *ongoing_call(DBusConnection *conn, DBusMessage *msg,
void *data)
{
dbus_bool_t ongoing;
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_BOOLEAN, &ongoing,
DBUS_TYPE_INVALID))
return invalid_args(msg);
if (ongoing_call_status && !ongoing) {
/* An ongoing call has finished. Continue connection.*/
sap_status_ind(sap_data, SAP_STATUS_CHANGE_CARD_RESET);
ongoing_call_status = FALSE;
} else if (!ongoing_call_status && ongoing) {
/* An ongoing call has started.*/
ongoing_call_status = TRUE;
}
DBG("OngoingCall status set to %d", ongoing_call_status);
return dbus_message_new_method_return(msg);
}
开发者ID:BalintBanyasz,项目名称:bluez-rda,代码行数:22,代码来源:sap-dummy.c
示例11: my_test_peek_reply
int
my_test_peek_reply (NihDBusMessage *message,
const char * value)
{
DBusMessage * reply;
DBusMessageIter iter;
nih_assert (message != NULL);
nih_assert (value != NULL);
/* If the sender doesn't care about a reply, don't bother wasting
* effort constructing and sending one.
*/
if (dbus_message_get_no_reply (message->message))
return 0;
/* Construct the reply message. */
reply = dbus_message_new_method_return (message->message);
if (! reply)
return -1;
dbus_message_iter_init_append (reply, &iter);
/* Marshal a char * onto the message */
if (! dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &value)) {
dbus_message_unref (reply);
return -1;
}
/* Send the reply, appending it to the outgoing queue. */
if (! dbus_connection_send (message->connection, reply, NULL)) {
dbus_message_unref (reply);
return -1;
}
dbus_message_unref (reply);
return 0;
}
开发者ID:Gladiel,项目名称:libnih,代码行数:39,代码来源:test_node_object_functions_standard.c
示例12: dbus_message_get_sender
static DBusMessage *stk_unregister_agent(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct ofono_stk *stk = data;
const char *agent_path;
const char *agent_bus = dbus_message_get_sender(msg);
if (dbus_message_get_args(msg, NULL,
DBUS_TYPE_OBJECT_PATH, &agent_path,
DBUS_TYPE_INVALID) == FALSE)
return __ofono_error_invalid_args(msg);
if (!stk->default_agent)
return __ofono_error_failed(msg);
if (!stk_agent_matches(stk->default_agent, agent_path, agent_bus))
return __ofono_error_failed(msg);
stk_agent_free(stk->default_agent);
return dbus_message_new_method_return(msg);
}
开发者ID:yongsu,项目名称:oFono,代码行数:22,代码来源:stk.c
示例13: mv_set_callback
static void mv_set_callback(const struct ofono_error *error, void *data)
{
struct ofono_call_volume *cv = data;
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(cv->atom);
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
__ofono_dbus_pending_reply(&cv->pending,
__ofono_error_failed(cv->pending));
return;
}
cv->microphone_volume = cv->pending_volume;
__ofono_dbus_pending_reply(&cv->pending,
dbus_message_new_method_return(cv->pending));
ofono_dbus_signal_property_changed(conn, path,
OFONO_CALL_VOLUME_INTERFACE,
"MicrophoneVolume",
DBUS_TYPE_BYTE, &cv->microphone_volume);
}
开发者ID:Conjuror,项目名称:ofono,代码行数:22,代码来源:call-volume.c
示例14: FcitxDBusMenuEventHandler
DBusHandlerResult FcitxDBusMenuEventHandler(DBusConnection* connection, DBusMessage* message, void* user_data)
{
FcitxNotificationItem* notificationitem = user_data;
DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
DBusMessage *reply = NULL;
boolean flush = false;
if (dbus_message_is_method_call(message, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
reply = dbus_message_new_method_return(message);
dbus_message_append_args(reply, DBUS_TYPE_STRING, &dbus_menu_interface, DBUS_TYPE_INVALID);
} else if (dbus_message_is_method_call(message, DBUS_MENU_IFACE, "Event")) {
/* this is no reply */
FcitxDBusMenuEvent(notificationitem, message);
return DBUS_HANDLER_RESULT_HANDLED;
} else if (dbus_message_is_method_call(message, DBUS_MENU_IFACE, "GetProperty")) {
reply = FcitxDBusMenuGetProperty(notificationitem, message);
} else if (dbus_message_is_method_call(message, DBUS_MENU_IFACE, "GetLayout")) {
reply = FcitxDBusMenuGetLayout(notificationitem, message);
} else if (dbus_message_is_method_call(message, DBUS_MENU_IFACE, "GetGroupProperties")) {
reply = FcitxDBusMenuGetGroupProperties(notificationitem, message);
} else if (dbus_message_is_method_call(message, DBUS_MENU_IFACE, "AboutToShow")) {
reply = FcitxDBusMenuAboutToShow(notificationitem, message);
} else if (dbus_message_is_method_call(message, DBUS_INTERFACE_PROPERTIES, "Get")) {
reply = FcitxDBusPropertyGet(notificationitem, dbusMenuPropertyTable, message);
} else if (dbus_message_is_method_call(message, DBUS_INTERFACE_PROPERTIES, "Set")) {
reply = FcitxDBusPropertySet(notificationitem, dbusMenuPropertyTable, message);
} else if (dbus_message_is_method_call(message, DBUS_INTERFACE_PROPERTIES, "GetAll")) {
reply = FcitxDBusPropertyGetAll(notificationitem, dbusMenuPropertyTable, message);
}
if (reply) {
dbus_connection_send(connection, reply, NULL);
dbus_message_unref(reply);
if (flush) {
dbus_connection_flush(connection);
}
result = DBUS_HANDLER_RESULT_HANDLED;
}
return result;
}
开发者ID:fantasticfears,项目名称:fcitx,代码行数:39,代码来源:dbusmenu.c
示例15: manager_find_adapter_by_id
static DBusMessage *default_adapter(DBusConnection *conn,
DBusMessage *msg, void *data)
{
DBusMessage *reply;
struct btd_adapter *adapter;
const gchar *path;
adapter = manager_find_adapter_by_id(default_adapter_id);
if (!adapter)
return btd_error_no_such_adapter(msg);
reply = dbus_message_new_method_return(msg);
if (!reply)
return NULL;
path = adapter_get_path(adapter);
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID);
return reply;
}
开发者ID:seinlin,项目名称:nv7fire-external-bluetooth-bluez,代码行数:22,代码来源:manager.c
示例16: __ofono_error_busy
static DBusMessage *push_notification_register_agent(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct push_notification *pn = data;
const char *agent_path;
if (pn->agent)
return __ofono_error_busy(msg);
if (dbus_message_get_args(msg, NULL,
DBUS_TYPE_OBJECT_PATH, &agent_path,
DBUS_TYPE_INVALID) == FALSE)
return __ofono_error_invalid_args(msg);
if (!__ofono_dbus_valid_object_path(agent_path))
return __ofono_error_invalid_format(msg);
pn->agent = sms_agent_new(AGENT_INTERFACE,
dbus_message_get_sender(msg),
agent_path);
if (pn->agent == NULL)
return __ofono_error_failed(msg);
sms_agent_set_removed_notify(pn->agent, agent_exited, pn);
pn->push_watch[0] = __ofono_sms_datagram_watch_add(pn->sms,
push_received,
WAP_PUSH_DST_PORT,
WAP_PUSH_SRC_PORT,
pn, NULL);
pn->push_watch[1] = __ofono_sms_datagram_watch_add(pn->sms,
push_received,
WAP_PUSH_DST_PORT,
0, pn, NULL);
return dbus_message_new_method_return(msg);
}
开发者ID:AndriusA,项目名称:ofono,代码行数:39,代码来源:push-notification.c
示例17: write_req_cb
static void write_req_cb(guint8 status, const guint8 *pdu,
guint16 len, gpointer user_data)
{
DBusMessage *reply;
struct write_val_op *write_op = user_data;
struct characteristic *chr = write_op->chr;
struct write_resp_op *resp_op;
const char *error_str = att_ecode2str(status);
INFO("write_req_cb chr:%s status:%s(%d)", chr->path, error_str,status);
reply = dbus_message_new_method_return(write_op->msg);
g_dbus_send_message(write_op->conn, reply);
g_free(write_op);
resp_op = g_new0(struct write_resp_op,1);
resp_op->chr = chr;
resp_op->status = status;
g_slist_foreach(chr->gatt->watchers, update_watchers_write_complete, resp_op);
g_free(resp_op);
}
开发者ID:richardxu,项目名称:panda-a4,代码行数:22,代码来源:client.c
示例18: dbus_message_new_method_return
static DBusMessage *sink_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct audio_device *device = data;
struct sink *sink = device->sink;
DBusMessage *reply;
DBusMessageIter iter;
DBusMessageIter dict;
const char *state;
gboolean value;
reply = dbus_message_new_method_return(msg);
if (!reply)
return NULL;
dbus_message_iter_init_append(reply, &iter);
dbus_message_iter_open_container(&iter, 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);
/* Playing */
value = (sink->stream_state == AVDTP_STATE_STREAMING);
dict_append_entry(&dict, "Playing", DBUS_TYPE_BOOLEAN, &value);
/* Connected */
value = (sink->stream_state >= AVDTP_STATE_CONFIGURED);
dict_append_entry(&dict, "Connected", DBUS_TYPE_BOOLEAN, &value);
/* State */
state = state2str(sink->state);
if (state)
dict_append_entry(&dict, "State", DBUS_TYPE_STRING, &state);
dbus_message_iter_close_container(&iter, &dict);
return reply;
}
开发者ID:0xD34D,项目名称:external_bluetooth_bluez,代码行数:39,代码来源:sink.c
示例19: radio_fast_dormancy_set_callback
static void radio_fast_dormancy_set_callback(const struct ofono_error *error,
void *data)
{
struct ofono_radio_settings *rs = data;
DBusMessage *reply;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
DBG("Error setting fast dormancy");
rs->fast_dormancy_pending = rs->fast_dormancy;
reply = __ofono_error_failed(rs->pending);
__ofono_dbus_pending_reply(&rs->pending, reply);
return;
}
reply = dbus_message_new_method_return(rs->pending);
__ofono_dbus_pending_reply(&rs->pending, reply);
radio_set_fast_dormancy(rs, rs->fast_dormancy_pending);
}
开发者ID:jkangas,项目名称:ofono-1,代码行数:22,代码来源:radio-settings.c
示例20: message_received
/* Callback: "a message is received to a registered object path" */
static DBusHandlerResult message_received(DBusConnection* conn, DBusMessage* msg, void* data)
{
const char* member = dbus_message_get_member(msg);
VERB1 log("%s(method:'%s')", __func__, member);
set_client_name(dbus_message_get_sender(msg));
DBusMessage* reply = dbus_message_new_method_return(msg);
int r = -1;
if (strcmp(member, "DeleteDebugDump") == 0)
r = handle_DeleteDebugDump(msg, reply);
// NB: C++ binding also handles "Introspect" method, which returns a string.
// It was sending "dummy" introspection answer whick looks like this:
// "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
// "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
// "<node>\n"
// "</node>\n"
// Apart from a warning from abrt-gui, just sending error back works as well.
// NB2: we may want to handle "Disconnected" here too.
if (r < 0)
{
/* handle_XXX experienced an error (and did not send any reply) */
dbus_message_unref(reply);
if (dbus_message_get_type(msg) == DBUS_MESSAGE_TYPE_METHOD_CALL)
{
/* Create and send error reply */
reply = dbus_message_new_error(msg, DBUS_ERROR_FAILED, "not supported");
if (!reply)
die_out_of_memory();
send_flush_and_unref(reply);
}
}
set_client_name(NULL);
return DBUS_HANDLER_RESULT_HANDLED;
}
开发者ID:rplnt,项目名称:abrt,代码行数:40,代码来源:CommLayerServerDBus.c
注:本文中的dbus_message_new_method_return函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论