*
* @remarks The media controller client get the @a server_name and @a request_id through the mc_client_custom_event_received_cb(). \n
* If @a request_id is not null there, the media controller client should send the reply to the media controller server with the @a request_id. \n
- * If @a request_id is null, this function will return #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER.
+ * If @a request_id is null, this function will return #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER.\n
+ * If the @a server_name application doesn't support receiving the event reply, this function will return #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP since 5.5.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_OPERATION Invalid operation
* @retval #MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP Limited by server application
*
* @pre Create a media controller server handle by calling mc_server_create().
* @see mc_client_create()
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks The @a request_id should be released using free().\n
- * If the @a request_id is null, the server will not send the reply of the command.
+ * If the @a request_id is null, the server will not send the reply of the command.\n
+ * If the @a server_name application doesn't support the playback action command, this function will return #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP since 5.5.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_OPERATION Invalid operation
* @retval #MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP Limited by server application
*
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks The @a request_id should be released using free().\n
- * If the @a request_id is null, the server will not send the reply of the command.
+ * If the @a request_id is null, the server will not send the reply of the command.\n
+ * If the @a server_name application doesn't support the playback position command, this function will return #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP since 5.5.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_OPERATION Invalid operation
* @retval #MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP Limited by server application
*
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks The @a request_id should be released using free().\n
- * If the @a request_id is null, the server will not send the reply of the command.
+ * If the @a request_id is null, the server will not send the reply of the command.\n
+ * If the @a server_name application doesn't support the shuffle mode, this function will return #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP since 5.5.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_OPERATION Invalid operation
* @retval #MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP Limited by server application
*
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks The @a request_id should be released using free().\n
- * If the @a request_id is null, the server will not send the reply of the command.
+ * If the @a request_id is null, the server will not send the reply of the command.\n
+ * If the @a server_name application doesn't support the repeat mode, this function will return #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP since 5.5.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_OPERATION Invalid operation
* @retval #MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP Limited by server application
*
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks The @a request_id should be released using free().\n
- * If the @a request_id is null, the server will not send the reply of the command.
+ * If the @a request_id is null, the server will not send the reply of the command.\n
+ * If the @a server_name application doesn't support the playlist command, this function will return #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP since 5.5.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_OPERATION Invalid operation
* @retval #MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP Limited by server application
*
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks The @a request_id should be released using free().\n
- * If the @a request_id is null, the server will not send the reply of the command.
+ * If the @a request_id is null, the server will not send the reply of the command.\n
+ * If the @a server_name application doesn't support the custom command, this function will return #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP since 5.5.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_OPERATION Invalid operation
* @retval #MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP Limited by server application
*
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
* @remarks The @a request_id should be released using free().\n
- * If the @a request_id is null, the server will not send the reply of the command.
+ * If the @a request_id is null, the server will not send the reply of the command.\n
+ * If the @a server_name application doesn't support the search command, this function will return #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP since 5.5.
*
* @param[in] client The handle of the media controller client
* @param[in] server_name The app_id of the media controller server
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTROLLER_ERROR_INVALID_OPERATION Invalid operation
* @retval #MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP Limited by server application
*
* @pre Create a media controller client handle by calling mc_client_create().
* @pre Create search handle and set data by calling mc_search_create() and mc_search_set_condition().
return ret;
}
+static int __mc_client_verify_ability(mc_client_h client, const char *server_name, int ability)
+{
+ int ret = MEDIA_CONTROLLER_ERROR_NONE;
+ media_controller_client_s *mc_client = (media_controller_client_s *)client;
+ mc_ability_support_e supported = MC_ABILITY_SUPPORTED_UNDECIDED;
+
+ mc_retvm_if(!mc_client, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid handle");
+ mc_retvm_if(!mc_db_is_server_table_exist(mc_client->db_handle, server_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid server_name");
+
+ ret = mc_db_get_ability_supported(mc_client->db_handle, server_name, ability, &supported);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to get ability");
+ mc_retvm_if(supported == MC_ABILITY_SUPPORTED_NO, MEDIA_CONTROLLER_ERROR_ABILITY_LIMITED_BY_SERVER_APP, "Not Supported ability");
+
+ return MEDIA_CONTROLLER_ERROR_NONE;
+}
+
int mc_client_send_playback_action_cmd(mc_client_h client, const char *server_name, mc_playback_action_e action, char **request_id)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
char *message = NULL;
media_controller_client_s *mc_client = (media_controller_client_s *)client;
- mc_retvm_if(mc_client == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
- mc_retvm_if(!MC_STRING_VALID(server_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid server_name");
+ mc_retvm_if(!mc_client, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid handle");
mc_retvm_if(!_mc_util_is_valid_playback_action(action), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid action");
+ ret = __mc_client_verify_ability(client, server_name, PLAYBACK_ACTION_ABILITY + action);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to verify ability");
+
message = g_strdup_printf("%s%s%d", mc_client->client_name, MC_STRING_DELIMITER, action);
mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret);
char *message = NULL;
media_controller_client_s *mc_client = (media_controller_client_s *)client;
- mc_retvm_if(mc_client == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
- mc_retvm_if(!MC_STRING_VALID(server_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid server_name");
- mc_retvm_if(((shuffle_mode < MC_SHUFFLE_MODE_ON) || (shuffle_mode > MC_SHUFFLE_MODE_OFF)), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "shuffle is invalid");
+ mc_retvm_if(!mc_client, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid handle");
+ mc_retvm_if(((shuffle_mode < MC_SHUFFLE_MODE_ON) || (shuffle_mode > MC_SHUFFLE_MODE_OFF)), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid shuffle mode [%d]", shuffle_mode);
+
+ ret = __mc_client_verify_ability(client, server_name, MC_SERVER_EVENT_SHUFFLE);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to verify ability");
message = g_strdup_printf("%s%s%d", mc_client->client_name, MC_STRING_DELIMITER, shuffle_mode);
mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret);
media_controller_client_s *mc_client = (media_controller_client_s *)client;
mc_retvm_if(mc_client == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
- mc_retvm_if(!MC_STRING_VALID(server_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid server_name");
- mc_retvm_if(((repeat_mode < MC_REPEAT_MODE_ON) || (repeat_mode > MC_REPEAT_MODE_ONE_MEDIA)), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "repeat is invalid [%d]", repeat_mode);
+ mc_retvm_if(((repeat_mode < MC_REPEAT_MODE_ON) || (repeat_mode > MC_REPEAT_MODE_ONE_MEDIA)), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid repeat mode [%d]", repeat_mode);
+
+ ret = __mc_client_verify_ability(client, server_name, MC_SERVER_EVENT_REPEAT);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail to verify ability");
message = g_strdup_printf("%s%s%d", mc_client->client_name, MC_STRING_DELIMITER, repeat_mode);
mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret);