- Requirements:
Server wants to send required IPC message when service state is changed.
- Solution:
Through previous commit, callback registration information was added.
Using this new information, server can decide whether the client require
to receive service state changed event. This patch adds checker for
deciding whether client regists callback.
Change-Id: I3ea1cc9e61626f393dc49a9bceff6c4b05a4a77c
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
return app_data->paused_data_existing;
}
+bool ttsd_data_is_service_state_changed_cb_set(unsigned int uid)
+{
+ lock_guard<mutex> lock(g_app_data_mutex);
+ app_data_s* app_data = __get_client_app_data(uid);
+ if (nullptr == app_data) {
+ SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%u)", uid);
+ return false;
+ }
+
+ bool is_service_state_changed_cb_set = ((app_data->registered_event_mask & TTS_EVENT_MASK_SERVICE_STATE_CHANGED) != 0);
+ return is_service_state_changed_cb_set;
+}
+
unsigned int ttsd_data_get_current_playing()
{
lock_guard<mutex> lock(g_app_data_mutex);
bool ttsd_data_is_paused_data_existing(unsigned int uid);
+bool ttsd_data_is_service_state_changed_cb_set(unsigned int uid);
+
unsigned int ttsd_data_get_current_playing();
return false;
}
- ttsdc_ipc_send_set_service_state_message(pid, uid, args->before, args->current);
+ if (ttsd_data_is_service_state_changed_cb_set(uid)) {
+ ttsdc_ipc_send_set_service_state_message(pid, uid, args->before, args->current);
+ }
+
return true;
}