return 0;
}
-int sttd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg)
+static void __sttd_dbus_server_send_method_return(DBusConnection* conn, DBusMessage* msg, int ret)
{
- DBusError err;
- dbus_error_init(&err);
-
- unsigned int uid;
- int ret = STTD_ERROR_OPERATION_FAILED;
- dbus_message_get_args(msg, &err, DBUS_TYPE_UINT32, &uid, DBUS_TYPE_INVALID);
-
- SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Finalize");
-
- if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt finalize : get arguments error (%s)", err.message);
- dbus_error_free(&err);
- ret = STTD_ERROR_OPERATION_FAILED;
- } else {
- SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt finalize : uid(%u)", uid);
- ret = sttd_server_finalize(uid);
- }
-
DBusMessage* reply;
-
reply = dbus_message_new_method_return(msg);
if (NULL != reply) {
- dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+ /* Append result and language */
+ dbus_message_append_args(reply,
+ DBUS_TYPE_INT32, &ret,
+ DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
+ SLOG(LOG_INFO, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
} else {
SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
}
} else {
SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
}
+ return;
+}
+
+int sttd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg)
+{
+ DBusError err;
+ dbus_error_init(&err);
+
+ unsigned int uid;
+ int ret = STTD_ERROR_OPERATION_FAILED;
+ dbus_message_get_args(msg, &err, DBUS_TYPE_UINT32, &uid, DBUS_TYPE_INVALID);
+
+ SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Finalize");
+
+ if (dbus_error_is_set(&err)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt finalize : get arguments error (%s)", err.message);
+ dbus_error_free(&err);
+ ret = STTD_ERROR_OPERATION_FAILED;
+ } else {
+ SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt finalize : uid(%u)", uid);
+ ret = sttd_server_finalize(uid);
+ }
+
+ __sttd_dbus_server_send_method_return(conn, msg, ret);
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, " ");
ret = sttd_server_set_private_data(uid, key, data);
}
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- dbus_message_append_args(reply,
- DBUS_TYPE_INT32, &ret,
- DBUS_TYPE_INVALID);
-
- if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
- }
+ __sttd_dbus_server_send_method_return(conn, msg, ret);
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, " ");
ret = sttd_server_set_start_sound(uid, file);
}
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- /* Append result and language */
- dbus_message_append_args(reply,
- DBUS_TYPE_INT32, &ret,
- DBUS_TYPE_INVALID);
-
- if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
- }
+ __sttd_dbus_server_send_method_return(conn, msg, ret);
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, " ");
ret = sttd_server_set_start_sound(uid, NULL);
}
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- /* Append result and language */
- dbus_message_append_args(reply,
- DBUS_TYPE_INT32, &ret,
- DBUS_TYPE_INVALID);
-
- if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
- }
+ __sttd_dbus_server_send_method_return(conn, msg, ret);
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, " ");
ret = sttd_server_set_stop_sound(uid, file);
}
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- /* Append result and language */
- dbus_message_append_args(reply,
- DBUS_TYPE_INT32, &ret,
- DBUS_TYPE_INVALID);
-
- if (0 == ret) {
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
- }
+ __sttd_dbus_server_send_method_return(conn, msg, ret);
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, " ");
ret = sttd_server_set_stop_sound(uid, NULL);
}
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- /* Append result and language */
- dbus_message_append_args(reply,
- DBUS_TYPE_INT32, &ret,
- DBUS_TYPE_INVALID);
-
- if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
- }
+ __sttd_dbus_server_send_method_return(conn, msg, ret);
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, " ");
}
}
-#if 0
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
-
- if (0 <= ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
- }
-#endif
-
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, " ");
SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to send error signal");
}
}
-#if 0
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
-
- if (0 <= ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
- }
-#endif
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, " ");
SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to send error signal");
}
}
-#if 0
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
- if (NULL != reply) {
- dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
-
- if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
- }
-#endif
SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
SLOG(LOG_DEBUG, TAG_STTD, " ");