modify codes for complying tizen coding rule 80/50580/1 accepted/tizen/mobile/20151031.105540 accepted/tizen/tv/20151031.110305 accepted/tizen/wearable/20151031.110530 submit/tizen/20151030.082415
authorMok Jeongho <jho.mok@samsung.com>
Fri, 30 Oct 2015 07:45:49 +0000 (16:45 +0900)
committerMok Jeongho <jho.mok@samsung.com>
Fri, 30 Oct 2015 07:48:44 +0000 (16:48 +0900)
[Version] Release 0.1.5
[Profile] Common
[Issue Type] Coding Rule

Change-Id: Icb47300d861b39dd73683c93fdb9826ec1a8d215
Signed-off-by: Mok Jeongho <jho.mok@samsung.com>
include/tone_player.h
packaging/capi-media-tone-player.spec
src/tone_player.c

index 362044098ebd43384f1ce046129064576cc6df99..75a4ed9b5669cd3e9cea2bc7f855b38398b0488a 100755 (executable)
@@ -44,23 +44,21 @@ extern "C"
  * @brief Enumeration of error codes for wav player.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
-typedef enum
-{
-    TONE_PLAYER_ERROR_NONE               = TIZEN_ERROR_NONE,                    /**< Successful */
-    TONE_PLAYER_ERROR_INVALID_PARAMETER  = TIZEN_ERROR_INVALID_PARAMETER,       /**< Invalid parameter */
-    TONE_PLAYER_ERROR_INVALID_OPERATION  = TIZEN_ERROR_INVALID_OPERATION,       /**< Invalid operation */
-    TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE = TIZEN_ERROR_TONE_PLAYER | 0x01       /**< Not supported (Since 3.0) */
+typedef enum {
+       TONE_PLAYER_ERROR_NONE               = TIZEN_ERROR_NONE,                    /**< Successful */
+       TONE_PLAYER_ERROR_INVALID_PARAMETER  = TIZEN_ERROR_INVALID_PARAMETER,       /**< Invalid parameter */
+       TONE_PLAYER_ERROR_INVALID_OPERATION  = TIZEN_ERROR_INVALID_OPERATION,       /**< Invalid operation */
+       TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE = TIZEN_ERROR_TONE_PLAYER | 0x01       /**< Not supported (Since 3.0) */
 } tone_player_error_e;
 
 /**
  * @brief Enumeration of tone.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
-typedef enum
-{
+typedef enum {
        TONE_TYPE_DEFAULT = 0,                  /**< The default tone */
        TONE_TYPE_DTMF_0 = 0,                           /**< Predefined DTMF 0 */
-       TONE_TYPE_DTMF_1,                               /**< Predefined DTMF 1 */
+       TONE_TYPE_DTMF_1,                               /**< Predefined DTMF 1 */
        TONE_TYPE_DTMF_2,                               /**< Predefined DTMF 2 */
        TONE_TYPE_DTMF_3,                               /**< Predefined DTMF 3 */
        TONE_TYPE_DTMF_4,                               /**< Predefined DTMF 4 */
@@ -190,7 +188,7 @@ typedef enum
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
  * @remarks Sound can be mixed with other sounds if you don't control the sound session in sound-manager module since 3.0.\n
- *     You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE.
+ *     You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE.
  *
  * @param[in] tone     The tone type to play
  * @param[in] type     The sound type
index bc16cb4437d0004d8dac92cf2f7cbf9c3b488e5e..4428176509838372fc69382c268baf5ab6d0f836 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-tone-player
 Summary:    A tone player library in Tizen C API
-Version:    0.1.4
+Version:    0.1.5
 Release:    18
 Group:      Multimedia/API
 License:    Apache-2.0
index 99d3bd65a1ed68dd38c5b215cefca1705a44570f..5caee5427456b884d97f4767a11f91cf4894da67 100755 (executable)
 #include <dlog.h>
 
 
-static int __convert_tone_player_error_code(const char *func, int code){
+static int __convert_tone_player_error_code(const char *func, int code)
+{
        int ret = TONE_PLAYER_ERROR_NONE;
        char *errorstr = NULL;
-       switch(code)
-       {
-               case MM_ERROR_NONE:
-                       ret = TONE_PLAYER_ERROR_NONE;
-                       errorstr = "ERROR_NONE";
-                       break;
-               case TONE_PLAYER_ERROR_INVALID_PARAMETER:
-               case MM_ERROR_INVALID_ARGUMENT:
-               case MM_ERROR_SOUND_INVALID_POINTER:
-                       ret = TONE_PLAYER_ERROR_INVALID_PARAMETER;
-                       errorstr = "INVALID_PARAMETER";
-                       break;
-               case MM_ERROR_SOUND_INTERNAL:
-                       ret = TONE_PLAYER_ERROR_INVALID_OPERATION;
-                       errorstr = "INVALID_OPERATION";
-                       break;
+       switch (code) {
+       case MM_ERROR_NONE:
+               ret = TONE_PLAYER_ERROR_NONE;
+               errorstr = "ERROR_NONE";
+               break;
+       case TONE_PLAYER_ERROR_INVALID_PARAMETER:
+       case MM_ERROR_INVALID_ARGUMENT:
+       case MM_ERROR_SOUND_INVALID_POINTER:
+               ret = TONE_PLAYER_ERROR_INVALID_PARAMETER;
+               errorstr = "INVALID_PARAMETER";
+               break;
+       case MM_ERROR_SOUND_INTERNAL:
+               ret = TONE_PLAYER_ERROR_INVALID_OPERATION;
+               errorstr = "INVALID_OPERATION";
+               break;
        }
-       LOGE( "[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code);
+       LOGE("[%s] %s(0x%08x) : core frameworks error code(0x%08x)", func, errorstr, ret, code);
        return ret;
 }
 
-int tone_player_start(tone_type_e tone, sound_type_e type, int duration, int *id){
-        int ret;
-        int player;
-        if( tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE )
-                return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER);
+int tone_player_start(tone_type_e tone, sound_type_e type, int duration, int *id)
+{
+       int ret;
+       int player;
+       if (tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE)
+       return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER);
 
-        ret = mm_sound_play_tone(tone, type , 1, duration, &player);
+       ret = mm_sound_play_tone(tone, type , 1, duration, &player);
 
-        if( ret == 0 && id != NULL)
-                *id = player;
-        return __convert_tone_player_error_code(__func__, ret);
+       if (ret == 0 && id != NULL)
+       *id = player;
+       return __convert_tone_player_error_code(__func__, ret);
 }
 
-int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h stream_info, int duration, int * id){
+int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h stream_info, int duration, int * id)
+{
        int ret;
        int player;
        double vol = 1.0;
@@ -76,23 +78,23 @@ int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h str
        int stream_id;
        bool result = false;
 
-       iftone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE || stream_info == NULL)
+       if (tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE || stream_info == NULL)
                return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER);
 
        ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_TONE_PLAYER, &result);
-       if ( !result )
+       if (!result)
                return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE);
 
        ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type);
-       if( ret )
+       if (ret)
                return __convert_tone_player_error_code(__func__, ret);
        ret = sound_manager_get_index_from_stream_information(stream_info, &stream_id);
-       if( ret )
+       if (ret)
                return __convert_tone_player_error_code(__func__, ret);
 
        ret = mm_sound_play_tone_with_stream_info(tone, stream_type, stream_id, vol, duration, &player);
 
-       ifret == 0 && id != NULL)
+       if (ret == 0 && id != NULL)
                *id = player;
 
        return __convert_tone_player_error_code(__func__, ret);
@@ -100,7 +102,8 @@ int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h str
 
 }
 
-int tone_player_stop(int id){
+int tone_player_stop(int id)
+{
        return __convert_tone_player_error_code(__func__, mm_sound_stop_sound(id));
 }