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)
--- /dev/null
+# 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
+++ /dev/null
-#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}")
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).
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).
+++ /dev/null
-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)
+++ /dev/null
-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}
+%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
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}
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));
&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]);
}