diff options
author | Gilbok Lee <gilbok.lee@samsung.com> | 2016-11-17 13:37:17 +0900 |
---|---|---|
committer | Gilbok Lee <gilbok.lee@samsung.com> | 2016-11-17 13:44:50 +0900 |
commit | 5b4287de9b021d91f6f06ad42ce979a58822a989 (patch) | |
tree | 3bf77b5670942495bd7e9e9e04e460f6393c443b /src/include | |
parent | d9dae815bc892a0d166cc80b871a057694f15de4 (diff) | |
download | libmm-radio-5b4287de9b021d91f6f06ad42ce979a58822a989.tar.gz libmm-radio-5b4287de9b021d91f6f06ad42ce979a58822a989.tar.bz2 libmm-radio-5b4287de9b021d91f6f06ad42ce979a58822a989.zip |
Apply tizen coding rule
[Version] 0.2.13
[Profile] Common
[Issue Type] coding rule
Change-Id: Ie55b949b2eefd173cdbeda259857d5c84c3592a6
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/mm_radio.h | 38 | ||||
-rw-r--r-- | src/include/mm_radio_priv.h | 10 | ||||
-rw-r--r-- | src/include/mm_radio_utils.h | 136 |
3 files changed, 97 insertions, 87 deletions
diff --git a/src/include/mm_radio.h b/src/include/mm_radio.h index 00052f6..e9d617e 100644 --- a/src/include/mm_radio.h +++ b/src/include/mm_radio.h @@ -91,7 +91,7 @@ typedef enum { * * @return This function returns zero on success, or negative value with errors * @pre None - * @post MM_RADIO_STATE_NULL + * @post MM_RADIO_STATE_NULL * @remark None * @see mm_radio_destroy mm_radio_realize mm_radio_unrealize mm_radio_start mm_radio_stop * @par Example @@ -311,7 +311,7 @@ int mm_radio_create(MMHandleType *hradio); * * @return This function returns zero on success, or negative value with errors * @pre Application can use this API at any state. - * @post None + * @post None * @remark None * @see mm_radio_create mm_radio_realize mm_radio_unrealize mm_radio_start mm_radio_stop * @par Example @@ -530,7 +530,7 @@ int mm_radio_destroy(MMHandleType hradio); * * @return This function returns zero on success, or negative value with errors * @pre MM_RADIO_STATE_NULL - * @post MM_RADIO_STATE_READY + * @post MM_RADIO_STATE_READY * @remark None * @see mm_radio_create mm_radio_destroy mm_radio_unrealize mm_radio_start mm_radio_stop * @par Example @@ -750,7 +750,7 @@ int mm_radio_realize(MMHandleType hradio); * * @return This function returns zero on success, or negative value with errors * @pre MM_RADIO_STATE_READY - * @post MM_RADIO_STATE_NULL + * @post MM_RADIO_STATE_NULL * @remark None * @see mm_radio_create mm_radio_destroy mm_radio_realize mm_radio_start mm_radio_stop * @par Example @@ -971,7 +971,7 @@ int mm_radio_unrealize(MMHandleType hradio); * * @return This function returns zero on success, or negative value with errors * @pre None - * @post None + * @post None * @remark None * @see * @par Example @@ -1191,7 +1191,7 @@ int mm_radio_set_message_callback(MMHandleType hradio, MMMessageCallback callbac * * @return This function returns zero on success, or negative value with errors * @pre None - * @post None + * @post None * @remark None * @see * @par Example @@ -1410,7 +1410,7 @@ int mm_radio_get_state(MMHandleType hradio, MMRadioStateType *state); * * @return This function returns zero on success, or negative value with errors * @pre MM_RADIO_STATE_READY - * @post MM_RADIO_STATE_PLAYING + * @post MM_RADIO_STATE_PLAYING * @remark None * @see mm_radio_create mm_radio_destroy mm_radio_realize mm_radio_unrealize mm_radio_stop * @par Example @@ -1630,7 +1630,7 @@ int mm_radio_start(MMHandleType hradio); * * @return This function returns zero on success, or negative value with errors * @pre MM_RADIO_STATE_PLAYING - * @post MM_RADIO_STATE_READY + * @post MM_RADIO_STATE_READY * @remark None * @see mm_radio_create mm_radio_destroy mm_radio_realize mm_radio_unrealize mm_radio_start * @par Example @@ -1858,7 +1858,7 @@ int mm_radio_stop(MMHandleType hradio); * * @return This function returns zero on success, or negative value with errors * @pre MM_RADIO_STATE_PLAYING - * @post MM_RADIO_STATE_PLAYING + * @post MM_RADIO_STATE_PLAYING * @remark None * @see MM_MESSAGE_RADIO_SEEK_START MM_MESSAGE_RADIO_SEEK_FINISH * @par Example @@ -2079,7 +2079,7 @@ int mm_radio_seek(MMHandleType hradio, MMRadioSeekDirectionType direction); * * @return This function returns zero on success, or negative value with errors * @pre MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING - * @post MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING + * @post MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING * @remark None * @see mm_radio_get_frequency * @par Example @@ -2300,7 +2300,7 @@ int mm_radio_set_frequency(MMHandleType hradio, int freq); * * @return This function returns zero on success, or negative value with errors * @pre MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING - * @post MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING + * @post MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING * @remark None * @see mm_radio_set_frequency * @par Example @@ -2523,7 +2523,7 @@ int mm_radio_get_frequency(MMHandleType hradio, int *pFreq); * * @return This function returns zero on success, or negative value with errors * @pre MM_RADIO_STATE_READY - * @post MM_RADIO_STATE_SCANNING + * @post MM_RADIO_STATE_SCANNING * @remark None * @see mm_radio_scan_stop * @par Example @@ -2744,7 +2744,7 @@ int mm_radio_scan_start(MMHandleType hradio); * * @return This function returns zero on success, or negative value with errors * @pre MM_RADIO_STATE_SCANNING - * @post MM_RADIO_STATE_READY + * @post MM_RADIO_STATE_READY * @remark None * @see mm_radio_scan_start * @par Example @@ -2965,7 +2965,7 @@ int mm_radio_scan_stop(MMHandleType hradio); * * @return This function returns zero on success, or negative value with errors * @pre None - * @post None + * @post None * @remark None * @see * @par Example @@ -3194,7 +3194,7 @@ int mm_radio_set_mute(MMHandleType hradio, bool muted); * * @return This function returns zero on success, or negative value with errors * @pre None - * @post None + * @post None * @remark None * @see * @par Example @@ -3424,7 +3424,7 @@ int mm_radio_get_signal_strength(MMHandleType hradio, int *value); * * @return This function returns zero on success, or negative value with errors * @pre None - * @post None + * @post None * @remark None * @see mm_radio_get_region_frequency_range() */ @@ -3439,8 +3439,8 @@ int mm_radio_get_region_type(MMHandleType hradio, MMRadioRegionType *type); * * @return This function returns zero on success, or negative value with errors * @pre None - * @post None - * @remark The unit of frequency is KHz. + * @post None + * @remark The unit of frequency is KHz. * @see mm_radio_get_region_type() */ int mm_radio_get_region_frequency_range(MMHandleType hradio, unsigned int *min, unsigned int *max); @@ -3453,7 +3453,7 @@ int mm_radio_get_region_frequency_range(MMHandleType hradio, unsigned int *min, * * @return This function returns zero on success, or negative value with errors * @pre None - * @post None + * @post None * @see mm_radio_get_region_type() */ int mm_radio_get_channel_spacing(MMHandleType hradio, int *channel_spacing); diff --git a/src/include/mm_radio_priv.h b/src/include/mm_radio_priv.h index 7b773a2..9e1eb3f 100644 --- a/src/include/mm_radio_priv.h +++ b/src/include/mm_radio_priv.h @@ -102,9 +102,9 @@ typedef enum { typedef enum { MM_RADIO_FREQ_NONE = 0, /* min band types */ - MM_RADIO_FREQ_MIN_76100_KHZ = 76100, - MM_RADIO_FREQ_MIN_87500_KHZ = 87500, - MM_RADIO_FREQ_MIN_88100_KHZ = 88100, + MM_RADIO_FREQ_MIN_76100_KHZ = 76100, + MM_RADIO_FREQ_MIN_87500_KHZ = 87500, + MM_RADIO_FREQ_MIN_88100_KHZ = 88100, /* max band types */ MM_RADIO_FREQ_MAX_89900_KHZ = 89900, MM_RADIO_FREQ_MAX_108000_KHZ = 108000, @@ -217,9 +217,9 @@ int _mmradio_start_scan(mm_radio_t *radio); int _mmradio_stop_scan(mm_radio_t *radio); int _mm_radio_get_signal_strength(mm_radio_t *radio, int *strength); #ifdef USE_GST_PIPELINE -int _mmradio_realize_pipeline( mm_radio_t *radio); +int _mmradio_realize_pipeline(mm_radio_t *radio); int _mmradio_start_pipeline(mm_radio_t *radio); -int _mmradio_stop_pipeline( mm_radio_t *radio); +int _mmradio_stop_pipeline(mm_radio_t *radio); int _mmradio_destroy_pipeline(mm_radio_t *radio); #endif int _mmradio_apply_region(mm_radio_t *radio, MMRadioRegionType region, bool update); diff --git a/src/include/mm_radio_utils.h b/src/include/mm_radio_utils.h index 35e8dc7..d368a60 100644 --- a/src/include/mm_radio_utils.h +++ b/src/include/mm_radio_utils.h @@ -49,39 +49,46 @@ #define MMRADIO_MAX_INT (2147483647) -#define MMRADIO_FREEIF(x) \ -if ( x ) \ - free( x ); \ -x = NULL; - -#define MMRADIO_CHECK_INSTANCE( x_radio ) \ -if ( ! x_radio ) \ -{ \ - debug_error("radio instance is NULL\n"); \ - return MM_ERROR_RADIO_NOT_INITIALIZED; \ -} - -#define MMRADIO_CHECK_ARG( x_radio ) \ -if ( ! x_radio ) \ -{ \ - debug_error("argument is NULL\n"); \ - return MM_ERROR_COMMON_INVALID_ARGUMENT; \ -} - - -#define MMRADIO_CHECK_INSTANCE_RETURN_VOID( x_radio ) \ -if ( ! x_radio ) \ -{ \ - debug_error("radio instance is NULL\n"); \ - return; \ -} - -#define MMRADIO_CHECK_DEVICE_STATE( x_radio ) \ -if ( x_radio->radio_fd < 0 ) \ -{ \ - debug_error("not available radio device\n"); \ - return MM_ERROR_RADIO_NOT_INITIALIZED;\ -} +#define MMRADIO_FREEIF(x) \ +do { \ + if (x) { \ + free(x); \ + x = NULL; \ + } \ +} while (0) + +#define MMRADIO_CHECK_INSTANCE(x_radio) \ +do { \ + if (!x_radio) { \ + debug_error("radio instance is NULL\n"); \ + return MM_ERROR_RADIO_NOT_INITIALIZED; \ + } \ +} while (0) + +#define MMRADIO_CHECK_ARG(x_radio) \ +do { \ + if (!x_radio) { \ + debug_error("argument is NULL\n"); \ + return MM_ERROR_COMMON_INVALID_ARGUMENT; \ + } \ +} while (0) + + +#define MMRADIO_CHECK_INSTANCE_RETURN_VOID(x_radio) \ +do { \ + if (!x_radio) { \ + debug_error("radio instance is NULL\n"); \ + return; \ + } \ +} while (0) + +#define MMRADIO_CHECK_DEVICE_STATE(x_radio) \ +do { \ + if (x_radio->radio_fd < 0) { \ + debug_error("not available radio device\n"); \ + return MM_ERROR_RADIO_NOT_INITIALIZED; \ + } \ +} while (0) /* command locking for multithreading */ #define MMRADIO_CMD_LOCK(x_radio) pthread_mutex_lock(&((mm_radio_t *)x_radio)->cmd_lock) @@ -91,40 +98,43 @@ if ( x_radio->radio_fd < 0 ) \ #define MMRADIO_VOLUME_UNLOCK(x_radio) pthread_mutex_unlock(&((mm_radio_t *)x_radio)->volume_lock) /* message posting */ -#define MMRADIO_POST_MSG( x_radio, x_msgtype, x_msg_param ) \ -debug_log("posting %s to application\n", #x_msgtype); \ -__mmradio_post_message(x_radio, x_msgtype, x_msg_param); +#define MMRADIO_POST_MSG(x_radio, x_msgtype, x_msg_param) \ +do { \ + debug_log("posting %s to application\n", #x_msgtype); \ + __mmradio_post_message(x_radio, x_msgtype, x_msg_param); \ +} while (0) /* setting radio state */ -#define MMRADIO_SET_STATE( x_radio, x_state ) \ -debug_log("setting mm-radio state to %d\n", x_state); \ -__mmradio_set_state(x_radio, x_state); +#define MMRADIO_SET_STATE(x_radio, x_state) \ +do { \ + debug_log("setting mm-radio state to %d\n", x_state); \ + __mmradio_set_state(x_radio, x_state); \ +} while (0) /* state */ -#define MMRADIO_CHECK_STATE_RETURN_IF_FAIL( x_radio, x_command ) \ -debug_log("checking radio state before doing %s\n", #x_command); \ -switch ( __mmradio_check_state(x_radio, x_command) ) \ -{ \ - case MM_ERROR_RADIO_INVALID_STATE: \ - return MM_ERROR_RADIO_INVALID_STATE; \ - break; \ - /* NOTE : for robustness of mmfw. we won't treat it as an error */ \ - case MM_ERROR_RADIO_NO_OP: \ - return MM_ERROR_NONE; \ - break; \ - default: \ - break; \ -} - -#define MMRADIO_CHECK_RETURN_IF_FAIL( x_ret, x_msg ) \ -do \ -{ \ - if( x_ret < 0 ) \ - { \ - debug_error("%s error\n", x_msg);\ - return x_ret; \ - } \ -} while( 0 ) ; +#define MMRADIO_CHECK_STATE_RETURN_IF_FAIL(x_radio, x_command) \ +do { \ + debug_log("checking radio state before doing %s\n", #x_command); \ + switch (__mmradio_check_state(x_radio, x_command)) { \ + case MM_ERROR_RADIO_INVALID_STATE: \ + return MM_ERROR_RADIO_INVALID_STATE; \ + break; \ + /* NOTE : for robustness of mmfw. we won't treat it as an error */ \ + case MM_ERROR_RADIO_NO_OP: \ + return MM_ERROR_NONE; \ + break; \ + default: \ + break; \ + } \ +} while (0) + +#define MMRADIO_CHECK_RETURN_IF_FAIL(x_ret, x_msg) \ +do { \ + if (x_ret < 0) { \ + debug_error("%s error\n", x_msg); \ + return x_ret; \ + } \ +} while (0); #endif |