Fixed build error 51/184651/3 accepted/tizen/unified/20180720.060817 submit/tizen/20180720.041524 submit/tizen/20180720.041921 submit/tizen/20180720.042518
authorsaerome.kim <saerome.kim@samsung.com>
Fri, 20 Jul 2018 00:06:58 +0000 (09:06 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Fri, 20 Jul 2018 04:12:10 +0000 (13:12 +0900)
- GBS system in TestHub seems not to recognize PATTERN matching in
  CMakeFiles.txt so, removing filtering PATTERN.

Change-Id: I4a7c9786c32e5aebf4a75a8ca424a36fd139b937
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
31 files changed:
CMakeLists.txt
capi-network-zigbee.pc.in [new file with mode: 0644]
common/CMakeLists.txt [deleted file]
include/zigbee-zcl_private.h
lib/CMakeLists.txt [deleted file]
lib/capi-network-zigbee.pc.in [deleted file]
packaging/capi-network-zigbee.spec
src/zbl-custom.c [moved from lib/zbl-custom.c with 100% similarity]
src/zbl-dbus.c [moved from lib/zbl-dbus.c with 99% similarity]
src/zbl-dbus.h [moved from lib/zbl-dbus.h with 100% similarity]
src/zbl-zcl-alarm.c [moved from lib/zbl-zcl-alarm.c with 100% similarity]
src/zbl-zcl-basic.c [moved from lib/zbl-zcl-basic.c with 100% similarity]
src/zbl-zcl-color-control.c [moved from lib/zbl-zcl-color-control.c with 100% similarity]
src/zbl-zcl-global-cmd.c [moved from lib/zbl-zcl-global-cmd.c with 100% similarity]
src/zbl-zcl-groups.c [moved from lib/zbl-zcl-groups.c with 100% similarity]
src/zbl-zcl-identify.c [moved from lib/zbl-zcl-identify.c with 100% similarity]
src/zbl-zcl-isa-zone.c [moved from lib/zbl-zcl-isa-zone.c with 100% similarity]
src/zbl-zcl-level-control.c [moved from lib/zbl-zcl-level-control.c with 100% similarity]
src/zbl-zcl-on-off.c [moved from lib/zbl-zcl-on-off.c with 100% similarity]
src/zbl-zcl-poll-control.c [moved from lib/zbl-zcl-poll-control.c with 100% similarity]
src/zbl-zcl-scenes.c [moved from lib/zbl-zcl-scenes.c with 100% similarity]
src/zbl-zcl-thermostat.c [moved from lib/zbl-zcl-thermostat.c with 100% similarity]
src/zbl-zcl.c [moved from lib/zbl-zcl.c with 100% similarity]
src/zbl-zdo-bind-mgr.c [moved from lib/zbl-zdo-bind-mgr.c with 100% similarity]
src/zbl-zdo-dev-disc.c [moved from lib/zbl-zdo-dev-disc.c with 100% similarity]
src/zbl-zdo-nwk-mgr.c [moved from lib/zbl-zdo-nwk-mgr.c with 100% similarity]
src/zbl-zdo-svc-disc.c [moved from lib/zbl-zdo-svc-disc.c with 100% similarity]
src/zbl-zdo.c [moved from lib/zbl-zdo.c with 100% similarity]
src/zbl.c [moved from lib/zbl.c with 100% similarity]
src/zbl.h [moved from lib/zbl.h with 100% similarity]
test/main.c

index c3e97a5..d7f9185 100644 (file)
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(capi-network-zigbee C)
+SET(fw_name "capi-network-zigbee")
 
-INCLUDE(FindPkgConfig)
+PROJECT(${fw_name})
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(LIB ${LIB_PATH})
+SET(LIBDIR ${PREFIX}/${LIB_PATH})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+INCLUDE_DIRECTORIES(common)
 
-#SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden -fsanitize=address")
-SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden")
-SET(CMAKE_C_FLAGS ${CMAKE_CFALGS} ${EXTRA_CFLAGS})
+SET(dependents "dlog capi-system-info glib-2.0 gio-2.0")
+SET(pc_dependents "")
 
 SET(CAPI_NETWORK_ZIGBEE "capi-network-zigbee")
 SET(CLIENT ${PROJECT_NAME})
+
+# for D-Bus
 SET(DBUS_INTERFACE "org.tizen.zigbee")
 SET(DBUS_OBJECT_PATH "/org/tizen/zigbee")
+ADD_DEFINITIONS("-DZIGBEE_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
+ADD_DEFINITIONS("-DZIGBEE_DBUS_OBJPATH=\"${DBUS_OBJECT_PATH}\"")
 
 # enable client log
 ADD_DEFINITIONS("-DZB_ENABLE_CLIENT_LOG")
+
+# Enable Global Command Response Async.
 IF(ZB_FEATURE_GLOBAL_RSP_SYNC)
-ADD_DEFINITIONS("-DZB_FEATURE_GLOBAL_RSP_SYNC")
+       ADD_DEFINITIONS("-DZB_FEATURE_GLOBAL_RSP_SYNC")
 ENDIF(ZB_FEATURE_GLOBAL_RSP_SYNC)
 
-ADD_SUBDIRECTORY(common)
-ADD_SUBDIRECTORY(lib)
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents} ${APPFW_REQUIRED_PKGS})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+IF(BUILD_GCOV)
+       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror-implicit-function-declaration -Werror -g -fvisibility=hidden -fprofile-arcs -ftest-coverage")
+
+ELSE(BUILD_GCOV)
+       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror-implicit-function-declaration -Werror -g -fvisibility=hidden")
+
+ENDIF(BUILD_GCOV)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror-implicit-function-declaration -Werror -g -fvisibility=hidden")
+
+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(common COMMON_SOURCES)
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${COMMON_SOURCES} ${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 ${LIB})
+INSTALL(
+        DIRECTORY ${INC_DIR}/ DESTINATION include/network
+        FILES_MATCHING
+        PATTERN "_private.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
+        )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_dependents})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+    ${fw_name}.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB}/pkgconfig)
+
 ADD_SUBDIRECTORY(test)
