static void __server_custom_cmd_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data);
static void __server_event_reply_received_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data);
static void __server_search_cmd_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data);
+static int __mc_server_update_ability(mc_server_h server, int support_item, mc_ability_support_e support, gboolean immediate_update);
static mc_cb_event_s cb_event[MC_SERVER_EVENT_MAX] = {
return ret;
}
+static int __mc_server_set_ability(mc_server_h server, mc_server_receive_event_e event, mc_ability_support_e support)
+{
+ int ret = MEDIA_CONTROLLER_ERROR_NONE;
+ media_controller_server_s *mc_server = (media_controller_server_s *)server;
+ char *ability_signal = NULL;
+
+ switch (event) {
+ case MC_SERVER_EVENT_SHUFFLE:
+ ability_signal = (char *)MC_DBUS_SIGNAL_NAME_SHUFFLE_ABILITY;
+ break;
+
+ case MC_SERVER_EVENT_REPEAT:
+ ability_signal = (char *)MC_DBUS_SIGNAL_NAME_REPEAT_ABILITY;
+ break;
+
+ default:
+ mc_error("Not supported event [%d]", event);
+ return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION;
+ }
+
+ ret = __mc_server_update_ability(server, event, support, TRUE);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to __mc_server_update_ability");
+
+ ret = __mc_server_send_message(mc_server, MC_DBUS_UPDATE_INTERFACE, ability_signal, support, 0, NULL);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to __mc_server_send_message");
+
+ return ret;
+}
+
static int __mc_server_set_updated_cb(mc_server_h server, mc_server_receive_event_e event, void *callback, void *user_data)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
int mc_server_set_shuffle_ability(mc_server_h server, mc_ability_support_e support)
{
- int ret = MEDIA_CONTROLLER_ERROR_NONE;
- media_controller_server_s *mc_server = (media_controller_server_s *)server;
-
- ret = __mc_server_update_ability(server, MC_SERVER_EVENT_SHUFFLE, support, TRUE);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to __mc_server_update_ability");
-
- ret = __mc_server_send_message(mc_server, MC_DBUS_UPDATE_INTERFACE, MC_DBUS_SIGNAL_NAME_SHUFFLE_ABILITY, support, 0, NULL);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to __mc_server_send_message");
-
- return ret;
+ return __mc_server_set_ability(server, MC_SERVER_EVENT_SHUFFLE, support);
}
int mc_server_set_repeat_ability(mc_server_h server, mc_ability_support_e support)
{
- int ret = MEDIA_CONTROLLER_ERROR_NONE;
- media_controller_server_s *mc_server = (media_controller_server_s *)server;
-
- ret = __mc_server_update_ability(server, MC_SERVER_EVENT_REPEAT, support, TRUE);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to __mc_server_update_ability");
-
- ret = __mc_server_send_message(mc_server, MC_DBUS_UPDATE_INTERFACE, MC_DBUS_SIGNAL_NAME_REPEAT_ABILITY, support, 0, NULL);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to __mc_server_send_message");
-
- return ret;
+ return __mc_server_set_ability(server, MC_SERVER_EVENT_REPEAT, support);
}
int mc_server_create(mc_server_h *server)