revise build scripts and apply visibility hidden 17/234817/8
authorYoungjae Shin <yj99.shin@samsung.com>
Fri, 29 May 2020 04:36:02 +0000 (13:36 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Tue, 2 Jun 2020 03:29:16 +0000 (12:29 +0900)
Change-Id: I12fc0948c1aea41edc02faf2993f364d7600d319

25 files changed:
CMakeLists.txt
LICENSE.APLv2 [moved from LICENSE with 100% similarity]
capi-telephony.manifest [deleted file]
capi-telephony.pc.in
common/telephony_private.h [moved from include/telephony_private.h with 97% similarity]
packaging/capi-telephony.manifest [new file with mode: 0644]
packaging/capi-telephony.spec
src/telephony_call.c
src/telephony_common.c
src/telephony_modem.c
src/telephony_network.c
src/telephony_sim.c
test_src/CMakeLists.txt [deleted file]
tests/CMakeLists.txt [new file with mode: 0644]
tests/call.c [moved from test_src/call.c with 100% similarity]
tests/call.h [moved from test_src/call.h with 100% similarity]
tests/main.c [moved from test_src/main.c with 100% similarity]
tests/menu.c [moved from test_src/menu.c with 96% similarity]
tests/menu.h [moved from test_src/menu.h with 100% similarity]
tests/modem.c [moved from test_src/modem.c with 100% similarity]
tests/modem.h [moved from test_src/modem.h with 100% similarity]
tests/network.c [moved from test_src/network.c with 100% similarity]
tests/network.h [moved from test_src/network.h with 100% similarity]
tests/sim.c [moved from test_src/sim.c with 100% similarity]
tests/sim.h [moved from test_src/sim.h with 100% similarity]

index f3f97d3..f079cb9 100644 (file)
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-
-SET(project_prefix "capi")
-SET(prefix "/usr")
-SET(version "0.0.1")
-SET(maintainer "Wootak Jung<wootak.jung@samsung.com>")
-SET(description "Telephony Core API")
-SET(service "telephony")
-SET(dependents "dlog tapi glib-2.0 \
-       capi-base-common openssl1.1 capi-system-info \
-       cynara-client cynara-session cynara-creds-self")
-SET(pc_dependents "capi-base-common tapi")
-
-SET(Services
-        "application"
-        "base"
-        "content"
-        "location"
-        "media"
-        "messaging"
-        "network"
-        "social"
-        "telephony"
-        "system"
-   )
-
-#FILE(STRINGS config.cfg configs REGEX "^ *[^#]")
-FOREACH(lines ${configs})
-#    MESSAGE(${lines})
-    IF(${lines} MATCHES "([^=]*)=['\"](.*)['\"]")
-        SET(key ${CMAKE_MATCH_1})
-        SET(value ${CMAKE_MATCH_2})
-#        MESSAGE("${key} -> ${value}")
-        SET(${key} "${value}")
-    ENDIF()
-ENDFOREACH(lines ${configs})
-
-LIST(FIND Services ${service} sfind)
-
-IF( ${sfind} EQUAL -1 )
-    MESSAGE(FATAL_ERROR "Service must be one of ")
-    FOREACH( s IN ${Services} )
-        MESSAGE(FATAL_ERROR "[${s}]")
-    ENDFOREACH( s IN ${Services} )
-ENDIF( ${sfind} EQUAL -1 )
-
-SET(fw_name "${project_prefix}-${service}")
-
-PROJECT(${fw_name})
-
-SET(CMAKE_INSTALL_PREFIX ${prefix})
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(VERSION ${version})
-
-SET(INC_DIR include)
-INCLUDE_DIRECTORIES(${INC_DIR})
+CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
+PROJECT(capi-telephony C)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${dependents})
-FOREACH(flag ${${fw_name}_CFLAGS})
-    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(ADDITIONAL_CFLAGS "-Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ADDITIONAL_CFLAGS}")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-
-IF("${ARCH}" STREQUAL "arm")
-    ADD_DEFINITIONS("-DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DTIZEN_DEBUG")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}")
-
-aux_source_directory(src SOURCES)
-ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
-
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
-
-SET_TARGET_PROPERTIES(${fw_name}
-     PROPERTIES
-     VERSION ${FULLVER}
-     SOVERSION ${MAJORVER}
-     CLEAN_DIRECT_OUTPUT 1
-)
-
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR})
-INSTALL(
-        DIRECTORY ${INC_DIR}/ DESTINATION include/${service}
-        FILES_MATCHING
-        PATTERN "*_private.h" EXCLUDE
-        PATTERN "${INC_DIR}/*.h"
-        )
+INCLUDE_DIRECTORIES(common)
+INCLUDE_DIRECTORIES(include)
 
-SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${pc_dependents})
-SET(PC_LDFLAGS -l${fw_name})
+SET(EXTRA_FLAGS "-Wall -Werror -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_FLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS} -std=c++11")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
 
-CONFIGURE_FILE(
-    capi-telephony.pc.in
-    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
-    @ONLY
-)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig)
+PKG_CHECK_MODULES(pkgs REQUIRED dlog tapi glib-2.0 capi-base-common openssl1.1
+    capi-system-info cynara-client cynara-session cynara-creds-self)
+INCLUDE_DIRECTORIES(${pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${pkgs_LIBRARY_DIRS})
 
-#ADD_SUBDIRECTORY(test_src)
+FILE(GLOB SRCS src/*.c)
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LIBRARIES})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
 
-IF(UNIX)
+FILE(GLOB HEADERS include/*.h)
+INSTALL(FILES ${HEADERS} DESTINATION ${HEADER_DIR})
 
-ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
-ADD_CUSTOM_COMMAND(
-        DEPENDS clean
-        COMMENT "distribution clean"
-        COMMAND find
-        ARGS    .
-        -not -name config.cmake -and \(
-        -name tester.c -or
-        -name Testing -or
-        -name CMakeFiles -or
-        -name cmake.depends -or
-        -name cmake.check_depends -or
-        -name CMakeCache.txt -or
-        -name cmake.check_cache -or
-        -name *.cmake -or
-        -name Makefile -or
-        -name core -or
-        -name core.* -or
-        -name gmon.out -or
-        -name install_manifest.txt -or
-        -name *.pc -or
-        -name *~ \)
-        | grep -v TC | xargs rm -rf
-        TARGET  distclean
-        VERBATIM
-)
+SET(PC_REQUIRES "capi-base-common")
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
-ENDIF(UNIX)
+ADD_SUBDIRECTORY(tests)
\ No newline at end of file
similarity index 100%
rename from LICENSE
rename to LICENSE.APLv2
diff --git a/capi-telephony.manifest b/capi-telephony.manifest
deleted file mode 100644 (file)
index dfdc35c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<manifest>
- <request>
-  <domain name="_"/>
- </request>
-</manifest>
index 35f14a9..740d0da 100644 (file)
@@ -1,14 +1,9 @@
+libdir=@LIB_INSTALL_DIR@
+includedir=@HEADER_DIR@
 
-# Package Information for pkg-config
-
-prefix=@PREFIX@
-exec_prefix=/usr
-libdir=@LIBDIR@
-includedir=/usr/include/telephony
-
-Name: @PC_NAME@
-Description: @PACKAGE_DESCRIPTION@
-Version: @VERSION@
-Requires: @PC_REQUIRED@
-Libs: -L${libdir} @PC_LDFLAGS@
+Name: @PROJECT_NAME@
+Description: Telephony Core API
+Version: @FULLVER@
+Requires: @PC_REQUIRES@
+Libs: -L${libdir} -l@PROJECT_NAME@
 Cflags: -I${includedir}
similarity index 97%
rename from include/telephony_private.h
rename to common/telephony_private.h
index bffd24f..bd006e1 100644 (file)
 
 #define TELEPHONY_FEATURE      "http://tizen.org/feature/network.telephony"
 
+#ifdef API
+#undef API
+#endif
+#define API __attribute__((visibility("default")))
+
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif
diff --git a/packaging/capi-telephony.manifest b/packaging/capi-telephony.manifest
new file mode 100644 (file)
index 0000000..9137c87
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+  <request>
+    <domain name="_" />
+  </request>
+</manifest>
index c4acdea..6ae461b 100644 (file)
@@ -1,10 +1,13 @@
-Name:       capi-telephony
-Summary:    Telephony Core API
-Version:    0.1.86
-Release:    1
-Group:      System/Libraries
-License:    Apache-2.0
-Source0:    %{name}-%{version}.tar.gz
+Name: capi-telephony
+Version: 0.2.0
+Release: 0
+Summary: Telephony Core API
+
+Group: Telephony/API
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+Source1001: %{name}.manifest
+
 BuildRequires: cmake
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(tapi)
@@ -17,8 +20,8 @@ BuildRequires: pkgconfig(cynara-session)
 BuildRequires: pkgconfig(cynara-creds-self)
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
-
 %if 0%{?gcov:1}
+BuildRequires: tar
 BuildRequires: lcov
 %endif
 
@@ -26,26 +29,37 @@ BuildRequires: lcov
 Telephony public API library
 
 %package devel
-Summary:  Telephony Core API
-Group:    Developement/Libraries
-Requires: %{name} = %{version}-%{release}
+Summary: Telephony Core API
+Group: Telephony/Development
+Requires: %{name} = %{version}
+Requires: pkgconfig
 
 %description devel
 Telephony public API library (development library)
 
+%package unittests
+Summary: Test Programs for %{name}
+Group: Telephony/Testing
+
+%description unittests
+The %{name}-unittests pacakge contains programs for checking quality the %{name}.
+
 %if 0%{?gcov:1}
 %package gcov
-Summary:  Telephony public API library(gcov)
-Group:    Developement/Libraries
+Summary: Coverage Data of %{name}
+Group: Telephony/Testing
+
 %description gcov
-gcov objects for coverage test
+The %{name}-gcov pacakge contains gcov objects
 %endif
 
+%define tel_header_dir %{_includedir}/telephony
+
 %prep
 %setup -q
+cp %{SOURCE1001} ./%{name}.manifest
 
 %build
-
 %if 0%{?gcov:1}
 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
@@ -54,48 +68,41 @@ export LDFLAGS+=" -lgcov"
 %endif
 
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-       -DLIB_INSTALL_DIR=%{_libdir} \
-       -DFULLVER=%{version} \
-       -DMAJORVER=${MAJORVER}
-
-make %{?jobs:-j%jobs}
-
-%if 0%{?gcov:1}
-mkdir -p gcov-obj
-find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
-%endif
+%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} \
+       -DCMAKE_VERBOSE_MAKEFILE=OFF \
+       -DBIN_INSTALL_DIR:PATH=%{_bindir} \
+       -DHEADER_DIR:PATH=%{tel_header_dir} \
+       -DTEST_INSTALL_DIR:PATH=%{_bindir}/%{name}
+make %{?_smp_mflags}
 
 %install
-rm -rf %{buildroot}
 %make_install
 
 %if 0%{?gcov:1}
-mkdir -p %{buildroot}%{_datadir}/gcov/obj
-install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+find .. -name '*.gcno' | tar cf %{name}-gcov.tar -T -
+install -d -m 755 %{buildroot}%{_datadir}/gcov/obj
+tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj
 %endif
 
 %post -p /sbin/ldconfig
-
 %postun -p /sbin/ldconfig
 
 %files
-%manifest capi-telephony.manifest
-%{_libdir}/libcapi-telephony.so.*
-%license LICENSE
-#%{_bindir}/telephony-test
+%manifest %{name}.manifest
+%{_libdir}/lib%{name}.so.*
+%license LICENSE.APLv2
 
 %files devel
-%{_includedir}/telephony/telephony.h
-%{_includedir}/telephony/telephony_common.h
-%{_includedir}/telephony/telephony_call.h
-%{_includedir}/telephony/telephony_sim.h
-%{_includedir}/telephony/telephony_network.h
-%{_includedir}/telephony/telephony_modem.h
-%{_libdir}/pkgconfig/*.pc
-%{_libdir}/libcapi-telephony.so
+%{_libdir}/lib%{name}*.so
+%{_libdir}/pkgconfig/%{name}*.pc
+%{tel_header_dir}/telephony*.h
+
+%files unittests
+%manifest %{name}.manifest
+%{_bindir}/telephony-test
+%license LICENSE.APLv2
 
 %if 0%{?gcov:1}
 %files gcov
-%{_datadir}/gcov/obj/*
-%endif
\ No newline at end of file
+%{_datadir}/gcov/*
+%endif
index 558f37f..f17d4fc 100644 (file)
@@ -88,7 +88,7 @@ static void _get_call_status_cb(TelCallStatus_t *status, void *user_data)
 }
 /* LCOV_EXCL_STOP */
 
-int telephony_call_get_preferred_voice_subscription(telephony_h handle, telephony_call_preferred_voice_subs_e *call_sub)
+API int telephony_call_get_preferred_voice_subscription(telephony_h handle, telephony_call_preferred_voice_subs_e *call_sub)
 {
        int ret;
        TapiHandle *tapi_h;
@@ -132,7 +132,7 @@ int telephony_call_get_preferred_voice_subscription(telephony_h handle, telephon
        return TELEPHONY_ERROR_NONE;
 }
 
-int telephony_call_get_call_list(telephony_h handle,
+API int telephony_call_get_call_list(telephony_h handle,
        unsigned int *count, telephony_call_h **call_list)
 {
        int ret;
@@ -181,7 +181,7 @@ int telephony_call_get_call_list(telephony_h handle,
        return TELEPHONY_ERROR_NONE;
 }
 
-int telephony_call_release_call_list(unsigned int count, telephony_call_h **call_list)
+API int telephony_call_release_call_list(unsigned int count, telephony_call_h **call_list)
 {
        /* LCOV_EXCL_START */
        int i;
@@ -198,7 +198,7 @@ int telephony_call_release_call_list(unsigned int count, telephony_call_h **call
        /* LCOV_EXCL_STOP */
 }
 
-int telephony_call_get_handle_id(telephony_call_h call_handle, unsigned int *handle_id)
+API int telephony_call_get_handle_id(telephony_call_h call_handle, unsigned int *handle_id)
 {
        /* LCOV_EXCL_START */
        CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
@@ -210,7 +210,7 @@ int telephony_call_get_handle_id(telephony_call_h call_handle, unsigned int *han
        /* LCOV_EXCL_STOP */
 }
 
-int telephony_call_get_number(telephony_call_h call_handle, char **number)
+API int telephony_call_get_number(telephony_call_h call_handle, char **number)
 {
        /* LCOV_EXCL_START */
        CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
@@ -222,7 +222,7 @@ int telephony_call_get_number(telephony_call_h call_handle, char **number)
        /* LCOV_EXCL_STOP */
 }
 
-int telephony_call_get_type(telephony_call_h call_handle,
+API int telephony_call_get_type(telephony_call_h call_handle,
        telephony_call_type_e *type)
 {
        /* LCOV_EXCL_START */
@@ -235,7 +235,7 @@ int telephony_call_get_type(telephony_call_h call_handle,
        /* LCOV_EXCL_STOP */
 }
 
-int telephony_call_get_status(telephony_call_h call_handle,
+API int telephony_call_get_status(telephony_call_h call_handle,
        telephony_call_status_e *status)
 {
        /* LCOV_EXCL_START */
@@ -248,7 +248,7 @@ int telephony_call_get_status(telephony_call_h call_handle,
        /* LCOV_EXCL_STOP */
 }
 
-int telephony_call_get_direction(telephony_call_h call_handle,
+API int telephony_call_get_direction(telephony_call_h call_handle,
        telephony_call_direction_e *direction)
 {
        /* LCOV_EXCL_START */
@@ -261,7 +261,7 @@ int telephony_call_get_direction(telephony_call_h call_handle,
        /* LCOV_EXCL_STOP */
 }
 
-int telephony_call_get_conference_status(telephony_call_h call_handle, bool *conference_status)
+API int telephony_call_get_conference_status(telephony_call_h call_handle, bool *conference_status)
 {
        /* LCOV_EXCL_START */
        CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
index 5bb3d73..5105fad 100644 (file)
@@ -308,7 +308,7 @@ static void on_signal_callback(TapiHandle *tapi_h, const char *evt_id,
 }
 /* LCOV_EXCL_STOP */
 
-int telephony_set_noti_cb(telephony_h handle,
+API int telephony_set_noti_cb(telephony_h handle,
        telephony_noti_e noti_id, telephony_noti_cb cb, void *user_data)
 {
        telephony_evt_cb_data *evt_cb_data = NULL;
@@ -350,7 +350,7 @@ int telephony_set_noti_cb(telephony_h handle,
        return TELEPHONY_ERROR_NONE;
 }
 
-int telephony_unset_noti_cb(telephony_h handle, telephony_noti_e noti_id)
+API int telephony_unset_noti_cb(telephony_h handle, telephony_noti_e noti_id)
 {
        telephony_evt_cb_data *evt_cb_data = NULL;
        GSList *list = NULL;
@@ -383,7 +383,7 @@ int telephony_unset_noti_cb(telephony_h handle, telephony_noti_e noti_id)
        return TELEPHONY_ERROR_NONE;
 }
 
-int telephony_init(telephony_handle_list_s *list)
+API int telephony_init(telephony_handle_list_s *list)
 {
        char **cp_list;
        int cp_count = 0;
@@ -460,7 +460,7 @@ int telephony_init(telephony_handle_list_s *list)
        return TELEPHONY_ERROR_NONE;
 }
 
-int telephony_deinit(telephony_handle_list_s *list)
+API int telephony_deinit(telephony_handle_list_s *list)
 {
        unsigned int i;
 
@@ -488,7 +488,7 @@ int telephony_deinit(telephony_handle_list_s *list)
        return TELEPHONY_ERROR_NONE;
 }
 
-int telephony_get_state(telephony_state_e *state)
+API int telephony_get_state(telephony_state_e *state)
 {
        int res = 0;
        int value = 0;
@@ -505,7 +505,7 @@ int telephony_get_state(telephony_state_e *state)
        return TELEPHONY_ERROR_NONE;
 }
 
-int telephony_set_state_changed_cb(telephony_state_changed_cb callback, void *user_data)
+API int telephony_set_state_changed_cb(telephony_state_changed_cb callback, void *user_data)
 {
        int res = 0;
 
@@ -519,7 +519,7 @@ int telephony_set_state_changed_cb(telephony_state_changed_cb callback, void *us
        return TELEPHONY_ERROR_NONE;
 }
 
-int telephony_unset_state_changed_cb(telephony_state_changed_cb callback)
+API int telephony_unset_state_changed_cb(telephony_state_changed_cb callback)
 {
        int res = 0;
 
index 6a322ac..f934baf 100644 (file)
@@ -28,7 +28,7 @@
 #include "telephony_private.h"
 
 /* LCOV_EXCL_START */
-int telephony_modem_get_imei(telephony_h handle, char **imei)
+API int telephony_modem_get_imei(telephony_h handle, char **imei)
 {
        GVariant *gv = NULL;
        GError *gerr = NULL;
@@ -83,7 +83,7 @@ int telephony_modem_get_imei(telephony_h handle, char **imei)
 }
 /* LCOV_EXCL_STOP */
 
-int telephony_modem_get_power_status(telephony_h handle,
+API int telephony_modem_get_power_status(telephony_h handle,
        telephony_modem_power_status_e *status)
 {
        TapiHandle *tapi_h;
@@ -134,7 +134,7 @@ int telephony_modem_get_power_status(telephony_h handle,
 }
 
 /* LCOV_EXCL_START */
-int telephony_modem_get_meid(telephony_h handle, char **meid)
+API int telephony_modem_get_meid(telephony_h handle, char **meid)
 {
        int ret = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
index 12b5bd8..63dcb6a 100644 (file)
@@ -29,7 +29,7 @@
 
 #define TELEPHONY_NETWORK_MCC_LEN 3
 
-int telephony_network_get_lac(telephony_h handle, int *lac)
+API int telephony_network_get_lac(telephony_h handle, int *lac)
 {
        int ret = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
@@ -66,7 +66,7 @@ int telephony_network_get_lac(telephony_h handle, int *lac)
        return ret;
 }
 
-int telephony_network_get_cell_id(telephony_h handle, int *cell_id)
+API int telephony_network_get_cell_id(telephony_h handle, int *cell_id)
 {
        int ret = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
@@ -103,7 +103,7 @@ int telephony_network_get_cell_id(telephony_h handle, int *cell_id)
        return ret;
 }
 
-int telephony_network_get_rssi(telephony_h handle, telephony_network_rssi_e *rssi)
+API int telephony_network_get_rssi(telephony_h handle, telephony_network_rssi_e *rssi)
 {
        int ret;
        TapiHandle *tapi_h;
@@ -131,7 +131,7 @@ int telephony_network_get_rssi(telephony_h handle, telephony_network_rssi_e *rss
        return ret;
 }
 
-int telephony_network_get_roaming_status(telephony_h handle, bool *status)
+API int telephony_network_get_roaming_status(telephony_h handle, bool *status)
 {
        int ret;
        int temp = 0;
@@ -164,7 +164,7 @@ int telephony_network_get_roaming_status(telephony_h handle, bool *status)
        return ret;
 }
 
-int telephony_network_get_mcc(telephony_h handle, char **mcc)
+API int telephony_network_get_mcc(telephony_h handle, char **mcc)
 {
        int ret = TELEPHONY_ERROR_NONE;
        char *plmn_str = NULL;
@@ -204,7 +204,7 @@ int telephony_network_get_mcc(telephony_h handle, char **mcc)
        return ret;
 }
 
-int telephony_network_get_mnc(telephony_h handle, char **mnc)
+API int telephony_network_get_mnc(telephony_h handle, char **mnc)
 {
        int ret = TELEPHONY_ERROR_NONE;
        char *plmn_str = NULL;
@@ -247,7 +247,7 @@ int telephony_network_get_mnc(telephony_h handle, char **mnc)
        return ret;
 }
 
-int telephony_network_get_network_name(telephony_h handle, char **network_name)
+API int telephony_network_get_network_name(telephony_h handle, char **network_name)
 {
        int ret;
        TapiHandle *tapi_h;
@@ -275,7 +275,7 @@ int telephony_network_get_network_name(telephony_h handle, char **network_name)
        return ret;
 }
 
-int telephony_network_get_network_name_option(telephony_h handle, telephony_network_name_option_e *network_name_option)
+API int telephony_network_get_network_name_option(telephony_h handle, telephony_network_name_option_e *network_name_option)
 {
        int ret;
        int name_option = 0;
@@ -319,7 +319,7 @@ int telephony_network_get_network_name_option(telephony_h handle, telephony_netw
        return ret;
 }
 
-int telephony_network_get_type(telephony_h handle, telephony_network_type_e *network_type)
+API int telephony_network_get_type(telephony_h handle, telephony_network_type_e *network_type)
 {
        int ret;
        int act;
@@ -401,7 +401,7 @@ int telephony_network_get_type(telephony_h handle, telephony_network_type_e *net
        return ret;
 }
 
-int telephony_network_get_ps_type(telephony_h handle, telephony_network_ps_type_e *ps_type)
+API int telephony_network_get_ps_type(telephony_h handle, telephony_network_ps_type_e *ps_type)
 {
        int ret;
        int service_type = 0;
@@ -448,7 +448,7 @@ int telephony_network_get_ps_type(telephony_h handle, telephony_network_ps_type_
        return ret;
 }
 
-int telephony_network_get_service_state(telephony_h handle, telephony_network_service_state_e *network_service_state)
+API int telephony_network_get_service_state(telephony_h handle, telephony_network_service_state_e *network_service_state)
 {
        int ret;
        int service_type = 0;
@@ -490,7 +490,7 @@ int telephony_network_get_service_state(telephony_h handle, telephony_network_se
        return ret;
 }
 
-int telephony_network_get_default_data_subscription(telephony_h handle,
+API int telephony_network_get_default_data_subscription(telephony_h handle,
        telephony_network_default_data_subs_e *default_data_sub)
 {
        TapiHandle *tapi_h;
@@ -532,7 +532,7 @@ int telephony_network_get_default_data_subscription(telephony_h handle,
        return ret;
 }
 
-int telephony_network_get_default_subscription(telephony_h handle,
+API int telephony_network_get_default_subscription(telephony_h handle,
        telephony_network_default_subs_e *default_sub)
 {
        TapiHandle *tapi_h;
@@ -574,7 +574,7 @@ int telephony_network_get_default_subscription(telephony_h handle,
        return ret;
 }
 
-int telephony_network_get_selection_mode(telephony_h handle, telephony_network_selection_mode_e *mode)
+API int telephony_network_get_selection_mode(telephony_h handle, telephony_network_selection_mode_e *mode)
 {
        int ret = TELEPHONY_ERROR_OPERATION_FAILED;
        TapiHandle *tapi_h;
@@ -617,7 +617,7 @@ int telephony_network_get_selection_mode(telephony_h handle, telephony_network_s
        return ret;
 }
 
-int telephony_network_get_tac(telephony_h handle, int *tac)
+API int telephony_network_get_tac(telephony_h handle, int *tac)
 {
        int ret = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
@@ -654,7 +654,7 @@ int telephony_network_get_tac(telephony_h handle, int *tac)
        return ret;
 }
 
-int telephony_network_get_system_id(telephony_h handle, int *sid)
+API int telephony_network_get_system_id(telephony_h handle, int *sid)
 {
        int ret = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
@@ -691,7 +691,7 @@ int telephony_network_get_system_id(telephony_h handle, int *sid)
        return ret;
 }
 
-int telephony_network_get_network_id(telephony_h handle, int *nid)
+API int telephony_network_get_network_id(telephony_h handle, int *nid)
 {
        int ret = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
@@ -728,7 +728,7 @@ int telephony_network_get_network_id(telephony_h handle, int *nid)
        return ret;
 }
 
-int telephony_network_get_base_station_id(telephony_h handle, int *bs_id)
+API int telephony_network_get_base_station_id(telephony_h handle, int *bs_id)
 {
        int ret = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
@@ -765,7 +765,7 @@ int telephony_network_get_base_station_id(telephony_h handle, int *bs_id)
        return ret;
 }
 
-int telephony_network_get_base_station_latitude(telephony_h handle, int *bs_latitude)
+API int telephony_network_get_base_station_latitude(telephony_h handle, int *bs_latitude)
 {
        int ret = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
@@ -802,7 +802,7 @@ int telephony_network_get_base_station_latitude(telephony_h handle, int *bs_lati
        return ret;
 }
 
-int telephony_network_get_base_station_longitude(telephony_h handle, int *bs_longitude)
+API int telephony_network_get_base_station_longitude(telephony_h handle, int *bs_longitude)
 {
        int ret = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
@@ -839,7 +839,7 @@ int telephony_network_get_base_station_longitude(telephony_h handle, int *bs_lon
        return ret;
 }
 
-int telephony_network_get_signal_strength(telephony_h handle, int *dbm)
+API int telephony_network_get_signal_strength(telephony_h handle, int *dbm)
 {
        int ret;
        TapiHandle *tapi_h;
index a76b67b..9699dfa 100644 (file)
@@ -86,7 +86,7 @@ static telephony_error_e _convert_dbus_errmsg_to_sim_error(gchar *err_msg)
 /* LCOV_EXCL_STOP */
 
 /* LCOV_EXCL_START */
-int telephony_sim_get_icc_id(telephony_h handle, char **icc_id)
+API int telephony_sim_get_icc_id(telephony_h handle, char **icc_id)
 {
        int error_code = TELEPHONY_ERROR_NONE;
        TapiHandle *tapi_h;
@@ -140,7 +140,7 @@ int telephony_sim_get_icc_id(telephony_h handle, char **icc_id)
 }
 /* LCOV_EXCL_STOP */
 
-int telephony_sim_get_operator(telephony_h handle, char **sim_operator)
+API int telephony_sim_get_operator(telephony_h handle, char **sim_operator)
 {
        int error_code = TELEPHONY_ERROR_NONE;
        TelSimCardStatus_t sim_card_state = TAPI_SIM_STATUS_UNKNOWN;
@@ -183,7 +183,7 @@ int telephony_sim_get_operator(telephony_h handle, char **sim_operator)
        return error_code;
 }
 
-int telephony_sim_get_msin(telephony_h handle, char **msin)
+API int telephony_sim_get_msin(telephony_h handle, char **msin)
 {
        int error_code = TELEPHONY_ERROR_NONE;
        TelSimCardStatus_t sim_card_state = TAPI_SIM_STATUS_UNKNOWN;
@@ -218,7 +218,7 @@ int telephony_sim_get_msin(telephony_h handle, char **msin)
        return error_code;
 }
 
-int telephony_sim_get_spn(telephony_h handle, char **spn)
+API int telephony_sim_get_spn(telephony_h handle, char **spn)
 {
        int error_code = TELEPHONY_ERROR_NONE;
        TelSimCardStatus_t sim_card_state = TAPI_SIM_STATUS_UNKNOWN;
@@ -278,7 +278,7 @@ int telephony_sim_get_spn(telephony_h handle, char **spn)
        return error_code;
 }
 
-int telephony_sim_is_changed(telephony_h handle, bool *is_changed)
+API int telephony_sim_is_changed(telephony_h handle, bool *is_changed)
 {
        int card_changed = 0;
        TelSimCardStatus_t sim_card_state = 0x00;
@@ -313,7 +313,7 @@ int telephony_sim_is_changed(telephony_h handle, bool *is_changed)
        return error_code;
 }
 
-int telephony_sim_get_state(telephony_h handle, telephony_sim_state_e *sim_state)
+API int telephony_sim_get_state(telephony_h handle, telephony_sim_state_e *sim_state)
 {
        TelSimCardStatus_t sim_card_state = TAPI_SIM_STATUS_UNKNOWN;
        int error_code = TELEPHONY_ERROR_NONE;
@@ -356,7 +356,7 @@ int telephony_sim_get_state(telephony_h handle, telephony_sim_state_e *sim_state
        return error_code;
 }
 
-int telephony_sim_get_application_list(telephony_h handle, unsigned int *app_list)
+API int telephony_sim_get_application_list(telephony_h handle, unsigned int *app_list)
 {
        int error_code = TELEPHONY_ERROR_NONE;
        TelSimCardStatus_t sim_card_state = TAPI_SIM_STATUS_UNKNOWN;
@@ -391,7 +391,7 @@ int telephony_sim_get_application_list(telephony_h handle, unsigned int *app_lis
        return error_code;
 }
 
-int telephony_sim_get_subscriber_number(telephony_h handle, char **subscriber_number)
+API int telephony_sim_get_subscriber_number(telephony_h handle, char **subscriber_number)
 {
        int error_code = TELEPHONY_ERROR_NONE;
        GError *gerr = NULL;
@@ -451,7 +451,7 @@ int telephony_sim_get_subscriber_number(telephony_h handle, char **subscriber_nu
        return error_code;
 }
 
-int telephony_sim_get_subscriber_id(telephony_h handle, char **subscriber_id)
+API int telephony_sim_get_subscriber_id(telephony_h handle, char **subscriber_id)
 {
        int error_code = TELEPHONY_ERROR_NONE;
        TelSimCardStatus_t sim_card_state = TAPI_SIM_STATUS_UNKNOWN;
@@ -502,7 +502,7 @@ int telephony_sim_get_subscriber_id(telephony_h handle, char **subscriber_id)
        return error_code;
 }
 
-int telephony_sim_get_lock_state(telephony_h handle, telephony_sim_lock_state_e *lock_state)
+API int telephony_sim_get_lock_state(telephony_h handle, telephony_sim_lock_state_e *lock_state)
 {
        /* LCOV_EXCL_START */
        TelSimCardStatus_t sim_card_state;
@@ -538,7 +538,7 @@ int telephony_sim_get_lock_state(telephony_h handle, telephony_sim_lock_state_e
        /* LCOV_EXCL_STOP */
 }
 
-int telephony_sim_get_group_id1(telephony_h handle, char **gid1)
+API int telephony_sim_get_group_id1(telephony_h handle, char **gid1)
 {
        int error_code = TELEPHONY_ERROR_NONE;
        TelSimCardStatus_t sim_card_state = TAPI_SIM_STATUS_UNKNOWN;
@@ -607,7 +607,7 @@ int telephony_sim_get_group_id1(telephony_h handle, char **gid1)
        return error_code;
 }
 
-int telephony_sim_get_call_forwarding_indicator_state(telephony_h handle, bool *state)
+API int telephony_sim_get_call_forwarding_indicator_state(telephony_h handle, bool *state)
 {
        int error_code = TELEPHONY_ERROR_NONE;
        TelSimCardStatus_t sim_card_state = TAPI_SIM_STATUS_UNKNOWN;
diff --git a/test_src/CMakeLists.txt b/test_src/CMakeLists.txt
deleted file mode 100644 (file)
index 5e77d1c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(telephony-test C)
-SET(test "telephony-test")
-
-SET(test_src
-       main.c
-       menu.c
-       call.c
-       modem.c
-       network.c
-       sim.c
-)
-
-##Address-Space Layout Randomization
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
-SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
-
-ADD_EXECUTABLE(${test} ${test_src})
-TARGET_LINK_LIBRARIES(${test} ${fw_name} ${${fw_test}_LDFLAGS})
-INSTALL(TARGETS ${test} RUNTIME DESTINATION bin/)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8c567af
--- /dev/null
@@ -0,0 +1,9 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+SET(TELE_TEST "telephony-test")
+
+FILE(GLOB TEST_SRCS *.c)
+ADD_EXECUTABLE(${TELE_TEST} ${TEST_SRCS})
+TARGET_LINK_LIBRARIES(${TELE_TEST} ${PROJECT_NAME})
+SET_TARGET_PROPERTIES(${TELE_TEST} PROPERTIES COMPILE_FLAGS "-fPIE")
+INSTALL(TARGETS ${TELE_TEST} DESTINATION ${BIN_INSTALL_DIR})
similarity index 100%
rename from test_src/call.c
rename to tests/call.c
similarity index 100%
rename from test_src/call.h
rename to tests/call.h
similarity index 100%
rename from test_src/main.c
rename to tests/main.c
similarity index 96%
rename from test_src/menu.c
rename to tests/menu.c
index 8228db4..20014bb 100644 (file)
@@ -334,9 +334,8 @@ int is_pid_show()
 
 static void _hex_dump(const char *pad, int size, const void *data)
 {
-       char buf[255] = {0, };
-       char hex[4] = {0, };
        int i;
+       char buf[255];
        unsigned char *p;
 
        if (size <= 0) {
@@ -345,18 +344,16 @@ static void _hex_dump(const char *pad, int size, const void *data)
        }
        p = (unsigned char *)data;
 
-       snprintf(buf, 255, "%s%04X: ", pad, 0);
+       int len = snprintf(buf, 255, "%s%04X: ", pad, 0);
        for (i = 0; i < size; i++) {
-               snprintf(hex, 4, "%02X ", p[i]);
-               strncat(buf, hex, strlen(hex));
+               len += snprintf(buf + len, sizeof(buf) - len, "%02X ", p[i]);
 
                if ((i + 1) % 8 == 0) {
                        if ((i + 1) % 16 == 0) {
                                msg("%s", buf);
-                               memset(buf, 0, 255);
-                               snprintf(buf, 255, "%s%04X: ", pad, i + 1);
+                               len = snprintf(buf, sizeof(buf), "%s%04X: ", pad, i + 1);
                        } else {
-                               strncat(buf, TAB_SPACE, strlen(TAB_SPACE));
+                               len += snprintf(buf + len, sizeof(buf) - len, "%s", TAB_SPACE);
                        }
                }
        }
similarity index 100%
rename from test_src/menu.h
rename to tests/menu.h
similarity index 100%
rename from test_src/modem.c
rename to tests/modem.c
similarity index 100%
rename from test_src/modem.h
rename to tests/modem.h
similarity index 100%
rename from test_src/network.c
rename to tests/network.c
similarity index 100%
rename from test_src/network.h
rename to tests/network.h
similarity index 100%
rename from test_src/sim.c
rename to tests/sim.c
similarity index 100%
rename from test_src/sim.h
rename to tests/sim.h