+
+IF(UNIX)
+
+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
+)
+
+ENDIF(UNIX)
diff --git a/capi-network-zigbee.pc.in b/capi-network-zigbee.pc.in
new file mode 100644 (file)
index 0000000..b4937b7
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=${prefix}/bin
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@/network
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @FULLVER@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir} -I${includedir}/network
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
deleted file mode 100644 (file)
index 7837c17..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#FIND_PROGRAM(GDBUS_CODEGEN NAMES gdbus-codegen)
-
-#MESSAGE("${GDBUS_CODEGEN}")
-#ADD_CUSTOM_COMMAND(
-#      OUTPUT dbus
-#      COMMAND ${GDBUS_CODEGEN} --generate-c-code ${ZB_DBUS}
-#                      --interface-prefix org.tizen.zigbee.
-#                      --c-namespace zb
-#                      ${ZB_DBUS}.xml
-#      DEPENDS ${ZB_DBUS}.xml)
-
-#ADD_CUSTOM_TARGET(GENERATED_DBUS_CODE DEPENDS dbus)
-
-#MESSAGE("${dbus}")
index ff0b359..b337f65 100644 (file)
@@ -254,6 +254,36 @@ int zb_report_config_response_record_set_status(
                zb_zcl_status_e status);
 
 /**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_REPORTING_CONFIG_RESPONSE_RECORD_MODULE
+ * @brief Sets the attribute identifier to a reporting configuration response record.
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that the reporting configuration details apply to.
+ *
+ * @since_tizen 4.0
+ *
+ * @param[in] handle The handle of write attribute status record
+ * @param[out] id Attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_config_report_write_cb()
+ * @see zb_report_config_response_record_clone()
+ * @see zb_report_config_response_record_destroy()
+ * @see zb_report_config_response_record_get_status()
+ * @see zb_report_config_response_record_get_dir()
+ * @see zb_report_config_response_record_get_id()
+ * @see zb_report_config_response_record_set_status()
+ * @see zb_report_config_response_record_set_dir()
+ * @see zb_report_config_response_record_set_id()
+ */
+int zb_report_config_response_record_set_id(
+               zb_zcl_report_config_response_record_h handle,
+               zb_attribute_id id);
+
+/**
  * @brief Sets direction to reporting configuration response record.
  * @details The direction field specifies whether values of the attribute are reported
  * (0x00), or whether reports of the attribute are received (0x01).
@@ -294,53 +324,6 @@ int zb_report_config_response_record_set_dir(
                zb_zcl_fc_direction_e dir);
 
 /**
- * @brief Gets change from reporting configuration record (type 5).
- * @details The reportable change field shall contain the minimum change to the attribute
- * that will result in a report being issued. This field is of variable length.
- *
- * For attributes with 'analog' data type the field has the same data type as the attribute.
- *
- * The sign (if any) of the reportable change field is ignored.
- * For attributes of 'discrete' data type
- * this field is omitted.
- *
- * @since_tizen 4.0
- *
- * @param[in] handle The handle of write attribute status record
- * @param[out] type attribute type
- * @param[out] value attribute data (only analog data type is allowed)
- * @param[out] size attribute data size
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #ZIGBEE_ERROR_NONE Successful
- * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
- *
- * @see zb_zcl_global_read_report_config_cb()
- * @see zb_report_config_record_create()
- * @see zb_report_config_record_clone()
- * @see zb_report_config_record_destroy()
- * @see zb_report_config_record_get_id()
- * @see zb_report_config_record_set_id()
- * @see zb_report_config_record_get_dir()
- * @see zb_report_config_record_set_dir()
- * @see zb_report_config_record_get_type()
- * @see zb_report_config_record_get_min_interval()
- * @see zb_report_config_record_set_min_interval()
- * @see zb_report_config_record_get_max_interval()
- * @see zb_report_config_record_set_max_interval()
- * @see zb_report_config_record_get_change()
- * @see zb_report_config_record_set_change()
- * @see zb_report_config_record_get_timeout()
- * @see zb_report_config_record_set_timeout()
- */
-int zb_report_config_record_get_change_3(
-               zb_zcl_reporting_config_record_h handle,
-               zb_zcl_data_type_e *type,
-               unsigned char *value,
-               int *size);
-
-/**
  * @brief Gets direction from read reporting configuration record.
  * @details The direction field specifies whether values of the attribute are reported
  * (0x00), or whether reports of the attribute are received (0x01).
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
deleted file mode 100644 (file)
index ce45060..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-
-SET(CLIENT_PKG_CONF_FILE "capi-network-zigbee")
-
-FILE(GLOB CLIENT_SRCS *.c ${CMAKE_SOURCE_DIR}/common/*.c)
-#SET(CLIENT_SRCS ${CLIENT_SRCS} ${CMAKE_SOURCE_DIR}/common/${ZB_DBUS}.c)
-#SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/common/${ZB_DBUS}.c
-#      PROPERTIES GENERATED TRUE)
-
-pkg_check_modules(client_pkgs REQUIRED glib-2.0 gio-2.0 gio-unix-2.0 dlog capi-base-common capi-system-info)
-INCLUDE_DIRECTORIES(${client_pkgs_INCLUDE_DIRS})
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror -pthread")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O0 -g")
-
-ADD_DEFINITIONS("-DZIGBEE_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
-ADD_DEFINITIONS("-DZIGBEE_DBUS_OBJPATH=\"${DBUS_OBJECT_PATH}\"")
-
-ADD_LIBRARY(${CLIENT} SHARED ${CLIENT_SRCS})
-#ADD_DEPENDENCIES(${CLIENT} GENERATED_DBUS_CODE)
-TARGET_LINK_LIBRARIES(${CLIENT} ${client_pkgs_LIBRARIES})
-SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES VERSION ${FULLVER} SUBVERSION ${MAJORVER})
-INSTALL(TARGETS ${CLIENT} DESTINATION ${LIB_INSTALL_DIR})
-
-CONFIGURE_FILE(${CLIENT_PKG_CONF_FILE}.pc.in ${CLIENT_PKG_CONF_FILE}.pc @ONLY)
-INSTALL(FILES ${CLIENT_PKG_CONF_FILE}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-FILE(GLOB CLIENT_HEADER ${CMAKE_SOURCE_DIR}/include/*.h)
-list(FILTER CLIENT_HEADER EXCLUDE REGEX ".*_private.h$")
-INSTALL(FILES ${CLIENT_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/network)
diff --git a/lib/capi-network-zigbee.pc.in b/lib/capi-network-zigbee.pc.in
deleted file mode 100644 (file)
index 7aa7398..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=${prefix}/bin
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@/network
-
-Name: @CLIENT@
-Description: Network/Wireless zigbee
-Version: @FULLVER@
-Requires:
-Libs: -L${libdir} -l@CLIENT@
-Cflags: -I${includedir}
index 542b38f..d7858dc 100644 (file)
@@ -1,6 +1,10 @@
+%define major 0
+%define minor 1
+%define patchlevel 1
+
 Name:          capi-network-zigbee
 Summary:       Network Zigbee Service in Tizen CAPI
-Version:       0.0.1
+Version:       %{major}.%{minor}.%{patchlevel}
 Release:       0
 Group:         Network & Connectivity/Other
 License:       Apache-2.0
@@ -34,11 +38,20 @@ chmod g-w %_sourcedir/*
 cp %{SOURCE1001} ./%{name}.manifest
 
 %build
-MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%if 0%{?gcov:1}
+export LDFLAGS+=" -lgcov"
+%endif
 
-%cmake . -DMAJORVER=%{MAJORVER} -DFULLVER=%{version} \
-       -DBIN_INSTALL_DIR:PATH=%{_bindir} \
-       -DZB_FEATURE_GLOBAL_RSP_SYNC=1
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+       -DLIB_INSTALL_DIR=%{_libdir} \
+       -DBIN_INSTALL_DIR=%{_bindir} \
+       -DINCLUDE_INSTALL_DIR=%{_includedir} \
+       -DLIB_PATH=%{_lib} \
+       -DFULLVER=%{version} \
+       -DMAJORVER=${MAJORVER} \
+       -DZB_FEATURE_GLOBAL_RSP_SYNC=1 \
+       -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
 
 %install
 rm -rf %{buildroot}/BUILD/%{name}
similarity index 100%
rename from lib/zbl-custom.c
rename to src/zbl-custom.c
similarity index 99%
rename from lib/zbl-dbus.c
rename to src/zbl-dbus.c
index f040020..0951abe 100644 (file)
@@ -2812,10 +2812,6 @@ GLOBAL_CONFIGURE_REPORTING_REQ_OUT:
                                goto GLOBAL_READ_CONFIGURE_REPORTING_REQ_OUT;
                        }
                }
-               if (!records) {
-                       ERR("calloc() Fail(%d)", errno);
-                       goto GLOBAL_READ_CONFIGURE_REPORTING_REQ_OUT;
-               }
 
                DBG("record_length %d", record_length);
                status = calloc(record_length, sizeof(unsigned char));
similarity index 100%
rename from lib/zbl-dbus.h
rename to src/zbl-dbus.h
similarity index 100%
rename from lib/zbl-zcl-alarm.c
rename to src/zbl-zcl-alarm.c
similarity index 100%
rename from lib/zbl-zcl-basic.c
rename to src/zbl-zcl-basic.c
similarity index 100%
rename from lib/zbl-zcl-groups.c
rename to src/zbl-zcl-groups.c
similarity index 100%
rename from lib/zbl-zcl-on-off.c
rename to src/zbl-zcl-on-off.c
similarity index 100%
rename from lib/zbl-zcl-scenes.c
rename to src/zbl-zcl-scenes.c
similarity index 100%
rename from lib/zbl-zcl.c
rename to src/zbl-zcl.c
similarity index 100%
rename from lib/zbl-zdo-nwk-mgr.c
rename to src/zbl-zdo-nwk-mgr.c
similarity index 100%
rename from lib/zbl-zdo.c
rename to src/zbl-zdo.c
similarity index 100%
rename from lib/zbl.c
rename to src/zbl.c
similarity index 100%
rename from lib/zbl.h
rename to src/zbl.h
index e0ed940..ab28b6a 100644 (file)
@@ -431,13 +431,13 @@ static void _zb_event_cb(zb_nwk_addr addr16, zb_ieee_addr addr64, zb_event_e e,
                                &type
                                );
                        msg("  type = [0x%02X][%s]", type, zb_zcl_get_data_type_str(type));
-                       zb_attr_report_get_value(
+                       ret = zb_attr_report_get_value(
                                records[j],
                                &type,
                                &buf,
                                &count
                                );
-                       if (ZIGBEE_ERROR_NONE == ret) {
+                       if (0 < count && ZIGBEE_ERROR_NONE == ret) {
                                for (i = 0; i < count; i++)
                                        msg("    0x%02X ", buf[i]);
                        }