ADD_SUBDIRECTORY(pb-agent)
ADD_SUBDIRECTORY(ag-agent)
ADD_SUBDIRECTORY(ipsp-agent)
-ADD_SUBDIRECTORY(hid-agent)
\ No newline at end of file
+ADD_SUBDIRECTORY(hid-agent)
+IF (BUILD_GTESTS)
+ADD_SUBDIRECTORY(unittest)
+ENDIF (BUILD_GTESTS)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-ag-agent C)
+PROJECT(bluetooth-ag-agent C CXX)
SET(SRCS bluetooth-ag-agent.c
bluetooth-ag-handler.c
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_ag_agent_LDFLAGS})
+IF (BUILD_GTESTS)
+# -fvisibility option should be "default" to call internal functions
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=default -fPIC -Werror -Wno-deprecated-declarations -fprofile-arcs -ftest-coverage")
+
+ADD_LIBRARY(ag-agent SHARED ${SRCS})
+SET_TARGET_PROPERTIES(ag-agent
+ PROPERTIES
+ SOVERSION 0.1.0
+ CLEAN_DIRECT_OUTPUT 1)
+
+TARGET_LINK_LIBRARIES(ag-agent ${pkgs_ag_agent_LDFLAGS} -lgcov)
+
+INSTALL(TARGETS ag-agent DESTINATION lib COMPONENT RuntimeLibraries)
+ENDIF (BUILD_GTESTS)
+
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.bluez.ag_agent.service
DESTINATION share/dbus-1/system-services)
#ifndef __DEF_BT_AG_AGENT_H_
#define __DEF_BT_AG_AGENT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#undef LOG_TAG
#define LOG_TAG "BLUETOOTH_AG_AGENT"
void _bt_ag_agent_check_transport_state(void);
#endif
+#ifdef __cplusplus
+}
+#endif
#endif /* __DEF_BT_AG_AGENT_H_ */
*
*/
+#ifndef __DEF_BT_AG_HANDLER_H_
+#define __DEF_BT_AG_HANDLER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
int _bt_hfp_send_vendor_cmd(bt_ag_info_t *hs,
const char *cmd);
int _bt_vendor_cmd_response(void *t_device, bt_hfp_agent_error_t err);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __DEF_BT_AG_HANDLER_H_ */
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-hf-agent C)
+PROJECT(bluetooth-hf-agent C CXX)
SET(SRCS bluetooth-hf-agent.c
../include/bluetooth-agent-profile.c)
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_hf_agent_LDFLAGS})
+IF (BUILD_GTESTS)
+# -fvisibility option should be "default" to call internal functions
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=default -fPIC -Werror -Wno-deprecated-declarations -fprofile-arcs -ftest-coverage")
+
+ADD_LIBRARY(hf-agent SHARED ${SRCS})
+SET_TARGET_PROPERTIES(hf-agent
+ PROPERTIES
+ SOVERSION 0.1.0
+ CLEAN_DIRECT_OUTPUT 1)
+
+TARGET_LINK_LIBRARIES(hf-agent ${pkgs_hf_agent_LDFLAGS} -lgcov)
+
+INSTALL(TARGETS hf-agent DESTINATION lib COMPONENT RuntimeLibraries)
+ENDIF (BUILD_GTESTS)
+
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.bluez.hf_agent.service
DESTINATION share/dbus-1/system-services)
#ifndef __DEF_BT_HF_AGENT_H_
#define __DEF_BT_HF_AGENT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#undef LOG_TAG
#define LOG_TAG "BLUETOOTH_HF_AGENT"
bdaddr_t sco_bdaddr;
};
+#ifdef __cplusplus
+}
+#endif
#endif /* __DEF_BT_HF_AGENT_H_ */
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-hid-agent C)
+PROJECT(bluetooth-hid-agent C CXX)
SET(SRCS bluetooth-hid-agent.c bluetooth-hid-manager.c)
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_hid_agent_LDFLAGS})
+IF (BUILD_GTESTS)
+# -fvisibility option should be "default" to call internal functions
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=default -fPIC -Werror -Wno-deprecated-declarations -fprofile-arcs -ftest-coverage")
+
+ADD_LIBRARY(hid-agent SHARED ${SRCS})
+SET_TARGET_PROPERTIES(hid-agent
+ PROPERTIES
+ SOVERSION 0.1.0
+ CLEAN_DIRECT_OUTPUT 1)
+
+TARGET_LINK_LIBRARIES(hid-agent ${pkgs_hid_agent_LDFLAGS} -lgcov)
+
+INSTALL(TARGETS hid-agent DESTINATION lib COMPONENT RuntimeLibraries)
+ENDIF (BUILD_GTESTS)
+
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.bluez.hid_agent.service
DESTINATION share/dbus-1/system-services)
#define __DEF_BT_HID_AGENT_H_
#define FUNCTION_TRACE
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdio.h>
#include <dlog.h>
#include <glib.h>
bt_hid_agent_error_t _bt_hid_disconnect_profile(void);
+#ifdef __cplusplus
+}
+#endif
#endif /* __DEF_BT_HID_AGENT_H_ */
#ifndef __DEF_BT_HID_MANAGER_H_
#define __DEF_BT_HID_MANAGER_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void _bt_hid_set_profile_state(bt_hid_state_t new_state);
bt_hid_agent_error_t _bt_hid_register_application(gboolean register_flag,
const char *sender_name);
const GSList* _bt_hid_get_sender_list(void);
+#ifdef __cplusplus
+}
+#endif
#endif /* __DEF_BT_HID_MANAGER_H_ */
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-ipsp-agent C)
+PROJECT(bluetooth-ipsp-agent C CXX)
SET(SRCS bluetooth_ipsp_agent.c
../include/bluetooth-agent-profile.c)
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_ipsp_agent_LDFLAGS} -L${CMAKE_CURRENT_SOURCE_DIR}/../bt-api -lbluetooth-api)
+IF (BUILD_GTESTS)
+# -fvisibility option should be "default" to call internal functions
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=default -fPIC -Werror -Wno-deprecated-declarations -fprofile-arcs -ftest-coverage")
+
+ADD_LIBRARY(ipsp-agent SHARED ${SRCS})
+SET_TARGET_PROPERTIES(ipsp-agent
+ PROPERTIES
+ SOVERSION 0.1.0
+ CLEAN_DIRECT_OUTPUT 1)
+
+TARGET_LINK_LIBRARIES(ipsp-agent ${pkgs_ipsp_agent_LDFLAGS} -lgcov)
+
+INSTALL(TARGETS ipsp-agent DESTINATION lib COMPONENT RuntimeLibraries)
+ENDIF (BUILD_GTESTS)
+
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.bluez.ipsp_agent.service DESTINATION share/dbus-1/system-services)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-map-agent C)
+PROJECT(bluetooth-map-agent C CXX)
SET(SRCS bluetooth_map_agent.c bluetooth_map_sms.c bluetooth_map_email.c
map_bmessage.c ../include/bluetooth-agent-profile.c)
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_map_agent_LDFLAGS})
+IF (BUILD_GTESTS)
+# -fvisibility option should be "default" to call internal functions
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=default -fPIC -Werror -Wno-deprecated-declarations -fprofile-arcs -ftest-coverage")
+
+ADD_LIBRARY(map-agent SHARED ${SRCS})
+SET_TARGET_PROPERTIES(map-agent
+ PROPERTIES
+ SOVERSION 0.1.0
+ CLEAN_DIRECT_OUTPUT 1)
+
+TARGET_LINK_LIBRARIES(map-agent ${pkgs_map_agent_LDFLAGS} -lgcov)
+
+INSTALL(TARGETS map-agent DESTINATION lib COMPONENT RuntimeLibraries)
+ENDIF (BUILD_GTESTS)
+
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.bluez.map_agent.service DESTINATION share/dbus-1/system-services)
#ifndef __DEF_BT_PB_AGENT_H_
#define __DEF_BT_PB_AGENT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <unistd.h>
#include <dlog.h>
#include <stdio.h>
gboolean _bt_verify_receiver(message_info_t *msg_info, char *receiver);
gboolean _bt_verify_time(message_info_t *msg_info, map_msg_filter_t *filter);
gboolean _bt_filter_priority(message_info_t *msg_info, guint8 priority);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* __DEF_BT_AGENT_H_ */
#ifndef __DEF_MAP_EMAIL_H_
#define __DEF_MAP_EMAIL_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <glib.h>
#include "bluetooth_map_types.h"
#include "map_bmessage.h"
gboolean _bt_map_push_email_data(struct bmsg_data *bmsg_info,
msg_send_option_t *option, char *folder);
+#ifdef __cplusplus
+}
+#endif
#endif /* __DEF_MAP_EMAIL_H_ */
#ifndef BLUETOOTH_MAP_SMS_H_
#define BLUETOOTH_MAP_SMS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <glib.h>
#include "bluetooth_map_types.h"
#include "map_bmessage.h"
gboolean _bt_map_push_sms_data(struct bmsg_data *bmsg_info,
msg_send_option_t *option, char *folder);
+#ifdef __cplusplus
+}
+#endif
#endif /* BLUETOOTH_MAP_SMS_H_ */
#ifndef BLUETOOTH_MAP_TYPES_H_
#define BLUETOOTH_MAP_TYPES_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define FOLDER_COUNT 5 /* INBOX, OUTBOX, SENT, DRAFT, DELETED*/
#define MSG_TYPES 2 /* GSM_SMS, EMAIL*/
#define BT_MAP_SUBJECT_MAX_LEN 50
char *originator;
guint8 priority;
} map_msg_filter_t;
+
+#ifdef __cplusplus
+}
+#endif
#endif /* BLUETOOTH_MAP_TYPES_H_ */
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: cmake
Requires: security-config
+%if 0%{?gcov:1}
+BuildRequires: pkgconfig(gmock)
+%endif
+
#Requires: %{name}-compat = %{version}-%{release}
#Recommends: %{name}-profile_common = %{version}-%{release}
%description ipsp
Bluetooth agent binary compiled for IPSP(Internet Protocol Support Profile)
+%if 0%{?gcov:1}
+%package test
+Summary: Test package for bluetooth-agent
+Group: TO_BE/FILLED
+Requires: %{name} = %{version}-%{release}
+
+%description test
+This package is C-API test application.
+%endif
+
%prep
%setup -q
cp %{SOURCE1001} .
export CFLAGS_DEFAULT="$CFLAGS"
# Build All (wearalbe/ivi/common/tv/mobile)
-cmake . -DCMAKE_INSTALL_PREFIX=/usr -DTIZEN_FEATURE_BT_HFP_AG=1
+cmake . -DCMAKE_INSTALL_PREFIX=/usr \
+ -DTIZEN_FEATURE_BT_HFP_AG=1 \
+ -DBUILD_GTESTS=%{?gcov:1}%{!?gcov:0} \
+ -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
+
make VERBOSE=1
%install
%{_datadir}/dbus-1/system-services/org.bluez.ipsp_agent.service
%{_sysconfdir}/dbus-1/system.d/bluetooth-ipsp-agent.conf
+%if 0%{?gcov:1}
+%files test
+%manifest %{name}.manifest
+%{_bindir}/gtest-bluetooth-agent
+%{_libdir}/lib*
+%exclude %{_libdir}/debug/*
+%exclude %{_libdir}/debug/.build-id/*
+%endif
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-pb-agent C)
+PROJECT(bluetooth-pb-agent C CXX)
SET(SRCS bluetooth_pb_agent.c bluetooth_pb_vcard.c
../include/bluetooth-agent-profile.c)
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_pb_agent_LDFLAGS})
+IF (BUILD_GTESTS)
+# -fvisibility option should be "default" to call internal functions
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=default -fPIC -Werror -Wno-deprecated-declarations -fprofile-arcs -ftest-coverage")
+
+ADD_LIBRARY(pb-agent SHARED ${SRCS})
+SET_TARGET_PROPERTIES(pb-agent
+ PROPERTIES
+ SOVERSION 0.1.0
+ CLEAN_DIRECT_OUTPUT 1)
+
+TARGET_LINK_LIBRARIES(pb-agent ${pkgs_pb_agent_LDFLAGS} -lgcov)
+
+INSTALL(TARGETS pb-agent DESTINATION lib COMPONENT RuntimeLibraries)
+ENDIF (BUILD_GTESTS)
+
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.bluez.pb_agent.service
DESTINATION share/dbus-1/system-services)
#ifndef __DEF_BT_PB_AGENT_H_
#define __DEF_BT_PB_AGENT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <unistd.h>
#include <dlog.h>
TELECOM_NONE
} PhoneBookType;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __DEF_BT_AGENT_H_ */
#ifndef __DEF_BT_PB_VCARD_H_
#define __DEF_BT_PB_VCARD_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <glib.h>
#define SIM_ADDRESSBOOK_PREFIX "http://tizen.org/addressbook/sim"
bool _bt_is_sim_addressbook(const char *addressbook);
+#ifdef __cplusplus
+}
+#endif
+
#endif
--- /dev/null
+# Copyright (c) 2014-2017 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.
+#
+# @file CMakeLists.txt
+# @author
+# @brief Cmake for tests
+#
+SET(TARGET_GTEST_TESTS "gtest-bluetooth-agent")
+
+INCLUDE_DIRECTORIES(/usr/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+INCLUDE_DIRECTORIES(/usr/include/glib-2.0)
+INCLUDE_DIRECTORIES(/usr/lib/glib-2.0/include/)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(INCLUDEDIR "/usr/include")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(testpkgs REQUIRED glib-2.0 gmock)
+
+SET(GTEST_TESTS_SOURCES
+bluetooth-agent_test.cpp
+)
+
+ADD_EXECUTABLE(${TARGET_GTEST_TESTS}
+ ${GTEST_TESTS_SOURCES}
+)
+
+TARGET_LINK_LIBRARIES(${TARGET_GTEST_TESTS}
+ ${pkgs_LDFLAGS}
+ ${pkgs_LIBRARIES}
+ gmock
+ -L${CMAKE_SOURCE_DIR}/ag-agent
+ -L${CMAKE_SOURCE_DIR}/hf-agent
+ -L${CMAKE_SOURCE_DIR}/hid-agent
+ -L${CMAKE_SOURCE_DIR}/ipsp-agent
+ -L${CMAKE_SOURCE_DIR}/map-agent
+ -L${CMAKE_SOURCE_DIR}/pb-agent
+ -lag-agent
+ -lhf-agent
+ -lhid-agent
+ -lipsp-agent
+ -lmap-agent
+ -lpb-agent
+)
+
+INSTALL(TARGETS ${TARGET_GTEST_TESTS} 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.
+ */
+/**
+ * @file bluetooth-agent_test.cpp
+ * @author abc
+ * @version 1.0
+ * @brief Unit-tests setup
+ */
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+#include <glib.h>
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+
+int main(int argc, char **argv) {
+ InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}