From 5251d75c04905877b7f1a16e315f5f072b504dde Mon Sep 17 00:00:00 2001 From: Inho Oh Date: Mon, 27 May 2024 14:59:11 +0900 Subject: [PATCH] base: apply NUGU_API macro to support win32 change the EXPORT_API macro to NUGU_API to support win32 Signed-off-by: Inho Oh --- include/base/nugu_audio.h | 11 ++- include/base/nugu_buffer.h | 33 ++++---- include/base/nugu_decoder.h | 36 +++++---- include/base/nugu_directive.h | 73 +++++++++--------- include/base/nugu_encoder.h | 42 +++++----- include/base/nugu_equeue.h | 18 +++-- include/base/nugu_event.h | 47 ++++++------ include/base/nugu_http.h | 115 +++++++++++++++------------- include/base/nugu_log.h | 42 ++++++---- include/base/nugu_network_manager.h | 65 ++++++++-------- include/base/nugu_pcm.h | 86 +++++++++++---------- include/base/nugu_player.h | 81 +++++++++++--------- include/base/nugu_plugin.h | 61 ++++++++------- include/base/nugu_prof.h | 35 +++++---- include/base/nugu_recorder.h | 57 +++++++------- include/base/nugu_ringbuffer.h | 23 +++--- include/base/nugu_timer.h | 23 +++--- include/base/nugu_uuid.h | 24 +++--- include/base/nugu_winsock.h | 23 +++--- nugu.h.in | 15 ++++ src/base/CMakeLists.txt | 7 +- src/base/nugu_audio.c | 9 +-- src/base/nugu_buffer.c | 30 ++++---- src/base/nugu_decoder.c | 35 ++++----- src/base/nugu_directive.c | 72 +++++++++-------- src/base/nugu_encoder.c | 36 ++++----- src/base/nugu_equeue.c | 16 ++-- src/base/nugu_event.c | 45 ++++++----- src/base/nugu_http.c | 113 +++++++++++++-------------- src/base/nugu_log.c | 35 ++++----- src/base/nugu_network_manager.c | 66 ++++++++-------- src/base/nugu_pcm.c | 85 ++++++++++---------- src/base/nugu_player.c | 78 +++++++++---------- src/base/nugu_plugin.c | 29 ++++--- src/base/nugu_prof.c | 35 ++++----- src/base/nugu_recorder.c | 57 +++++++------- src/base/nugu_ringbuffer.c | 21 +++-- src/base/nugu_timer.c | 21 +++-- src/base/nugu_uuid.c | 23 +++--- tests/clientkit/CMakeLists.txt | 2 - tests/core/CMakeLists.txt | 3 - 41 files changed, 881 insertions(+), 847 deletions(-) diff --git a/include/base/nugu_audio.h b/include/base/nugu_audio.h index ad0749ea0..8cade47c5 100644 --- a/include/base/nugu_audio.h +++ b/include/base/nugu_audio.h @@ -17,6 +17,8 @@ #ifndef __NUGU_AUDIO_H__ #define __NUGU_AUDIO_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -108,22 +110,23 @@ typedef struct nugu_audio_property NuguAudioProperty; * @param[in] attribute audio attribute * @param[in] str audio attribute's string */ -void nugu_audio_set_attribute_str(const NuguAudioAttribute attribute, - const char *str); +NUGU_API void nugu_audio_set_attribute_str(const NuguAudioAttribute attribute, + const char *str); /** * @brief Get audio attribute string * @param[in] attribute audio attribute * @return audio attribute string */ -const char *nugu_audio_get_attribute_str(const NuguAudioAttribute attribute); +NUGU_API const char * +nugu_audio_get_attribute_str(const NuguAudioAttribute attribute); /** * @brief Get audio attribute type from string * @param[in] str audio attribute's string * @return audio attribute */ -NuguAudioAttribute nugu_audio_get_attribute(const char *str); +NUGU_API NuguAudioAttribute nugu_audio_get_attribute(const char *str); #ifdef __cplusplus } diff --git a/include/base/nugu_buffer.h b/include/base/nugu_buffer.h index efe2696cd..4a1b67a13 100644 --- a/include/base/nugu_buffer.h +++ b/include/base/nugu_buffer.h @@ -18,6 +18,7 @@ #define __NUGU_BUFFER_H__ #include +#include #ifdef __cplusplus extern "C" { @@ -43,7 +44,7 @@ extern "C" { * @brief Not found return type of nugu_buffer_find_byte() * @see nugu_buffer_find_byte() */ -#define NUGU_BUFFER_NOT_FOUND ((size_t)-1) +#define NUGU_BUFFER_NOT_FOUND ((size_t) - 1) /** * @brief Buffer object @@ -57,7 +58,7 @@ typedef struct _nugu_buffer NuguBuffer; * @return Buffer object * @see nugu_buffer_free() */ -NuguBuffer *nugu_buffer_new(size_t default_size); +NUGU_API NuguBuffer *nugu_buffer_new(size_t default_size); /** * @brief Destroy the buffer object @@ -68,7 +69,7 @@ NuguBuffer *nugu_buffer_new(size_t default_size); * manually. If false, always return NULL. * @see nugu_buffer_new() */ -void *nugu_buffer_free(NuguBuffer *buf, int is_data_free); +NUGU_API void *nugu_buffer_free(NuguBuffer *buf, int is_data_free); /** * @brief Append the data to buffer object @@ -77,7 +78,8 @@ void *nugu_buffer_free(NuguBuffer *buf, int is_data_free); * @param[in] data_len Length of the data * @return added length (0 = failure) */ -size_t nugu_buffer_add(NuguBuffer *buf, const void *data, size_t data_len); +NUGU_API size_t nugu_buffer_add(NuguBuffer *buf, const void *data, + size_t data_len); /** * @brief Append the data to buffer object @@ -85,7 +87,7 @@ size_t nugu_buffer_add(NuguBuffer *buf, const void *data, size_t data_len); * @param[in] byte The data to add to the buffer. * @return added length (0 = failure) */ -size_t nugu_buffer_add_byte(NuguBuffer *buf, unsigned char byte); +NUGU_API size_t nugu_buffer_add_byte(NuguBuffer *buf, unsigned char byte); /** * @brief Append the data to buffer object @@ -96,7 +98,8 @@ size_t nugu_buffer_add_byte(NuguBuffer *buf, unsigned char byte); * @retval 0 success * @retval -1 failure */ -int nugu_buffer_set_byte(NuguBuffer *buf, size_t pos, unsigned char byte); +NUGU_API int nugu_buffer_set_byte(NuguBuffer *buf, size_t pos, + unsigned char byte); /** * @brief Get the internal buffer @@ -104,7 +107,7 @@ int nugu_buffer_set_byte(NuguBuffer *buf, size_t pos, unsigned char byte); * @return Internal buffer address. Please do not modify the data manually. * @see nugu_buffer_peek_byte() */ -const void *nugu_buffer_peek(NuguBuffer *buf); +NUGU_API const void *nugu_buffer_peek(NuguBuffer *buf); /** * @brief Gets the size of the entire data added to the buffer. @@ -112,7 +115,7 @@ const void *nugu_buffer_peek(NuguBuffer *buf); * @return size of data * @see nugu_buffer_get_alloc_size() */ -size_t nugu_buffer_get_size(NuguBuffer *buf); +NUGU_API size_t nugu_buffer_get_size(NuguBuffer *buf); /** * @brief Gets the size of the entire data allocated for the buffer. @@ -120,7 +123,7 @@ size_t nugu_buffer_get_size(NuguBuffer *buf); * @return size of allocated internal buffer. * @see nugu_buffer_get_size() */ -size_t nugu_buffer_get_alloc_size(NuguBuffer *buf); +NUGU_API size_t nugu_buffer_get_alloc_size(NuguBuffer *buf); /** * @brief Get the position of the data you want to find. @@ -129,7 +132,7 @@ size_t nugu_buffer_get_alloc_size(NuguBuffer *buf); * @return position. if fail, return NUGU_BUFFER_NOT_FOUND * @see NUGU_BUFFER_NOT_FOUND */ -size_t nugu_buffer_find_byte(NuguBuffer *buf, unsigned char want); +NUGU_API size_t nugu_buffer_find_byte(NuguBuffer *buf, unsigned char want); /** * @brief Get data at a specific position. @@ -137,7 +140,7 @@ size_t nugu_buffer_find_byte(NuguBuffer *buf, unsigned char want); * @param[in] pos position * @return byte data */ -unsigned char nugu_buffer_peek_byte(NuguBuffer *buf, size_t pos); +NUGU_API unsigned char nugu_buffer_peek_byte(NuguBuffer *buf, size_t pos); /** * @brief Clear the buffer @@ -147,7 +150,7 @@ unsigned char nugu_buffer_peek_byte(NuguBuffer *buf, size_t pos); * @retval -1 failure * @see nugu_buffer_clear_from() */ -int nugu_buffer_clear(NuguBuffer *buf); +NUGU_API int nugu_buffer_clear(NuguBuffer *buf); /** * @brief Clear data from a specific position to the end. @@ -158,7 +161,7 @@ int nugu_buffer_clear(NuguBuffer *buf); * @retval -1 failure * @see nugu_buffer_clear() */ -int nugu_buffer_clear_from(NuguBuffer *buf, size_t pos); +NUGU_API int nugu_buffer_clear_from(NuguBuffer *buf, size_t pos); /** * @brief Delete a certain amount of data and move the remaining data forward. @@ -168,7 +171,7 @@ int nugu_buffer_clear_from(NuguBuffer *buf, size_t pos); * @retval 0 success * @retval -1 failure */ -int nugu_buffer_shift_left(NuguBuffer *buf, size_t size); +NUGU_API int nugu_buffer_shift_left(NuguBuffer *buf, size_t size); /** * @brief Extract data by a certain size. @@ -176,7 +179,7 @@ int nugu_buffer_shift_left(NuguBuffer *buf, size_t size); * @param[in] size size to extract * @return Extracted data. Developer must free the data manually. */ -void *nugu_buffer_pop(NuguBuffer *buf, size_t size); +NUGU_API void *nugu_buffer_pop(NuguBuffer *buf, size_t size); /** * @} diff --git a/include/base/nugu_decoder.h b/include/base/nugu_decoder.h index 1126729df..4343f740c 100644 --- a/include/base/nugu_decoder.h +++ b/include/base/nugu_decoder.h @@ -17,6 +17,7 @@ #ifndef __NUGU_DECODER_H__ #define __NUGU_DECODER_H__ +#include #include #include @@ -60,7 +61,8 @@ typedef struct _nugu_decoder_driver NuguDecoderDriver; * @see nugu_decoder_get_pcm() * @see nugu_pcm_new() */ -NuguDecoder *nugu_decoder_new(NuguDecoderDriver *driver, NuguPcm *sink); +NUGU_API NuguDecoder *nugu_decoder_new(NuguDecoderDriver *driver, + NuguPcm *sink); /** * @brief Destroy the decoder object @@ -70,7 +72,7 @@ NuguDecoder *nugu_decoder_new(NuguDecoderDriver *driver, NuguPcm *sink); * @retval -1 failure * @see nugu_decoder_new() */ -int nugu_decoder_free(NuguDecoder *dec); +NUGU_API int nugu_decoder_free(NuguDecoder *dec); /** * @brief Decode the encoded data and pass the result to sink @@ -82,7 +84,8 @@ int nugu_decoder_free(NuguDecoder *dec); * @retval -1 failure * @see nugu_decoder_decode() */ -int nugu_decoder_play(NuguDecoder *dec, const void *data, size_t data_len); +NUGU_API int nugu_decoder_play(NuguDecoder *dec, const void *data, + size_t data_len); /** * @brief Set custom data for driver @@ -93,7 +96,7 @@ int nugu_decoder_play(NuguDecoder *dec, const void *data, size_t data_len); * @retval -1 failure * @see nugu_decoder_get_driver_data() */ -int nugu_decoder_set_driver_data(NuguDecoder *dec, void *data); +NUGU_API int nugu_decoder_set_driver_data(NuguDecoder *dec, void *data); /** * @brief Get custom data for driver @@ -101,7 +104,7 @@ int nugu_decoder_set_driver_data(NuguDecoder *dec, void *data); * @return data * @see nugu_decoder_set_driver_data() */ -void *nugu_decoder_get_driver_data(NuguDecoder *dec); +NUGU_API void *nugu_decoder_get_driver_data(NuguDecoder *dec); /** * @brief Decode the encoded data @@ -111,8 +114,8 @@ void *nugu_decoder_get_driver_data(NuguDecoder *dec); * @param[out] output_len output buffer length * @return memory allocated decoded data. Developer must free the data manually. */ -void *nugu_decoder_decode(NuguDecoder *dec, const void *data, size_t data_len, - size_t *output_len); +NUGU_API void *nugu_decoder_decode(NuguDecoder *dec, const void *data, + size_t data_len, size_t *output_len); /** * @brief Get pcm(sink) object @@ -120,7 +123,7 @@ void *nugu_decoder_decode(NuguDecoder *dec, const void *data, size_t data_len, * @return pcm object * @see nugu_decoder_new() */ -NuguPcm *nugu_decoder_get_pcm(NuguDecoder *dec); +NUGU_API NuguPcm *nugu_decoder_get_pcm(NuguDecoder *dec); /** * @} @@ -177,9 +180,9 @@ struct nugu_decoder_driver_ops { * @return decoder driver object * @see nugu_decoder_driver_free() */ -NuguDecoderDriver *nugu_decoder_driver_new(const char *name, - enum nugu_decoder_type type, - struct nugu_decoder_driver_ops *ops); +NUGU_API NuguDecoderDriver * +nugu_decoder_driver_new(const char *name, enum nugu_decoder_type type, + struct nugu_decoder_driver_ops *ops); /** * @brief Destroy the decoder driver @@ -188,7 +191,7 @@ NuguDecoderDriver *nugu_decoder_driver_new(const char *name, * @retval 0 success * @retval -1 failure */ -int nugu_decoder_driver_free(NuguDecoderDriver *driver); +NUGU_API int nugu_decoder_driver_free(NuguDecoderDriver *driver); /** * @brief Register the driver to driver list @@ -197,7 +200,7 @@ int nugu_decoder_driver_free(NuguDecoderDriver *driver); * @retval 0 success * @retval -1 failure */ -int nugu_decoder_driver_register(NuguDecoderDriver *driver); +NUGU_API int nugu_decoder_driver_register(NuguDecoderDriver *driver); /** * @brief Remove the driver from driver list @@ -206,7 +209,7 @@ int nugu_decoder_driver_register(NuguDecoderDriver *driver); * @retval 0 success * @retval -1 failure */ -int nugu_decoder_driver_remove(NuguDecoderDriver *driver); +NUGU_API int nugu_decoder_driver_remove(NuguDecoderDriver *driver); /** * @brief Find a driver by name in the driver list @@ -214,7 +217,7 @@ int nugu_decoder_driver_remove(NuguDecoderDriver *driver); * @return decoder driver object * @see nugu_decoder_driver_find_bytype() */ -NuguDecoderDriver *nugu_decoder_driver_find(const char *name); +NUGU_API NuguDecoderDriver *nugu_decoder_driver_find(const char *name); /** * @brief Find a driver by type in the driver list @@ -222,7 +225,8 @@ NuguDecoderDriver *nugu_decoder_driver_find(const char *name); * @return decoder driver object * @see nugu_decoder_driver_find */ -NuguDecoderDriver *nugu_decoder_driver_find_bytype(enum nugu_decoder_type type); +NUGU_API NuguDecoderDriver * +nugu_decoder_driver_find_bytype(enum nugu_decoder_type type); /** * @} diff --git a/include/base/nugu_directive.h b/include/base/nugu_directive.h index 604af2ae7..2a9fa2636 100644 --- a/include/base/nugu_directive.h +++ b/include/base/nugu_directive.h @@ -18,6 +18,7 @@ #define __NUGU_DIRECTIVE_H__ #include +#include #ifdef __cplusplus extern "C" { @@ -76,81 +77,81 @@ typedef void (*NuguDirectiveDataCallback)(NuguDirective *ndir, int seq, * @return directive object * @see nugu_directive_free() */ -NuguDirective *nugu_directive_new(const char *name_space, const char *name, - const char *version, const char *msg_id, - const char *dialog_id, - const char *referrer_id, const char *json, - const char *groups); +NUGU_API NuguDirective * +nugu_directive_new(const char *name_space, const char *name, + const char *version, const char *msg_id, + const char *dialog_id, const char *referrer_id, + const char *json, const char *groups); /** * @brief Increment the reference count of the directive object. * @param[in] ndir directive object * @see nugu_directive_new() */ -void nugu_directive_ref(NuguDirective *ndir); +NUGU_API void nugu_directive_ref(NuguDirective *ndir); /** * @brief Decrement the reference count of the directive object. * @param[in] ndir directive object * @see nugu_directive_new() */ -void nugu_directive_unref(NuguDirective *ndir); +NUGU_API void nugu_directive_unref(NuguDirective *ndir); /** * @brief Get the namespace of directive * @param[in] ndir directive object * @return namespace. Please don't free the data manually. */ -const char *nugu_directive_peek_namespace(const NuguDirective *ndir); +NUGU_API const char *nugu_directive_peek_namespace(const NuguDirective *ndir); /** * @brief Get the name of directive * @param[in] ndir directive object * @return name. Please don't free the data manually. */ -const char *nugu_directive_peek_name(const NuguDirective *ndir); +NUGU_API const char *nugu_directive_peek_name(const NuguDirective *ndir); /** * @brief Get the group of directive * @param[in] ndir directive object * @return groups. Please don't free the data manually. */ -const char *nugu_directive_peek_groups(const NuguDirective *ndir); +NUGU_API const char *nugu_directive_peek_groups(const NuguDirective *ndir); /** * @brief Get the version of directive * @param[in] ndir directive object * @return version. Please don't free the data manually. */ -const char *nugu_directive_peek_version(const NuguDirective *ndir); +NUGU_API const char *nugu_directive_peek_version(const NuguDirective *ndir); /** * @brief Get the message-id of directive * @param[in] ndir directive object * @return message-id. Please don't free the data manually. */ -const char *nugu_directive_peek_msg_id(const NuguDirective *ndir); +NUGU_API const char *nugu_directive_peek_msg_id(const NuguDirective *ndir); /** * @brief Get the dialog-request-id of directive * @param[in] ndir directive object * @return dialog-request-id. Please don't free the data manually. */ -const char *nugu_directive_peek_dialog_id(const NuguDirective *ndir); +NUGU_API const char *nugu_directive_peek_dialog_id(const NuguDirective *ndir); /** * @brief Get the referer-dialog-request-id of directive * @param[in] ndir directive object * @return referrer-dialog-request-id. Please don't free the data manually. */ -const char *nugu_directive_peek_referrer_id(const NuguDirective *ndir); +NUGU_API const char *nugu_directive_peek_referrer_id(const NuguDirective *ndir); /** * @brief Get the payload of directive * @param[in] ndir directive object * @return json type payload. Please don't free the data manually. */ -const char *nugu_directive_peek_json(const NuguDirective *ndir); +NUGU_API const char *nugu_directive_peek_json(const NuguDirective *ndir); /** * @brief Get the active status of directive. @@ -162,7 +163,7 @@ const char *nugu_directive_peek_json(const NuguDirective *ndir); * @retval -1 failure * @see nugu_directive_set_active() */ -int nugu_directive_is_active(const NuguDirective *ndir); +NUGU_API int nugu_directive_is_active(const NuguDirective *ndir); /** * @brief Set the active status of directive. @@ -173,7 +174,7 @@ int nugu_directive_is_active(const NuguDirective *ndir); * @retval -1 failure * @see nugu_directive_is_active() */ -int nugu_directive_set_active(NuguDirective *ndir, int flag); +NUGU_API int nugu_directive_set_active(NuguDirective *ndir, int flag); /** * @brief Add attachment data to directive. (e.g. TTS payload) @@ -188,8 +189,8 @@ int nugu_directive_set_active(NuguDirective *ndir, int flag); * @see nugu_directive_get_data() * @see nugu_directive_get_data_size() */ -int nugu_directive_add_data(NuguDirective *ndir, size_t length, - const unsigned char *data); +NUGU_API int nugu_directive_add_data(NuguDirective *ndir, size_t length, + const unsigned char *data); /** * @brief Set the attachment data status to "Received all data" @@ -199,7 +200,7 @@ int nugu_directive_add_data(NuguDirective *ndir, size_t length, * @retval -1 failure * @see nugu_directive_is_data_end() */ -int nugu_directive_close_data(NuguDirective *ndir); +NUGU_API int nugu_directive_close_data(NuguDirective *ndir); /** * @brief Get the attachment data status @@ -210,7 +211,7 @@ int nugu_directive_close_data(NuguDirective *ndir); * @retval -1 failure * @see nugu_directive_close_data() */ -int nugu_directive_is_data_end(const NuguDirective *ndir); +NUGU_API int nugu_directive_is_data_end(const NuguDirective *ndir); /** * @brief Set the attachment mime type @@ -221,7 +222,8 @@ int nugu_directive_is_data_end(const NuguDirective *ndir); * @retval -1 failure * @see nugu_directive_peek_media_type() */ -int nugu_directive_set_media_type(NuguDirective *ndir, const char *type); +NUGU_API int nugu_directive_set_media_type(NuguDirective *ndir, + const char *type); /** * @brief Get the attachment mime type @@ -229,7 +231,7 @@ int nugu_directive_set_media_type(NuguDirective *ndir, const char *type); * @return mime type * @see nugu_directive_set_media_type() */ -const char *nugu_directive_peek_media_type(const NuguDirective *ndir); +NUGU_API const char *nugu_directive_peek_media_type(const NuguDirective *ndir); /** * @brief Get the attachment data received so far. @@ -239,7 +241,8 @@ const char *nugu_directive_peek_media_type(const NuguDirective *ndir); * @return received attachment data. Developer must free the data manually. * @see nugu_directive_get_data_size() */ -unsigned char *nugu_directive_get_data(NuguDirective *ndir, size_t *length); +NUGU_API unsigned char *nugu_directive_get_data(NuguDirective *ndir, + size_t *length); /** * @brief Get the size of attachment data received so far. @@ -247,7 +250,7 @@ unsigned char *nugu_directive_get_data(NuguDirective *ndir, size_t *length); * @return size of attachment data * @see nugu_directive_get_data() */ -size_t nugu_directive_get_data_size(const NuguDirective *ndir); +NUGU_API size_t nugu_directive_get_data_size(const NuguDirective *ndir); /** * @brief Set the medium of BlockingPolicy for the directive @@ -261,9 +264,8 @@ size_t nugu_directive_get_data_size(const NuguDirective *ndir); * @see nugu_directive_get_blocking_medium_string() * @see nugu_directive_is_blocking() */ -int nugu_directive_set_blocking_policy(NuguDirective *ndir, - enum nugu_directive_medium medium, - int is_block); +NUGU_API int nugu_directive_set_blocking_policy( + NuguDirective *ndir, enum nugu_directive_medium medium, int is_block); /** * @brief Get the medium of BlockingPolicy for the directive @@ -272,7 +274,7 @@ int nugu_directive_set_blocking_policy(NuguDirective *ndir, * @see nugu_directive_set_blocking_policy() * @see nugu_directive_get_blocking_medium_string() */ -enum nugu_directive_medium +NUGU_API enum nugu_directive_medium nugu_directive_get_blocking_medium(const NuguDirective *ndir); /** @@ -282,7 +284,7 @@ nugu_directive_get_blocking_medium(const NuguDirective *ndir); * @see nugu_directive_set_blocking_policy() * @see nugu_directive_get_blocking_medium() */ -const char * +NUGU_API const char * nugu_directive_get_blocking_medium_string(const NuguDirective *ndir); /** @@ -294,7 +296,7 @@ nugu_directive_get_blocking_medium_string(const NuguDirective *ndir); * @retval -1 failure * @see nugu_directive_set_blocking_policy() */ -int nugu_directive_is_blocking(const NuguDirective *ndir); +NUGU_API int nugu_directive_is_blocking(const NuguDirective *ndir); /** * @brief Set attachment received event callback @@ -306,9 +308,10 @@ int nugu_directive_is_blocking(const NuguDirective *ndir); * @retval -1 failure * @see nugu_directive_remove_data_callback() */ -int nugu_directive_set_data_callback(NuguDirective *ndir, - NuguDirectiveDataCallback callback, - void *userdata); +NUGU_API int +nugu_directive_set_data_callback(NuguDirective *ndir, + NuguDirectiveDataCallback callback, + void *userdata); /** * @brief Remove attachment received event callback @@ -318,7 +321,7 @@ int nugu_directive_set_data_callback(NuguDirective *ndir, * @retval -1 failure * @see nugu_directive_set_data_callback() */ -int nugu_directive_remove_data_callback(NuguDirective *ndir); +NUGU_API int nugu_directive_remove_data_callback(NuguDirective *ndir); /** * @} diff --git a/include/base/nugu_encoder.h b/include/base/nugu_encoder.h index 526d6e5d5..58161a450 100644 --- a/include/base/nugu_encoder.h +++ b/include/base/nugu_encoder.h @@ -17,6 +17,7 @@ #ifndef __NUGU_ENCODER_H__ #define __NUGU_ENCODER_H__ +#include #include #include @@ -57,8 +58,8 @@ typedef struct _nugu_encoder_driver NuguEncoderDriver; * @return encoder object * @see nugu_encoder_free() */ -NuguEncoder *nugu_encoder_new(NuguEncoderDriver *driver, - NuguAudioProperty property); +NUGU_API NuguEncoder *nugu_encoder_new(NuguEncoderDriver *driver, + NuguAudioProperty property); /** * @brief Destroy the encoder object @@ -68,7 +69,7 @@ NuguEncoder *nugu_encoder_new(NuguEncoderDriver *driver, * @retval -1 failure * @see nugu_encoder_new() */ -int nugu_encoder_free(NuguEncoder *enc); +NUGU_API int nugu_encoder_free(NuguEncoder *enc); /** * @brief Set custom data for driver @@ -79,7 +80,7 @@ int nugu_encoder_free(NuguEncoder *enc); * @retval -1 failure * @see nugu_encoder_get_driver_data() */ -int nugu_encoder_set_driver_data(NuguEncoder *enc, void *data); +NUGU_API int nugu_encoder_set_driver_data(NuguEncoder *enc, void *data); /** * @brief Get custom data for driver @@ -87,7 +88,7 @@ int nugu_encoder_set_driver_data(NuguEncoder *enc, void *data); * @return data * @see nugu_encoder_set_driver_data() */ -void *nugu_encoder_get_driver_data(NuguEncoder *enc); +NUGU_API void *nugu_encoder_get_driver_data(NuguEncoder *enc); /** * @brief Encode the encoded data @@ -98,22 +99,23 @@ void *nugu_encoder_get_driver_data(NuguEncoder *enc); * @param[out] output_len output buffer length * @return memory allocated encoded data. Developer must free the data manually. */ -void *nugu_encoder_encode(NuguEncoder *enc, int is_last, const void *data, - size_t data_len, size_t *output_len); +NUGU_API void *nugu_encoder_encode(NuguEncoder *enc, int is_last, + const void *data, size_t data_len, + size_t *output_len); /** * @brief Get encoder codec. e.g. "OGG_OPUS" or "SPEEX" * @param[in] enc encoder object * @return encoder type string */ -const char *nugu_encoder_get_codec(NuguEncoder *enc); +NUGU_API const char *nugu_encoder_get_codec(NuguEncoder *enc); /** * @brief Get encoder mime type * @param[in] enc encoder object * @return encoder mime type string */ -const char *nugu_encoder_get_mime_type(NuguEncoder *enc); +NUGU_API const char *nugu_encoder_get_mime_type(NuguEncoder *enc); /** * @} @@ -155,9 +157,8 @@ struct nugu_encoder_driver_ops { * @brief Called when a encoding request is received from the encoder. * @see nugu_encoder_encode() */ - int (*encode)(NuguEncoderDriver *driver, NuguEncoder *enc, - int is_last, const void *data, size_t data_len, - NuguBuffer *out_buf); + int (*encode)(NuguEncoderDriver *driver, NuguEncoder *enc, int is_last, + const void *data, size_t data_len, NuguBuffer *out_buf); /** * @brief Called when the encoder is destroyed. * @see nugu_encoder_free() @@ -173,9 +174,9 @@ struct nugu_encoder_driver_ops { * @return encoder driver object * @see nugu_encoder_driver_free() */ -NuguEncoderDriver *nugu_encoder_driver_new(const char *name, - enum nugu_encoder_type type, - struct nugu_encoder_driver_ops *ops); +NUGU_API NuguEncoderDriver * +nugu_encoder_driver_new(const char *name, enum nugu_encoder_type type, + struct nugu_encoder_driver_ops *ops); /** * @brief Destroy the encoder driver @@ -184,7 +185,7 @@ NuguEncoderDriver *nugu_encoder_driver_new(const char *name, * @retval 0 success * @retval -1 failure */ -int nugu_encoder_driver_free(NuguEncoderDriver *driver); +NUGU_API int nugu_encoder_driver_free(NuguEncoderDriver *driver); /** * @brief Register the driver to driver list @@ -193,7 +194,7 @@ int nugu_encoder_driver_free(NuguEncoderDriver *driver); * @retval 0 success * @retval -1 failure */ -int nugu_encoder_driver_register(NuguEncoderDriver *driver); +NUGU_API int nugu_encoder_driver_register(NuguEncoderDriver *driver); /** * @brief Remove the driver from driver list @@ -202,7 +203,7 @@ int nugu_encoder_driver_register(NuguEncoderDriver *driver); * @retval 0 success * @retval -1 failure */ -int nugu_encoder_driver_remove(NuguEncoderDriver *driver); +NUGU_API int nugu_encoder_driver_remove(NuguEncoderDriver *driver); /** * @brief Find a driver by name in the driver list @@ -210,7 +211,7 @@ int nugu_encoder_driver_remove(NuguEncoderDriver *driver); * @return encoder driver object * @see nugu_encoder_driver_find_bytype() */ -NuguEncoderDriver *nugu_encoder_driver_find(const char *name); +NUGU_API NuguEncoderDriver *nugu_encoder_driver_find(const char *name); /** * @brief Find a driver by type in the driver list @@ -218,7 +219,8 @@ NuguEncoderDriver *nugu_encoder_driver_find(const char *name); * @return encoder driver object * @see nugu_encoder_driver_find */ -NuguEncoderDriver *nugu_encoder_driver_find_bytype(enum nugu_encoder_type type); +NUGU_API NuguEncoderDriver * +nugu_encoder_driver_find_bytype(enum nugu_encoder_type type); /** * @} diff --git a/include/base/nugu_equeue.h b/include/base/nugu_equeue.h index 10c1072a5..489c30c62 100644 --- a/include/base/nugu_equeue.h +++ b/include/base/nugu_equeue.h @@ -17,6 +17,8 @@ #ifndef __NUGU_EQUEUE_H__ #define __NUGU_EQUEUE_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -82,12 +84,12 @@ typedef void (*NuguEqueueDestroyCallback)(void *data); * @retval 0 success * @retval -1 failure */ -int nugu_equeue_initialize(void); +NUGU_API int nugu_equeue_initialize(void); /** * @brief De-initialize the event queue */ -void nugu_equeue_deinitialize(void); +NUGU_API void nugu_equeue_deinitialize(void); /** * @brief Set handler for event type @@ -99,10 +101,10 @@ void nugu_equeue_deinitialize(void); * @retval 0 success * @retval -1 failure */ -int nugu_equeue_set_handler(enum nugu_equeue_type type, - NuguEqueueCallback callback, - NuguEqueueDestroyCallback destroy_callback, - void *userdata); +NUGU_API int nugu_equeue_set_handler(enum nugu_equeue_type type, + NuguEqueueCallback callback, + NuguEqueueDestroyCallback destroy_callback, + void *userdata); /** * @brief Unset handler for event type @@ -111,7 +113,7 @@ int nugu_equeue_set_handler(enum nugu_equeue_type type, * @retval 0 success * @retval -1 failure */ -int nugu_equeue_unset_handler(enum nugu_equeue_type type); +NUGU_API int nugu_equeue_unset_handler(enum nugu_equeue_type type); /** * @brief Push new event with data to queue and trigger event callback @@ -123,7 +125,7 @@ int nugu_equeue_unset_handler(enum nugu_equeue_type type); * @retval 0 success * @retval -1 failure */ -int nugu_equeue_push(enum nugu_equeue_type type, void *data); +NUGU_API int nugu_equeue_push(enum nugu_equeue_type type, void *data); /** * @} diff --git a/include/base/nugu_event.h b/include/base/nugu_event.h index 509664f40..c1b6c0b4d 100644 --- a/include/base/nugu_event.h +++ b/include/base/nugu_event.h @@ -17,6 +17,8 @@ #ifndef __NUGU_EVENT_H__ #define __NUGU_EVENT_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -64,43 +66,43 @@ typedef struct _nugu_event NuguEvent; * @return event object * @see nugu_event_free() */ -NuguEvent *nugu_event_new(const char *name_space, const char *name, - const char *version); +NUGU_API NuguEvent *nugu_event_new(const char *name_space, const char *name, + const char *version); /** * @brief Destroy the event object * @param[in] nev event object * @see nugu_event_new() */ -void nugu_event_free(NuguEvent *nev); +NUGU_API void nugu_event_free(NuguEvent *nev); /** * @brief Get the namespace of event * @param[in] nev event object * @return namespace. Please don't free the data manually. */ -const char *nugu_event_peek_namespace(NuguEvent *nev); +NUGU_API const char *nugu_event_peek_namespace(NuguEvent *nev); /** * @brief Get the name of event * @param[in] nev event object * @return name. Please don't free the data manually. */ -const char *nugu_event_peek_name(NuguEvent *nev); +NUGU_API const char *nugu_event_peek_name(NuguEvent *nev); /** * @brief Get the version of event * @param[in] nev event object * @return version. Please don't free the data manually. */ -const char *nugu_event_peek_version(NuguEvent *nev); +NUGU_API const char *nugu_event_peek_version(NuguEvent *nev); /** * @brief Get the message-id of event * @param[in] nev event object * @return message-id. Please don't free the data manually. */ -const char *nugu_event_peek_msg_id(NuguEvent *nev); +NUGU_API const char *nugu_event_peek_msg_id(NuguEvent *nev); /** * @brief Set text context of event @@ -110,14 +112,14 @@ const char *nugu_event_peek_msg_id(NuguEvent *nev); * @retval 0 success * @retval -1 failure */ -int nugu_event_set_context(NuguEvent *nev, const char *context); +NUGU_API int nugu_event_set_context(NuguEvent *nev, const char *context); /** * @brief Get the context of event * @param[in] nev event object * @return context. Please don't free the data manually. */ -const char *nugu_event_peek_context(NuguEvent *nev); +NUGU_API const char *nugu_event_peek_context(NuguEvent *nev); /** * @brief Set the payload of event @@ -127,14 +129,14 @@ const char *nugu_event_peek_context(NuguEvent *nev); * @retval 0 success * @retval -1 failure */ -int nugu_event_set_json(NuguEvent *nev, const char *json); +NUGU_API int nugu_event_set_json(NuguEvent *nev, const char *json); /** * @brief Get the payload of event * @param[in] nev event object * @return json type payload. Please don't free the data manually. */ -const char *nugu_event_peek_json(NuguEvent *nev); +NUGU_API const char *nugu_event_peek_json(NuguEvent *nev); /** * @brief Set the dialog-request-id of event @@ -144,14 +146,14 @@ const char *nugu_event_peek_json(NuguEvent *nev); * @retval 0 success * @retval -1 failure */ -int nugu_event_set_dialog_id(NuguEvent *nev, const char *dialog_id); +NUGU_API int nugu_event_set_dialog_id(NuguEvent *nev, const char *dialog_id); /** * @brief Get the dialog-request-id of event * @param[in] nev event object * @return dialog-request-id. Please don't free the data manually. */ -const char *nugu_event_peek_dialog_id(NuguEvent *nev); +NUGU_API const char *nugu_event_peek_dialog_id(NuguEvent *nev); /** * @brief Set the referer-dialog-request-id of event @@ -161,14 +163,15 @@ const char *nugu_event_peek_dialog_id(NuguEvent *nev); * @retval 0 success * @retval -1 failure */ -int nugu_event_set_referrer_id(NuguEvent *nev, const char *referrer_id); +NUGU_API int nugu_event_set_referrer_id(NuguEvent *nev, + const char *referrer_id); /** * @brief Get the referer-dialog-request-id of event * @param[in] nev event object * @return referrer-dialog-request-id. Please don't free the data manually. */ -const char *nugu_event_peek_referrer_id(NuguEvent *nev); +NUGU_API const char *nugu_event_peek_referrer_id(NuguEvent *nev); /** * @brief Set the type of NuguEvent @@ -178,21 +181,21 @@ const char *nugu_event_peek_referrer_id(NuguEvent *nev); * @retval 0 success * @retval -1 failure */ -int nugu_event_set_type(NuguEvent *nev, enum nugu_event_type type); +NUGU_API int nugu_event_set_type(NuguEvent *nev, enum nugu_event_type type); /** * @brief Get the type of NuguEvent * @param[in] nev event object * @return type of NuguEvent */ -enum nugu_event_type nugu_event_get_type(NuguEvent *nev); +NUGU_API enum nugu_event_type nugu_event_get_type(NuguEvent *nev); /** * @brief Get the current sequence number of attachment data * @param[in] nev event object * @return sequence number */ -int nugu_event_get_seq(NuguEvent *nev); +NUGU_API int nugu_event_get_seq(NuguEvent *nev); /** * @brief Increase the sequence number @@ -201,7 +204,7 @@ int nugu_event_get_seq(NuguEvent *nev); * @retval 0 success * @retval -1 failure */ -int nugu_event_increase_seq(NuguEvent *nev); +NUGU_API int nugu_event_increase_seq(NuguEvent *nev); /** * @brief Generate JSON payload using nugu_event attributes @@ -209,7 +212,7 @@ int nugu_event_increase_seq(NuguEvent *nev); * @return memory allocated JSON string. Developer must free the data manually. * @retval NULL failure */ -char *nugu_event_generate_payload(NuguEvent *nev); +NUGU_API char *nugu_event_generate_payload(NuguEvent *nev); /** * @brief Set the attachment mime type of NuguEvent @@ -219,14 +222,14 @@ char *nugu_event_generate_payload(NuguEvent *nev); * @retval 0 success * @retval -1 failure */ -int nugu_event_set_mime_type(NuguEvent *nev, const char *type); +NUGU_API int nugu_event_set_mime_type(NuguEvent *nev, const char *type); /** * @brief Get the attachment mime type of NuguEvent * @param[in] nev event object * @return attachment type. Please don't free the data manually. */ -const char *nugu_event_peek_mime_type(NuguEvent *nev); +NUGU_API const char *nugu_event_peek_mime_type(NuguEvent *nev); /** * @} diff --git a/include/base/nugu_http.h b/include/base/nugu_http.h index 50309b92b..21dd4cda3 100644 --- a/include/base/nugu_http.h +++ b/include/base/nugu_http.h @@ -18,6 +18,7 @@ #define __NUGU_HTTP_H__ #include +#include #ifdef __cplusplus extern "C" { @@ -96,7 +97,7 @@ typedef int (*NuguHttpProgressCallback)(NuguHttpRequest *req, /** * @brief Initialize HTTP module (curl_global_init) */ -void nugu_http_init(void); +NUGU_API void nugu_http_init(void); /** * @brief Create a new HTTP host object @@ -105,42 +106,43 @@ void nugu_http_init(void); * @see nugu_http_host_free() * @see nugu_http_peek_url(); */ -NuguHttpHost *nugu_http_host_new(const char *url); +NUGU_API NuguHttpHost *nugu_http_host_new(const char *url); /** * @brief Set timeout to host * @param[in] host host object * @param[in] msecs millisecond */ -void nugu_http_host_set_timeout(NuguHttpHost *host, long msecs); +NUGU_API void nugu_http_host_set_timeout(NuguHttpHost *host, long msecs); /** * @brief Set connection timeout to host * @param[in] host host object * @param[in] msecs millisecond */ -void nugu_http_host_set_connection_timeout(NuguHttpHost *host, long msecs); +NUGU_API void nugu_http_host_set_connection_timeout(NuguHttpHost *host, + long msecs); /** * @brief Get url from HTTP host object * @param[in] host host object * @return url */ -const char *nugu_http_host_peek_url(NuguHttpHost *host); +NUGU_API const char *nugu_http_host_peek_url(NuguHttpHost *host); /** * @brief Destroy the host object * @param[in] host host object * @see nugu_http_host_new() */ -void nugu_http_host_free(NuguHttpHost *host); +NUGU_API void nugu_http_host_free(NuguHttpHost *host); /** * @brief Create a new HTTP header object * @return HTTP header object * @see nugu_http_header_free() */ -NuguHttpHeader *nugu_http_header_new(void); +NUGU_API NuguHttpHeader *nugu_http_header_new(void); /** * @brief Add a key-value string to header object @@ -152,8 +154,8 @@ NuguHttpHeader *nugu_http_header_new(void); * @retval -1 failure * @see nugu_http_header_remove() */ -int nugu_http_header_add(NuguHttpHeader *header, const char *key, - const char *value); +NUGU_API int nugu_http_header_add(NuguHttpHeader *header, const char *key, + const char *value); /** * @brief Remove a key-value string from header object @@ -164,7 +166,7 @@ int nugu_http_header_add(NuguHttpHeader *header, const char *key, * @retval -1 failure * @see nugu_http_header_add() */ -int nugu_http_header_remove(NuguHttpHeader *header, const char *key); +NUGU_API int nugu_http_header_remove(NuguHttpHeader *header, const char *key); /** * @brief Find value from header object @@ -172,7 +174,8 @@ int nugu_http_header_remove(NuguHttpHeader *header, const char *key); * @param[in] key key string * @return value string */ -const char *nugu_http_header_find(NuguHttpHeader *header, const char *key); +NUGU_API const char *nugu_http_header_find(NuguHttpHeader *header, + const char *key); /** * @brief Duplicate the http header object @@ -180,7 +183,7 @@ const char *nugu_http_header_find(NuguHttpHeader *header, const char *key); * @return duplicated new header object * @see nugu_http_header_new() */ -NuguHttpHeader *nugu_http_header_dup(const NuguHttpHeader *src_header); +NUGU_API NuguHttpHeader *nugu_http_header_dup(const NuguHttpHeader *src_header); /** * @brief Import header data from other header object @@ -190,14 +193,15 @@ NuguHttpHeader *nugu_http_header_dup(const NuguHttpHeader *src_header); * @retval 0 success * @retval -1 failure */ -int nugu_http_header_import(NuguHttpHeader *header, const NuguHttpHeader *from); +NUGU_API int nugu_http_header_import(NuguHttpHeader *header, + const NuguHttpHeader *from); /** * @brief Destroy the header object * @param[in] header header object * @see nugu_http_header_new() */ -void nugu_http_header_free(NuguHttpHeader *header); +NUGU_API void nugu_http_header_free(NuguHttpHeader *header); /** * @brief HTTP async request @@ -212,11 +216,10 @@ void nugu_http_header_free(NuguHttpHeader *header); * @return HTTP request object * @see nugu_http_request_free() */ -NuguHttpRequest *nugu_http_request(enum NuguHttpRequestType type, - NuguHttpHost *host, const char *path, - NuguHttpHeader *header, const void *body, - size_t body_len, NuguHttpCallback callback, - void *user_data); +NUGU_API NuguHttpRequest * +nugu_http_request(enum NuguHttpRequestType type, NuguHttpHost *host, + const char *path, NuguHttpHeader *header, const void *body, + size_t body_len, NuguHttpCallback callback, void *user_data); /** * @brief HTTP sync request @@ -230,10 +233,10 @@ NuguHttpRequest *nugu_http_request(enum NuguHttpRequestType type, * @see nugu_http_request_free() * @see nugu_http_request_response_get() */ -NuguHttpRequest *nugu_http_request_sync(enum NuguHttpRequestType type, - NuguHttpHost *host, const char *path, - NuguHttpHeader *header, - const void *body, size_t body_len); +NUGU_API NuguHttpRequest * +nugu_http_request_sync(enum NuguHttpRequestType type, NuguHttpHost *host, + const char *path, NuguHttpHeader *header, + const void *body, size_t body_len); /** * @brief A convenient API for HTTP GET async requests @@ -245,9 +248,10 @@ NuguHttpRequest *nugu_http_request_sync(enum NuguHttpRequestType type, * @return HTTP request object * @see nugu_http_request_free() */ -NuguHttpRequest *nugu_http_get(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, - NuguHttpCallback callback, void *user_data); +NUGU_API NuguHttpRequest *nugu_http_get(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, + NuguHttpCallback callback, + void *user_data); /** * @brief A convenient API for HTTP GET sync requests @@ -258,8 +262,9 @@ NuguHttpRequest *nugu_http_get(NuguHttpHost *host, const char *path, * @see nugu_http_request_free() * @see nugu_http_request_response_get() */ -NuguHttpRequest *nugu_http_get_sync(NuguHttpHost *host, const char *path, - NuguHttpHeader *header); +NUGU_API NuguHttpRequest *nugu_http_get_sync(NuguHttpHost *host, + const char *path, + NuguHttpHeader *header); /** * @brief A convenient API for HTTP POST async requests @@ -273,10 +278,11 @@ NuguHttpRequest *nugu_http_get_sync(NuguHttpHost *host, const char *path, * @return HTTP request object * @see nugu_http_request_free() */ -NuguHttpRequest *nugu_http_post(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, const void *body, - size_t body_len, NuguHttpCallback callback, - void *user_data); +NUGU_API NuguHttpRequest *nugu_http_post(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, + const void *body, size_t body_len, + NuguHttpCallback callback, + void *user_data); /** * @brief A convenient API for HTTP POST sync requests @@ -289,9 +295,9 @@ NuguHttpRequest *nugu_http_post(NuguHttpHost *host, const char *path, * @see nugu_http_request_free() * @see nugu_http_request_response_get() */ -NuguHttpRequest *nugu_http_post_sync(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, const void *body, - size_t body_len); +NUGU_API NuguHttpRequest * +nugu_http_post_sync(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, const void *body, size_t body_len); /** * @brief A convenient API for HTTP PUT async requests @@ -305,10 +311,11 @@ NuguHttpRequest *nugu_http_post_sync(NuguHttpHost *host, const char *path, * @return HTTP request object * @see nugu_http_request_free() */ -NuguHttpRequest *nugu_http_put(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, const void *body, - size_t body_len, NuguHttpCallback callback, - void *user_data); +NUGU_API NuguHttpRequest *nugu_http_put(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, + const void *body, size_t body_len, + NuguHttpCallback callback, + void *user_data); /** * @brief A convenient API for HTTP PUT sync requests @@ -321,9 +328,10 @@ NuguHttpRequest *nugu_http_put(NuguHttpHost *host, const char *path, * @see nugu_http_request_free() * @see nugu_http_request_response_get() */ -NuguHttpRequest *nugu_http_put_sync(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, const void *body, - size_t body_len); +NUGU_API NuguHttpRequest *nugu_http_put_sync(NuguHttpHost *host, + const char *path, + NuguHttpHeader *header, + const void *body, size_t body_len); /** * @brief A convenient API for HTTP DELETE async requests @@ -335,9 +343,10 @@ NuguHttpRequest *nugu_http_put_sync(NuguHttpHost *host, const char *path, * @return HTTP request object * @see nugu_http_request_free() */ -NuguHttpRequest *nugu_http_delete(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, - NuguHttpCallback callback, void *user_data); +NUGU_API NuguHttpRequest *nugu_http_delete(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, + NuguHttpCallback callback, + void *user_data); /** * @brief A convenient API for HTTP DELETE sync requests @@ -348,8 +357,9 @@ NuguHttpRequest *nugu_http_delete(NuguHttpHost *host, const char *path, * @see nugu_http_request_free() * @see nugu_http_request_response_get() */ -NuguHttpRequest *nugu_http_delete_sync(NuguHttpHost *host, const char *path, - NuguHttpHeader *header); +NUGU_API NuguHttpRequest *nugu_http_delete_sync(NuguHttpHost *host, + const char *path, + NuguHttpHeader *header); /** * @brief A convenient API for HTTP file download async requests @@ -363,7 +373,7 @@ NuguHttpRequest *nugu_http_delete_sync(NuguHttpHost *host, const char *path, * @return HTTP request object * @see nugu_http_request_free() */ -NuguHttpRequest * +NUGU_API NuguHttpRequest * nugu_http_download(NuguHttpHost *host, const char *path, const char *dest_path, NuguHttpHeader *header, NuguHttpCallback callback, NuguHttpProgressCallback progress_callback, void *user_data); @@ -374,7 +384,7 @@ nugu_http_download(NuguHttpHost *host, const char *path, const char *dest_path, * @see nugu_http_request() * @see nugu_http_request_sync() */ -void nugu_http_request_free(NuguHttpRequest *req); +NUGU_API void nugu_http_request_free(NuguHttpRequest *req); /** * @brief Duplicate the HTTP response object @@ -382,21 +392,22 @@ void nugu_http_request_free(NuguHttpRequest *req); * @return HTTP response object * @see nugu_http_response_free() */ -NuguHttpResponse *nugu_http_response_dup(const NuguHttpResponse *orig); +NUGU_API NuguHttpResponse *nugu_http_response_dup(const NuguHttpResponse *orig); /** * @brief Destroy the HTTP response object * @param[in] resp response object * @see nugu_http_response_dup() */ -void nugu_http_response_free(NuguHttpResponse *resp); +NUGU_API void nugu_http_response_free(NuguHttpResponse *resp); /** * @brief Get the HTTP response from request object * @param[in] req request object * @return HTTP response object */ -const NuguHttpResponse *nugu_http_request_response_get(NuguHttpRequest *req); +NUGU_API const NuguHttpResponse * +nugu_http_request_response_get(NuguHttpRequest *req); /** * @} diff --git a/include/base/nugu_log.h b/include/base/nugu_log.h index a11cfaf22..93f4a8f43 100644 --- a/include/base/nugu_log.h +++ b/include/base/nugu_log.h @@ -19,6 +19,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -218,9 +219,10 @@ enum nugu_log_module { * @see nugu_warn() * @see nugu_error() */ -void nugu_log_print(enum nugu_log_module module, enum nugu_log_level level, - const char *filename, const char *funcname, int line, - const char *format, ...); +NUGU_API void nugu_log_print(enum nugu_log_module module, + enum nugu_log_level level, const char *filename, + const char *funcname, int line, const char *format, + ...); /** * @brief Custom log hook handler @@ -241,13 +243,13 @@ typedef void (*nugu_log_handler)(enum nugu_log_module module, * @brief Set logging backend system * @see enum nugu_log_system */ -int nugu_log_set_system(enum nugu_log_system log_system); +NUGU_API int nugu_log_set_system(enum nugu_log_system log_system); /** * @brief Get logging backend system * @see enum nugu_log_system */ -enum nugu_log_system nugu_log_get_system(void); +NUGU_API enum nugu_log_system nugu_log_get_system(void); /** * @brief Set custom log handler @@ -255,35 +257,35 @@ enum nugu_log_system nugu_log_get_system(void); * @param[in] user_data The user data to be passed to the callback function * @see nugu_log_handler */ -int nugu_log_set_handler(nugu_log_handler handler, void *user_data); +NUGU_API int nugu_log_set_handler(nugu_log_handler handler, void *user_data); /** * @brief Set the additional information fields * @param[in] field_set bitmask by enum nugu_log_prefix * @see enum nugu_log_prefix */ -void nugu_log_set_prefix_fields(enum nugu_log_prefix field_set); +NUGU_API void nugu_log_set_prefix_fields(enum nugu_log_prefix field_set); /** * @brief Get the additional information fields * @return bitmask by enum nugu_log_prefix * @see enum nugu_log_prefix */ -enum nugu_log_prefix nugu_log_get_prefix_fields(void); +NUGU_API enum nugu_log_prefix nugu_log_get_prefix_fields(void); /** * @brief Set the bitset of modules * @param[in] bitset bitmask by enum nugu_log_prefix * @see enum nugu_log_module */ -void nugu_log_set_modules(unsigned int bitset); +NUGU_API void nugu_log_set_modules(unsigned int bitset); /** * @brief Get the bitset of modules * @return bitmask by enum nugu_log_module * @see enum nugu_log_module */ -unsigned int nugu_log_get_modules(void); +NUGU_API unsigned int nugu_log_get_modules(void); /** * @brief Set minimum log level(debug, info, warning, error) @@ -291,25 +293,25 @@ unsigned int nugu_log_get_modules(void); * with info, warning, and error levels are displayed. * @param[in] level log level */ -void nugu_log_set_level(enum nugu_log_level level); +NUGU_API void nugu_log_set_level(enum nugu_log_level level); /** * @brief Get log level * @return log level */ -enum nugu_log_level nugu_log_get_level(void); +NUGU_API enum nugu_log_level nugu_log_get_level(void); /** * @brief Set the maximum length of each protocol log line * @param[in] length line length. -1 means unlimited. */ -void nugu_log_set_protocol_line_limit(int length); +NUGU_API void nugu_log_set_protocol_line_limit(int length); /** * @brief Get the maximum length of each protocol log line * @return line length. -1 means unlimited. */ -int nugu_log_get_protocol_line_limit(void); +NUGU_API int nugu_log_get_protocol_line_limit(void); /** * @brief Hexdump the specific data to stderr @@ -320,9 +322,9 @@ int nugu_log_get_protocol_line_limit(void); * @param[in] footer message to be printed at the bottom of hexdump * @param[in] lineindent message to be printed at the beginning of each line */ -void nugu_hexdump(enum nugu_log_module module, const uint8_t *data, - size_t data_size, const char *header, const char *footer, - const char *lineindent); +NUGU_API void nugu_hexdump(enum nugu_log_module module, const uint8_t *data, + size_t data_size, const char *header, + const char *footer, const char *lineindent); #ifdef __cplusplus } @@ -340,9 +342,15 @@ void nugu_hexdump(enum nugu_log_module module, const uint8_t *data, * @see enum nugu_log_module * @see enum nugu_log_level */ +#ifdef _WIN32 +#define nugu_log(module, level, fmt, ...) \ + nugu_log_print(module, level, __FILENAME__, __FUNCSIG__, __LINE__, \ + fmt, ##__VA_ARGS__) +#else #define nugu_log(module, level, fmt, ...) \ nugu_log_print(module, level, __FILENAME__, __PRETTY_FUNCTION__, \ __LINE__, fmt, ##__VA_ARGS__) +#endif #ifdef CONFIG_RELEASE #define nugu_dbg(fmt, ...) diff --git a/include/base/nugu_network_manager.h b/include/base/nugu_network_manager.h index b2edaf23c..edb28751d 100644 --- a/include/base/nugu_network_manager.h +++ b/include/base/nugu_network_manager.h @@ -17,6 +17,7 @@ #ifndef __NUGU_NETWORK_MANAGER_H__ #define __NUGU_NETWORK_MANAGER_H__ +#include #include #include @@ -192,7 +193,7 @@ typedef struct nugu_network_server_policy { * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_set_status_callback( +NUGU_API int nugu_network_manager_set_status_callback( NuguNetworkManagerStatusCallback callback, void *userdata); /** @@ -203,7 +204,7 @@ int nugu_network_manager_set_status_callback( * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_set_handoff_status_callback( +NUGU_API int nugu_network_manager_set_handoff_status_callback( NuguNetworkManagerHandoffStatusCallback callback, void *userdata); /** @@ -214,7 +215,7 @@ int nugu_network_manager_set_handoff_status_callback( * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_set_event_send_notify_callback( +NUGU_API int nugu_network_manager_set_event_send_notify_callback( NuguNetworkManagerEventSendNotifyCallback callback, void *userdata); /** @@ -225,7 +226,7 @@ int nugu_network_manager_set_event_send_notify_callback( * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_set_event_data_send_notify_callback( +NUGU_API int nugu_network_manager_set_event_data_send_notify_callback( NuguNetworkManagerEventDataSendNotifyCallback callback, void *userdata); /** @@ -236,7 +237,7 @@ int nugu_network_manager_set_event_data_send_notify_callback( * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_set_event_result_callback( +NUGU_API int nugu_network_manager_set_event_result_callback( NuguNetworkManagerEventResultCallback callback, void *userdata); /** @@ -247,7 +248,7 @@ int nugu_network_manager_set_event_result_callback( * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_set_event_response_callback( +NUGU_API int nugu_network_manager_set_event_response_callback( NuguNetworkManagerEventResponseCallback callback, void *userdata); /** @@ -258,7 +259,7 @@ int nugu_network_manager_set_event_response_callback( * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_set_directive_callback( +NUGU_API int nugu_network_manager_set_directive_callback( NuguNetworkManagerDirectiveCallback callback, void *userdata); /** @@ -269,7 +270,7 @@ int nugu_network_manager_set_directive_callback( * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_set_attachment_callback( +NUGU_API int nugu_network_manager_set_attachment_callback( NuguNetworkManagerAttachmentCallback callback, void *userdata); /** @@ -280,14 +281,14 @@ int nugu_network_manager_set_attachment_callback( * @retval -1 failure * @see nugu_network_manager_get_status() */ -int nugu_network_manager_set_status(NuguNetworkStatus network_status); +NUGU_API int nugu_network_manager_set_status(NuguNetworkStatus network_status); /** * @brief Get the current network status * @return NuguNetworkStatus network status * @see nugu_network_manager_set_status() */ -NuguNetworkStatus nugu_network_manager_get_status(void); +NUGU_API NuguNetworkStatus nugu_network_manager_get_status(void); /** * @brief Send the event to server @@ -299,7 +300,7 @@ NuguNetworkStatus nugu_network_manager_get_status(void); * @see nugu_network_manager_send_event_data() * @see nugu_network_manager_force_close_event() */ -int nugu_network_manager_send_event(NuguEvent *nev); +NUGU_API int nugu_network_manager_send_event(NuguEvent *nev); /** * @brief Send the attachment data of event to server @@ -312,8 +313,9 @@ int nugu_network_manager_send_event(NuguEvent *nev); * @retval -1 failure * @see nugu_network_manager_send_event() */ -int nugu_network_manager_send_event_data(NuguEvent *nev, int is_end, - size_t length, unsigned char *data); +NUGU_API int nugu_network_manager_send_event_data(NuguEvent *nev, int is_end, + size_t length, + unsigned char *data); /** * @brief Force close the NUGU_EVENT_TYPE_WITH_ATTACHMENT type event. @@ -323,7 +325,7 @@ int nugu_network_manager_send_event_data(NuguEvent *nev, int is_end, * @retval -1 failure * @see nugu_event_set_type() */ -int nugu_network_manager_force_close_event(NuguEvent *nev); +NUGU_API int nugu_network_manager_force_close_event(NuguEvent *nev); /** * @brief Initialize the network manager @@ -331,12 +333,12 @@ int nugu_network_manager_force_close_event(NuguEvent *nev); * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_initialize(void); +NUGU_API int nugu_network_manager_initialize(void); /** * @brief De-initialize the network manager */ -void nugu_network_manager_deinitialize(void); +NUGU_API void nugu_network_manager_deinitialize(void); /** * @brief Connect to server @@ -345,7 +347,7 @@ void nugu_network_manager_deinitialize(void); * @retval -1 failure * @see nugu_network_manager_disconnect() */ -int nugu_network_manager_connect(void); +NUGU_API int nugu_network_manager_connect(void); /** * @brief Disconnect from server @@ -354,7 +356,7 @@ int nugu_network_manager_connect(void); * @retval -1 failure * @see nugu_network_manager_connect() */ -int nugu_network_manager_disconnect(void); +NUGU_API int nugu_network_manager_disconnect(void); /** * @brief Handoff the current connection to new server @@ -372,7 +374,8 @@ int nugu_network_manager_disconnect(void); * - If the handoff connection is lost, start again from the Registry step. * */ -int nugu_network_manager_handoff(const NuguNetworkServerPolicy *policy); +NUGU_API int +nugu_network_manager_handoff(const NuguNetworkServerPolicy *policy); /** * @brief Immediately disconnect the current connection and reconnect. @@ -380,7 +383,7 @@ int nugu_network_manager_handoff(const NuguNetworkServerPolicy *policy); * @retval 0 success * @retval -1 failure */ -int nugu_network_manager_reset_connection(void); +NUGU_API int nugu_network_manager_reset_connection(void); /** * @brief Set the access token value. @@ -390,14 +393,14 @@ int nugu_network_manager_reset_connection(void); * @retval -1 failure * @see nugu_network_manager_peek_token() */ -int nugu_network_manager_set_token(const char *token); +NUGU_API int nugu_network_manager_set_token(const char *token); /** * @brief Get the access token value. * @return access token value. Please do not modify the data manually. * @see nugu_network_manager_set_token() */ -const char *nugu_network_manager_peek_token(void); +NUGU_API const char *nugu_network_manager_peek_token(void); /** * @brief Set the device gateway registry url. @@ -407,14 +410,14 @@ const char *nugu_network_manager_peek_token(void); * @retval -1 failure * @see nugu_network_manager_peek_registry_url() */ -int nugu_network_manager_set_registry_url(const char *urlname); +NUGU_API int nugu_network_manager_set_registry_url(const char *urlname); /** * @brief Get the device gateway registry url. * @return gateway registry url. Please do not modify the data manually. * @see nugu_network_manager_set_registry_url() */ -const char *nugu_network_manager_peek_registry_url(void); +NUGU_API const char *nugu_network_manager_peek_registry_url(void); /** * @brief Set the HTTP header UserAgent information. @@ -425,21 +428,21 @@ const char *nugu_network_manager_peek_registry_url(void); * @retval -1 failure * @see nugu_network_manager_peek_useragent() */ -int nugu_network_manager_set_useragent(const char *app_version, - const char *additional_info); +NUGU_API int nugu_network_manager_set_useragent(const char *app_version, + const char *additional_info); /** * @brief Get the UserAgent information. * @return UserAgent information. Please do not modify the data manually. * @see nugu_network_manager_set_useragent() */ -const char *nugu_network_manager_peek_useragent(void); +NUGU_API const char *nugu_network_manager_peek_useragent(void); /** * @brief Get the last ASR event time information. * @return Last-Asr-Event-Time. Please do not modify the data manually. */ -const char *nugu_network_manager_peek_last_asr_time(void); +NUGU_API const char *nugu_network_manager_peek_last_asr_time(void); /** * @brief Set the connection type. @@ -449,14 +452,16 @@ const char *nugu_network_manager_peek_last_asr_time(void); * @retval -1 failure * @see nugu_network_manager_get_connection_type() */ -int nugu_network_manager_set_connection_type(NuguNetworkConnectionType ctype); +NUGU_API int +nugu_network_manager_set_connection_type(NuguNetworkConnectionType ctype); /** * @brief Get the connection type. * @return network connection type * @see nugu_network_manager_set_connection_type() */ -NuguNetworkConnectionType nugu_network_manager_get_connection_type(void); +NUGU_API NuguNetworkConnectionType +nugu_network_manager_get_connection_type(void); /** * @} diff --git a/include/base/nugu_pcm.h b/include/base/nugu_pcm.h index 368ab95ab..2a7f427e9 100644 --- a/include/base/nugu_pcm.h +++ b/include/base/nugu_pcm.h @@ -18,6 +18,7 @@ #define __NUGU_PCM_H__ #include +#include #include #include @@ -61,15 +62,15 @@ typedef struct _nugu_pcm_driver NuguPcmDriver; * @see nugu_pcm_driver_get_default() * @see nugu_pcm_free() */ -NuguPcm *nugu_pcm_new(const char *name, NuguPcmDriver *driver, - NuguAudioProperty property); +NUGU_API NuguPcm *nugu_pcm_new(const char *name, NuguPcmDriver *driver, + NuguAudioProperty property); /** * @brief Destroy the pcm object * @param[in] pcm pcm object * @see nugu_pcm_new() */ -void nugu_pcm_free(NuguPcm *pcm); +NUGU_API void nugu_pcm_free(NuguPcm *pcm); /** * @brief Add pcm object to managed list @@ -80,7 +81,7 @@ void nugu_pcm_free(NuguPcm *pcm); * @see nugu_pcm_remove() * @see nugu_pcm_find() */ -int nugu_pcm_add(NuguPcm *pcm); +NUGU_API int nugu_pcm_add(NuguPcm *pcm); /** * @brief Remove pcm object from managed list @@ -91,7 +92,7 @@ int nugu_pcm_add(NuguPcm *pcm); * @see nugu_pcm_add() * @see nugu_pcm_find() */ -int nugu_pcm_remove(NuguPcm *pcm); +NUGU_API int nugu_pcm_remove(NuguPcm *pcm); /** * @brief Find a pcm object by name in the managed list @@ -100,7 +101,7 @@ int nugu_pcm_remove(NuguPcm *pcm); * @see nugu_pcm_add() * @see nugu_pcm_remove() */ -NuguPcm *nugu_pcm_find(const char *name); +NUGU_API NuguPcm *nugu_pcm_find(const char *name); /** * @brief Set audio attribute @@ -110,7 +111,8 @@ NuguPcm *nugu_pcm_find(const char *name); * @retval 0 success * @retval -1 failure */ -int nugu_pcm_set_audio_attribute(NuguPcm *pcm, NuguAudioAttribute attr); +NUGU_API int nugu_pcm_set_audio_attribute(NuguPcm *pcm, + NuguAudioAttribute attr); /** * @brief Get audio attribute @@ -118,7 +120,7 @@ int nugu_pcm_set_audio_attribute(NuguPcm *pcm, NuguAudioAttribute attr); * @return audio attribute * @retval -1 failure */ -int nugu_pcm_get_audio_attribute(NuguPcm *pcm); +NUGU_API int nugu_pcm_get_audio_attribute(NuguPcm *pcm); /** * @brief Get audio attribute @@ -126,7 +128,7 @@ int nugu_pcm_get_audio_attribute(NuguPcm *pcm); * @return audio attribute string * @retval NULL failure */ -const char *nugu_pcm_get_audio_attribute_str(NuguPcm *pcm); +NUGU_API const char *nugu_pcm_get_audio_attribute_str(NuguPcm *pcm); /** * @brief Start pcm playback @@ -136,7 +138,7 @@ const char *nugu_pcm_get_audio_attribute_str(NuguPcm *pcm); * @retval -1 failure * @see nugu_pcm_stop() */ -int nugu_pcm_start(NuguPcm *pcm); +NUGU_API int nugu_pcm_start(NuguPcm *pcm); /** * @brief Stop pcm playback @@ -146,7 +148,7 @@ int nugu_pcm_start(NuguPcm *pcm); * @retval -1 failure * @see nugu_pcm_start() */ -int nugu_pcm_stop(NuguPcm *pcm); +NUGU_API int nugu_pcm_stop(NuguPcm *pcm); /** * @brief Pause pcm playback @@ -156,7 +158,7 @@ int nugu_pcm_stop(NuguPcm *pcm); * @retval -1 failure * @see nugu_pcm_resume() */ -int nugu_pcm_pause(NuguPcm *pcm); +NUGU_API int nugu_pcm_pause(NuguPcm *pcm); /** * @brief Resume pcm playback @@ -166,7 +168,7 @@ int nugu_pcm_pause(NuguPcm *pcm); * @retval -1 failure * @see nugu_pcm_pause() */ -int nugu_pcm_resume(NuguPcm *pcm); +NUGU_API int nugu_pcm_resume(NuguPcm *pcm); /** * @brief Set volume of pcm @@ -177,7 +179,7 @@ int nugu_pcm_resume(NuguPcm *pcm); * @retval -1 failure * @see nugu_pcm_get_volume() */ -int nugu_pcm_set_volume(NuguPcm *pcm, int volume); +NUGU_API int nugu_pcm_set_volume(NuguPcm *pcm, int volume); /** * @brief Get volume of pcm @@ -187,7 +189,7 @@ int nugu_pcm_set_volume(NuguPcm *pcm, int volume); * @retval -1 failure * @see nugu_pcm_set_volume() */ -int nugu_pcm_get_volume(NuguPcm *pcm); +NUGU_API int nugu_pcm_get_volume(NuguPcm *pcm); /** * @brief Get duration information of pcm @@ -196,7 +198,7 @@ int nugu_pcm_get_volume(NuguPcm *pcm); * @retval >0 success (duration) * @retval -1 failure */ -int nugu_pcm_get_duration(NuguPcm *pcm); +NUGU_API int nugu_pcm_get_duration(NuguPcm *pcm); /** * @brief Get current playback position of pcm @@ -205,14 +207,14 @@ int nugu_pcm_get_duration(NuguPcm *pcm); * @retval >0 success (position) * @retval -1 failure */ -int nugu_pcm_get_position(NuguPcm *pcm); +NUGU_API int nugu_pcm_get_position(NuguPcm *pcm); /** * @brief Get status of pcm * @param[in] pcm pcm object * @return status */ -enum nugu_media_status nugu_pcm_get_status(NuguPcm *pcm); +NUGU_API enum nugu_media_status nugu_pcm_get_status(NuguPcm *pcm); /** * @brief Set pcm status callback @@ -220,15 +222,16 @@ enum nugu_media_status nugu_pcm_get_status(NuguPcm *pcm); * @param[in] cb callback function * @param[in] userdata data to pass to the user callback */ -void nugu_pcm_set_status_callback(NuguPcm *pcm, NuguMediaStatusCallback cb, - void *userdata); +NUGU_API void nugu_pcm_set_status_callback(NuguPcm *pcm, + NuguMediaStatusCallback cb, + void *userdata); /** * @brief Emit status to registered callback * @param[in] pcm pcm object * @param[in] status pcm status */ -void nugu_pcm_emit_status(NuguPcm *pcm, enum nugu_media_status status); +NUGU_API void nugu_pcm_emit_status(NuguPcm *pcm, enum nugu_media_status status); /** * @brief Set pcm event callback @@ -236,15 +239,16 @@ void nugu_pcm_emit_status(NuguPcm *pcm, enum nugu_media_status status); * @param[in] cb callback function * @param[in] userdata data to pass to the user callback */ -void nugu_pcm_set_event_callback(NuguPcm *pcm, NuguMediaEventCallback cb, - void *userdata); +NUGU_API void nugu_pcm_set_event_callback(NuguPcm *pcm, + NuguMediaEventCallback cb, + void *userdata); /** * @brief Emit event to registered callback * @param[in] pcm pcm object * @param[in] event pcm event */ -void nugu_pcm_emit_event(NuguPcm *pcm, enum nugu_media_event event); +NUGU_API void nugu_pcm_emit_event(NuguPcm *pcm, enum nugu_media_event event); /** * @brief Set custom data for driver @@ -255,7 +259,7 @@ void nugu_pcm_emit_event(NuguPcm *pcm, enum nugu_media_event event); * @retval -1 failure * @see nugu_pcm_get_driver_data() */ -int nugu_pcm_set_driver_data(NuguPcm *pcm, void *data); +NUGU_API int nugu_pcm_set_driver_data(NuguPcm *pcm, void *data); /** * @brief Get custom data for driver @@ -263,13 +267,13 @@ int nugu_pcm_set_driver_data(NuguPcm *pcm, void *data); * @return data * @see nugu_pcm_set_driver_data() */ -void *nugu_pcm_get_driver_data(NuguPcm *pcm); +NUGU_API void *nugu_pcm_get_driver_data(NuguPcm *pcm); /** * @brief Clear pcm buffer * @param[in] pcm pcm object */ -void nugu_pcm_clear_buffer(NuguPcm *pcm); +NUGU_API void nugu_pcm_clear_buffer(NuguPcm *pcm); /** * @brief Push playback pcm data @@ -281,8 +285,8 @@ void nugu_pcm_clear_buffer(NuguPcm *pcm); * @retval 0 success * @retval -1 failure */ -int nugu_pcm_push_data(NuguPcm *pcm, const char *data, size_t size, - int is_last); +NUGU_API int nugu_pcm_push_data(NuguPcm *pcm, const char *data, size_t size, + int is_last); /** * @brief Set flag that push for all data is complete. @@ -292,7 +296,7 @@ int nugu_pcm_push_data(NuguPcm *pcm, const char *data, size_t size, * @retval -1 failure * @see nugu_pcm_receive_is_last_data() */ -int nugu_pcm_push_data_done(NuguPcm *pcm); +NUGU_API int nugu_pcm_push_data_done(NuguPcm *pcm); /** * @brief Get all data @@ -303,14 +307,14 @@ int nugu_pcm_push_data_done(NuguPcm *pcm); * @retval 0 success * @retval -1 failure */ -int nugu_pcm_get_data(NuguPcm *pcm, char *data, size_t size); +NUGU_API int nugu_pcm_get_data(NuguPcm *pcm, char *data, size_t size); /** * @brief Get pcm data size * @param[in] pcm pcm object * @return size of pcm data */ -size_t nugu_pcm_get_data_size(NuguPcm *pcm); +NUGU_API size_t nugu_pcm_get_data_size(NuguPcm *pcm); /** * @brief Get flag that all data pushes are complete. @@ -320,7 +324,7 @@ size_t nugu_pcm_get_data_size(NuguPcm *pcm); * @retval -1 failure * @see nugu_pcm_push_data_done() */ -int nugu_pcm_receive_is_last_data(NuguPcm *pcm); +NUGU_API int nugu_pcm_receive_is_last_data(NuguPcm *pcm); /** * @} @@ -405,8 +409,8 @@ struct nugu_pcm_driver_ops { * @return pcm driver object * @see nugu_pcm_driver_free() */ -NuguPcmDriver *nugu_pcm_driver_new(const char *name, - struct nugu_pcm_driver_ops *ops); +NUGU_API NuguPcmDriver *nugu_pcm_driver_new(const char *name, + struct nugu_pcm_driver_ops *ops); /** * @brief Destroy the pcm driver object @@ -416,7 +420,7 @@ NuguPcmDriver *nugu_pcm_driver_new(const char *name, * @retval -1 failure * @see nugu_pcm_driver_new() */ -int nugu_pcm_driver_free(NuguPcmDriver *driver); +NUGU_API int nugu_pcm_driver_free(NuguPcmDriver *driver); /** * @brief Register the driver to driver list @@ -426,7 +430,7 @@ int nugu_pcm_driver_free(NuguPcmDriver *driver); * @retval -1 failure * @see nugu_pcm_driver_remove() */ -int nugu_pcm_driver_register(NuguPcmDriver *driver); +NUGU_API int nugu_pcm_driver_register(NuguPcmDriver *driver); /** * @brief Remove the driver from driver list @@ -436,7 +440,7 @@ int nugu_pcm_driver_register(NuguPcmDriver *driver); * @retval -1 failure * @see nugu_pcm_driver_register() */ -int nugu_pcm_driver_remove(NuguPcmDriver *driver); +NUGU_API int nugu_pcm_driver_remove(NuguPcmDriver *driver); /** * @brief Set the default pcm driver @@ -446,21 +450,21 @@ int nugu_pcm_driver_remove(NuguPcmDriver *driver); * @retval -1 failure * @see nugu_pcm_driver_get_default() */ -int nugu_pcm_driver_set_default(NuguPcmDriver *driver); +NUGU_API int nugu_pcm_driver_set_default(NuguPcmDriver *driver); /** * @brief Get the default pcm driver * @return pcm driver * @see nugu_pcm_driver_set_default() */ -NuguPcmDriver *nugu_pcm_driver_get_default(void); +NUGU_API NuguPcmDriver *nugu_pcm_driver_get_default(void); /** * @brief Find a driver by name in the driver list * @param[in] name pcm driver name * @return pcm driver */ -NuguPcmDriver *nugu_pcm_driver_find(const char *name); +NUGU_API NuguPcmDriver *nugu_pcm_driver_find(const char *name); /** * @} diff --git a/include/base/nugu_player.h b/include/base/nugu_player.h index 748ff7018..3788a56c9 100644 --- a/include/base/nugu_player.h +++ b/include/base/nugu_player.h @@ -17,6 +17,7 @@ #ifndef __NUGU_PLAYER_H__ #define __NUGU_PLAYER_H__ +#include #include #include @@ -57,14 +58,15 @@ typedef struct _nugu_player_driver NuguPlayerDriver; * @return player object * @see nugu_player_free() */ -NuguPlayer *nugu_player_new(const char *name, NuguPlayerDriver *driver); +NUGU_API NuguPlayer *nugu_player_new(const char *name, + NuguPlayerDriver *driver); /** * @brief Destroy the player object * @param[in] player player object * @see nugu_player_new() */ -void nugu_player_free(NuguPlayer *player); +NUGU_API void nugu_player_free(NuguPlayer *player); /** * @brief Add player object to managed list @@ -75,7 +77,7 @@ void nugu_player_free(NuguPlayer *player); * @see nugu_player_find() * @see nugu_player_remove() */ -int nugu_player_add(NuguPlayer *player); +NUGU_API int nugu_player_add(NuguPlayer *player); /** * @brief Remove player object from managed list @@ -86,7 +88,7 @@ int nugu_player_add(NuguPlayer *player); * @see nugu_player_find() * @see nugu_player_add() */ -int nugu_player_remove(NuguPlayer *player); +NUGU_API int nugu_player_remove(NuguPlayer *player); /** * @brief Find a player object by name in the managed list @@ -95,7 +97,7 @@ int nugu_player_remove(NuguPlayer *player); * @see nugu_player_add() * @see nugu_player_remove() */ -NuguPlayer *nugu_player_find(const char *name); +NUGU_API NuguPlayer *nugu_player_find(const char *name); /** * @brief Set audio attribute @@ -105,8 +107,8 @@ NuguPlayer *nugu_player_find(const char *name); * @retval 0 success * @retval -1 failure */ -int nugu_player_set_audio_attribute(NuguPlayer *player, - NuguAudioAttribute attr); +NUGU_API int nugu_player_set_audio_attribute(NuguPlayer *player, + NuguAudioAttribute attr); /** * @brief Get audio attribute @@ -114,7 +116,7 @@ int nugu_player_set_audio_attribute(NuguPlayer *player, * @return audio attribute * @retval NULL -1 */ -int nugu_player_get_audio_attribute(NuguPlayer *player); +NUGU_API int nugu_player_get_audio_attribute(NuguPlayer *player); /** * @brief Get audio attribute @@ -122,7 +124,7 @@ int nugu_player_get_audio_attribute(NuguPlayer *player); * @return audio attribute string * @retval NULL failure */ -const char *nugu_player_get_audio_attribute_str(NuguPlayer *player); +NUGU_API const char *nugu_player_get_audio_attribute_str(NuguPlayer *player); /** * @brief Set source url @@ -132,7 +134,7 @@ const char *nugu_player_get_audio_attribute_str(NuguPlayer *player); * @retval 0 success * @retval -1 failure */ -int nugu_player_set_source(NuguPlayer *player, const char *url); +NUGU_API int nugu_player_set_source(NuguPlayer *player, const char *url); /** * @brief Start the player @@ -143,7 +145,7 @@ int nugu_player_set_source(NuguPlayer *player, const char *url); * @see nugu_player_stop() * @see nugu_player_pause() */ -int nugu_player_start(NuguPlayer *player); +NUGU_API int nugu_player_start(NuguPlayer *player); /** * @brief Stop the player @@ -153,7 +155,7 @@ int nugu_player_start(NuguPlayer *player); * @retval -1 failure * @see nugu_player_start() */ -int nugu_player_stop(NuguPlayer *player); +NUGU_API int nugu_player_stop(NuguPlayer *player); /** * @brief Pause the player @@ -163,7 +165,7 @@ int nugu_player_stop(NuguPlayer *player); * @retval -1 failure * @see nugu_player_resume() */ -int nugu_player_pause(NuguPlayer *player); +NUGU_API int nugu_player_pause(NuguPlayer *player); /** * @brief Resume the player @@ -174,7 +176,7 @@ int nugu_player_pause(NuguPlayer *player); * @see nugu_player_pause() * @see nugu_player_stop() */ -int nugu_player_resume(NuguPlayer *player); +NUGU_API int nugu_player_resume(NuguPlayer *player); /** * @brief Seek the player @@ -184,7 +186,7 @@ int nugu_player_resume(NuguPlayer *player); * @retval 0 success * @retval -1 failure */ -int nugu_player_seek(NuguPlayer *player, int sec); +NUGU_API int nugu_player_seek(NuguPlayer *player, int sec); /** * @brief Set volume of player @@ -195,7 +197,7 @@ int nugu_player_seek(NuguPlayer *player, int sec); * @retval -1 failure * @see nugu_player_get_volume() */ -int nugu_player_set_volume(NuguPlayer *player, int vol); +NUGU_API int nugu_player_set_volume(NuguPlayer *player, int vol); /** * @brief Get volume of player @@ -205,7 +207,7 @@ int nugu_player_set_volume(NuguPlayer *player, int vol); * @retval -1 failure * @see nugu_player_set_volume() */ -int nugu_player_get_volume(NuguPlayer *player); +NUGU_API int nugu_player_get_volume(NuguPlayer *player); /** * @brief Get duration information of player @@ -214,7 +216,7 @@ int nugu_player_get_volume(NuguPlayer *player); * @retval >0 success (duration) * @retval -1 failure */ -int nugu_player_get_duration(NuguPlayer *player); +NUGU_API int nugu_player_get_duration(NuguPlayer *player); /** * @brief Set current playback position of player @@ -224,7 +226,7 @@ int nugu_player_get_duration(NuguPlayer *player); * @retval 0 success * @retval -1 failure */ -int nugu_player_set_position(NuguPlayer *player, int position); +NUGU_API int nugu_player_set_position(NuguPlayer *player, int position); /** * @brief Get current playback position of player @@ -233,14 +235,14 @@ int nugu_player_set_position(NuguPlayer *player, int position); * @retval >0 success (position) * @retval -1 failure */ -int nugu_player_get_position(NuguPlayer *player); +NUGU_API int nugu_player_get_position(NuguPlayer *player); /** * @brief Get status of player * @param[in] player player object * @return status */ -enum nugu_media_status nugu_player_get_status(NuguPlayer *player); +NUGU_API enum nugu_media_status nugu_player_get_status(NuguPlayer *player); /** * @brief Set player status callback @@ -248,16 +250,17 @@ enum nugu_media_status nugu_player_get_status(NuguPlayer *player); * @param[in] cb callback function * @param[in] userdata data to pass to the user callback */ -void nugu_player_set_status_callback(NuguPlayer *player, - NuguMediaStatusCallback cb, - void *userdata); +NUGU_API void nugu_player_set_status_callback(NuguPlayer *player, + NuguMediaStatusCallback cb, + void *userdata); /** * @brief Emit status to registered callback * @param[in] player player object * @param[in] status player status */ -void nugu_player_emit_status(NuguPlayer *player, enum nugu_media_status status); +NUGU_API void nugu_player_emit_status(NuguPlayer *player, + enum nugu_media_status status); /** * @brief Set player event callback @@ -265,15 +268,17 @@ void nugu_player_emit_status(NuguPlayer *player, enum nugu_media_status status); * @param[in] cb callback function * @param[in] userdata data to pass to the user callback */ -void nugu_player_set_event_callback(NuguPlayer *player, - NuguMediaEventCallback cb, void *userdata); +NUGU_API void nugu_player_set_event_callback(NuguPlayer *player, + NuguMediaEventCallback cb, + void *userdata); /** * @brief Emit event to registered callback * @param[in] player player object * @param[in] event player event */ -void nugu_player_emit_event(NuguPlayer *player, enum nugu_media_event event); +NUGU_API void nugu_player_emit_event(NuguPlayer *player, + enum nugu_media_event event); /** * @brief Set custom data for driver @@ -284,7 +289,7 @@ void nugu_player_emit_event(NuguPlayer *player, enum nugu_media_event event); * @retval -1 failure * @see nugu_player_get_driver_data() */ -int nugu_player_set_driver_data(NuguPlayer *player, void *data); +NUGU_API int nugu_player_set_driver_data(NuguPlayer *player, void *data); /** * @brief Get custom data for driver @@ -292,7 +297,7 @@ int nugu_player_set_driver_data(NuguPlayer *player, void *data); * @return data * @see nugu_player_set_driver_data() */ -void *nugu_player_get_driver_data(NuguPlayer *player); +NUGU_API void *nugu_player_get_driver_data(NuguPlayer *player); /** * @} @@ -389,8 +394,8 @@ struct nugu_player_driver_ops { * @param[in] ops operation table * @return player driver object */ -NuguPlayerDriver *nugu_player_driver_new(const char *name, - struct nugu_player_driver_ops *ops); +NUGU_API NuguPlayerDriver * +nugu_player_driver_new(const char *name, struct nugu_player_driver_ops *ops); /** * @brief Destroy the player driver object @@ -399,7 +404,7 @@ NuguPlayerDriver *nugu_player_driver_new(const char *name, * @retval 0 success * @retval -1 failure */ -int nugu_player_driver_free(NuguPlayerDriver *driver); +NUGU_API int nugu_player_driver_free(NuguPlayerDriver *driver); /** * @brief Register the driver to driver list @@ -408,7 +413,7 @@ int nugu_player_driver_free(NuguPlayerDriver *driver); * @retval 0 success * @retval -1 failure */ -int nugu_player_driver_register(NuguPlayerDriver *driver); +NUGU_API int nugu_player_driver_register(NuguPlayerDriver *driver); /** * @brief Remove the driver from driver list @@ -417,7 +422,7 @@ int nugu_player_driver_register(NuguPlayerDriver *driver); * @retval 0 success * @retval -1 failure */ -int nugu_player_driver_remove(NuguPlayerDriver *driver); +NUGU_API int nugu_player_driver_remove(NuguPlayerDriver *driver); /** * @brief Set the default player driver @@ -426,20 +431,20 @@ int nugu_player_driver_remove(NuguPlayerDriver *driver); * @retval 0 success * @retval -1 failure */ -int nugu_player_driver_set_default(NuguPlayerDriver *driver); +NUGU_API int nugu_player_driver_set_default(NuguPlayerDriver *driver); /** * @brief Get the default player driver * @return player driver */ -NuguPlayerDriver *nugu_player_driver_get_default(void); +NUGU_API NuguPlayerDriver *nugu_player_driver_get_default(void); /** * @brief Find a driver by name in the driver list * @param[in] name player driver name * @return player driver */ -NuguPlayerDriver *nugu_player_driver_find(const char *name); +NUGU_API NuguPlayerDriver *nugu_player_driver_find(const char *name); /** * @} diff --git a/include/base/nugu_plugin.h b/include/base/nugu_plugin.h index 70621d205..8a7e2144e 100644 --- a/include/base/nugu_plugin.h +++ b/include/base/nugu_plugin.h @@ -17,6 +17,8 @@ #ifndef __NUGU_PLUGIN_H__ #define __NUGU_PLUGIN_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -60,22 +62,24 @@ extern "C" { */ #ifdef NUGU_PLUGIN_BUILTIN #define NUGU_PLUGIN_DEFINE(p_name, p_prio, p_ver, p_load, p_unload, p_init) \ - __attribute__((visibility("default"))) struct nugu_plugin_desc \ - _builtin_plugin_##p_name = { .name = #p_name, \ - .priority = p_prio, \ - .version = p_ver, \ - .load = p_load, \ - .unload = p_unload, \ - .init = p_init } + NUGU_API_EXPORT struct nugu_plugin_desc _builtin_plugin_##p_name = { \ + .name = #p_name, \ + .priority = p_prio, \ + .version = p_ver, \ + .load = p_load, \ + .unload = p_unload, \ + .init = p_init \ + } #else #define NUGU_PLUGIN_DEFINE(p_name, p_prio, p_ver, p_load, p_unload, p_init) \ - __attribute__((visibility("default"))) struct nugu_plugin_desc \ - nugu_plugin_define_desc = { .name = #p_name, \ - .priority = p_prio, \ - .version = p_ver, \ - .load = p_load, \ - .unload = p_unload, \ - .init = p_init } + NUGU_API_EXPORT struct nugu_plugin_desc nugu_plugin_define_desc = { \ + .name = #p_name, \ + .priority = p_prio, \ + .version = p_ver, \ + .load = p_load, \ + .unload = p_unload, \ + .init = p_init \ + } #endif /** @@ -126,7 +130,7 @@ struct nugu_plugin_desc { * @see nugu_plugin_new_from_file() * @see nugu_plugin_free() */ -NuguPlugin *nugu_plugin_new(struct nugu_plugin_desc *desc); +NUGU_API NuguPlugin *nugu_plugin_new(struct nugu_plugin_desc *desc); /** * @brief Create new plugin object from file @@ -135,13 +139,13 @@ NuguPlugin *nugu_plugin_new(struct nugu_plugin_desc *desc); * @see nugu_plugin_new() * @see nugu_plugin_free() */ -NuguPlugin *nugu_plugin_new_from_file(const char *filepath); +NUGU_API NuguPlugin *nugu_plugin_new_from_file(const char *filepath); /** * @brief Destroy the plugin * @param[in] p plugin object */ -void nugu_plugin_free(NuguPlugin *p); +NUGU_API void nugu_plugin_free(NuguPlugin *p); /** * @brief Add the plugin to managed list @@ -153,7 +157,7 @@ void nugu_plugin_free(NuguPlugin *p); * @see nugu_plugin_find() * @see nugu_plugin_remove() */ -int nugu_plugin_add(NuguPlugin *p); +NUGU_API int nugu_plugin_add(NuguPlugin *p); /** * @brief Remove the plugin to managed list @@ -164,7 +168,7 @@ int nugu_plugin_add(NuguPlugin *p); * @see nugu_plugin_add() * @see nugu_plugin_find() */ -int nugu_plugin_remove(NuguPlugin *p); +NUGU_API int nugu_plugin_remove(NuguPlugin *p); /** * @brief Find a plugin by name in the managed list @@ -173,7 +177,7 @@ int nugu_plugin_remove(NuguPlugin *p); * @see nugu_plugin_add() * @see nugu_plugin_remove() */ -NuguPlugin *nugu_plugin_find(const char *name); +NUGU_API NuguPlugin *nugu_plugin_find(const char *name); /** * @brief Set private data to plugin @@ -184,7 +188,7 @@ NuguPlugin *nugu_plugin_find(const char *name); * @retval -1 failure * @see nugu_plugin_get_data() */ -int nugu_plugin_set_data(NuguPlugin *p, void *data); +NUGU_API int nugu_plugin_set_data(NuguPlugin *p, void *data); /** * @brief Get private data from plugin @@ -192,7 +196,7 @@ int nugu_plugin_set_data(NuguPlugin *p, void *data); * @return data * @see nugu_plugin_set_data() */ -void *nugu_plugin_get_data(NuguPlugin *p); +NUGU_API void *nugu_plugin_get_data(NuguPlugin *p); /** * @brief Get dlsym result from plugin @@ -200,14 +204,15 @@ void *nugu_plugin_get_data(NuguPlugin *p); * @param[in] symbol_name symbol name to find * @return symbol address */ -void *nugu_plugin_get_symbol(NuguPlugin *p, const char *symbol_name); +NUGU_API void *nugu_plugin_get_symbol(NuguPlugin *p, const char *symbol_name); /** * @brief Get the plugin description * @param[in] p plugin object * @return plugin description */ -const struct nugu_plugin_desc *nugu_plugin_get_description(NuguPlugin *p); +NUGU_API const struct nugu_plugin_desc * +nugu_plugin_get_description(NuguPlugin *p); /** * @brief Load all plugin files from directory @@ -215,25 +220,25 @@ const struct nugu_plugin_desc *nugu_plugin_get_description(NuguPlugin *p); * @return Number of plugins loaded * @retval -1 failure */ -int nugu_plugin_load_directory(const char *dirpath); +NUGU_API int nugu_plugin_load_directory(const char *dirpath); /** * @brief Load all built-in plugins * @return Number of plugins loaded * @retval -1 failure */ -int nugu_plugin_load_builtin(void); +NUGU_API int nugu_plugin_load_builtin(void); /** * @brief Initialize plugin * @return Number of plugins initialized */ -int nugu_plugin_initialize(void); +NUGU_API int nugu_plugin_initialize(void); /** * @brief De-initialize plugin */ -void nugu_plugin_deinitialize(void); +NUGU_API void nugu_plugin_deinitialize(void); /** * @} diff --git a/include/base/nugu_prof.h b/include/base/nugu_prof.h index e2d5a8abc..50b0323b9 100644 --- a/include/base/nugu_prof.h +++ b/include/base/nugu_prof.h @@ -17,6 +17,7 @@ #ifndef __NUGU_PROF_H__ #define __NUGU_PROF_H__ +#include #include #ifdef __cplusplus @@ -216,24 +217,24 @@ typedef void (*NuguProfCallback)(enum nugu_prof_type type, /** * @brief clear all cached profiling data */ -void nugu_prof_clear(void); +NUGU_API void nugu_prof_clear(void); /** * @brief turn on the profiling trace log message */ -void nugu_prof_enable_tracelog(void); +NUGU_API void nugu_prof_enable_tracelog(void); /** * @brief turn off the profiling trace log message */ -void nugu_prof_disable_tracelog(void); +NUGU_API void nugu_prof_disable_tracelog(void); /** * @brief Set profiling callback * @param[in] callback callback function * @param[in] userdata data to pass to the user callback */ -void nugu_prof_set_callback(NuguProfCallback callback, void *userdata); +NUGU_API void nugu_prof_set_callback(NuguProfCallback callback, void *userdata); /** * @brief Marking to profiling data and emit the callback @@ -242,7 +243,7 @@ void nugu_prof_set_callback(NuguProfCallback callback, void *userdata); * @retval 0 success * @retval -1 failure */ -int nugu_prof_mark(enum nugu_prof_type type); +NUGU_API int nugu_prof_mark(enum nugu_prof_type type); /** * @brief Marking to profiling data with additional id and emit the callback @@ -254,15 +255,17 @@ int nugu_prof_mark(enum nugu_prof_type type); * @retval 0 success * @retval -1 failure */ -int nugu_prof_mark_data(enum nugu_prof_type type, const char *dialog_id, - const char *msg_id, const char *contents); +NUGU_API int nugu_prof_mark_data(enum nugu_prof_type type, + const char *dialog_id, const char *msg_id, + const char *contents); /** * @brief Get last cached data by profiling type * @param[in] type profiling type * @return memory allocated nugu_prof_data struct. developer must free the data. */ -struct nugu_prof_data *nugu_prof_get_last_data(enum nugu_prof_type type); +NUGU_API struct nugu_prof_data * +nugu_prof_get_last_data(enum nugu_prof_type type); /** * @brief Get the time difference(ts2 - ts1) value in milliseconds @@ -270,8 +273,8 @@ struct nugu_prof_data *nugu_prof_get_last_data(enum nugu_prof_type type); * @param[in] ts2 time value * @return milliseconds */ -int nugu_prof_get_diff_msec_timespec(const struct timespec *ts1, - const struct timespec *ts2); +NUGU_API int nugu_prof_get_diff_msec_timespec(const struct timespec *ts1, + const struct timespec *ts2); /** * @brief Get the time difference(ts2 - ts1) value in milliseconds @@ -279,8 +282,8 @@ int nugu_prof_get_diff_msec_timespec(const struct timespec *ts1, * @param[in] type2 profiling type * @return milliseconds */ -int nugu_prof_get_diff_msec_type(enum nugu_prof_type type1, - enum nugu_prof_type type2); +NUGU_API int nugu_prof_get_diff_msec_type(enum nugu_prof_type type1, + enum nugu_prof_type type2); /** * @brief Get the time difference(prof2 - prof1) value in milliseconds @@ -288,22 +291,22 @@ int nugu_prof_get_diff_msec_type(enum nugu_prof_type type1, * @param[in] prof2 time value * @return milliseconds */ -int nugu_prof_get_diff_msec(const struct nugu_prof_data *prof1, - const struct nugu_prof_data *prof2); +NUGU_API int nugu_prof_get_diff_msec(const struct nugu_prof_data *prof1, + const struct nugu_prof_data *prof2); /** * @brief Get string type name for profiling type * @param[in] type profiling type * @return NULL terminated string */ -const char *nugu_prof_get_type_name(enum nugu_prof_type type); +NUGU_API const char *nugu_prof_get_type_name(enum nugu_prof_type type); /** * @brief Dump the profiling data between 'from' type to 'to' type * @param[in] from start type to dump * @param[in] to end type to dump */ -void nugu_prof_dump(enum nugu_prof_type from, enum nugu_prof_type to); +NUGU_API void nugu_prof_dump(enum nugu_prof_type from, enum nugu_prof_type to); /** * @} diff --git a/include/base/nugu_recorder.h b/include/base/nugu_recorder.h index a228e28e7..f2d8d5a84 100644 --- a/include/base/nugu_recorder.h +++ b/include/base/nugu_recorder.h @@ -17,6 +17,7 @@ #ifndef __NUGU_RECORDER_H__ #define __NUGU_RECORDER_H__ +#include #include #ifdef __cplusplus @@ -72,14 +73,15 @@ typedef struct _nugu_recorder_driver NuguRecorderDriver; * @return recorder object * @see nugu_recorder_free() */ -NuguRecorder *nugu_recorder_new(const char *name, NuguRecorderDriver *driver); +NUGU_API NuguRecorder *nugu_recorder_new(const char *name, + NuguRecorderDriver *driver); /** * @brief Destroy the recorder object * @param[in] rec recorder object * @see nugu_recorder_new() */ -void nugu_recorder_free(NuguRecorder *rec); +NUGU_API void nugu_recorder_free(NuguRecorder *rec); /** * @brief Add recorder object to managed list @@ -90,7 +92,7 @@ void nugu_recorder_free(NuguRecorder *rec); * @see nugu_recorder_remove() * @see nugu_recorder_find() */ -int nugu_recorder_add(NuguRecorder *rec); +NUGU_API int nugu_recorder_add(NuguRecorder *rec); /** * @brief Remove recorder object from managed list @@ -99,7 +101,7 @@ int nugu_recorder_add(NuguRecorder *rec); * @retval 0 success * @retval -1 failure */ -int nugu_recorder_remove(NuguRecorder *rec); +NUGU_API int nugu_recorder_remove(NuguRecorder *rec); /** * @brief Find a recorder object by name in the managed list @@ -108,7 +110,7 @@ int nugu_recorder_remove(NuguRecorder *rec); * @see nugu_recorder_add() * @see nugu_recorder_remove() */ -NuguRecorder *nugu_recorder_find(const char *name); +NUGU_API NuguRecorder *nugu_recorder_find(const char *name); /** * @brief Set property to recorder object @@ -118,7 +120,8 @@ NuguRecorder *nugu_recorder_find(const char *name); * @retval 0 success * @retval -1 failure */ -int nugu_recorder_set_property(NuguRecorder *rec, NuguAudioProperty property); +NUGU_API int nugu_recorder_set_property(NuguRecorder *rec, + NuguAudioProperty property); /** * @brief Start recording @@ -128,7 +131,7 @@ int nugu_recorder_set_property(NuguRecorder *rec, NuguAudioProperty property); * @retval -1 failure * @see nugu_recorder_stop() */ -int nugu_recorder_start(NuguRecorder *rec); +NUGU_API int nugu_recorder_start(NuguRecorder *rec); /** * @brief Stop recording @@ -138,7 +141,7 @@ int nugu_recorder_start(NuguRecorder *rec); * @retval -1 failure * @see nugu_recorder_start() */ -int nugu_recorder_stop(NuguRecorder *rec); +NUGU_API int nugu_recorder_stop(NuguRecorder *rec); /** * @brief Clear recording data @@ -147,7 +150,7 @@ int nugu_recorder_stop(NuguRecorder *rec); * @retval 0 success * @retval -1 failure */ -int nugu_recorder_clear(NuguRecorder *rec); +NUGU_API int nugu_recorder_clear(NuguRecorder *rec); /** * @brief Get the status of recording @@ -157,7 +160,7 @@ int nugu_recorder_clear(NuguRecorder *rec); * @retval 1 recording * @retval -1 failure */ -int nugu_recorder_is_recording(NuguRecorder *rec); +NUGU_API int nugu_recorder_is_recording(NuguRecorder *rec); /** * @brief Set custom data for driver @@ -168,7 +171,7 @@ int nugu_recorder_is_recording(NuguRecorder *rec); * @retval -1 failure * @see nugu_recorder_get_driver_data() */ -int nugu_recorder_set_driver_data(NuguRecorder *rec, void *data); +NUGU_API int nugu_recorder_set_driver_data(NuguRecorder *rec, void *data); /** * @brief Get custom data for driver @@ -176,7 +179,7 @@ int nugu_recorder_set_driver_data(NuguRecorder *rec, void *data); * @return data * @see nugu_recorder_set_driver_data() */ -void *nugu_recorder_get_driver_data(NuguRecorder *rec); +NUGU_API void *nugu_recorder_get_driver_data(NuguRecorder *rec); /** * @brief Get frame size @@ -188,7 +191,8 @@ void *nugu_recorder_get_driver_data(NuguRecorder *rec); * @retval -1 failure * @see nugu_recorder_set_frame_size() */ -int nugu_recorder_get_frame_size(NuguRecorder *rec, int *size, int *max); +NUGU_API int nugu_recorder_get_frame_size(NuguRecorder *rec, int *size, + int *max); /** * @brief Set frame size @@ -200,7 +204,7 @@ int nugu_recorder_get_frame_size(NuguRecorder *rec, int *size, int *max); * @retval -1 failure * @see nugu_recorder_get_frame_size() */ -int nugu_recorder_set_frame_size(NuguRecorder *rec, int size, int max); +NUGU_API int nugu_recorder_set_frame_size(NuguRecorder *rec, int size, int max); /** * @brief Push recorded data @@ -211,7 +215,8 @@ int nugu_recorder_set_frame_size(NuguRecorder *rec, int size, int max); * @retval 0 success * @retval -1 failure */ -int nugu_recorder_push_frame(NuguRecorder *rec, const char *data, int size); +NUGU_API int nugu_recorder_push_frame(NuguRecorder *rec, const char *data, + int size); /** * @brief Get recorded data @@ -222,7 +227,7 @@ int nugu_recorder_push_frame(NuguRecorder *rec, const char *data, int size); * @retval 0 success * @retval -1 failure */ -int nugu_recorder_get_frame(NuguRecorder *rec, char *data, int *size); +NUGU_API int nugu_recorder_get_frame(NuguRecorder *rec, char *data, int *size); /** * @brief Get recorded data with timeout @@ -234,8 +239,8 @@ int nugu_recorder_get_frame(NuguRecorder *rec, char *data, int *size); * @retval 0 success * @retval -1 failure */ -int nugu_recorder_get_frame_timeout(NuguRecorder *rec, char *data, int *size, - int timeout); +NUGU_API int nugu_recorder_get_frame_timeout(NuguRecorder *rec, char *data, + int *size, int timeout); /** * @brief Get frame count @@ -244,7 +249,7 @@ int nugu_recorder_get_frame_timeout(NuguRecorder *rec, char *data, int *size, * @retval >0 success (frame count) * @retval -1 failure */ -int nugu_recorder_get_frame_count(NuguRecorder *rec); +NUGU_API int nugu_recorder_get_frame_count(NuguRecorder *rec); /** * @} @@ -282,7 +287,7 @@ struct nugu_recorder_driver_ops { * @return recorder driver object * @see nugu_recorder_driver_free() */ -NuguRecorderDriver * +NUGU_API NuguRecorderDriver * nugu_recorder_driver_new(const char *name, struct nugu_recorder_driver_ops *ops); @@ -294,7 +299,7 @@ nugu_recorder_driver_new(const char *name, * @retval -1 failure * @see nugu_recorder_driver_new() */ -int nugu_recorder_driver_free(NuguRecorderDriver *driver); +NUGU_API int nugu_recorder_driver_free(NuguRecorderDriver *driver); /** * @brief Register the driver to driver list @@ -304,7 +309,7 @@ int nugu_recorder_driver_free(NuguRecorderDriver *driver); * @retval -1 failure * @see nugu_recorder_driver_remove() */ -int nugu_recorder_driver_register(NuguRecorderDriver *driver); +NUGU_API int nugu_recorder_driver_register(NuguRecorderDriver *driver); /** * @brief Remove the driver from driver list @@ -314,7 +319,7 @@ int nugu_recorder_driver_register(NuguRecorderDriver *driver); * @retval -1 failure * @see nugu_recorder_driver_register() */ -int nugu_recorder_driver_remove(NuguRecorderDriver *driver); +NUGU_API int nugu_recorder_driver_remove(NuguRecorderDriver *driver); /** * @brief Set the default recorder driver @@ -324,21 +329,21 @@ int nugu_recorder_driver_remove(NuguRecorderDriver *driver); * @retval -1 failure * @see nugu_recorder_driver_get_default() */ -int nugu_recorder_driver_set_default(NuguRecorderDriver *driver); +NUGU_API int nugu_recorder_driver_set_default(NuguRecorderDriver *driver); /** * @brief Get the default recorder driver * @return recorder driver * @see nugu_recorder_driver_set_default() */ -NuguRecorderDriver *nugu_recorder_driver_get_default(void); +NUGU_API NuguRecorderDriver *nugu_recorder_driver_get_default(void); /** * @brief Find a driver by name in the driver list * @param[in] name recorder driver name * @return recorder driver */ -NuguRecorderDriver *nugu_recorder_driver_find(const char *name); +NUGU_API NuguRecorderDriver *nugu_recorder_driver_find(const char *name); /** * @} diff --git a/include/base/nugu_ringbuffer.h b/include/base/nugu_ringbuffer.h index 1cdbc7066..d65cd9b42 100644 --- a/include/base/nugu_ringbuffer.h +++ b/include/base/nugu_ringbuffer.h @@ -17,6 +17,8 @@ #ifndef __NUGU_RING_BUFFER_H__ #define __NUGU_RING_BUFFER_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -44,13 +46,13 @@ typedef struct _nugu_ring_buffer NuguRingBuffer; * @param[in] max_items count of items * @return ringbuffer object */ -NuguRingBuffer *nugu_ring_buffer_new(int item_size, int max_items); +NUGU_API NuguRingBuffer *nugu_ring_buffer_new(int item_size, int max_items); /** * @brief Destroy the ringbuffer object * @param[in] buf ringbuffer object */ -void nugu_ring_buffer_free(NuguRingBuffer *buf); +NUGU_API void nugu_ring_buffer_free(NuguRingBuffer *buf); /** * @brief Resize the ringbuffer @@ -61,7 +63,8 @@ void nugu_ring_buffer_free(NuguRingBuffer *buf); * @retval 0 success * @retval -1 failure */ -int nugu_ring_buffer_resize(NuguRingBuffer *buf, int item_size, int max_items); +NUGU_API int nugu_ring_buffer_resize(NuguRingBuffer *buf, int item_size, + int max_items); /** * @brief Push data to ringbuffer @@ -72,7 +75,8 @@ int nugu_ring_buffer_resize(NuguRingBuffer *buf, int item_size, int max_items); * @retval 0 success * @retval -1 failure */ -int nugu_ring_buffer_push_data(NuguRingBuffer *buf, const char *data, int size); +NUGU_API int nugu_ring_buffer_push_data(NuguRingBuffer *buf, const char *data, + int size); /** * @brief Read item from ringbuffer @@ -83,7 +87,8 @@ int nugu_ring_buffer_push_data(NuguRingBuffer *buf, const char *data, int size); * @retval 0 success * @retval -1 failure */ -int nugu_ring_buffer_read_item(NuguRingBuffer *buf, char *item, int *size); +NUGU_API int nugu_ring_buffer_read_item(NuguRingBuffer *buf, char *item, + int *size); /** * @brief Get count @@ -92,7 +97,7 @@ int nugu_ring_buffer_read_item(NuguRingBuffer *buf, char *item, int *size); * @retval >0 success (count) * @retval -1 failure */ -int nugu_ring_buffer_get_count(NuguRingBuffer *buf); +NUGU_API int nugu_ring_buffer_get_count(NuguRingBuffer *buf); /** * @brief Get itemsize @@ -101,7 +106,7 @@ int nugu_ring_buffer_get_count(NuguRingBuffer *buf); * @retval >0 success (itemsize) * @retval -1 failure */ -int nugu_ring_buffer_get_item_size(NuguRingBuffer *buf); +NUGU_API int nugu_ring_buffer_get_item_size(NuguRingBuffer *buf); /** * @brief Get maxcount @@ -110,13 +115,13 @@ int nugu_ring_buffer_get_item_size(NuguRingBuffer *buf); * @retval >0 success (max count) * @retval -1 failure */ -int nugu_ring_buffer_get_maxcount(NuguRingBuffer *buf); +NUGU_API int nugu_ring_buffer_get_maxcount(NuguRingBuffer *buf); /** * @brief Clear the ringbuffer * @param[in] buf ringbuffer object */ -void nugu_ring_buffer_clear_items(NuguRingBuffer *buf); +NUGU_API void nugu_ring_buffer_clear_items(NuguRingBuffer *buf); /** * @} diff --git a/include/base/nugu_timer.h b/include/base/nugu_timer.h index ccded14cb..9db617d1e 100644 --- a/include/base/nugu_timer.h +++ b/include/base/nugu_timer.h @@ -17,6 +17,8 @@ #ifndef __NUGU_TIMER_H__ #define __NUGU_TIMER_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -47,13 +49,13 @@ typedef void (*NuguTimeoutCallback)(void *userdata); * @param[in] interval interval seconds * @return timer object */ -NuguTimer *nugu_timer_new(long interval); +NUGU_API NuguTimer *nugu_timer_new(long interval); /** * @brief Destroy the timer object * @param[in] timer timer object */ -void nugu_timer_delete(NuguTimer *timer); +NUGU_API void nugu_timer_delete(NuguTimer *timer); /** * @brief Set interval @@ -61,7 +63,7 @@ void nugu_timer_delete(NuguTimer *timer); * @param[in] interval interval seconds * @see nugu_timer_get_interval() */ -void nugu_timer_set_interval(NuguTimer *timer, long interval); +NUGU_API void nugu_timer_set_interval(NuguTimer *timer, long interval); /** * @brief Get interval @@ -69,7 +71,7 @@ void nugu_timer_set_interval(NuguTimer *timer, long interval); * @return interval * @see nugu_timer_set_interval() */ -long nugu_timer_get_interval(NuguTimer *timer); +NUGU_API long nugu_timer_get_interval(NuguTimer *timer); /** * @brief Set timer running single shot @@ -79,7 +81,7 @@ long nugu_timer_get_interval(NuguTimer *timer); * and the timer runs repeatedly. * @see nugu_timer_get_singleshot() */ -void nugu_timer_set_singleshot(NuguTimer *timer, int singleshot); +NUGU_API void nugu_timer_set_singleshot(NuguTimer *timer, int singleshot); /** * @brief Get timer single shot property @@ -87,21 +89,21 @@ void nugu_timer_set_singleshot(NuguTimer *timer, int singleshot); * @return single shot value * @see nugu_timer_set_singleshot() */ -int nugu_timer_get_singleshot(NuguTimer *timer); +NUGU_API int nugu_timer_get_singleshot(NuguTimer *timer); /** * @brief Start the timer * @param[in] timer timer object * @see nugu_timer_stop() */ -void nugu_timer_start(NuguTimer *timer); +NUGU_API void nugu_timer_start(NuguTimer *timer); /** * @brief Stop the timer * @param[in] timer timer object * @see nugu_timer_start() */ -void nugu_timer_stop(NuguTimer *timer); +NUGU_API void nugu_timer_stop(NuguTimer *timer); /** * @brief Set timeout callback @@ -109,8 +111,9 @@ void nugu_timer_stop(NuguTimer *timer); * @param[in] callback callback function * @param[in] userdata data to pass to the user callback */ -void nugu_timer_set_callback(NuguTimer *timer, NuguTimeoutCallback callback, - void *userdata); +NUGU_API void nugu_timer_set_callback(NuguTimer *timer, + NuguTimeoutCallback callback, + void *userdata); /** * @} diff --git a/include/base/nugu_uuid.h b/include/base/nugu_uuid.h index ac4b75198..c3e37dcdb 100644 --- a/include/base/nugu_uuid.h +++ b/include/base/nugu_uuid.h @@ -18,6 +18,7 @@ #define __NUGU_UUID_H__ #include +#include #ifdef __cplusplus extern "C" { @@ -58,7 +59,7 @@ extern "C" { * @brief Generate time based UUID * @return memory allocated UUID string. Developer must free the data manually. */ -char *nugu_uuid_generate_time(void); +NUGU_API char *nugu_uuid_generate_time(void); /** * @brief Convert base16-encoded string to byte array @@ -70,8 +71,8 @@ char *nugu_uuid_generate_time(void); * @retval 0 Success * @retval -1 Failure */ -int nugu_uuid_convert_bytes(const char *base16, size_t base16_len, - unsigned char *out, size_t out_len); +NUGU_API int nugu_uuid_convert_bytes(const char *base16, size_t base16_len, + unsigned char *out, size_t out_len); /** * @brief Convert byte array to base16-encoded string @@ -83,8 +84,9 @@ int nugu_uuid_convert_bytes(const char *base16, size_t base16_len, * @retval 0 Success * @retval -1 Failure */ -int nugu_uuid_convert_base16(const unsigned char *bytes, size_t bytes_len, - char *out, size_t out_len); +NUGU_API int nugu_uuid_convert_base16(const unsigned char *bytes, + size_t bytes_len, char *out, + size_t out_len); /** * @brief Convert byte array to base16-encoded string @@ -95,8 +97,9 @@ int nugu_uuid_convert_base16(const unsigned char *bytes, size_t bytes_len, * @retval 0 Success * @retval -1 Failure */ -int nugu_uuid_convert_timespec(const unsigned char *bytes, size_t bytes_len, - struct timespec *out_time); +NUGU_API int nugu_uuid_convert_timespec(const unsigned char *bytes, + size_t bytes_len, + struct timespec *out_time); /** * @brief Generate random bytes and fill to destination buffer @@ -106,7 +109,7 @@ int nugu_uuid_convert_timespec(const unsigned char *bytes, size_t bytes_len, * @retval 0 Success * @retval -1 Failure */ -int nugu_uuid_fill_random(unsigned char *dest, size_t dest_len); +NUGU_API int nugu_uuid_fill_random(unsigned char *dest, size_t dest_len); /** * @brief Fill to output buffer with NUGU UUID format using parameters @@ -119,8 +122,9 @@ int nugu_uuid_fill_random(unsigned char *dest, size_t dest_len); * @retval 0 Success * @retval -1 Failure */ -int nugu_uuid_fill(const struct timespec *time, const unsigned char *hash, - size_t hash_len, unsigned char *out, size_t out_len); +NUGU_API int nugu_uuid_fill(const struct timespec *time, + const unsigned char *hash, size_t hash_len, + unsigned char *out, size_t out_len); /** * @} */ diff --git a/include/base/nugu_winsock.h b/include/base/nugu_winsock.h index 0f6835e06..d75ba886b 100644 --- a/include/base/nugu_winsock.h +++ b/include/base/nugu_winsock.h @@ -17,7 +17,9 @@ #ifndef __NUGU_WINSOCKET_H__ #define __NUGU_WINSOCKET_H__ -#ifdef __MSYS__ +#include + +#if defined(_WIN32) || defined(__MSYS__) #ifdef __cplusplus extern "C" { @@ -51,26 +53,26 @@ typedef struct _nugu_winsock_t NuguWinSocket; * @retval 0 success * @retval -1 failure */ -int nugu_winsock_init(void); +NUGU_API int nugu_winsock_init(void); /** * @brief Deinitialize window socket */ -void nugu_winsock_deinit(void); +NUGU_API void nugu_winsock_deinit(void); /** * @brief Create window socket * @return window socket * @see nugu_winsock_remove() */ -NuguWinSocket *nugu_winsock_create(void); +NUGU_API NuguWinSocket *nugu_winsock_create(void); /** * @brief Remove window socket * @param[in] wsock window socket * @see nugu_winsock_create() */ -void nugu_winsock_remove(NuguWinSocket *wsock); +NUGU_API void nugu_winsock_remove(NuguWinSocket *wsock); /** * @brief Get window socket handle for read/write @@ -79,7 +81,8 @@ void nugu_winsock_remove(NuguWinSocket *wsock); * @return window socket handle * @retval -1 failure */ -int nugu_winsock_get_handle(NuguWinSocket *wsock, NuguWinSocketType type); +NUGU_API int nugu_winsock_get_handle(NuguWinSocket *wsock, + NuguWinSocketType type); /** * @brief Check for data in window socket @@ -88,7 +91,7 @@ int nugu_winsock_get_handle(NuguWinSocket *wsock, NuguWinSocketType type); * @retval -1 failure * @retval 0 data is exist */ -int nugu_winsock_check_for_data(int handle); +NUGU_API int nugu_winsock_check_for_data(int handle); /** * @brief Read data in window socket @@ -98,7 +101,7 @@ int nugu_winsock_check_for_data(int handle); * @return read data size * @retval -1 failure */ -int nugu_winsock_read(int handle, char *buf, int len); +NUGU_API int nugu_winsock_read(int handle, char *buf, int len); /** * @brief Write data to window socket @@ -108,12 +111,12 @@ int nugu_winsock_read(int handle, char *buf, int len); * @return written data size * @retval -1 failure */ -int nugu_winsock_write(int handle, const char *buf, int len); +NUGU_API int nugu_winsock_write(int handle, const char *buf, int len); #ifdef __cplusplus } #endif -#endif // __MSYS__ +#endif // _WIN32 || __MSYS__ #endif // __NUGU_WINSOCKET_H__ diff --git a/nugu.h.in b/nugu.h.in index 57a58854c..72c9b95f3 100644 --- a/nugu.h.in +++ b/nugu.h.in @@ -43,6 +43,21 @@ extern "C" { #define NUGU_PLUGIN_DIR "@plugindir@" + +#if defined(_WIN32) +#define NUGU_API_EXPORT __declspec(dllexport) +#define NUGU_API_IMPORT __declspec(dllimport) +#else +#define NUGU_API_EXPORT __attribute__((visibility("default"))) +#define NUGU_API_IMPORT +#endif + +#ifdef NUGU_LIBRARY_BUILD +#define NUGU_API NUGU_API_EXPORT +#else +#define NUGU_API NUGU_API_IMPORT +#endif + /** * @} */ diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index fc337cf17..59b0bd167 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -28,12 +28,7 @@ ADD_LIBRARY(objbase OBJECT ${SRCS}) TARGET_INCLUDE_DIRECTORIES(objbase PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/externals/curl/include) -TARGET_COMPILE_DEFINITIONS(objbase PRIVATE - # Only symbols that use EXPORT_API are visible, and all other symbols are hidden. - -DEXPORT_API=__attribute__\(\(visibility\(\"default\"\)\)\) - - # Convenient macro to avoid unused parameter warnings. - -D__UNUSED__=__attribute\(\(unused\)\)) +TARGET_COMPILE_DEFINITIONS(objbase PRIVATE -DNUGU_LIBRARY_BUILD) TARGET_COMPILE_OPTIONS(objbase PRIVATE # Set default visibility to hidden to reduce symbol count -fvisibility=hidden diff --git a/src/base/nugu_audio.c b/src/base/nugu_audio.c index f2145ef97..bbf564834 100644 --- a/src/base/nugu_audio.c +++ b/src/base/nugu_audio.c @@ -63,8 +63,8 @@ static char *nugu_audio_get_default_attribute_str(NuguAudioAttribute attribute) return attr_str; } -EXPORT_API void nugu_audio_set_attribute_str(const NuguAudioAttribute attribute, - const char *str) +void nugu_audio_set_attribute_str(const NuguAudioAttribute attribute, + const char *str) { int index = GET_AUDIO_ATTR_INDEX(attribute); @@ -82,8 +82,7 @@ EXPORT_API void nugu_audio_set_attribute_str(const NuguAudioAttribute attribute, snprintf(audio_attr_str[index], strlen(str) + 1, "%s", str); } -EXPORT_API const char * -nugu_audio_get_attribute_str(const NuguAudioAttribute attribute) +const char *nugu_audio_get_attribute_str(const NuguAudioAttribute attribute) { int index = GET_AUDIO_ATTR_INDEX(attribute); @@ -93,7 +92,7 @@ nugu_audio_get_attribute_str(const NuguAudioAttribute attribute) return nugu_audio_get_default_attribute_str(attribute); } -EXPORT_API NuguAudioAttribute nugu_audio_get_attribute(const char *str) +NuguAudioAttribute nugu_audio_get_attribute(const char *str) { if (str == NULL) return NUGU_AUDIO_ATTRIBUTE_MUSIC; diff --git a/src/base/nugu_buffer.c b/src/base/nugu_buffer.c index 2bf397191..4f389a3f4 100644 --- a/src/base/nugu_buffer.c +++ b/src/base/nugu_buffer.c @@ -32,7 +32,7 @@ struct _nugu_buffer { unsigned char *data; }; -EXPORT_API NuguBuffer *nugu_buffer_new(size_t default_size) +NuguBuffer *nugu_buffer_new(size_t default_size) { NuguBuffer *buf; @@ -58,7 +58,7 @@ EXPORT_API NuguBuffer *nugu_buffer_new(size_t default_size) return buf; } -EXPORT_API void *nugu_buffer_free(NuguBuffer *buf, int is_data_free) +void *nugu_buffer_free(NuguBuffer *buf, int is_data_free) { g_return_val_if_fail(buf != NULL, NULL); @@ -102,8 +102,7 @@ static int _buffer_resize(NuguBuffer *buf, size_t needed) return 0; } -EXPORT_API size_t nugu_buffer_add(NuguBuffer *buf, const void *data, - size_t data_len) +size_t nugu_buffer_add(NuguBuffer *buf, const void *data, size_t data_len) { g_return_val_if_fail(buf != NULL, 0); g_return_val_if_fail(data != NULL, 0); @@ -120,7 +119,7 @@ EXPORT_API size_t nugu_buffer_add(NuguBuffer *buf, const void *data, return data_len; } -EXPORT_API size_t nugu_buffer_add_byte(NuguBuffer *buf, unsigned char byte) +size_t nugu_buffer_add_byte(NuguBuffer *buf, unsigned char byte) { g_return_val_if_fail(buf != NULL, 0); @@ -135,8 +134,7 @@ EXPORT_API size_t nugu_buffer_add_byte(NuguBuffer *buf, unsigned char byte) return 1; } -EXPORT_API int nugu_buffer_set_byte(NuguBuffer *buf, size_t pos, - unsigned char byte) +int nugu_buffer_set_byte(NuguBuffer *buf, size_t pos, unsigned char byte) { g_return_val_if_fail(buf != NULL, -1); @@ -148,28 +146,28 @@ EXPORT_API int nugu_buffer_set_byte(NuguBuffer *buf, size_t pos, return 0; } -EXPORT_API const void *nugu_buffer_peek(NuguBuffer *buf) +const void *nugu_buffer_peek(NuguBuffer *buf) { g_return_val_if_fail(buf != NULL, NULL); return buf->data; } -EXPORT_API size_t nugu_buffer_get_size(NuguBuffer *buf) +size_t nugu_buffer_get_size(NuguBuffer *buf) { g_return_val_if_fail(buf != NULL, 0); return buf->index; } -EXPORT_API size_t nugu_buffer_get_alloc_size(NuguBuffer *buf) +size_t nugu_buffer_get_alloc_size(NuguBuffer *buf) { g_return_val_if_fail(buf != NULL, 0); return buf->alloc_size; } -EXPORT_API size_t nugu_buffer_find_byte(NuguBuffer *buf, unsigned char want) +size_t nugu_buffer_find_byte(NuguBuffer *buf, unsigned char want) { unsigned char *pos; unsigned char *last_pos; @@ -189,7 +187,7 @@ EXPORT_API size_t nugu_buffer_find_byte(NuguBuffer *buf, unsigned char want) return NUGU_BUFFER_NOT_FOUND; } -EXPORT_API unsigned char nugu_buffer_peek_byte(NuguBuffer *buf, size_t pos) +unsigned char nugu_buffer_peek_byte(NuguBuffer *buf, size_t pos) { g_return_val_if_fail(buf != NULL, 0); @@ -199,7 +197,7 @@ EXPORT_API unsigned char nugu_buffer_peek_byte(NuguBuffer *buf, size_t pos) return *(buf->data + pos); } -EXPORT_API int nugu_buffer_clear(NuguBuffer *buf) +int nugu_buffer_clear(NuguBuffer *buf) { g_return_val_if_fail(buf != NULL, -1); @@ -210,7 +208,7 @@ EXPORT_API int nugu_buffer_clear(NuguBuffer *buf) return 0; } -EXPORT_API int nugu_buffer_clear_from(NuguBuffer *buf, size_t pos) +int nugu_buffer_clear_from(NuguBuffer *buf, size_t pos) { g_return_val_if_fail(buf != NULL, -1); g_return_val_if_fail(pos <= buf->index, -1); @@ -222,7 +220,7 @@ EXPORT_API int nugu_buffer_clear_from(NuguBuffer *buf, size_t pos) return 0; } -EXPORT_API int nugu_buffer_shift_left(NuguBuffer *buf, size_t size) +int nugu_buffer_shift_left(NuguBuffer *buf, size_t size) { unsigned char *dst; unsigned char *src; @@ -251,7 +249,7 @@ EXPORT_API int nugu_buffer_shift_left(NuguBuffer *buf, size_t size) return 0; } -EXPORT_API void *nugu_buffer_pop(NuguBuffer *buf, size_t size) +void *nugu_buffer_pop(NuguBuffer *buf, size_t size) { unsigned char *tmp; diff --git a/src/base/nugu_decoder.c b/src/base/nugu_decoder.c index 9a3c5a8be..7754d9e5b 100644 --- a/src/base/nugu_decoder.c +++ b/src/base/nugu_decoder.c @@ -42,9 +42,9 @@ struct _nugu_decoder_driver { static GList *_decoder_drivers; -EXPORT_API NuguDecoderDriver * -nugu_decoder_driver_new(const char *name, enum nugu_decoder_type type, - struct nugu_decoder_driver_ops *ops) +NuguDecoderDriver *nugu_decoder_driver_new(const char *name, + enum nugu_decoder_type type, + struct nugu_decoder_driver_ops *ops) { NuguDecoderDriver *driver; @@ -60,7 +60,7 @@ nugu_decoder_driver_new(const char *name, enum nugu_decoder_type type, return driver; } -EXPORT_API int nugu_decoder_driver_free(NuguDecoderDriver *driver) +int nugu_decoder_driver_free(NuguDecoderDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -75,7 +75,7 @@ EXPORT_API int nugu_decoder_driver_free(NuguDecoderDriver *driver) return 0; } -EXPORT_API int nugu_decoder_driver_register(NuguDecoderDriver *driver) +int nugu_decoder_driver_register(NuguDecoderDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -89,7 +89,7 @@ EXPORT_API int nugu_decoder_driver_register(NuguDecoderDriver *driver) return 0; } -EXPORT_API int nugu_decoder_driver_remove(NuguDecoderDriver *driver) +int nugu_decoder_driver_remove(NuguDecoderDriver *driver) { GList *l; @@ -102,7 +102,7 @@ EXPORT_API int nugu_decoder_driver_remove(NuguDecoderDriver *driver) return 0; } -EXPORT_API NuguDecoderDriver *nugu_decoder_driver_find(const char *name) +NuguDecoderDriver *nugu_decoder_driver_find(const char *name) { GList *cur; @@ -120,8 +120,7 @@ EXPORT_API NuguDecoderDriver *nugu_decoder_driver_find(const char *name) return NULL; } -EXPORT_API NuguDecoderDriver * -nugu_decoder_driver_find_bytype(enum nugu_decoder_type type) +NuguDecoderDriver *nugu_decoder_driver_find_bytype(enum nugu_decoder_type type) { GList *cur; @@ -136,8 +135,7 @@ nugu_decoder_driver_find_bytype(enum nugu_decoder_type type) return NULL; } -EXPORT_API NuguDecoder *nugu_decoder_new(NuguDecoderDriver *driver, - NuguPcm *sink) +NuguDecoder *nugu_decoder_new(NuguDecoderDriver *driver, NuguPcm *sink) { NuguDecoder *dec; @@ -167,7 +165,7 @@ EXPORT_API NuguDecoder *nugu_decoder_new(NuguDecoderDriver *driver, return NULL; } -EXPORT_API int nugu_decoder_free(NuguDecoder *dec) +int nugu_decoder_free(NuguDecoder *dec) { g_return_val_if_fail(dec != NULL, -1); @@ -186,15 +184,14 @@ EXPORT_API int nugu_decoder_free(NuguDecoder *dec) return 0; } -EXPORT_API NuguPcm *nugu_decoder_get_pcm(NuguDecoder *dec) +NuguPcm *nugu_decoder_get_pcm(NuguDecoder *dec) { g_return_val_if_fail(dec != NULL, NULL); return dec->pcm; } -EXPORT_API int nugu_decoder_play(NuguDecoder *dec, const void *data, - size_t data_len) +int nugu_decoder_play(NuguDecoder *dec, const void *data, size_t data_len) { int ret; void *out; @@ -233,8 +230,8 @@ EXPORT_API int nugu_decoder_play(NuguDecoder *dec, const void *data, return 0; } -EXPORT_API void *nugu_decoder_decode(NuguDecoder *dec, const void *data, - size_t data_len, size_t *output_len) +void *nugu_decoder_decode(NuguDecoder *dec, const void *data, size_t data_len, + size_t *output_len) { int ret; void *out; @@ -264,7 +261,7 @@ EXPORT_API void *nugu_decoder_decode(NuguDecoder *dec, const void *data, return out; } -EXPORT_API int nugu_decoder_set_driver_data(NuguDecoder *dec, void *data) +int nugu_decoder_set_driver_data(NuguDecoder *dec, void *data) { g_return_val_if_fail(dec != NULL, -1); @@ -273,7 +270,7 @@ EXPORT_API int nugu_decoder_set_driver_data(NuguDecoder *dec, void *data) return 0; } -EXPORT_API void *nugu_decoder_get_driver_data(NuguDecoder *dec) +void *nugu_decoder_get_driver_data(NuguDecoder *dec) { g_return_val_if_fail(dec != NULL, NULL); diff --git a/src/base/nugu_directive.c b/src/base/nugu_directive.c index 2445b1a4b..e15dba1aa 100644 --- a/src/base/nugu_directive.c +++ b/src/base/nugu_directive.c @@ -49,11 +49,11 @@ struct _nugu_directive { int ref_count; }; -EXPORT_API NuguDirective * -nugu_directive_new(const char *name_space, const char *name, - const char *version, const char *msg_id, - const char *dialog_id, const char *referrer_id, - const char *json, const char *groups) +NuguDirective *nugu_directive_new(const char *name_space, const char *name, + const char *version, const char *msg_id, + const char *dialog_id, + const char *referrer_id, const char *json, + const char *groups) { NuguDirective *ndir; @@ -128,14 +128,14 @@ static void nugu_directive_free(NuguDirective *ndir) free(ndir); } -EXPORT_API void nugu_directive_ref(NuguDirective *ndir) +void nugu_directive_ref(NuguDirective *ndir) { g_return_if_fail(ndir != NULL); ndir->ref_count++; } -EXPORT_API void nugu_directive_unref(NuguDirective *ndir) +void nugu_directive_unref(NuguDirective *ndir) { g_return_if_fail(ndir != NULL); @@ -146,14 +146,14 @@ EXPORT_API void nugu_directive_unref(NuguDirective *ndir) nugu_directive_free(ndir); } -EXPORT_API int nugu_directive_is_active(const NuguDirective *ndir) +int nugu_directive_is_active(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, -1); return ndir->is_active; } -EXPORT_API int nugu_directive_set_active(NuguDirective *ndir, int flag) +int nugu_directive_set_active(NuguDirective *ndir, int flag) { g_return_val_if_fail(ndir != NULL, -1); g_return_val_if_fail(flag == 0 || flag == 1, -1); @@ -163,65 +163,63 @@ EXPORT_API int nugu_directive_set_active(NuguDirective *ndir, int flag) return ndir->is_active; } -EXPORT_API const char *nugu_directive_peek_namespace(const NuguDirective *ndir) +const char *nugu_directive_peek_namespace(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); return ndir->name_space; } -EXPORT_API const char *nugu_directive_peek_name(const NuguDirective *ndir) +const char *nugu_directive_peek_name(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); return ndir->name; } -EXPORT_API const char *nugu_directive_peek_groups(const NuguDirective *ndir) +const char *nugu_directive_peek_groups(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); return ndir->groups; } -EXPORT_API const char *nugu_directive_peek_version(const NuguDirective *ndir) +const char *nugu_directive_peek_version(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); return ndir->version; } -EXPORT_API const char *nugu_directive_peek_msg_id(const NuguDirective *ndir) +const char *nugu_directive_peek_msg_id(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); return ndir->msg_id; } -EXPORT_API const char *nugu_directive_peek_dialog_id(const NuguDirective *ndir) +const char *nugu_directive_peek_dialog_id(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); return ndir->dialog_id; } -EXPORT_API const char * -nugu_directive_peek_referrer_id(const NuguDirective *ndir) +const char *nugu_directive_peek_referrer_id(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); return ndir->referrer_id; } -EXPORT_API const char *nugu_directive_peek_json(const NuguDirective *ndir) +const char *nugu_directive_peek_json(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); return ndir->json; } -EXPORT_API int nugu_directive_set_media_type(NuguDirective *ndir, - const char *type) +int nugu_directive_set_media_type(NuguDirective *ndir, const char *type) { g_return_val_if_fail(ndir != NULL, -1); @@ -238,15 +236,15 @@ EXPORT_API int nugu_directive_set_media_type(NuguDirective *ndir, return 0; } -EXPORT_API const char *nugu_directive_peek_media_type(const NuguDirective *ndir) +const char *nugu_directive_peek_media_type(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); return ndir->media_type; } -EXPORT_API int nugu_directive_add_data(NuguDirective *ndir, size_t length, - const unsigned char *data) +int nugu_directive_add_data(NuguDirective *ndir, size_t length, + const unsigned char *data) { g_return_val_if_fail(ndir != NULL, -1); @@ -279,7 +277,7 @@ EXPORT_API int nugu_directive_add_data(NuguDirective *ndir, size_t length, return 0; } -EXPORT_API int nugu_directive_close_data(NuguDirective *ndir) +int nugu_directive_close_data(NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, -1); @@ -288,15 +286,14 @@ EXPORT_API int nugu_directive_close_data(NuguDirective *ndir) return 0; } -EXPORT_API int nugu_directive_is_data_end(const NuguDirective *ndir) +int nugu_directive_is_data_end(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, -1); return ndir->is_end; } -EXPORT_API unsigned char *nugu_directive_get_data(NuguDirective *ndir, - size_t *length) +unsigned char *nugu_directive_get_data(NuguDirective *ndir, size_t *length) { unsigned char *buf; size_t buf_size; @@ -316,7 +313,7 @@ EXPORT_API unsigned char *nugu_directive_get_data(NuguDirective *ndir, return buf; } -EXPORT_API size_t nugu_directive_get_data_size(const NuguDirective *ndir) +size_t nugu_directive_get_data_size(const NuguDirective *ndir) { size_t size; @@ -327,8 +324,9 @@ EXPORT_API size_t nugu_directive_get_data_size(const NuguDirective *ndir) return size; } -EXPORT_API int nugu_directive_set_blocking_policy( - NuguDirective *ndir, enum nugu_directive_medium medium, int is_block) +int nugu_directive_set_blocking_policy(NuguDirective *ndir, + enum nugu_directive_medium medium, + int is_block) { g_return_val_if_fail(ndir != NULL, -1); @@ -338,7 +336,7 @@ EXPORT_API int nugu_directive_set_blocking_policy( return 0; } -EXPORT_API enum nugu_directive_medium +enum nugu_directive_medium nugu_directive_get_blocking_medium(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, -1); @@ -346,8 +344,7 @@ nugu_directive_get_blocking_medium(const NuguDirective *ndir) return ndir->policy_medium; } -EXPORT_API const char * -nugu_directive_get_blocking_medium_string(const NuguDirective *ndir) +const char *nugu_directive_get_blocking_medium_string(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, NULL); @@ -367,15 +364,16 @@ nugu_directive_get_blocking_medium_string(const NuguDirective *ndir) return "----"; } -EXPORT_API int nugu_directive_is_blocking(const NuguDirective *ndir) +int nugu_directive_is_blocking(const NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, -1); return ndir->is_policy_block; } -EXPORT_API int nugu_directive_set_data_callback( - NuguDirective *ndir, NuguDirectiveDataCallback callback, void *userdata) +int nugu_directive_set_data_callback(NuguDirective *ndir, + NuguDirectiveDataCallback callback, + void *userdata) { g_return_val_if_fail(ndir != NULL, -1); g_return_val_if_fail(callback != NULL, -1); @@ -386,7 +384,7 @@ EXPORT_API int nugu_directive_set_data_callback( return 0; } -EXPORT_API int nugu_directive_remove_data_callback(NuguDirective *ndir) +int nugu_directive_remove_data_callback(NuguDirective *ndir) { g_return_val_if_fail(ndir != NULL, -1); diff --git a/src/base/nugu_encoder.c b/src/base/nugu_encoder.c index e4adc1a8f..3ae204bea 100644 --- a/src/base/nugu_encoder.c +++ b/src/base/nugu_encoder.c @@ -41,9 +41,9 @@ struct _nugu_encoder_driver { static GList *_encoder_drivers; -EXPORT_API NuguEncoderDriver * -nugu_encoder_driver_new(const char *name, enum nugu_encoder_type type, - struct nugu_encoder_driver_ops *ops) +NuguEncoderDriver *nugu_encoder_driver_new(const char *name, + enum nugu_encoder_type type, + struct nugu_encoder_driver_ops *ops) { NuguEncoderDriver *driver; @@ -59,7 +59,7 @@ nugu_encoder_driver_new(const char *name, enum nugu_encoder_type type, return driver; } -EXPORT_API int nugu_encoder_driver_free(NuguEncoderDriver *driver) +int nugu_encoder_driver_free(NuguEncoderDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -74,7 +74,7 @@ EXPORT_API int nugu_encoder_driver_free(NuguEncoderDriver *driver) return 0; } -EXPORT_API int nugu_encoder_driver_register(NuguEncoderDriver *driver) +int nugu_encoder_driver_register(NuguEncoderDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -88,7 +88,7 @@ EXPORT_API int nugu_encoder_driver_register(NuguEncoderDriver *driver) return 0; } -EXPORT_API int nugu_encoder_driver_remove(NuguEncoderDriver *driver) +int nugu_encoder_driver_remove(NuguEncoderDriver *driver) { GList *l; @@ -101,7 +101,7 @@ EXPORT_API int nugu_encoder_driver_remove(NuguEncoderDriver *driver) return 0; } -EXPORT_API NuguEncoderDriver *nugu_encoder_driver_find(const char *name) +NuguEncoderDriver *nugu_encoder_driver_find(const char *name) { GList *cur; @@ -119,8 +119,7 @@ EXPORT_API NuguEncoderDriver *nugu_encoder_driver_find(const char *name) return NULL; } -EXPORT_API NuguEncoderDriver * -nugu_encoder_driver_find_bytype(enum nugu_encoder_type type) +NuguEncoderDriver *nugu_encoder_driver_find_bytype(enum nugu_encoder_type type) { GList *cur; @@ -135,8 +134,8 @@ nugu_encoder_driver_find_bytype(enum nugu_encoder_type type) return NULL; } -EXPORT_API NuguEncoder *nugu_encoder_new(NuguEncoderDriver *driver, - NuguAudioProperty property) +NuguEncoder *nugu_encoder_new(NuguEncoderDriver *driver, + NuguAudioProperty property) { NuguEncoder *enc; @@ -165,7 +164,7 @@ EXPORT_API NuguEncoder *nugu_encoder_new(NuguEncoderDriver *driver, return NULL; } -EXPORT_API int nugu_encoder_free(NuguEncoder *enc) +int nugu_encoder_free(NuguEncoder *enc) { g_return_val_if_fail(enc != NULL, -1); @@ -184,9 +183,8 @@ EXPORT_API int nugu_encoder_free(NuguEncoder *enc) return 0; } -EXPORT_API void *nugu_encoder_encode(NuguEncoder *enc, int is_last, - const void *data, size_t data_len, - size_t *output_len) +void *nugu_encoder_encode(NuguEncoder *enc, int is_last, const void *data, + size_t data_len, size_t *output_len) { int ret; void *out; @@ -215,7 +213,7 @@ EXPORT_API void *nugu_encoder_encode(NuguEncoder *enc, int is_last, return out; } -EXPORT_API int nugu_encoder_set_driver_data(NuguEncoder *enc, void *data) +int nugu_encoder_set_driver_data(NuguEncoder *enc, void *data) { g_return_val_if_fail(enc != NULL, -1); @@ -224,14 +222,14 @@ EXPORT_API int nugu_encoder_set_driver_data(NuguEncoder *enc, void *data) return 0; } -EXPORT_API void *nugu_encoder_get_driver_data(NuguEncoder *enc) +void *nugu_encoder_get_driver_data(NuguEncoder *enc) { g_return_val_if_fail(enc != NULL, NULL); return enc->driver_data; } -EXPORT_API const char *nugu_encoder_get_codec(NuguEncoder *enc) +const char *nugu_encoder_get_codec(NuguEncoder *enc) { g_return_val_if_fail(enc != NULL, NULL); g_return_val_if_fail(enc->driver != NULL, NULL); @@ -244,7 +242,7 @@ EXPORT_API const char *nugu_encoder_get_codec(NuguEncoder *enc) return "CUSTOM"; } -EXPORT_API const char *nugu_encoder_get_mime_type(NuguEncoder *enc) +const char *nugu_encoder_get_mime_type(NuguEncoder *enc) { g_return_val_if_fail(enc != NULL, NULL); g_return_val_if_fail(enc->driver != NULL, NULL); diff --git a/src/base/nugu_equeue.c b/src/base/nugu_equeue.c index 4c3672212..e1c37dc31 100644 --- a/src/base/nugu_equeue.c +++ b/src/base/nugu_equeue.c @@ -136,7 +136,7 @@ static gboolean on_event(GIOChannel *channel, GIOCondition cond, return TRUE; } -EXPORT_API int nugu_equeue_initialize(void) +int nugu_equeue_initialize(void) { GIOChannel *channel; #if !defined(HAVE_EVENTFD) && !defined(__MSYS__) @@ -211,7 +211,7 @@ EXPORT_API int nugu_equeue_initialize(void) return 0; } -EXPORT_API void nugu_equeue_deinitialize(void) +void nugu_equeue_deinitialize(void) { pthread_mutex_lock(&_lock); @@ -261,10 +261,10 @@ EXPORT_API void nugu_equeue_deinitialize(void) pthread_mutex_unlock(&_lock); } -EXPORT_API int -nugu_equeue_set_handler(enum nugu_equeue_type type, NuguEqueueCallback callback, - NuguEqueueDestroyCallback destroy_callback, - void *userdata) +int nugu_equeue_set_handler(enum nugu_equeue_type type, + NuguEqueueCallback callback, + NuguEqueueDestroyCallback destroy_callback, + void *userdata) { g_return_val_if_fail(type < NUGU_EQUEUE_TYPE_MAX, -1); g_return_val_if_fail(callback != NULL, -1); @@ -286,7 +286,7 @@ nugu_equeue_set_handler(enum nugu_equeue_type type, NuguEqueueCallback callback, return 0; } -EXPORT_API int nugu_equeue_unset_handler(enum nugu_equeue_type type) +int nugu_equeue_unset_handler(enum nugu_equeue_type type) { g_return_val_if_fail(type < NUGU_EQUEUE_TYPE_MAX, -1); @@ -307,7 +307,7 @@ EXPORT_API int nugu_equeue_unset_handler(enum nugu_equeue_type type) return 0; } -EXPORT_API int nugu_equeue_push(enum nugu_equeue_type type, void *data) +int nugu_equeue_push(enum nugu_equeue_type type, void *data) { struct _econtainer *item; ssize_t written; diff --git a/src/base/nugu_event.c b/src/base/nugu_event.c index 02e38504a..1725da405 100644 --- a/src/base/nugu_event.c +++ b/src/base/nugu_event.c @@ -83,8 +83,8 @@ struct _nugu_event { char *mime_type; }; -EXPORT_API NuguEvent *nugu_event_new(const char *name_space, const char *name, - const char *version) +NuguEvent *nugu_event_new(const char *name_space, const char *name, + const char *version) { NuguEvent *nev; @@ -111,7 +111,7 @@ EXPORT_API NuguEvent *nugu_event_new(const char *name_space, const char *name, return nev; } -EXPORT_API void nugu_event_free(NuguEvent *nev) +void nugu_event_free(NuguEvent *nev) { g_return_if_fail(nev != NULL); @@ -137,28 +137,28 @@ EXPORT_API void nugu_event_free(NuguEvent *nev) free(nev); } -EXPORT_API const char *nugu_event_peek_namespace(NuguEvent *nev) +const char *nugu_event_peek_namespace(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, NULL); return nev->name_space; } -EXPORT_API const char *nugu_event_peek_name(NuguEvent *nev) +const char *nugu_event_peek_name(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, NULL); return nev->name; } -EXPORT_API const char *nugu_event_peek_version(NuguEvent *nev) +const char *nugu_event_peek_version(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, NULL); return nev->version; } -EXPORT_API int nugu_event_set_context(NuguEvent *nev, const char *context) +int nugu_event_set_context(NuguEvent *nev, const char *context) { int length; @@ -178,14 +178,14 @@ EXPORT_API int nugu_event_set_context(NuguEvent *nev, const char *context) return 0; } -EXPORT_API const char *nugu_event_peek_context(NuguEvent *nev) +const char *nugu_event_peek_context(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, NULL); return nev->context; } -EXPORT_API int nugu_event_set_json(NuguEvent *nev, const char *json) +int nugu_event_set_json(NuguEvent *nev, const char *json) { int length; @@ -209,19 +209,19 @@ EXPORT_API int nugu_event_set_json(NuguEvent *nev, const char *json) return 0; } -EXPORT_API const char *nugu_event_peek_json(NuguEvent *nev) +const char *nugu_event_peek_json(NuguEvent *nev) { return nev->json; } -EXPORT_API const char *nugu_event_peek_msg_id(NuguEvent *nev) +const char *nugu_event_peek_msg_id(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, NULL); return nev->msg_id; } -EXPORT_API int nugu_event_set_dialog_id(NuguEvent *nev, const char *dialog_id) +int nugu_event_set_dialog_id(NuguEvent *nev, const char *dialog_id) { g_return_val_if_fail(nev != NULL, -1); g_return_val_if_fail(dialog_id != NULL, -1); @@ -234,15 +234,14 @@ EXPORT_API int nugu_event_set_dialog_id(NuguEvent *nev, const char *dialog_id) return 0; } -EXPORT_API const char *nugu_event_peek_dialog_id(NuguEvent *nev) +const char *nugu_event_peek_dialog_id(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, NULL); return nev->dialog_id; } -EXPORT_API int nugu_event_set_referrer_id(NuguEvent *nev, - const char *referrer_id) +int nugu_event_set_referrer_id(NuguEvent *nev, const char *referrer_id) { g_return_val_if_fail(nev != NULL, -1); @@ -257,21 +256,21 @@ EXPORT_API int nugu_event_set_referrer_id(NuguEvent *nev, return 0; } -EXPORT_API const char *nugu_event_peek_referrer_id(NuguEvent *nev) +const char *nugu_event_peek_referrer_id(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, NULL); return nev->referrer_id; } -EXPORT_API int nugu_event_get_seq(NuguEvent *nev) +int nugu_event_get_seq(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, -1); return nev->seq; } -EXPORT_API int nugu_event_increase_seq(NuguEvent *nev) +int nugu_event_increase_seq(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, -1); @@ -280,7 +279,7 @@ EXPORT_API int nugu_event_increase_seq(NuguEvent *nev) return nev->seq; } -EXPORT_API char *nugu_event_generate_payload(NuguEvent *nev) +char *nugu_event_generate_payload(NuguEvent *nev) { const char *payload; gchar *buf; @@ -305,7 +304,7 @@ EXPORT_API char *nugu_event_generate_payload(NuguEvent *nev) return buf; } -EXPORT_API int nugu_event_set_type(NuguEvent *nev, enum nugu_event_type type) +int nugu_event_set_type(NuguEvent *nev, enum nugu_event_type type) { g_return_val_if_fail(nev != NULL, -1); @@ -314,14 +313,14 @@ EXPORT_API int nugu_event_set_type(NuguEvent *nev, enum nugu_event_type type) return 0; } -EXPORT_API enum nugu_event_type nugu_event_get_type(NuguEvent *nev) +enum nugu_event_type nugu_event_get_type(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, NUGU_EVENT_TYPE_DEFAULT); return nev->type; } -EXPORT_API int nugu_event_set_mime_type(NuguEvent *nev, const char *type) +int nugu_event_set_mime_type(NuguEvent *nev, const char *type) { g_return_val_if_fail(nev != NULL, -1); @@ -336,7 +335,7 @@ EXPORT_API int nugu_event_set_mime_type(NuguEvent *nev, const char *type) return 0; } -EXPORT_API const char *nugu_event_peek_mime_type(NuguEvent *nev) +const char *nugu_event_peek_mime_type(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, NULL); diff --git a/src/base/nugu_http.c b/src/base/nugu_http.c index d187a2b31..0cbeb3937 100644 --- a/src/base/nugu_http.c +++ b/src/base/nugu_http.c @@ -73,7 +73,7 @@ struct _nugu_http_host { long conn_timeout; }; -EXPORT_API NuguHttpHost *nugu_http_host_new(const char *url) +NuguHttpHost *nugu_http_host_new(const char *url) { struct _nugu_http_host *host; size_t url_len; @@ -106,29 +106,28 @@ EXPORT_API NuguHttpHost *nugu_http_host_new(const char *url) return host; } -EXPORT_API void nugu_http_host_set_timeout(NuguHttpHost *host, long msecs) +void nugu_http_host_set_timeout(NuguHttpHost *host, long msecs) { g_return_if_fail(host != NULL); host->timeout = msecs; } -EXPORT_API void nugu_http_host_set_connection_timeout(NuguHttpHost *host, - long msecs) +void nugu_http_host_set_connection_timeout(NuguHttpHost *host, long msecs) { g_return_if_fail(host != NULL); host->conn_timeout = msecs; } -EXPORT_API const char *nugu_http_host_peek_url(NuguHttpHost *host) +const char *nugu_http_host_peek_url(NuguHttpHost *host) { g_return_val_if_fail(host != NULL, NULL); return host->url; } -EXPORT_API void nugu_http_host_free(NuguHttpHost *host) +void nugu_http_host_free(NuguHttpHost *host) { g_return_if_fail(host != NULL); @@ -136,7 +135,7 @@ EXPORT_API void nugu_http_host_free(NuguHttpHost *host) free(host); } -EXPORT_API NuguHttpHeader *nugu_http_header_new(void) +NuguHttpHeader *nugu_http_header_new(void) { struct _nugu_http_header *header; @@ -152,8 +151,8 @@ EXPORT_API NuguHttpHeader *nugu_http_header_new(void) return header; } -EXPORT_API int nugu_http_header_add(NuguHttpHeader *header, const char *key, - const char *value) +int nugu_http_header_add(NuguHttpHeader *header, const char *key, + const char *value) { g_return_val_if_fail(header != NULL, -1); g_return_val_if_fail(key != NULL, -1); @@ -164,7 +163,7 @@ EXPORT_API int nugu_http_header_add(NuguHttpHeader *header, const char *key, return 0; } -EXPORT_API int nugu_http_header_remove(NuguHttpHeader *header, const char *key) +int nugu_http_header_remove(NuguHttpHeader *header, const char *key) { g_return_val_if_fail(header != NULL, -1); g_return_val_if_fail(key != NULL, -1); @@ -175,8 +174,7 @@ EXPORT_API int nugu_http_header_remove(NuguHttpHeader *header, const char *key) return 0; } -EXPORT_API const char *nugu_http_header_find(NuguHttpHeader *header, - const char *key) +const char *nugu_http_header_find(NuguHttpHeader *header, const char *key) { g_return_val_if_fail(header != NULL, NULL); g_return_val_if_fail(key != NULL, NULL); @@ -184,8 +182,7 @@ EXPORT_API const char *nugu_http_header_find(NuguHttpHeader *header, return g_hash_table_lookup(header->map, key); } -EXPORT_API NuguHttpHeader * -nugu_http_header_dup(const NuguHttpHeader *src_header) +NuguHttpHeader *nugu_http_header_dup(const NuguHttpHeader *src_header) { NuguHttpHeader *header; @@ -203,8 +200,7 @@ nugu_http_header_dup(const NuguHttpHeader *src_header) return header; } -EXPORT_API int nugu_http_header_import(NuguHttpHeader *header, - const NuguHttpHeader *from) +int nugu_http_header_import(NuguHttpHeader *header, const NuguHttpHeader *from) { GHashTableIter iter; gpointer key, value; @@ -221,7 +217,7 @@ EXPORT_API int nugu_http_header_import(NuguHttpHeader *header, return 0; } -EXPORT_API void nugu_http_header_free(NuguHttpHeader *header) +void nugu_http_header_free(NuguHttpHeader *header) { g_return_if_fail(header != NULL); @@ -252,8 +248,7 @@ static NuguHttpResponse *nugu_http_response_new(void) return resp; } -EXPORT_API NuguHttpResponse * -nugu_http_response_dup(const NuguHttpResponse *orig) +NuguHttpResponse *nugu_http_response_dup(const NuguHttpResponse *orig) { struct _nugu_http_response *resp; @@ -292,7 +287,7 @@ static void _nugu_http_response_free_internal(NuguHttpResponse *resp) free(resp); } -EXPORT_API void nugu_http_response_free(NuguHttpResponse *resp) +void nugu_http_response_free(NuguHttpResponse *resp) { g_return_if_fail(resp != NULL); @@ -576,10 +571,11 @@ static NuguHttpRequest *_request_new_body(NuguHttpHost *host, const char *path, return req; } -EXPORT_API NuguHttpRequest * -nugu_http_request(enum NuguHttpRequestType type, NuguHttpHost *host, - const char *path, NuguHttpHeader *header, const void *body, - size_t body_len, NuguHttpCallback callback, void *user_data) +NuguHttpRequest *nugu_http_request(enum NuguHttpRequestType type, + NuguHttpHost *host, const char *path, + NuguHttpHeader *header, const void *body, + size_t body_len, NuguHttpCallback callback, + void *user_data) { struct _nugu_http_request *req; @@ -617,10 +613,10 @@ nugu_http_request(enum NuguHttpRequestType type, NuguHttpHost *host, return req; } -EXPORT_API NuguHttpRequest * -nugu_http_request_sync(enum NuguHttpRequestType type, NuguHttpHost *host, - const char *path, NuguHttpHeader *header, - const void *body, size_t body_len) +NuguHttpRequest *nugu_http_request_sync(enum NuguHttpRequestType type, + NuguHttpHost *host, const char *path, + NuguHttpHeader *header, + const void *body, size_t body_len) { struct _nugu_http_request *req; @@ -654,75 +650,71 @@ nugu_http_request_sync(enum NuguHttpRequestType type, NuguHttpHost *host, return req; } -EXPORT_API NuguHttpRequest *nugu_http_get(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, - NuguHttpCallback callback, - void *user_data) +NuguHttpRequest *nugu_http_get(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, + NuguHttpCallback callback, void *user_data) { return nugu_http_request(NUGU_HTTP_REQUEST_GET, host, path, header, NULL, 0, callback, user_data); } -EXPORT_API NuguHttpRequest * -nugu_http_get_sync(NuguHttpHost *host, const char *path, NuguHttpHeader *header) +NuguHttpRequest *nugu_http_get_sync(NuguHttpHost *host, const char *path, + NuguHttpHeader *header) { return nugu_http_request_sync(NUGU_HTTP_REQUEST_GET, host, path, header, NULL, 0); } -EXPORT_API NuguHttpRequest *nugu_http_post(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, - const void *body, size_t body_len, - NuguHttpCallback callback, - void *user_data) +NuguHttpRequest *nugu_http_post(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, const void *body, + size_t body_len, NuguHttpCallback callback, + void *user_data) { return nugu_http_request(NUGU_HTTP_REQUEST_POST, host, path, header, body, body_len, callback, user_data); } -EXPORT_API NuguHttpRequest * -nugu_http_post_sync(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, const void *body, size_t body_len) +NuguHttpRequest *nugu_http_post_sync(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, const void *body, + size_t body_len) { return nugu_http_request_sync(NUGU_HTTP_REQUEST_POST, host, path, header, body, body_len); } -EXPORT_API NuguHttpRequest *nugu_http_put(NuguHttpHost *host, const char *path, - NuguHttpHeader *header, - const void *body, size_t body_len, - NuguHttpCallback callback, - void *user_data) +NuguHttpRequest *nugu_http_put(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, const void *body, + size_t body_len, NuguHttpCallback callback, + void *user_data) { return nugu_http_request(NUGU_HTTP_REQUEST_PUT, host, path, header, body, body_len, callback, user_data); } -EXPORT_API NuguHttpRequest * -nugu_http_put_sync(NuguHttpHost *host, const char *path, NuguHttpHeader *header, - const void *body, size_t body_len) +NuguHttpRequest *nugu_http_put_sync(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, const void *body, + size_t body_len) { return nugu_http_request_sync(NUGU_HTTP_REQUEST_PUT, host, path, header, body, body_len); } -EXPORT_API NuguHttpRequest * -nugu_http_delete(NuguHttpHost *host, const char *path, NuguHttpHeader *header, - NuguHttpCallback callback, void *user_data) +NuguHttpRequest *nugu_http_delete(NuguHttpHost *host, const char *path, + NuguHttpHeader *header, + NuguHttpCallback callback, void *user_data) { return nugu_http_request(NUGU_HTTP_REQUEST_DELETE, host, path, header, NULL, 0, callback, user_data); } -EXPORT_API NuguHttpRequest *nugu_http_delete_sync(NuguHttpHost *host, - const char *path, - NuguHttpHeader *header) +NuguHttpRequest *nugu_http_delete_sync(NuguHttpHost *host, const char *path, + NuguHttpHeader *header) { return nugu_http_request_sync(NUGU_HTTP_REQUEST_DELETE, host, path, header, NULL, 0); } -EXPORT_API NuguHttpRequest * +NuguHttpRequest * nugu_http_download(NuguHttpHost *host, const char *path, const char *dest_path, NuguHttpHeader *header, NuguHttpCallback callback, NuguHttpProgressCallback progress_callback, void *user_data) @@ -771,15 +763,14 @@ nugu_http_download(NuguHttpHost *host, const char *path, const char *dest_path, return req; } -EXPORT_API const NuguHttpResponse * -nugu_http_request_response_get(NuguHttpRequest *req) +const NuguHttpResponse *nugu_http_request_response_get(NuguHttpRequest *req) { g_return_val_if_fail(req != NULL, NULL); return req->resp; } -EXPORT_API void nugu_http_request_free(NuguHttpRequest *req) +void nugu_http_request_free(NuguHttpRequest *req) { g_return_if_fail(req != NULL); @@ -821,7 +812,7 @@ EXPORT_API void nugu_http_request_free(NuguHttpRequest *req) free(req); } -EXPORT_API void nugu_http_init(void) +void nugu_http_init(void) { curl_global_init(CURL_GLOBAL_ALL); } diff --git a/src/base/nugu_log.c b/src/base/nugu_log.c index c92d6fce0..916c0fedc 100644 --- a/src/base/nugu_log.c +++ b/src/base/nugu_log.c @@ -501,10 +501,9 @@ static void _syslog_formatted(enum nugu_log_module module, g_string_free(buf, TRUE); } -EXPORT_API void nugu_log_print(enum nugu_log_module module, - enum nugu_log_level level, const char *filename, - const char *funcname, int line, - const char *format, ...) +void nugu_log_print(enum nugu_log_module module, enum nugu_log_level level, + const char *filename, const char *funcname, int line, + const char *format, ...) { va_list arg; enum nugu_log_system log_system; @@ -553,7 +552,7 @@ EXPORT_API void nugu_log_print(enum nugu_log_module module, } } -EXPORT_API int nugu_log_set_system(enum nugu_log_system log_system) +int nugu_log_set_system(enum nugu_log_system log_system) { if (log_system > NUGU_LOG_SYSTEM_CUSTOM) { nugu_error("invalid log system(%d)", log_system); @@ -574,7 +573,7 @@ EXPORT_API int nugu_log_set_system(enum nugu_log_system log_system) return 0; } -EXPORT_API enum nugu_log_system nugu_log_get_system(void) +enum nugu_log_system nugu_log_get_system(void) { enum nugu_log_system log_system; @@ -591,7 +590,7 @@ EXPORT_API enum nugu_log_system nugu_log_get_system(void) return log_system; } -EXPORT_API int nugu_log_set_handler(nugu_log_handler handler, void *user_data) +int nugu_log_set_handler(nugu_log_handler handler, void *user_data) { if (!handler) { nugu_error("handler is NULL"); @@ -614,14 +613,14 @@ EXPORT_API int nugu_log_set_handler(nugu_log_handler handler, void *user_data) return 0; } -EXPORT_API void nugu_log_set_prefix_fields(enum nugu_log_prefix field_set) +void nugu_log_set_prefix_fields(enum nugu_log_prefix field_set) { pthread_mutex_lock(&_log_mutex); _log_prefix_fields = field_set; pthread_mutex_unlock(&_log_mutex); } -EXPORT_API enum nugu_log_prefix nugu_log_get_prefix_fields(void) +enum nugu_log_prefix nugu_log_get_prefix_fields(void) { enum nugu_log_prefix tmp; @@ -638,14 +637,14 @@ EXPORT_API enum nugu_log_prefix nugu_log_get_prefix_fields(void) return tmp; } -EXPORT_API void nugu_log_set_modules(unsigned int bitset) +void nugu_log_set_modules(unsigned int bitset) { pthread_mutex_lock(&_log_mutex); _log_module_bitset = bitset; pthread_mutex_unlock(&_log_mutex); } -EXPORT_API unsigned int nugu_log_get_modules(void) +unsigned int nugu_log_get_modules(void) { unsigned int tmp; @@ -662,14 +661,14 @@ EXPORT_API unsigned int nugu_log_get_modules(void) return tmp; } -EXPORT_API void nugu_log_set_level(enum nugu_log_level level) +void nugu_log_set_level(enum nugu_log_level level) { pthread_mutex_lock(&_log_mutex); _log_level = level; pthread_mutex_unlock(&_log_mutex); } -EXPORT_API enum nugu_log_level nugu_log_get_level(void) +enum nugu_log_level nugu_log_get_level(void) { enum nugu_log_level tmp; @@ -686,7 +685,7 @@ EXPORT_API enum nugu_log_level nugu_log_get_level(void) return tmp; } -EXPORT_API void nugu_log_set_protocol_line_limit(int length) +void nugu_log_set_protocol_line_limit(int length) { pthread_mutex_lock(&_log_mutex); if (length <= 0) @@ -696,7 +695,7 @@ EXPORT_API void nugu_log_set_protocol_line_limit(int length) pthread_mutex_unlock(&_log_mutex); } -EXPORT_API int nugu_log_get_protocol_line_limit(void) +int nugu_log_get_protocol_line_limit(void) { int tmp; @@ -713,9 +712,9 @@ EXPORT_API int nugu_log_get_protocol_line_limit(void) return tmp; } -EXPORT_API void nugu_hexdump(enum nugu_log_module module, const uint8_t *data, - size_t data_size, const char *header, - const char *footer, const char *lineindent) +void nugu_hexdump(enum nugu_log_module module, const uint8_t *data, + size_t data_size, const char *header, const char *footer, + const char *lineindent) { size_t i; size_t j; diff --git a/src/base/nugu_network_manager.c b/src/base/nugu_network_manager.c index 9b26c27c9..1a24bba29 100644 --- a/src/base/nugu_network_manager.c +++ b/src/base/nugu_network_manager.c @@ -736,8 +736,8 @@ static NetworkManager *nugu_network_manager_new(void) on_event_send_result, on_destroy_event_send_result, nm); nugu_equeue_set_handler(NUGU_EQUEUE_TYPE_EVENT_RESPONSE, - on_event_response, - on_destroy_event_response, nm); + on_event_response, on_destroy_event_response, + nm); /* Received registry policy */ nugu_equeue_set_handler(NUGU_EQUEUE_TYPE_REGISTRY_HEALTH, @@ -796,7 +796,7 @@ static void nugu_network_manager_free(NetworkManager *nm) static NetworkManager *_network; -EXPORT_API int nugu_network_manager_initialize(void) +int nugu_network_manager_initialize(void) { struct timespec spec; curl_version_info_data *cinfo; @@ -836,7 +836,7 @@ EXPORT_API int nugu_network_manager_initialize(void) return 0; } -EXPORT_API void nugu_network_manager_deinitialize(void) +void nugu_network_manager_deinitialize(void) { if (!_network) return; @@ -850,7 +850,7 @@ EXPORT_API void nugu_network_manager_deinitialize(void) nugu_info("network manager de-initialized"); } -EXPORT_API int nugu_network_manager_connect(void) +int nugu_network_manager_connect(void) { g_return_val_if_fail(_network != NULL, -1); @@ -891,7 +891,7 @@ static void _disconnect(NetworkManager *nm) } } -EXPORT_API int nugu_network_manager_disconnect(void) +int nugu_network_manager_disconnect(void) { g_return_val_if_fail(_network != NULL, -1); @@ -907,7 +907,7 @@ EXPORT_API int nugu_network_manager_disconnect(void) return 0; } -EXPORT_API int nugu_network_manager_reset_connection(void) +int nugu_network_manager_reset_connection(void) { if (!_network) { nugu_error("network manager not initialized"); @@ -921,7 +921,7 @@ EXPORT_API int nugu_network_manager_reset_connection(void) return 0; } -EXPORT_API int nugu_network_manager_set_status_callback( +int nugu_network_manager_set_status_callback( NuguNetworkManagerStatusCallback callback, void *userdata) { if (!_network) @@ -933,7 +933,7 @@ EXPORT_API int nugu_network_manager_set_status_callback( return 0; } -EXPORT_API int nugu_network_manager_set_handoff_status_callback( +int nugu_network_manager_set_handoff_status_callback( NuguNetworkManagerHandoffStatusCallback callback, void *userdata) { if (!_network) @@ -945,7 +945,7 @@ EXPORT_API int nugu_network_manager_set_handoff_status_callback( return 0; } -EXPORT_API int nugu_network_manager_set_event_send_notify_callback( +int nugu_network_manager_set_event_send_notify_callback( NuguNetworkManagerEventSendNotifyCallback callback, void *userdata) { if (!_network) @@ -957,7 +957,7 @@ EXPORT_API int nugu_network_manager_set_event_send_notify_callback( return 0; } -EXPORT_API int nugu_network_manager_set_event_data_send_notify_callback( +int nugu_network_manager_set_event_data_send_notify_callback( NuguNetworkManagerEventDataSendNotifyCallback callback, void *userdata) { if (!_network) @@ -969,7 +969,7 @@ EXPORT_API int nugu_network_manager_set_event_data_send_notify_callback( return 0; } -EXPORT_API int nugu_network_manager_set_event_result_callback( +int nugu_network_manager_set_event_result_callback( NuguNetworkManagerEventResultCallback callback, void *userdata) { if (!_network) @@ -981,7 +981,7 @@ EXPORT_API int nugu_network_manager_set_event_result_callback( return 0; } -EXPORT_API int nugu_network_manager_set_event_response_callback( +int nugu_network_manager_set_event_response_callback( NuguNetworkManagerEventResponseCallback callback, void *userdata) { if (!_network) @@ -993,7 +993,7 @@ EXPORT_API int nugu_network_manager_set_event_response_callback( return 0; } -EXPORT_API int nugu_network_manager_set_directive_callback( +int nugu_network_manager_set_directive_callback( NuguNetworkManagerDirectiveCallback callback, void *userdata) { if (!_network) @@ -1005,7 +1005,7 @@ EXPORT_API int nugu_network_manager_set_directive_callback( return 0; } -EXPORT_API int nugu_network_manager_set_attachment_callback( +int nugu_network_manager_set_attachment_callback( NuguNetworkManagerAttachmentCallback callback, void *userdata) { if (!_network) @@ -1017,12 +1017,12 @@ EXPORT_API int nugu_network_manager_set_attachment_callback( return 0; } -EXPORT_API NuguNetworkStatus nugu_network_manager_get_status(void) +NuguNetworkStatus nugu_network_manager_get_status(void) { return _network->cur_status; } -EXPORT_API int nugu_network_manager_send_event(NuguEvent *nev) +int nugu_network_manager_send_event(NuguEvent *nev) { int ret; @@ -1094,7 +1094,7 @@ EXPORT_API int nugu_network_manager_send_event(NuguEvent *nev) return 0; } -EXPORT_API int nugu_network_manager_force_close_event(NuguEvent *nev) +int nugu_network_manager_force_close_event(NuguEvent *nev) { g_return_val_if_fail(nev != NULL, -1); @@ -1116,9 +1116,8 @@ EXPORT_API int nugu_network_manager_force_close_event(NuguEvent *nev) return dg_server_force_close_event(_network->server, nev); } -EXPORT_API int nugu_network_manager_send_event_data(NuguEvent *nev, int is_end, - size_t length, - unsigned char *data) +int nugu_network_manager_send_event_data(NuguEvent *nev, int is_end, + size_t length, unsigned char *data) { g_return_val_if_fail(nev != NULL, -1); @@ -1141,8 +1140,7 @@ EXPORT_API int nugu_network_manager_send_event_data(NuguEvent *nev, int is_end, data); } -EXPORT_API int -nugu_network_manager_handoff(const NuguNetworkServerPolicy *policy) +int nugu_network_manager_handoff(const NuguNetworkServerPolicy *policy) { g_return_val_if_fail(policy != NULL, -1); @@ -1176,7 +1174,7 @@ nugu_network_manager_handoff(const NuguNetworkServerPolicy *policy) return 0; } -EXPORT_API int nugu_network_manager_set_token(const char *token) +int nugu_network_manager_set_token(const char *token) { if (!_network) { nugu_error("network manager not initialized"); @@ -1202,7 +1200,7 @@ EXPORT_API int nugu_network_manager_set_token(const char *token) return 0; } -EXPORT_API const char *nugu_network_manager_peek_token(void) +const char *nugu_network_manager_peek_token(void) { if (!_network) { nugu_error("network manager not initialized"); @@ -1212,7 +1210,7 @@ EXPORT_API const char *nugu_network_manager_peek_token(void) return _network->token; } -EXPORT_API int nugu_network_manager_set_registry_url(const char *urlname) +int nugu_network_manager_set_registry_url(const char *urlname) { #ifdef NUGU_ENV_NETWORK_REGISTRY_SERVER char *override_value; @@ -1244,7 +1242,7 @@ EXPORT_API int nugu_network_manager_set_registry_url(const char *urlname) return 0; } -EXPORT_API const char *nugu_network_manager_peek_registry_url(void) +const char *nugu_network_manager_peek_registry_url(void) { if (!_network) { nugu_error("network manager not initialized"); @@ -1254,8 +1252,8 @@ EXPORT_API const char *nugu_network_manager_peek_registry_url(void) return _network->registry_url; } -EXPORT_API int nugu_network_manager_set_useragent(const char *app_version, - const char *additional_info) +int nugu_network_manager_set_useragent(const char *app_version, + const char *additional_info) { #ifdef NUGU_ENV_NETWORK_USERAGENT char *override_value; @@ -1293,7 +1291,7 @@ EXPORT_API int nugu_network_manager_set_useragent(const char *app_version, return 0; } -EXPORT_API const char *nugu_network_manager_peek_useragent(void) +const char *nugu_network_manager_peek_useragent(void) { if (!_network) { nugu_error("network manager not initialized"); @@ -1303,7 +1301,7 @@ EXPORT_API const char *nugu_network_manager_peek_useragent(void) return _network->useragent; } -EXPORT_API const char *nugu_network_manager_peek_last_asr_time(void) +const char *nugu_network_manager_peek_last_asr_time(void) { if (!_network) { nugu_error("network manager not initialized"); @@ -1313,8 +1311,7 @@ EXPORT_API const char *nugu_network_manager_peek_last_asr_time(void) return _network->last_asr; } -EXPORT_API int -nugu_network_manager_set_connection_type(NuguNetworkConnectionType ctype) +int nugu_network_manager_set_connection_type(NuguNetworkConnectionType ctype) { if (!_network) { nugu_error("network manager not initialized"); @@ -1326,8 +1323,7 @@ nugu_network_manager_set_connection_type(NuguNetworkConnectionType ctype) return 0; } -EXPORT_API NuguNetworkConnectionType -nugu_network_manager_get_connection_type(void) +NuguNetworkConnectionType nugu_network_manager_get_connection_type(void) { if (!_network) { nugu_error("network manager not initialized"); diff --git a/src/base/nugu_pcm.c b/src/base/nugu_pcm.c index aabe087c2..1adfecd3c 100644 --- a/src/base/nugu_pcm.c +++ b/src/base/nugu_pcm.c @@ -54,8 +54,8 @@ static GList *_pcms; static GList *_pcm_drivers; static NuguPcmDriver *_default_driver; -EXPORT_API NuguPcmDriver *nugu_pcm_driver_new(const char *name, - struct nugu_pcm_driver_ops *ops) +NuguPcmDriver *nugu_pcm_driver_new(const char *name, + struct nugu_pcm_driver_ops *ops) { NuguPcmDriver *driver; @@ -75,7 +75,7 @@ EXPORT_API NuguPcmDriver *nugu_pcm_driver_new(const char *name, return driver; } -EXPORT_API int nugu_pcm_driver_free(NuguPcmDriver *driver) +int nugu_pcm_driver_free(NuguPcmDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -95,7 +95,7 @@ EXPORT_API int nugu_pcm_driver_free(NuguPcmDriver *driver) return 0; } -EXPORT_API int nugu_pcm_driver_register(NuguPcmDriver *driver) +int nugu_pcm_driver_register(NuguPcmDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -112,7 +112,7 @@ EXPORT_API int nugu_pcm_driver_register(NuguPcmDriver *driver) return 0; } -EXPORT_API int nugu_pcm_driver_remove(NuguPcmDriver *driver) +int nugu_pcm_driver_remove(NuguPcmDriver *driver) { GList *l; @@ -133,7 +133,7 @@ EXPORT_API int nugu_pcm_driver_remove(NuguPcmDriver *driver) return 0; } -EXPORT_API int nugu_pcm_driver_set_default(NuguPcmDriver *driver) +int nugu_pcm_driver_set_default(NuguPcmDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -144,7 +144,7 @@ EXPORT_API int nugu_pcm_driver_set_default(NuguPcmDriver *driver) return 0; } -EXPORT_API NuguPcmDriver *nugu_pcm_driver_get_default(void) +NuguPcmDriver *nugu_pcm_driver_get_default(void) { #ifdef NUGU_ENV_DEFAULT_PCM_DRIVER const char *tmp; @@ -159,7 +159,7 @@ EXPORT_API NuguPcmDriver *nugu_pcm_driver_get_default(void) return _default_driver; } -EXPORT_API NuguPcmDriver *nugu_pcm_driver_find(const char *name) +NuguPcmDriver *nugu_pcm_driver_find(const char *name) { GList *cur; @@ -176,8 +176,8 @@ EXPORT_API NuguPcmDriver *nugu_pcm_driver_find(const char *name) return NULL; } -EXPORT_API NuguPcm *nugu_pcm_new(const char *name, NuguPcmDriver *driver, - NuguAudioProperty property) +NuguPcm *nugu_pcm_new(const char *name, NuguPcmDriver *driver, + NuguAudioProperty property) { NuguPcm *pcm; @@ -232,7 +232,7 @@ EXPORT_API NuguPcm *nugu_pcm_new(const char *name, NuguPcmDriver *driver, return pcm; } -EXPORT_API void nugu_pcm_free(NuguPcm *pcm) +void nugu_pcm_free(NuguPcm *pcm) { g_return_if_fail(pcm != NULL); @@ -252,7 +252,7 @@ EXPORT_API void nugu_pcm_free(NuguPcm *pcm) g_free(pcm); } -EXPORT_API int nugu_pcm_add(NuguPcm *pcm) +int nugu_pcm_add(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); @@ -266,7 +266,7 @@ EXPORT_API int nugu_pcm_add(NuguPcm *pcm) return 0; } -EXPORT_API int nugu_pcm_remove(NuguPcm *pcm) +int nugu_pcm_remove(NuguPcm *pcm) { GList *l; @@ -279,7 +279,7 @@ EXPORT_API int nugu_pcm_remove(NuguPcm *pcm) return 0; } -EXPORT_API NuguPcm *nugu_pcm_find(const char *name) +NuguPcm *nugu_pcm_find(const char *name) { GList *cur; @@ -296,8 +296,7 @@ EXPORT_API NuguPcm *nugu_pcm_find(const char *name) return NULL; } -EXPORT_API int nugu_pcm_set_audio_attribute(NuguPcm *pcm, - NuguAudioAttribute attr) +int nugu_pcm_set_audio_attribute(NuguPcm *pcm, NuguAudioAttribute attr) { g_return_val_if_fail(pcm != NULL, -1); @@ -305,21 +304,21 @@ EXPORT_API int nugu_pcm_set_audio_attribute(NuguPcm *pcm, return 0; } -EXPORT_API int nugu_pcm_get_audio_attribute(NuguPcm *pcm) +int nugu_pcm_get_audio_attribute(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); return pcm->attr; } -EXPORT_API const char *nugu_pcm_get_audio_attribute_str(NuguPcm *pcm) +const char *nugu_pcm_get_audio_attribute_str(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, NULL); return nugu_audio_get_attribute_str(pcm->attr); } -EXPORT_API int nugu_pcm_start(NuguPcm *pcm) +int nugu_pcm_start(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); @@ -334,7 +333,7 @@ EXPORT_API int nugu_pcm_start(NuguPcm *pcm) return pcm->driver->ops->start(pcm->driver, pcm); } -EXPORT_API int nugu_pcm_stop(NuguPcm *pcm) +int nugu_pcm_stop(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); @@ -349,7 +348,7 @@ EXPORT_API int nugu_pcm_stop(NuguPcm *pcm) return pcm->driver->ops->stop(pcm->driver, pcm); } -EXPORT_API int nugu_pcm_pause(NuguPcm *pcm) +int nugu_pcm_pause(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); @@ -362,7 +361,7 @@ EXPORT_API int nugu_pcm_pause(NuguPcm *pcm) return pcm->driver->ops->pause(pcm->driver, pcm); } -EXPORT_API int nugu_pcm_resume(NuguPcm *pcm) +int nugu_pcm_resume(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); @@ -375,7 +374,7 @@ EXPORT_API int nugu_pcm_resume(NuguPcm *pcm) return pcm->driver->ops->resume(pcm->driver, pcm); } -EXPORT_API int nugu_pcm_set_volume(NuguPcm *pcm, int volume) +int nugu_pcm_set_volume(NuguPcm *pcm, int volume) { g_return_val_if_fail(pcm != NULL, -1); @@ -401,14 +400,14 @@ EXPORT_API int nugu_pcm_set_volume(NuguPcm *pcm, int volume) return 0; } -EXPORT_API int nugu_pcm_get_volume(NuguPcm *pcm) +int nugu_pcm_get_volume(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); return pcm->volume; } -EXPORT_API int nugu_pcm_get_duration(NuguPcm *pcm) +int nugu_pcm_get_duration(NuguPcm *pcm) { int samplerate; @@ -438,7 +437,7 @@ EXPORT_API int nugu_pcm_get_duration(NuguPcm *pcm) return (pcm->total_size / samplerate); } -EXPORT_API int nugu_pcm_get_position(NuguPcm *pcm) +int nugu_pcm_get_position(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); @@ -451,9 +450,8 @@ EXPORT_API int nugu_pcm_get_position(NuguPcm *pcm) return pcm->driver->ops->get_position(pcm->driver, pcm); } -EXPORT_API void nugu_pcm_set_status_callback(NuguPcm *pcm, - NuguMediaStatusCallback cb, - void *userdata) +void nugu_pcm_set_status_callback(NuguPcm *pcm, NuguMediaStatusCallback cb, + void *userdata) { g_return_if_fail(pcm != NULL); @@ -461,8 +459,7 @@ EXPORT_API void nugu_pcm_set_status_callback(NuguPcm *pcm, pcm->sud = userdata; } -EXPORT_API void nugu_pcm_emit_status(NuguPcm *pcm, - enum nugu_media_status status) +void nugu_pcm_emit_status(NuguPcm *pcm, enum nugu_media_status status) { g_return_if_fail(pcm != NULL); @@ -475,16 +472,15 @@ EXPORT_API void nugu_pcm_emit_status(NuguPcm *pcm, pcm->scb(status, pcm->sud); } -EXPORT_API enum nugu_media_status nugu_pcm_get_status(NuguPcm *pcm) +enum nugu_media_status nugu_pcm_get_status(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, NUGU_MEDIA_STATUS_STOPPED); return pcm->status; } -EXPORT_API void nugu_pcm_set_event_callback(NuguPcm *pcm, - NuguMediaEventCallback cb, - void *userdata) +void nugu_pcm_set_event_callback(NuguPcm *pcm, NuguMediaEventCallback cb, + void *userdata) { g_return_if_fail(pcm != NULL); @@ -492,7 +488,7 @@ EXPORT_API void nugu_pcm_set_event_callback(NuguPcm *pcm, pcm->eud = userdata; } -EXPORT_API void nugu_pcm_emit_event(NuguPcm *pcm, enum nugu_media_event event) +void nugu_pcm_emit_event(NuguPcm *pcm, enum nugu_media_event event) { g_return_if_fail(pcm != NULL); @@ -503,7 +499,7 @@ EXPORT_API void nugu_pcm_emit_event(NuguPcm *pcm, enum nugu_media_event event) pcm->ecb(event, pcm->eud); } -EXPORT_API int nugu_pcm_set_driver_data(NuguPcm *pcm, void *data) +int nugu_pcm_set_driver_data(NuguPcm *pcm, void *data) { g_return_val_if_fail(pcm != NULL, -1); @@ -512,14 +508,14 @@ EXPORT_API int nugu_pcm_set_driver_data(NuguPcm *pcm, void *data) return 0; } -EXPORT_API void *nugu_pcm_get_driver_data(NuguPcm *pcm) +void *nugu_pcm_get_driver_data(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, NULL); return pcm->driver_data; } -EXPORT_API void nugu_pcm_clear_buffer(NuguPcm *pcm) +void nugu_pcm_clear_buffer(NuguPcm *pcm) { g_return_if_fail(pcm != NULL); g_return_if_fail(pcm->buf != NULL); @@ -533,8 +529,7 @@ EXPORT_API void nugu_pcm_clear_buffer(NuguPcm *pcm) pthread_mutex_unlock(&pcm->mutex); } -EXPORT_API int nugu_pcm_push_data(NuguPcm *pcm, const char *data, size_t size, - int is_last) +int nugu_pcm_push_data(NuguPcm *pcm, const char *data, size_t size, int is_last) { int ret; @@ -559,7 +554,7 @@ EXPORT_API int nugu_pcm_push_data(NuguPcm *pcm, const char *data, size_t size, return ret; } -EXPORT_API int nugu_pcm_push_data_done(NuguPcm *pcm) +int nugu_pcm_push_data_done(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); @@ -575,7 +570,7 @@ EXPORT_API int nugu_pcm_push_data_done(NuguPcm *pcm) return 0; } -EXPORT_API int nugu_pcm_get_data(NuguPcm *pcm, char *data, size_t size) +int nugu_pcm_get_data(NuguPcm *pcm, char *data, size_t size) { size_t data_size; const char *ptr; @@ -615,7 +610,7 @@ EXPORT_API int nugu_pcm_get_data(NuguPcm *pcm, char *data, size_t size) return size; } -EXPORT_API size_t nugu_pcm_get_data_size(NuguPcm *pcm) +size_t nugu_pcm_get_data_size(NuguPcm *pcm) { size_t ret; @@ -630,7 +625,7 @@ EXPORT_API size_t nugu_pcm_get_data_size(NuguPcm *pcm) return ret; } -EXPORT_API int nugu_pcm_receive_is_last_data(NuguPcm *pcm) +int nugu_pcm_receive_is_last_data(NuguPcm *pcm) { g_return_val_if_fail(pcm != NULL, -1); diff --git a/src/base/nugu_player.c b/src/base/nugu_player.c index 027458b9f..793d3197c 100644 --- a/src/base/nugu_player.c +++ b/src/base/nugu_player.c @@ -50,8 +50,8 @@ static GList *_players; static GList *_player_drivers; static NuguPlayerDriver *_default_driver; -EXPORT_API NuguPlayerDriver * -nugu_player_driver_new(const char *name, struct nugu_player_driver_ops *ops) +NuguPlayerDriver *nugu_player_driver_new(const char *name, + struct nugu_player_driver_ops *ops) { NuguPlayerDriver *driver; @@ -71,7 +71,7 @@ nugu_player_driver_new(const char *name, struct nugu_player_driver_ops *ops) return driver; } -EXPORT_API int nugu_player_driver_free(NuguPlayerDriver *driver) +int nugu_player_driver_free(NuguPlayerDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -88,7 +88,7 @@ EXPORT_API int nugu_player_driver_free(NuguPlayerDriver *driver) return 0; } -EXPORT_API int nugu_player_driver_register(NuguPlayerDriver *driver) +int nugu_player_driver_register(NuguPlayerDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -105,7 +105,7 @@ EXPORT_API int nugu_player_driver_register(NuguPlayerDriver *driver) return 0; } -EXPORT_API int nugu_player_driver_remove(NuguPlayerDriver *driver) +int nugu_player_driver_remove(NuguPlayerDriver *driver) { GList *l; @@ -126,7 +126,7 @@ EXPORT_API int nugu_player_driver_remove(NuguPlayerDriver *driver) return 0; } -EXPORT_API int nugu_player_driver_set_default(NuguPlayerDriver *driver) +int nugu_player_driver_set_default(NuguPlayerDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -137,12 +137,12 @@ EXPORT_API int nugu_player_driver_set_default(NuguPlayerDriver *driver) return 0; } -EXPORT_API NuguPlayerDriver *nugu_player_driver_get_default(void) +NuguPlayerDriver *nugu_player_driver_get_default(void) { return _default_driver; } -EXPORT_API NuguPlayerDriver *nugu_player_driver_find(const char *name) +NuguPlayerDriver *nugu_player_driver_find(const char *name) { GList *cur; @@ -159,8 +159,7 @@ EXPORT_API NuguPlayerDriver *nugu_player_driver_find(const char *name) return NULL; } -EXPORT_API NuguPlayer *nugu_player_new(const char *name, - NuguPlayerDriver *driver) +NuguPlayer *nugu_player_new(const char *name, NuguPlayerDriver *driver) { NuguPlayer *player; @@ -196,7 +195,7 @@ EXPORT_API NuguPlayer *nugu_player_new(const char *name, return player; } -EXPORT_API void nugu_player_free(NuguPlayer *player) +void nugu_player_free(NuguPlayer *player) { g_return_if_fail(player != NULL); @@ -214,7 +213,7 @@ EXPORT_API void nugu_player_free(NuguPlayer *player) g_free(player); } -EXPORT_API int nugu_player_add(NuguPlayer *player) +int nugu_player_add(NuguPlayer *player) { g_return_val_if_fail(player != NULL, -1); @@ -228,7 +227,7 @@ EXPORT_API int nugu_player_add(NuguPlayer *player) return 0; } -EXPORT_API int nugu_player_remove(NuguPlayer *player) +int nugu_player_remove(NuguPlayer *player) { GList *l; @@ -241,7 +240,7 @@ EXPORT_API int nugu_player_remove(NuguPlayer *player) return 0; } -EXPORT_API NuguPlayer *nugu_player_find(const char *name) +NuguPlayer *nugu_player_find(const char *name) { GList *cur; @@ -258,8 +257,7 @@ EXPORT_API NuguPlayer *nugu_player_find(const char *name) return NULL; } -EXPORT_API int nugu_player_set_audio_attribute(NuguPlayer *player, - NuguAudioAttribute attr) +int nugu_player_set_audio_attribute(NuguPlayer *player, NuguAudioAttribute attr) { g_return_val_if_fail(player != NULL, -1); @@ -267,21 +265,21 @@ EXPORT_API int nugu_player_set_audio_attribute(NuguPlayer *player, return 0; } -EXPORT_API int nugu_player_get_audio_attribute(NuguPlayer *player) +int nugu_player_get_audio_attribute(NuguPlayer *player) { g_return_val_if_fail(player != NULL, -1); return player->attr; } -EXPORT_API const char *nugu_player_get_audio_attribute_str(NuguPlayer *player) +const char *nugu_player_get_audio_attribute_str(NuguPlayer *player) { g_return_val_if_fail(player != NULL, NULL); return nugu_audio_get_attribute_str(player->attr); } -EXPORT_API int nugu_player_set_source(NuguPlayer *player, const char *url) +int nugu_player_set_source(NuguPlayer *player, const char *url) { g_return_val_if_fail(player != NULL, -1); g_return_val_if_fail(url != NULL, -1); @@ -300,7 +298,7 @@ EXPORT_API int nugu_player_set_source(NuguPlayer *player, const char *url) return player->driver->ops->set_source(player->driver, player, url); } -EXPORT_API int nugu_player_start(NuguPlayer *player) +int nugu_player_start(NuguPlayer *player) { g_return_val_if_fail(player != NULL, -1); @@ -318,7 +316,7 @@ EXPORT_API int nugu_player_start(NuguPlayer *player) return player->driver->ops->start(player->driver, player); } -EXPORT_API int nugu_player_stop(NuguPlayer *player) +int nugu_player_stop(NuguPlayer *player) { g_return_val_if_fail(player != NULL, -1); @@ -333,7 +331,7 @@ EXPORT_API int nugu_player_stop(NuguPlayer *player) return player->driver->ops->stop(player->driver, player); } -EXPORT_API int nugu_player_pause(NuguPlayer *player) +int nugu_player_pause(NuguPlayer *player) { g_return_val_if_fail(player != NULL, -1); @@ -346,7 +344,7 @@ EXPORT_API int nugu_player_pause(NuguPlayer *player) return player->driver->ops->pause(player->driver, player); } -EXPORT_API int nugu_player_resume(NuguPlayer *player) +int nugu_player_resume(NuguPlayer *player) { g_return_val_if_fail(player != NULL, -1); @@ -359,7 +357,7 @@ EXPORT_API int nugu_player_resume(NuguPlayer *player) return player->driver->ops->resume(player->driver, player); } -EXPORT_API int nugu_player_seek(NuguPlayer *player, int sec) +int nugu_player_seek(NuguPlayer *player, int sec) { g_return_val_if_fail(player != NULL, -1); @@ -372,7 +370,7 @@ EXPORT_API int nugu_player_seek(NuguPlayer *player, int sec) return player->driver->ops->seek(player->driver, player, sec); } -EXPORT_API int nugu_player_set_volume(NuguPlayer *player, int vol) +int nugu_player_set_volume(NuguPlayer *player, int vol) { g_return_val_if_fail(player != NULL, -1); @@ -393,14 +391,14 @@ EXPORT_API int nugu_player_set_volume(NuguPlayer *player, int vol) player->volume); } -EXPORT_API int nugu_player_get_volume(NuguPlayer *player) +int nugu_player_get_volume(NuguPlayer *player) { g_return_val_if_fail(player != NULL, -1); return player->volume; } -EXPORT_API int nugu_player_get_duration(NuguPlayer *player) +int nugu_player_get_duration(NuguPlayer *player) { g_return_val_if_fail(player != NULL, -1); @@ -412,7 +410,7 @@ EXPORT_API int nugu_player_get_duration(NuguPlayer *player) return player->driver->ops->get_duration(player->driver, player); } -EXPORT_API int nugu_player_set_position(NuguPlayer *player, int position) +int nugu_player_set_position(NuguPlayer *player, int position) { g_return_val_if_fail(player != NULL, -1); @@ -420,7 +418,7 @@ EXPORT_API int nugu_player_set_position(NuguPlayer *player, int position) return 0; } -EXPORT_API int nugu_player_get_position(NuguPlayer *player) +int nugu_player_get_position(NuguPlayer *player) { g_return_val_if_fail(player != NULL, -1); @@ -436,16 +434,15 @@ EXPORT_API int nugu_player_get_position(NuguPlayer *player) return player->driver->ops->get_position(player->driver, player); } -EXPORT_API enum nugu_media_status nugu_player_get_status(NuguPlayer *player) +enum nugu_media_status nugu_player_get_status(NuguPlayer *player) { g_return_val_if_fail(player != NULL, NUGU_MEDIA_STATUS_STOPPED); return player->status; } -EXPORT_API void nugu_player_set_status_callback(NuguPlayer *player, - NuguMediaStatusCallback cb, - void *userdata) +void nugu_player_set_status_callback(NuguPlayer *player, + NuguMediaStatusCallback cb, void *userdata) { g_return_if_fail(player != NULL); @@ -453,8 +450,7 @@ EXPORT_API void nugu_player_set_status_callback(NuguPlayer *player, player->sud = userdata; } -EXPORT_API void nugu_player_emit_status(NuguPlayer *player, - enum nugu_media_status status) +void nugu_player_emit_status(NuguPlayer *player, enum nugu_media_status status) { g_return_if_fail(player != NULL); @@ -467,9 +463,8 @@ EXPORT_API void nugu_player_emit_status(NuguPlayer *player, player->scb(status, player->sud); } -EXPORT_API void nugu_player_set_event_callback(NuguPlayer *player, - NuguMediaEventCallback cb, - void *userdata) +void nugu_player_set_event_callback(NuguPlayer *player, + NuguMediaEventCallback cb, void *userdata) { g_return_if_fail(player != NULL); @@ -477,8 +472,7 @@ EXPORT_API void nugu_player_set_event_callback(NuguPlayer *player, player->eud = userdata; } -EXPORT_API void nugu_player_emit_event(NuguPlayer *player, - enum nugu_media_event event) +void nugu_player_emit_event(NuguPlayer *player, enum nugu_media_event event) { g_return_if_fail(player != NULL); @@ -491,7 +485,7 @@ EXPORT_API void nugu_player_emit_event(NuguPlayer *player, player->ecb(event, player->eud); } -EXPORT_API int nugu_player_set_driver_data(NuguPlayer *player, void *data) +int nugu_player_set_driver_data(NuguPlayer *player, void *data) { g_return_val_if_fail(player != NULL, -1); @@ -500,7 +494,7 @@ EXPORT_API int nugu_player_set_driver_data(NuguPlayer *player, void *data) return 0; } -EXPORT_API void *nugu_player_get_driver_data(NuguPlayer *player) +void *nugu_player_get_driver_data(NuguPlayer *player) { g_return_val_if_fail(player != NULL, NULL); diff --git a/src/base/nugu_plugin.c b/src/base/nugu_plugin.c index d1db223ba..7b8dbabce 100644 --- a/src/base/nugu_plugin.c +++ b/src/base/nugu_plugin.c @@ -35,7 +35,7 @@ struct _plugin { static GList *_plugin_list; -EXPORT_API NuguPlugin *nugu_plugin_new(struct nugu_plugin_desc *desc) +NuguPlugin *nugu_plugin_new(struct nugu_plugin_desc *desc) { NuguPlugin *p; @@ -62,7 +62,7 @@ EXPORT_API NuguPlugin *nugu_plugin_new(struct nugu_plugin_desc *desc) return p; } -EXPORT_API NuguPlugin *nugu_plugin_new_from_file(const char *filepath) +NuguPlugin *nugu_plugin_new_from_file(const char *filepath) { void *handle; struct nugu_plugin_desc *desc; @@ -96,7 +96,7 @@ EXPORT_API NuguPlugin *nugu_plugin_new_from_file(const char *filepath) return p; } -EXPORT_API void nugu_plugin_free(NuguPlugin *p) +void nugu_plugin_free(NuguPlugin *p) { g_return_if_fail(p != NULL); @@ -113,7 +113,7 @@ EXPORT_API void nugu_plugin_free(NuguPlugin *p) free(p); } -EXPORT_API int nugu_plugin_add(NuguPlugin *p) +int nugu_plugin_add(NuguPlugin *p) { GList *cur; @@ -147,7 +147,7 @@ EXPORT_API int nugu_plugin_add(NuguPlugin *p) return 0; } -EXPORT_API int nugu_plugin_remove(NuguPlugin *p) +int nugu_plugin_remove(NuguPlugin *p) { g_return_val_if_fail(p != NULL, -1); @@ -159,7 +159,7 @@ EXPORT_API int nugu_plugin_remove(NuguPlugin *p) return 0; } -EXPORT_API int nugu_plugin_set_data(NuguPlugin *p, void *data) +int nugu_plugin_set_data(NuguPlugin *p, void *data) { g_return_val_if_fail(p != NULL, -1); @@ -168,14 +168,14 @@ EXPORT_API int nugu_plugin_set_data(NuguPlugin *p, void *data) return 0; } -EXPORT_API void *nugu_plugin_get_data(NuguPlugin *p) +void *nugu_plugin_get_data(NuguPlugin *p) { g_return_val_if_fail(p != NULL, NULL); return p->data; } -EXPORT_API void *nugu_plugin_get_symbol(NuguPlugin *p, const char *symbol_name) +void *nugu_plugin_get_symbol(NuguPlugin *p, const char *symbol_name) { g_return_val_if_fail(p != NULL, NULL); g_return_val_if_fail(symbol_name != NULL, NULL); @@ -183,15 +183,14 @@ EXPORT_API void *nugu_plugin_get_symbol(NuguPlugin *p, const char *symbol_name) return dlsym(p->handle, symbol_name); } -EXPORT_API const struct nugu_plugin_desc * -nugu_plugin_get_description(NuguPlugin *p) +const struct nugu_plugin_desc *nugu_plugin_get_description(NuguPlugin *p) { g_return_val_if_fail(p != NULL, NULL); return p->desc; } -EXPORT_API int nugu_plugin_load_directory(const char *dirpath) +int nugu_plugin_load_directory(const char *dirpath) { const gchar *file; gchar *filename; @@ -244,7 +243,7 @@ EXPORT_API int nugu_plugin_load_directory(const char *dirpath) return g_list_length(_plugin_list); } -EXPORT_API int nugu_plugin_load_builtin(void) +int nugu_plugin_load_builtin(void) { size_t length; size_t i; @@ -273,7 +272,7 @@ static gint _sort_priority_cmp(gconstpointer a, gconstpointer b) ((NuguPlugin *)b)->desc->priority; } -EXPORT_API int nugu_plugin_initialize(void) +int nugu_plugin_initialize(void) { GList *cur; @@ -312,7 +311,7 @@ EXPORT_API int nugu_plugin_initialize(void) return g_list_length(_plugin_list); } -EXPORT_API void nugu_plugin_deinitialize(void) +void nugu_plugin_deinitialize(void) { GList *cur; @@ -334,7 +333,7 @@ EXPORT_API void nugu_plugin_deinitialize(void) _plugin_list = NULL; } -EXPORT_API NuguPlugin *nugu_plugin_find(const char *name) +NuguPlugin *nugu_plugin_find(const char *name) { GList *cur; diff --git a/src/base/nugu_prof.c b/src/base/nugu_prof.c index b64307bc2..016354af6 100644 --- a/src/base/nugu_prof.c +++ b/src/base/nugu_prof.c @@ -144,7 +144,7 @@ static void _fill_timestr(char *dest_buf, size_t bufsize, (int)(ts->tv_nsec / 1000000)); } -EXPORT_API void nugu_prof_clear(void) +void nugu_prof_clear(void) { pthread_mutex_lock(&_lock); memset(_prof_data, 0, sizeof(_prof_data)); @@ -153,22 +153,21 @@ EXPORT_API void nugu_prof_clear(void) nugu_dbg("clear profiling cache %d bytes", sizeof(_prof_data)); } -EXPORT_API void nugu_prof_enable_tracelog(void) +void nugu_prof_enable_tracelog(void) { pthread_mutex_lock(&_lock); _trace = TRUE; pthread_mutex_unlock(&_lock); } -EXPORT_API void nugu_prof_disable_tracelog(void) +void nugu_prof_disable_tracelog(void) { pthread_mutex_lock(&_lock); _trace = FALSE; pthread_mutex_unlock(&_lock); } -EXPORT_API void nugu_prof_set_callback(NuguProfCallback callback, - void *userdata) +void nugu_prof_set_callback(NuguProfCallback callback, void *userdata) { pthread_mutex_lock(&_lock); _callback = callback; @@ -262,9 +261,8 @@ static void _set_timestamp_with_emit(enum nugu_prof_type type, _emit_callback(type, contents); } -EXPORT_API int nugu_prof_mark_data(enum nugu_prof_type type, - const char *dialog_id, const char *msg_id, - const char *contents) +int nugu_prof_mark_data(enum nugu_prof_type type, const char *dialog_id, + const char *msg_id, const char *contents) { g_return_val_if_fail(type < NUGU_PROF_TYPE_MAX, -1); @@ -287,7 +285,7 @@ EXPORT_API int nugu_prof_mark_data(enum nugu_prof_type type, return 0; } -EXPORT_API int nugu_prof_mark(enum nugu_prof_type type) +int nugu_prof_mark(enum nugu_prof_type type) { g_return_val_if_fail(type < NUGU_PROF_TYPE_MAX, -1); @@ -299,8 +297,7 @@ EXPORT_API int nugu_prof_mark(enum nugu_prof_type type) return 0; } -EXPORT_API struct nugu_prof_data * -nugu_prof_get_last_data(enum nugu_prof_type type) +struct nugu_prof_data *nugu_prof_get_last_data(enum nugu_prof_type type) { struct nugu_prof_data *tmp; @@ -319,8 +316,8 @@ nugu_prof_get_last_data(enum nugu_prof_type type) return tmp; } -EXPORT_API int nugu_prof_get_diff_msec_timespec(const struct timespec *ts1, - const struct timespec *ts2) +int nugu_prof_get_diff_msec_timespec(const struct timespec *ts1, + const struct timespec *ts2) { int sec; int nsec; @@ -336,15 +333,15 @@ EXPORT_API int nugu_prof_get_diff_msec_timespec(const struct timespec *ts1, return (nsec / 1000000) + (sec * 1000); } -EXPORT_API int nugu_prof_get_diff_msec_type(enum nugu_prof_type type1, - enum nugu_prof_type type2) +int nugu_prof_get_diff_msec_type(enum nugu_prof_type type1, + enum nugu_prof_type type2) { return nugu_prof_get_diff_msec_timespec(&_prof_data[type1].timestamp, &_prof_data[type2].timestamp); } -EXPORT_API int nugu_prof_get_diff_msec(const struct nugu_prof_data *prof1, - const struct nugu_prof_data *prof2) +int nugu_prof_get_diff_msec(const struct nugu_prof_data *prof1, + const struct nugu_prof_data *prof2) { if (prof1 == NULL || prof2 == NULL) return 0; @@ -357,7 +354,7 @@ EXPORT_API int nugu_prof_get_diff_msec(const struct nugu_prof_data *prof1, &prof2->timestamp); } -EXPORT_API const char *nugu_prof_get_type_name(enum nugu_prof_type type) +const char *nugu_prof_get_type_name(enum nugu_prof_type type) { return _hints[type].text; } @@ -429,7 +426,7 @@ static void _fill_relative_part(enum nugu_prof_type type, char *dest, snprintf(dest, dest_len, "[%2d ~ %2d]: %s", rel, type, buf); } -EXPORT_API void nugu_prof_dump(enum nugu_prof_type from, enum nugu_prof_type to) +void nugu_prof_dump(enum nugu_prof_type from, enum nugu_prof_type to) { enum nugu_prof_type cur; char ts_str[255]; diff --git a/src/base/nugu_recorder.c b/src/base/nugu_recorder.c index 5bb452638..7a1e9fb0d 100644 --- a/src/base/nugu_recorder.c +++ b/src/base/nugu_recorder.c @@ -54,7 +54,7 @@ static GList *_recorders; static GList *_recorder_drivers; static NuguRecorderDriver *_default_driver; -EXPORT_API NuguRecorderDriver * +NuguRecorderDriver * nugu_recorder_driver_new(const char *name, struct nugu_recorder_driver_ops *ops) { NuguRecorderDriver *driver; @@ -73,7 +73,7 @@ nugu_recorder_driver_new(const char *name, struct nugu_recorder_driver_ops *ops) return driver; } -EXPORT_API int nugu_recorder_driver_free(NuguRecorderDriver *driver) +int nugu_recorder_driver_free(NuguRecorderDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -88,7 +88,7 @@ EXPORT_API int nugu_recorder_driver_free(NuguRecorderDriver *driver) return 0; } -EXPORT_API int nugu_recorder_driver_register(NuguRecorderDriver *driver) +int nugu_recorder_driver_register(NuguRecorderDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -105,7 +105,7 @@ EXPORT_API int nugu_recorder_driver_register(NuguRecorderDriver *driver) return 0; } -EXPORT_API int nugu_recorder_driver_remove(NuguRecorderDriver *driver) +int nugu_recorder_driver_remove(NuguRecorderDriver *driver) { GList *l; @@ -126,7 +126,7 @@ EXPORT_API int nugu_recorder_driver_remove(NuguRecorderDriver *driver) return 0; } -EXPORT_API int nugu_recorder_driver_set_default(NuguRecorderDriver *driver) +int nugu_recorder_driver_set_default(NuguRecorderDriver *driver) { g_return_val_if_fail(driver != NULL, -1); @@ -137,12 +137,12 @@ EXPORT_API int nugu_recorder_driver_set_default(NuguRecorderDriver *driver) return 0; } -EXPORT_API NuguRecorderDriver *nugu_recorder_driver_get_default(void) +NuguRecorderDriver *nugu_recorder_driver_get_default(void) { return _default_driver; } -EXPORT_API NuguRecorderDriver *nugu_recorder_driver_find(const char *name) +NuguRecorderDriver *nugu_recorder_driver_find(const char *name) { GList *cur; @@ -160,8 +160,7 @@ EXPORT_API NuguRecorderDriver *nugu_recorder_driver_find(const char *name) return NULL; } -EXPORT_API NuguRecorder *nugu_recorder_new(const char *name, - NuguRecorderDriver *driver) +NuguRecorder *nugu_recorder_new(const char *name, NuguRecorderDriver *driver) { NuguRecorder *rec; @@ -189,7 +188,7 @@ EXPORT_API NuguRecorder *nugu_recorder_new(const char *name, return rec; } -EXPORT_API void nugu_recorder_free(NuguRecorder *rec) +void nugu_recorder_free(NuguRecorder *rec) { g_return_if_fail(rec != NULL); @@ -210,7 +209,7 @@ EXPORT_API void nugu_recorder_free(NuguRecorder *rec) g_free(rec); } -EXPORT_API int nugu_recorder_add(NuguRecorder *rec) +int nugu_recorder_add(NuguRecorder *rec) { g_return_val_if_fail(rec != NULL, -1); @@ -224,7 +223,7 @@ EXPORT_API int nugu_recorder_add(NuguRecorder *rec) return 0; } -EXPORT_API int nugu_recorder_remove(NuguRecorder *rec) +int nugu_recorder_remove(NuguRecorder *rec) { GList *l; @@ -237,7 +236,7 @@ EXPORT_API int nugu_recorder_remove(NuguRecorder *rec) return 0; } -EXPORT_API NuguRecorder *nugu_recorder_find(const char *name) +NuguRecorder *nugu_recorder_find(const char *name) { GList *cur; @@ -254,8 +253,7 @@ EXPORT_API NuguRecorder *nugu_recorder_find(const char *name) return NULL; } -EXPORT_API int nugu_recorder_set_property(NuguRecorder *rec, - NuguAudioProperty property) +int nugu_recorder_set_property(NuguRecorder *rec, NuguAudioProperty property) { g_return_val_if_fail(rec != NULL, -1); @@ -264,7 +262,7 @@ EXPORT_API int nugu_recorder_set_property(NuguRecorder *rec, return 0; } -EXPORT_API int nugu_recorder_start(NuguRecorder *rec) +int nugu_recorder_start(NuguRecorder *rec) { g_return_val_if_fail(rec != NULL, -1); @@ -284,7 +282,7 @@ EXPORT_API int nugu_recorder_start(NuguRecorder *rec) return rec->driver->ops->start(rec->driver, rec, rec->property); } -EXPORT_API int nugu_recorder_stop(NuguRecorder *rec) +int nugu_recorder_stop(NuguRecorder *rec) { g_return_val_if_fail(rec != NULL, -1); @@ -305,7 +303,7 @@ EXPORT_API int nugu_recorder_stop(NuguRecorder *rec) return rec->driver->ops->stop(rec->driver, rec); } -EXPORT_API int nugu_recorder_clear(NuguRecorder *rec) +int nugu_recorder_clear(NuguRecorder *rec) { g_return_val_if_fail(rec != NULL, -1); @@ -318,14 +316,14 @@ EXPORT_API int nugu_recorder_clear(NuguRecorder *rec) return 0; } -EXPORT_API int nugu_recorder_is_recording(NuguRecorder *rec) +int nugu_recorder_is_recording(NuguRecorder *rec) { g_return_val_if_fail(rec != NULL, -1); return rec->is_recording; } -EXPORT_API int nugu_recorder_set_driver_data(NuguRecorder *rec, void *data) +int nugu_recorder_set_driver_data(NuguRecorder *rec, void *data) { g_return_val_if_fail(rec != NULL, -1); @@ -334,15 +332,14 @@ EXPORT_API int nugu_recorder_set_driver_data(NuguRecorder *rec, void *data) return 0; } -EXPORT_API void *nugu_recorder_get_driver_data(NuguRecorder *rec) +void *nugu_recorder_get_driver_data(NuguRecorder *rec) { g_return_val_if_fail(rec != NULL, NULL); return rec->driver_data; } -EXPORT_API int nugu_recorder_get_frame_size(NuguRecorder *rec, int *size, - int *max) +int nugu_recorder_get_frame_size(NuguRecorder *rec, int *size, int *max) { g_return_val_if_fail(rec != NULL, -1); g_return_val_if_fail(rec->buf != NULL, -1); @@ -359,8 +356,7 @@ EXPORT_API int nugu_recorder_get_frame_size(NuguRecorder *rec, int *size, return 0; } -EXPORT_API int nugu_recorder_set_frame_size(NuguRecorder *rec, int size, - int max) +int nugu_recorder_set_frame_size(NuguRecorder *rec, int size, int max) { int ret; @@ -378,8 +374,7 @@ EXPORT_API int nugu_recorder_set_frame_size(NuguRecorder *rec, int size, return ret; } -EXPORT_API int nugu_recorder_push_frame(NuguRecorder *rec, const char *data, - int size) +int nugu_recorder_push_frame(NuguRecorder *rec, const char *data, int size) { int ret; @@ -403,7 +398,7 @@ EXPORT_API int nugu_recorder_push_frame(NuguRecorder *rec, const char *data, return ret; } -EXPORT_API int nugu_recorder_get_frame(NuguRecorder *rec, char *data, int *size) +int nugu_recorder_get_frame(NuguRecorder *rec, char *data, int *size) { int ret; @@ -420,8 +415,8 @@ EXPORT_API int nugu_recorder_get_frame(NuguRecorder *rec, char *data, int *size) return ret; } -EXPORT_API int nugu_recorder_get_frame_timeout(NuguRecorder *rec, char *data, - int *size, int timeout) +int nugu_recorder_get_frame_timeout(NuguRecorder *rec, char *data, int *size, + int timeout) { struct timeval curtime; struct timespec spec; @@ -455,7 +450,7 @@ EXPORT_API int nugu_recorder_get_frame_timeout(NuguRecorder *rec, char *data, return ret; } -EXPORT_API int nugu_recorder_get_frame_count(NuguRecorder *rec) +int nugu_recorder_get_frame_count(NuguRecorder *rec) { g_return_val_if_fail(rec != NULL, 0); diff --git a/src/base/nugu_ringbuffer.c b/src/base/nugu_ringbuffer.c index 4b3f3ae88..beb8d3354 100644 --- a/src/base/nugu_ringbuffer.c +++ b/src/base/nugu_ringbuffer.c @@ -49,7 +49,7 @@ static void _calculate_count(NuguRingBuffer *buf, int write_item, int size) buf->count = new_write_index - buf->read_index; } -EXPORT_API NuguRingBuffer *nugu_ring_buffer_new(int item_size, int max_items) +NuguRingBuffer *nugu_ring_buffer_new(int item_size, int max_items) { NuguRingBuffer *buffer; @@ -73,7 +73,7 @@ EXPORT_API NuguRingBuffer *nugu_ring_buffer_new(int item_size, int max_items) return buffer; } -EXPORT_API void nugu_ring_buffer_free(NuguRingBuffer *buf) +void nugu_ring_buffer_free(NuguRingBuffer *buf) { g_return_if_fail(buf != NULL); g_return_if_fail(buf->buf != NULL); @@ -83,8 +83,7 @@ EXPORT_API void nugu_ring_buffer_free(NuguRingBuffer *buf) free(buf); } -EXPORT_API int nugu_ring_buffer_resize(NuguRingBuffer *buf, int item_size, - int max_items) +int nugu_ring_buffer_resize(NuguRingBuffer *buf, int item_size, int max_items) { g_return_val_if_fail(buf != NULL, -1); g_return_val_if_fail(buf->buf != NULL, -1); @@ -109,8 +108,7 @@ EXPORT_API int nugu_ring_buffer_resize(NuguRingBuffer *buf, int item_size, return 0; } -EXPORT_API int nugu_ring_buffer_push_data(NuguRingBuffer *buf, const char *data, - int size) +int nugu_ring_buffer_push_data(NuguRingBuffer *buf, const char *data, int size) { unsigned long buf_size; int write_item = 0; @@ -182,8 +180,7 @@ EXPORT_API int nugu_ring_buffer_push_data(NuguRingBuffer *buf, const char *data, return 0; } -EXPORT_API int nugu_ring_buffer_read_item(NuguRingBuffer *buf, char *item, - int *size) +int nugu_ring_buffer_read_item(NuguRingBuffer *buf, char *item, int *size) { g_return_val_if_fail(buf != NULL, -1); g_return_val_if_fail(item != NULL, -1); @@ -209,25 +206,25 @@ EXPORT_API int nugu_ring_buffer_read_item(NuguRingBuffer *buf, char *item, return 0; } -EXPORT_API int nugu_ring_buffer_get_count(NuguRingBuffer *buf) +int nugu_ring_buffer_get_count(NuguRingBuffer *buf) { g_return_val_if_fail(buf != NULL, -1); return buf->count; } -EXPORT_API int nugu_ring_buffer_get_maxcount(NuguRingBuffer *buf) +int nugu_ring_buffer_get_maxcount(NuguRingBuffer *buf) { g_return_val_if_fail(buf != NULL, -1); return buf->max_items; } -EXPORT_API int nugu_ring_buffer_get_item_size(NuguRingBuffer *buf) +int nugu_ring_buffer_get_item_size(NuguRingBuffer *buf) { g_return_val_if_fail(buf != NULL, -1); return buf->item_size; } -EXPORT_API void nugu_ring_buffer_clear_items(NuguRingBuffer *buf) +void nugu_ring_buffer_clear_items(NuguRingBuffer *buf) { g_return_if_fail(buf != NULL); diff --git a/src/base/nugu_timer.c b/src/base/nugu_timer.c index 1cc9462a2..647a95d0d 100644 --- a/src/base/nugu_timer.c +++ b/src/base/nugu_timer.c @@ -39,7 +39,7 @@ static gboolean _nugu_timer_callback(gpointer userdata) return !timer->singleshot; } -EXPORT_API NuguTimer *nugu_timer_new(long interval) +NuguTimer *nugu_timer_new(long interval) { NuguTimer *timer; @@ -58,7 +58,7 @@ EXPORT_API NuguTimer *nugu_timer_new(long interval) return timer; } -EXPORT_API void nugu_timer_delete(NuguTimer *timer) +void nugu_timer_delete(NuguTimer *timer) { g_return_if_fail(timer != NULL); @@ -71,7 +71,7 @@ EXPORT_API void nugu_timer_delete(NuguTimer *timer) g_free(timer); } -EXPORT_API void nugu_timer_set_interval(NuguTimer *timer, long interval) +void nugu_timer_set_interval(NuguTimer *timer, long interval) { g_return_if_fail(timer != NULL); g_return_if_fail(interval > 0); @@ -79,14 +79,14 @@ EXPORT_API void nugu_timer_set_interval(NuguTimer *timer, long interval) timer->interval = interval; } -EXPORT_API long nugu_timer_get_interval(NuguTimer *timer) +long nugu_timer_get_interval(NuguTimer *timer) { g_return_val_if_fail(timer != NULL, -1); return timer->interval; } -EXPORT_API void nugu_timer_set_singleshot(NuguTimer *timer, int singleshot) +void nugu_timer_set_singleshot(NuguTimer *timer, int singleshot) { g_return_if_fail(timer != NULL); g_return_if_fail(singleshot >= 0); @@ -94,14 +94,14 @@ EXPORT_API void nugu_timer_set_singleshot(NuguTimer *timer, int singleshot) timer->singleshot = singleshot == 0 ? FALSE : TRUE; } -EXPORT_API int nugu_timer_get_singleshot(NuguTimer *timer) +int nugu_timer_get_singleshot(NuguTimer *timer) { g_return_val_if_fail(timer != NULL, FALSE); return timer->singleshot; } -EXPORT_API void nugu_timer_start(NuguTimer *timer) +void nugu_timer_start(NuguTimer *timer) { g_return_if_fail(timer != NULL); g_return_if_fail(timer->cb != NULL); @@ -115,7 +115,7 @@ EXPORT_API void nugu_timer_start(NuguTimer *timer) g_source_attach(timer->source, g_main_context_default()); } -EXPORT_API void nugu_timer_stop(NuguTimer *timer) +void nugu_timer_stop(NuguTimer *timer) { g_return_if_fail(timer != NULL); @@ -126,9 +126,8 @@ EXPORT_API void nugu_timer_stop(NuguTimer *timer) } } -EXPORT_API void nugu_timer_set_callback(NuguTimer *timer, - NuguTimeoutCallback callback, - void *userdata) +void nugu_timer_set_callback(NuguTimer *timer, NuguTimeoutCallback callback, + void *userdata) { g_return_if_fail(timer != NULL); g_return_if_fail(callback != NULL); diff --git a/src/base/nugu_uuid.c b/src/base/nugu_uuid.c index cf9b371d8..3ad926593 100644 --- a/src/base/nugu_uuid.c +++ b/src/base/nugu_uuid.c @@ -31,7 +31,7 @@ static const char *_cached_seed; static unsigned char _cached_hash[MAX_HASH_SIZE]; -EXPORT_API int nugu_uuid_fill_random(unsigned char *dest, size_t dest_len) +int nugu_uuid_fill_random(unsigned char *dest, size_t dest_len) { g_return_val_if_fail(dest != NULL, -1); g_return_val_if_fail(dest_len > 0, -1); @@ -46,9 +46,8 @@ EXPORT_API int nugu_uuid_fill_random(unsigned char *dest, size_t dest_len) return 0; } -EXPORT_API int nugu_uuid_convert_base16(const unsigned char *bytes, - size_t bytes_len, char *out, - size_t out_len) +int nugu_uuid_convert_base16(const unsigned char *bytes, size_t bytes_len, + char *out, size_t out_len) { size_t i; @@ -78,8 +77,8 @@ EXPORT_API int nugu_uuid_convert_base16(const unsigned char *bytes, return 0; } -EXPORT_API int nugu_uuid_convert_bytes(const char *base16, size_t base16_len, - unsigned char *out, size_t out_len) +int nugu_uuid_convert_bytes(const char *base16, size_t base16_len, + unsigned char *out, size_t out_len) { size_t i; @@ -115,9 +114,8 @@ EXPORT_API int nugu_uuid_convert_bytes(const char *base16, size_t base16_len, return 0; } -EXPORT_API int nugu_uuid_convert_timespec(const unsigned char *bytes, - size_t bytes_len, - struct timespec *out_time) +int nugu_uuid_convert_timespec(const unsigned char *bytes, size_t bytes_len, + struct timespec *out_time) { uint64_t t; @@ -151,7 +149,7 @@ EXPORT_API int nugu_uuid_convert_timespec(const unsigned char *bytes, * - 6 bytes: hash: cut(sha1(token) 20 bytes, 0, 6 bytes) * - 4 bytes: random */ -EXPORT_API char *nugu_uuid_generate_time(void) +char *nugu_uuid_generate_time(void) { unsigned char buf[NUGU_MAX_UUID_SIZE]; char base16[NUGU_MAX_UUID_SIZE * 2 + 1]; @@ -186,9 +184,8 @@ EXPORT_API char *nugu_uuid_generate_time(void) return g_strdup(base16); } -EXPORT_API int nugu_uuid_fill(const struct timespec *time, - const unsigned char *hash, size_t hash_len, - unsigned char *out, size_t out_len) +int nugu_uuid_fill(const struct timespec *time, const unsigned char *hash, + size_t hash_len, unsigned char *out, size_t out_len) { uint64_t milliseconds; diff --git a/tests/clientkit/CMakeLists.txt b/tests/clientkit/CMakeLists.txt index 7723b1438..449e235cf 100644 --- a/tests/clientkit/CMakeLists.txt +++ b/tests/clientkit/CMakeLists.txt @@ -8,8 +8,6 @@ SET(UNIT_TESTS FOREACH(test ${UNIT_TESTS}) ADD_EXECUTABLE(${test} ${test}.cc) - TARGET_COMPILE_DEFINITIONS(${test} PRIVATE - -DRUNPATH="${CMAKE_CURRENT_BINARY_DIR}") TARGET_INCLUDE_DIRECTORIES(${test} PRIVATE ../../src/clientkit ../../include) diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index 14f920660..53d010471 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -24,9 +24,6 @@ FOREACH(test ${UNIT_TESTS}) LIST(APPEND SRC ${${test}_srcs}) ENDIF () ADD_EXECUTABLE(${test} ${SRC}) - TARGET_COMPILE_DEFINITIONS(${test} PRIVATE - -DEXPORT_API=__attribute__\(\(visibility\(\"default\"\)\)\) - -DRUNPATH="${CMAKE_CURRENT_BINARY_DIR}") TARGET_INCLUDE_DIRECTORIES(${test} PRIVATE ../../src/core ../../include