+ if (dbus_message_is_method_call(msg, if_name, STTD_METHOD_HELLO)) {
+ SLOG(LOG_DEBUG, TAG_STTC, "===== Get Hello");
+ int uid = 0;
+ int response = -1;
+
+ dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
+
+ if (uid > 0) {
+ SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt get hello : uid(%d) \n", uid);
+
+ /* check uid */
+ stt_client_s* client = stt_client_get_by_uid(uid);
+ if( NULL != client )
+ response = 1;
+ else
+ response = 0;
+ } else {
+ SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get hello : invalid uid \n");
+ }
+
+ reply = dbus_message_new_method_return(msg);
+
+ if (NULL != reply) {
+ dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
+
+ if (!dbus_connection_send(conn, reply, NULL))
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to send reply");
+ else
+ SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get hello : result(%d)", response);
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(reply);
+ } else {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to create reply message");
+ }
+
+ SLOG(LOG_DEBUG, TAG_STTC, "=====");
+ SLOG(LOG_DEBUG, TAG_STTC, " ");
+ } /* STTD_METHOD_HELLO */
+
+ else if (dbus_message_is_method_call(msg, if_name, STTD_METHOD_SET_STATE)) {
+ SLOG(LOG_DEBUG, TAG_STTC, "===== Set State");
+ int uid = 0;
+ int response = -1;
+ int state = -1;
+
+ dbus_message_get_args(msg, &err,
+ DBUS_TYPE_INT32, &uid,
+ DBUS_TYPE_INT32, &state,
+ DBUS_TYPE_INVALID);
+
+ if (uid > 0 && state >= 0) {
+ SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt set state : uid(%d), state(%d)", uid, state);
+
+ response = __stt_cb_set_state(uid, state);
+ } else {
+ SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set state : invalid uid or state");
+ }
+
+ reply = dbus_message_new_method_return(msg);
+
+ if (NULL != reply) {
+ dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
+
+ if (!dbus_connection_send(conn, reply, NULL))
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set state : fail to send reply");
+ else
+ SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set state : result(%d)", response);
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(reply);
+ } else {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set state : fail to create reply message");
+ }
+
+ SLOG(LOG_DEBUG, TAG_STTC, "=====");
+ SLOG(LOG_DEBUG, TAG_STTC, " ");
+ } /* STTD_METHOD_SET_STATE */
+
+ else if (dbus_message_is_method_call(msg, if_name, STTD_METHOD_GET_STATE)) {
+ SLOG(LOG_DEBUG, TAG_STTC, "===== Get state");
+ int uid = 0;
+ int response = -1;
+
+ dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
+
+ if (uid > 0) {
+ SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt get state : uid(%d) \n", uid);
+
+ /* check state */
+ stt_client_s* client = stt_client_get_by_uid(uid);
+ if( NULL != client )
+ response = client->current_state;
+ else
+ SLOG(LOG_ERROR, TAG_STTC, "invalid uid \n");
+
+ } else {
+ SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get state : invalid uid \n");
+ }
+
+ reply = dbus_message_new_method_return(msg);
+
+ if (NULL != reply) {
+ dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
+
+ if (!dbus_connection_send(conn, reply, NULL))
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get state : fail to send reply");
+ else
+ SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get state : result(%d)", response);
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(reply);
+ } else {
+ SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get hello : fail to create reply message");
+ }
+
+ SLOG(LOG_DEBUG, TAG_STTC, "=====");
+ SLOG(LOG_DEBUG, TAG_STTC, " ");
+ } /* STTD_METHOD_GET_STATE */
+
+ else if (dbus_message_is_method_call(msg, if_name, STTD_METHOD_RESULT)) {