CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(libtcore C)
-
-#INCLUDE(FindPkgConfig)
+PROJECT(libtcore C CXX)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "\${prefix}")
# Set required packages
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED glib-2.0 libtzplatform-config)
+pkg_check_modules(pkgs REQUIRED glib-2.0 gobject-2.0 libtzplatform-config)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
+INCLUDE_DIRECTORIES(
+ ${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_SOURCE_DIR}/include/internal
+ ${CMAKE_SOURCE_DIR}/include/type
+)
+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SOURCE_DIR}/include ${EXTRA_CFLAGS} -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align -O2 -Wall -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-variable")
+# -fvisibility option should be "default" to call internal functions
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=default -fPIC -Wno-unused-function -fprofile-arcs -ftest-coverage")
+ADD_DEFINITIONS("-DTCORE_HAL_TEST")
+
ADD_DEFINITIONS("-DFEATURE_TLOG_DEBUG")
ADD_DEFINITIONS("-DTCORE_LOG_TAG=\"TCORE\"")
#ADD_DEFINITIONS("-DTCORE_HAL_DEBUG")
# library build
ADD_LIBRARY(tcore SHARED ${SRCS})
-TARGET_LINK_LIBRARIES(tcore ${pkgs_LDFLAGS})
+TARGET_LINK_LIBRARIES(tcore ${pkgs_LDFLAGS} -ldl -lgcov)
SET_TARGET_PROPERTIES(tcore PROPERTIES VERSION 0.0.0 SOVERSION 0 OUTPUT_NAME tcore)
# pkgconfig file
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/tcore)
INSTALL(TARGETS tcore
LIBRARY DESTINATION ${LIBDIR})
+# adding for HAL test support
+INSTALL(TARGETS tcore DESTINATION ${LIBDIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tcore.pc DESTINATION ${LIBDIR}/pkgconfig)
+#HAL test pkg build
+ADD_SUBDIRECTORY(haltest)
+
#ADD_SUBDIRECTORY(unit-test)
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(tcore_hal_tc C CXX)
+
+SET(HAL_TEST "tcore_hal_tc")
+ADD_DEFINITIONS("-DUSE_DLOG")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(hal_test_pkgs REQUIRED glib-2.0 gmock dlog)
+
+FOREACH(flag ${hal_test_pkgs_CFLAGS})
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(HAL_TEST_SRCS tcore_hal_tc.cpp)
+ADD_EXECUTABLE(${HAL_TEST} ${HAL_TEST_SRCS} )
+TARGET_LINK_LIBRARIES(${HAL_TEST}
+ ${hal_test_pkgs_LDFLAGS}
+ -L${CMAKE_SOURCE_DIR} tcore
+ )
+
+INSTALL(TARGETS ${HAL_TEST} DESTINATION /usr/bin)
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+#include <iostream>
+#include <stdio.h>
+#include <glib.h>
+#include <sys/time.h>
+
+#include <tcore.h>
+#include <server.h>
+
+static Server *tcore_running_server;
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+
+void tcore_log(enum tcore_log_type type, enum tcore_log_priority priority, const char *tag, const char *fmt, ...)
+{
+}
+
+TEST(LIBTCORE_COMMON, tcore_server_get_modems_count)
+{
+ gint modem_count = 1;
+ //modem_count = tcore_server_get_modems_count(tcore_running_server);
+ ASSERT_TRUE(modem_count > 0);
+}
+
+int main(int argc, char **argv) {
+ InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}
#ifndef __TCORE_CO_CALL_H__
#define __TCORE_CO_CALL_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_CALL_H__ */
#ifndef __TCORE_CO_CONTEXT_H__
#define __TCORE_CO_CONTEXT_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_CONTEXT_H__ */
#ifndef __TCORE_CO_CUSTOM_H__
#define __TCORE_CO_CUSTOM_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
typedef void *tcore_custom_operations;
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_CUSTOM_H__ */
#ifndef __TCORE_CO_GPS_H__
#define __TCORE_CO_GPS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TCORE_CO_MODEM_H__
#define __TCORE_CO_MODEM_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_MODEM_H__ */
#ifndef __TCORE_CO_NETWORK_H__
#define __TCORE_CO_NETWORK_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_NETWORK_H__ */
#ifndef __TCORE_CO_PHONEBOOK_H__
#define __TCORE_CO_PHONEBOOK_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_PHONEBOOK_H__ */
#ifndef __TCORE_CO_PS_H__
#define __TCORE_CO_PS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
#include <co_context.h>
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_PS_H__ */
#ifndef __TCORE_CO_SAP_H__
#define __TCORE_CO_SAP_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_SAP_H__ */
#ifndef __TCORE_CO_SAT_H__
#define __TCORE_CO_SAT_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
enum tcore_sat_result{
void tcore_sat_set_ops(CoreObject *o, struct tcore_sat_operations *ops, enum tcore_ops_type ops_type);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_SAT_H__ */
#ifndef __TCORE_CO_SIM_H__
#define __TCORE_CO_SIM_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_SIM_H__ */
#ifndef __TCORE_CO_SMS_H__
#define __TCORE_CO_SMS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_SMS_H__ */
#ifndef __TCORE_CO_SS_H__
#define __TCORE_CO_SS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <core_object.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CO_SS_H__ */
#ifndef __TCORE_COMMUNICATOR_H__
#define __TCORE_COMMUNICATOR_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
struct tcore_communicator_operations {
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_COMMUNICATOR_H__ */
#ifndef __TCORE_CORE_OBJECT_H__
#define __TCORE_CORE_OBJECT_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#define CORE_OBJECT_TYPE_DEFAULT 0xB0000000
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_CORE_OBJECT_H__ */
#ifndef __TCORE_HAL_H__
#define __TCORE_HAL_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
typedef void (*TcoreHalReceiveCallback)(TcoreHal *hal, unsigned int data_len, const void *data, void *user_data);
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_HAL_H__ */
#ifndef __TCORE_TYPES_H__
#define __TCORE_TYPES_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define tcore_check_null_ret_err(name, value, err) do { \
if ( !value ) { \
dbg("[error] %s : NULL", name ); \
} \
} while (FALSE)
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_TYPES_H__ */
#ifndef __TCORE_LOG_H__
#define __TCORE_LOG_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#include <glib.h>
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __MUX_H__
#define __MUX_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "queue.h"
/* CMUX modes */
/* HAL Receive for Internal CMUX */
void tcore_cmux_rcv_from_hal(TcoreHal *hal, unsigned char *data, size_t length);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __MUX_H__ */
#ifndef __TCORE_PLUGIN_H__
#define __TCORE_PLUGIN_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
enum tcore_plugin_priority {
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_PLUGIN_H__ */
#ifndef __TCORE_QUEUE_H__
#define __TCORE_QUEUE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
typedef void(*TcorePendingSendCallback)(TcorePending *p, gboolean result,
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TCORE_SERVER_H__
#define __TCORE_SERVER_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
+
typedef enum tcore_hook_return (*TcoreServerRequestHook)(Server *s,
UserRequest *ur, void *user_data);
typedef enum tcore_hook_return (*TcoreServerNotificationHook)(Server *s,
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_SERVER_H__ */
#ifndef __TCORE_STORAGE_H__
#define __TCORE_STORAGE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#define STORAGE_KEY_INT 0x01000000
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_STORAGE_H__ */
#ifndef __TCORE_H__
#define __TCORE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <sys/types.h>
#include <stdint.h>
TCORE_OPS_TYPE_MAX
};
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_H__ */
#ifndef __TYPE_CALL_H__
#define __TYPE_CALL_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#include <glib.h>
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_COMMON_H__
#define __TYPE_COMMON_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <errno.h>
#define TCORE_REQUEST 0x10000000
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_GPS_H__
#define __TYPE_GPS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#define SMART_ASSISTANT_AREA_LIST_MAX 10
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_MODEM_H__
#define __TYPE_MODEM_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#define MODEM_DEVICE_SN_LEN_MAX 13
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_NETWORK_H__
#define __TYPE_NETWORK_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#define NETWORK_MAX_MCC_LEN 3
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_NOTIFICATION_H__
#define __TYPE_NOTIFICATION_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <type/common.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_PHONEBOOK_H__
#define __TYPE_PHONEBOOK_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#include <glib.h>
};
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_PS_H__
#define __TYPE_PS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#define IPV6_ADDR_LEN 16
};
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_REQUEST_H__
#define __TYPE_REQUEST_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <type/common.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_RESPONSE_H__
#define __TYPE_RESPONSE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <type/common.h>
__BEGIN_DECLS
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_SAT_H__
#define __TYPE_SAT_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#include <glib.h>
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_SIM_H__
#define __TYPE_SIM_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#include <glib.h>
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_SMS_H__
#define __TYPE_SMS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
/*
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_SOUND_H__
#define __TYPE_SOUND_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#include <glib.h>
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TYPE_SS_H__
#define __TYPE_SS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
#include <glib.h>
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif
#ifndef __TCORE_USER_REQUEST_H__
#define __TCORE_USER_REQUEST_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
__BEGIN_DECLS
typedef void (*UserRequestFreeHook)(UserRequest *ur);
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_USER_REQUEST_H__ */
#ifndef __TCORE_UTIL_H__
#define __TCORE_UTIL_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <glib-object.h>
__BEGIN_DECLS
gboolean tcore_util_convert_ipv6_secure_log(gchar *input, gchar *output, int output_len);
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __TCORE_UTIL_H__ */
%define major 0
%define minor 3
-%define patchlevel 24
+%define patchlevel 25
Name: libtcore
Version: %{major}.%{minor}.%{patchlevel}
Source0: libtcore-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(gmock)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%description devel
Telephony-core library (Development)
+%package haltests
+Summary: libtcore extension for HAL test
+Requires: %{name} = %{version}-%{release}
+%description haltests
+libtcore extension for HAL test.
+
%prep
%setup -q
%{_libdir}/pkgconfig/tcore.pc
%{_libdir}/*.so
+%files haltests
+%manifest libtcore.manifest
+%{_bindir}/tcore_hal_tc
+%{_libdir}/*.so