Tizen 2.1 base
authorJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:46:12 +0000 (01:46 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:46:12 +0000 (01:46 +0900)
19 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
LICENSE.APLv2 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
capi-network-serial.manifest [new file with mode: 0644]
capi-network-serial.pc.in [new file with mode: 0644]
debian/README [new file with mode: 0644]
debian/capi-network-serial-dev.install [new file with mode: 0644]
debian/capi-network-serial-dev.postinst [new file with mode: 0644]
debian/capi-network-serial.install [new file with mode: 0644]
debian/capi-network-serial.postinst [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/rules [new file with mode: 0755]
include/serial.h [new file with mode: 0644]
include/serial_private.h [new file with mode: 0644]
packaging/capi-network-serial.spec [new file with mode: 0644]
src/serial.c [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..54bdcfd
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+Jinmin Jung <jinmin@samsung.com>
+DoHyun Pyun <dh79.pyun@samsung.com>
+InJun Yang <injun.yang@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..77e9f04
--- /dev/null
@@ -0,0 +1,63 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-network-serial")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(dependents "dlog glib-2.0 capi-base-common dbus-glib-1")
+SET(pc_dependents "capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+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=/usr/lib")
+
+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 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(
+    capi-network-serial.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..43e91eb
--- /dev/null
@@ -0,0 +1,203 @@
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..0e0f016
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
diff --git a/capi-network-serial.manifest b/capi-network-serial.manifest
new file mode 100644 (file)
index 0000000..75b0fa5
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_"/>
+    </request>
+</manifest>
diff --git a/capi-network-serial.pc.in b/capi-network-serial.pc.in
new file mode 100644 (file)
index 0000000..127da21
--- /dev/null
@@ -0,0 +1,14 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/network
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
diff --git a/debian/README b/debian/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/capi-network-serial-dev.install b/debian/capi-network-serial-dev.install
new file mode 100644 (file)
index 0000000..761a28b
--- /dev/null
@@ -0,0 +1,4 @@
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
diff --git a/debian/capi-network-serial-dev.postinst b/debian/capi-network-serial-dev.postinst
new file mode 100644 (file)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/capi-network-serial.install b/debian/capi-network-serial.install
new file mode 100644 (file)
index 0000000..4a755a4
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/lib*.so*
diff --git a/debian/capi-network-serial.postinst b/debian/capi-network-serial.postinst
new file mode 100644 (file)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..6513f06
--- /dev/null
@@ -0,0 +1,32 @@
+capi-network-serial (0.0.2-3) unstable; urgency=low
+
+  * Upload the package
+  * Git: slp-source.sec.samsung.net:slp/api/serial
+  * Tag: capi-network-serial_0.0.4
+
+ -- InJun Yang <injun.yang@samsung.com>  Sat, 08 Sep 2012 00:49:53 +0900
+
+capi-network-serial (0.0.2-2) unstable; urgency=low
+
+  * Upload the package
+  * Git: slp-source.sec.samsung.net:slp/api/serial
+  * Tag: capi-network-serial_0.0.3
+
+ -- InJun Yang <injun.yang@samsung.com>  Wed, 08 Aug 2012 13:25:47 +0900
+
+capi-network-serial (0.0.2-1) unstable; urgency=low
+
+   * Fix the crash issue
+   * Git: slp-source.sec.samsung.net:slp/api/serial
+   * Tag: capi-network-serial_0.0.2-1
+
+ -- InJun Yang <injun.yang@samsung.com>  Mon, 14 May 2012 10:49:29 +0900
+
+capi-network-serial (0.0.1-1) unstable; urgency=low
+
+   * Initial upload
+   * Git: slp-source.sec.samsung.net:slp/api/serial
+   * Tag: capi-network-serial_0.0.1-1
+
+ -- InJun Yang <injun.yang@samsung.com>  Mon, 08 Aug 2011 10:12:25 +0900
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..a85ecaf
--- /dev/null
@@ -0,0 +1,21 @@
+Source: capi-network-serial
+Section: libs
+Priority: extra
+Maintainer: Kangho Hur <kangho.hur@samsung.com>, ByungWoo Lee <bw1212.lee@samsung.com>, Hocheol Seo <hocheol.seo@samsung.com>, InJun Yang <injun.yang@samsung.com>
+Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev, libglib2.0-dev
+
+Package: capi-network-serial
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: A Network Serial library in Tizen Native API
+
+Package: capi-network-serial-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-serial (= ${Source-Version}), capi-base-common-dev
+Description: A Network Serial library in Tizen Native API (DEV)
+
+Package: capi-network-serial-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-serial (= ${Source-Version})
+Description: A Network Serial library in Tizen Native API (DBG)
+
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..6b8edf9
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/make -f
+
+FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
+MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+CMAKE_ROOT_DIR ?= $(CURDIR)
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
+       touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp
+       dh_testdir
+       cd $(CMAKE_BUILD_DIR) && $(MAKE)
+       touch $@
+
+clean:
+       cd $(CMAKE_ROOT_DIR)
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       rm -f `find . -name *.pc`
+       rm -rf $(CMAKE_BUILD_DIR)
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+binary-indep: build install
+
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=capi-network-serial-dbg
+       dh_fixperms
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+
diff --git a/include/serial.h b/include/serial.h
new file mode 100644 (file)
index 0000000..7f21fc5
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+*
+* 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.
+*/
+
+#ifndef __TIZEN_NETWORK_SERIAL_H__
+#define __TIZEN_NETWORK_SERIAL_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+* @addtogroup CAPI_NETWORK_SERIAL_MODULE
+* @{
+*/
+
+
+/**
+* @brief The handle of serial
+*/
+typedef void* serial_h;
+
+/**
+* @brief Enumerations for the state of serial
+*/
+typedef enum
+{
+    SERIAL_STATE_OPENED = 0,  /**< Opened */
+    SERIAL_STATE_CLOSED = 1,  /**< Closed */
+} serial_state_e;
+
+/**
+* @brief Enumerations for error code
+*/
+typedef enum
+{
+    SERIAL_ERROR_NONE = TIZEN_ERROR_NONE,  /**< Successful */
+    SERIAL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,  /**< Out of memory */
+    SERIAL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid parameter */
+    SERIAL_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,  /**< Invalid operation */
+    SERIAL_ERROR_OPERATION_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0601,  /**< Operation failed */
+} serial_error_e;
+
+/**
+* @brief  Called when you receive data.
+* @remarks  @a data is valid only in this function.
+* @param[in]  data  The received data
+* @param[in]  user_data  The user data passed from serial_set_data_received_cb()
+* @pre  If you register callback function using serial_set_data_received_cb(), this will be invoked when you receive data.
+* @see  serial_set_data_received_cb()
+* @see  serial_unset_data_received_cb()
+*/
+typedef bool (*serial_data_received_cb)(const char *data, int data_length, void *user_data);
+
+/**
+* @brief  Called when the state of serial is changed.
+* @param[in]  result  The result of opening the serial
+* @param[in]  state  The state of serial
+* @param[in]  user_data  The user data passed from serial_set_state_changed_cb()
+* @pre  If you register callback function using serial_set_state_changed_cb(), this will be invoked when the state of serial is changed.
+* @see serial_set_state_changed_cb()
+* @see serial_unset_state_changed_cb()
+*/
+typedef void (*serial_state_changed_cb)(serial_error_e result, serial_state_e state, void *user_data);
+
+
+/**
+* @brief  Creates the handle of serial.
+* @param[out]  serial  The serial handle
+* @return  0 on success, otherwise a negative error value.
+* @retval  #SERIAL_ERROR_NONE  Successful
+* @retval  #SERIAL_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval  #SERIAL_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval  #SERIAL_ERROR_OPERATION_FAILED  Operation failed
+* @see  serial_destroy()
+*/
+int serial_create(serial_h *serial);
+
+/**
+* @brief  Destroys the handle of serial.
+* @param[in]  serial  The serial handle
+* @return  0 on success, otherwise a negative error value.
+* @retval  #SERIAL_ERROR_NONE  Successful
+* @retval  #SERIAL_ERROR_INVALID_PARAMETER  Invalid parameter
+* @see  serial_create()
+*/
+int serial_destroy(serial_h serial);
+
+/**
+* @brief  Opens the serial.
+* @param[in]  serial  The serial handle
+* @return  0 on success, otherwise a negative error value.
+* @retval  #SERIAL_ERROR_NONE  Successful
+* @retval  #SERIAL_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval  #SERIAL_ERROR_OPERATION_FAILED  Operation failed
+* @retval  #SERIAL_ERROR_INVALID_OPERATION  Invalid operation
+* @post  When a serial is opened, serial_state_changed_cb() will be called with #SERIAL_STATE_OPENED state
+* @see  serial_close()
+*/
+int serial_open(serial_h serial);
+
+/**
+* @brief  Closes the serial.
+* @param[in]  serial  The serial handle
+* @return  0 on success, otherwise a negative error value.
+* @retval  #SERIAL_ERROR_NONE  Successful
+* @retval  #SERIAL_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval  #SERIAL_ERROR_OPERATION_FAILED  Operation failed
+* @retval  #SERIAL_ERROR_INVALID_OPERATION  Invalid operation
+* @pre  The serial must be opened.
+* @post  When a serial is closed, serial_state_changed_cb() will be called with #SERIAL_STATE_CLOSED state
+* @see  serial_open()
+*/
+int serial_close(serial_h serial);
+
+/**
+* @brief  Writes data to serial server.
+* @param[in]  serial  The serial handle
+* @param[in]  data The data to send
+* @param[in]  data_length The length of data to send
+* @return  The number of characters sent on success, otherwise a negative error value.
+* @retval  #SERIAL_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval  #SERIAL_ERROR_OPERATION_FAILED  Operation failed
+* @pre  The serial must be opened.
+* @see  serial_open()
+*/
+int serial_write(serial_h serial, const char *data, int data_length);
+
+/**
+* @brief  Register a callback function to be invoked when you receive data.
+* @param[in]  serial  The serial handle
+* @param[in]  callback  The callback function to be invoked
+* @param[in]  user_data  The user data to be passed to the callback function
+* @return  0 on success, otherwise a negative error value.
+* @retval  #SERIAL_ERROR_NONE  Successful
+* @retval  #SERIAL_ERROR_INVALID_PARAMETER  Invalid parameter
+* @post  serial_data_received_cb() will be invoked when you receive data.
+* @see  serial_unset_data_received_cb()
+* @see  serial_data_received_cb()
+*/
+int serial_set_data_received_cb(serial_h serial, serial_data_received_cb callback, void *user_data);
+
+/**
+* @brief  Unregister a callback function to be invoked when you receive data.
+* @param[in]  serial  The serial handle
+* @return   0 on success, otherwise a negative error value.
+* @retval  #SERIAL_ERROR_NONE  Successful
+* @retval  #SERIAL_ERROR_INVALID_PARAMETER  Invalid parameter
+* @see  serial_set_data_received_cb()
+*/
+int serial_unset_data_received_cb(serial_h serial);
+
+/**
+* @brief  Register a callback function to be invoked when the state of serial is changed.
+* @param[in]  serial  The serial handle
+* @param[in]  callback  The callback function to be invoked
+* @param[in]  user_data  The user data to be passed to the callback function
+* @return   0 on success, otherwise a negative error value.
+* @retval  #SERIAL_ERROR_NONE  Successful
+* @retval  #SERIAL_ERROR_INVALID_PARAMETER  Invalid parameter
+* @post  serial_state_changed_cb() will be invoked when the state of serial is changed.
+* @see  serial_unset_state_changed_cb()
+* @see  serial_state_changed_cb()
+*/
+int serial_set_state_changed_cb(serial_h serial, serial_state_changed_cb callback, void *user_data);
+
+/**
+* @brief  Unregister a callback function to be invoked when the state of serial is changed.
+* @param[in]  serial  The serial handle
+* @return   0 on success, otherwise a negative error value.
+* @retval  #SERIAL_ERROR_NONE  Successful
+* @retval  #SERIAL_ERROR_INVALID_PARAMETER  Invalid parameter
+* @see  serial_set_state_changed_cb()
+*/
+int serial_unset_state_changed_cb(serial_h serial);
+
+/**
+* @}
+*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_SERIAL_H__ */
diff --git a/include/serial_private.h b/include/serial_private.h
new file mode 100644 (file)
index 0000000..3b63b50
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#ifndef __TIZEN_NETWORK_SERIAL_PRIVATE_H__
+#define __TIZEN_NETWORK_SERIAL_PRIVATE_H__
+
+#include <dbus/dbus-glib.h>
+
+#include "serial.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @internal
+ * @brief Serial callback.
+ */
+ typedef struct _serial_event_s
+ {
+        const void *callback;
+        void *user_data;
+ } serial_event_s;
+
+
+ /**
+  * @internal
+  * @brief Serial handle
+  */
+ typedef struct _serial_s{
+       DBusGConnection *client_bus;
+       int client_socket;
+       int g_watch_id;
+       serial_event_s state_handler;
+       serial_event_s data_handler;
+       void *handle;
+}serial_s;
+
+/**
+ * @internal
+ * @brief dbus signal from socket server
+ */
+typedef enum {
+       SERIAL_CLOSED,          /* Serial session closed */
+       SERIAL_OPENED,          /* Serial session opened */
+}serial_event_e;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_SERIAL_PRIVATE_H__ */
diff --git a/packaging/capi-network-serial.spec b/packaging/capi-network-serial.spec
new file mode 100644 (file)
index 0000000..6fa4dd5
--- /dev/null
@@ -0,0 +1,58 @@
+Name:       capi-network-serial
+Summary:    Network Serial Framework
+Version: 0.0.7
+Release:    0
+Group:      TO_BE/FILLED_IN
+License:    Apache License, Version 2.0
+Source0:    %{name}-%{version}.tar.gz
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+BuildRequires:  pkgconfig(dbus-glib-1)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(capi-base-common)
+
+BuildRequires:  cmake
+
+
+%description
+Network Serial Framework
+
+%package devel
+Summary:    Network Serial Framework (DEV)
+Group:      TO_BE/FILLED
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Network Serial Framework (DEV).
+
+%prep
+%setup -q
+
+%build
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest capi-network-serial.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libcapi-network-serial.so.*
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/network/serial.h
+%{_libdir}/pkgconfig/capi-network-serial.pc
+%{_libdir}/libcapi-network-serial.so
+
diff --git a/src/serial.c b/src/serial.c
new file mode 100644 (file)
index 0000000..b30d4e3
--- /dev/null
@@ -0,0 +1,435 @@
+/*
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * 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 <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib-bindings.h>
+#include <unistd.h>
+#include <sys/un.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <dlog.h>
+
+#include "serial.h"
+#include "serial_private.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CAPI_NETWORK_SERIAL"
+
+#define DBG(fmt, args...) SLOGD(fmt, ##args)
+#define ERR(fmt, args...) SLOGE(fmt, ##args)
+
+#define SERIAL_SOCKET_PATH     "/tmp/.dr_common_stream"
+#define SERIAL_BUF_SIZE                65536
+#define SERIAL_INTERFACE               "User.Data.Router.Introspectable"
+
+DBusConnection *dbus_connection = NULL;
+
+
+/*
+ *  Internal Functions
+ */
+static gboolean __g_io_client_handler(GIOChannel *io, GIOCondition cond, void *data)
+{
+       int fd;
+       serial_s *pHandle = (serial_s *)data;
+       if (pHandle == NULL)
+               return FALSE;
+
+       if (pHandle->data_handler.callback) {
+               char buffer[SERIAL_BUF_SIZE] = { 0 };
+               int len = 0;
+               fd = g_io_channel_unix_get_fd(io);
+               len = recv(fd, buffer, SERIAL_BUF_SIZE, 0);
+               if(len <= 0) {
+                       ERR("Error occured or the peer is shutdownd. [%d]\n", len);
+                       ((serial_state_changed_cb)pHandle->state_handler.callback)
+                                       (SERIAL_ERROR_NONE,
+                                       SERIAL_STATE_CLOSED,
+                                       pHandle->state_handler.user_data);
+                       return FALSE;
+               }
+
+               ((serial_data_received_cb)pHandle->data_handler.callback)
+                       (buffer, len, pHandle->data_handler.user_data);
+       }
+       return TRUE;
+}
+
+static void __init_client_giochannel(void *data)
+{
+       GIOChannel *io;
+       serial_s *pHandle = (serial_s *)data;
+       if (pHandle == NULL)
+               return;
+
+       io = g_io_channel_unix_new(pHandle->client_socket);
+       g_io_channel_set_close_on_unref(io, TRUE);
+       pHandle->g_watch_id = g_io_add_watch(io,
+                               G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
+                               __g_io_client_handler, pHandle);
+       g_io_channel_unref(io);
+       return;
+}
+
+static int __connect_to_serial_server(void *data)
+{
+       int client_socket = -1;
+       struct sockaddr_un      server_addr;
+       serial_s *pHandle = (serial_s *)data;
+       if (pHandle == NULL)
+               return -1;
+
+       client_socket = socket(AF_UNIX, SOCK_STREAM, 0);
+       if (client_socket < 0) {
+               ERR("Create socket failed\n");
+               return -1;
+       }
+
+       memset(&server_addr, 0, sizeof(server_addr));
+       server_addr.sun_family = AF_UNIX;
+       g_strlcpy(server_addr.sun_path, SERIAL_SOCKET_PATH, sizeof(server_addr.sun_path));
+
+       if (connect(client_socket, (struct sockaddr*)&server_addr, sizeof(server_addr)) < 0) {
+               ERR("Connect failed\n");
+               close(client_socket);
+               return -1;
+       }
+       pHandle->client_socket = client_socket;
+
+       __init_client_giochannel(pHandle);
+
+       return client_socket;
+}
+
+
+static DBusHandlerResult __dbus_event_filter(DBusConnection *sys_conn,
+                                                       DBusMessage *msg, void *data)
+{
+       static int socket = -1;
+       const char *path = dbus_message_get_path(msg);
+
+       if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL)
+               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+       if (path == NULL || strcmp(path, "/") == 0)
+               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+       if (dbus_message_is_signal(msg, SERIAL_INTERFACE, "serial_status")) {
+               int res = 0;
+               dbus_message_get_args(msg, NULL,
+                                       DBUS_TYPE_INT32, &res,
+                                       DBUS_TYPE_INVALID);
+
+               serial_s *pHandle = (serial_s *)data;
+               if (res == SERIAL_OPENED) {
+                       socket = __connect_to_serial_server(pHandle);
+                       if (socket < 0) {
+                               ((serial_state_changed_cb)pHandle->state_handler.callback)
+                                               (SERIAL_ERROR_OPERATION_FAILED,
+                                               SERIAL_STATE_OPENED,
+                                               pHandle->state_handler.user_data);
+                               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+                       }
+
+                       ((serial_state_changed_cb)pHandle->state_handler.callback)
+                                       (SERIAL_ERROR_NONE,
+                                       SERIAL_STATE_OPENED,
+                                       pHandle->state_handler.user_data);
+               } else if (res == SERIAL_CLOSED) {
+                       if (socket < 0)
+                               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+                       ((serial_state_changed_cb)pHandle->state_handler.callback)
+                                       (SERIAL_ERROR_NONE,
+                                       SERIAL_STATE_CLOSED,
+                                       pHandle->state_handler.user_data);
+               }
+       } else {
+               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+       }
+
+       return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+int __send_serial_ready_done_signal(void)
+{
+       DBusMessage *msg = NULL;
+       const char *res = "OK";
+
+       if(dbus_connection == NULL)
+               return SERIAL_ERROR_INVALID_OPERATION;
+
+       msg = dbus_message_new_signal("/Network/Serial",
+                                         "Capi.Network.Serial",
+                                         "ready_for_serial");
+       if (!msg) {
+               ERR("Unable to allocate D-Bus signal\n");
+               return SERIAL_ERROR_OPERATION_FAILED;
+       }
+
+       if (!dbus_message_append_args(msg,
+                       DBUS_TYPE_STRING, &res,
+                       DBUS_TYPE_INVALID)) {
+               ERR("Event sending failed\n");
+               dbus_message_unref(msg);
+               return SERIAL_ERROR_OPERATION_FAILED;
+       }
+
+       dbus_connection_send(dbus_connection, msg, NULL);
+       dbus_message_unref(msg);
+       return SERIAL_ERROR_NONE;
+}
+
+
+static int __serial_set_state_changed_cb(serial_h serial, void *callback, void *user_data)
+{
+       if (!serial) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+
+       serial_s *pHandle = (serial_s *)serial;
+
+       if (callback) {
+               pHandle->state_handler.callback = callback;
+               pHandle->state_handler.user_data = user_data;
+       } else {
+               pHandle->state_handler.callback = NULL;
+               pHandle->state_handler.user_data = NULL;
+       }
+
+       return SERIAL_ERROR_NONE;
+}
+
+static int __serial_set_data_received_cb(serial_h serial, void *callback, void *user_data)
+{
+       if (!serial) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+
+       serial_s *pHandle = (serial_s *)serial;
+
+       if (callback) {
+               pHandle->data_handler.callback = callback;
+               pHandle->data_handler.user_data = user_data;
+       } else {
+               pHandle->data_handler.callback = NULL;
+               pHandle->data_handler.user_data = NULL;
+       }
+
+       return SERIAL_ERROR_NONE;
+}
+
+
+
+/*
+ *  Public Functions
+ */
+
+int serial_create(serial_h *serial)
+{
+       DBG("%s\n", __FUNCTION__);
+
+       GError *error = NULL;
+       DBusError dbus_error;
+       serial_s *pHandle = NULL;
+
+       if (serial == NULL)
+               return SERIAL_ERROR_INVALID_PARAMETER;
+
+       pHandle = (serial_s *)g_try_malloc0(sizeof(serial_s));
+       if (pHandle == NULL)
+               return SERIAL_ERROR_OUT_OF_MEMORY;
+
+       g_type_init();
+
+       pHandle->client_bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+       if (error) {
+               ERR("Couldn't connect to the System bus[%s]",
+                                                               error->message);
+               g_error_free(error);
+               g_free(pHandle);
+               return SERIAL_ERROR_OPERATION_FAILED;
+       }
+       dbus_connection = dbus_g_connection_get_connection(pHandle->client_bus);
+
+       /* Add the filter for network client functions */
+       dbus_error_init(&dbus_error);
+       dbus_connection_add_filter(dbus_connection, __dbus_event_filter, pHandle, NULL);
+       dbus_bus_add_match(dbus_connection,
+                          "type=signal,interface=" SERIAL_INTERFACE
+                          ",member=serial_status", &dbus_error);
+       if (dbus_error_is_set(&dbus_error)) {
+               ERR("Fail to add dbus filter signal\n");
+               dbus_error_free(&dbus_error);
+               g_free(pHandle);
+               return SERIAL_ERROR_OPERATION_FAILED;
+       }
+
+       *serial = (serial_h)pHandle;
+
+       return SERIAL_ERROR_NONE;
+}
+
+
+int serial_open(serial_h serial)
+{
+       DBG("%s\n", __FUNCTION__);
+
+       if (!serial) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+
+       return __send_serial_ready_done_signal();
+}
+
+int serial_close(serial_h serial)
+{
+       DBG("%s\n", __FUNCTION__);
+
+       if (!serial) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+
+       serial_s *pHandle = (serial_s *)serial;
+
+       if (pHandle->client_socket > 0) {
+               if (close(pHandle->client_socket) < 0)
+                       return SERIAL_ERROR_OPERATION_FAILED;
+
+               pHandle->client_socket = -1;
+
+               return SERIAL_ERROR_NONE;
+       } else {
+               return SERIAL_ERROR_INVALID_OPERATION;
+       }
+}
+
+int serial_destroy(serial_h serial)
+{
+       DBG("%s\n", __FUNCTION__);
+
+       if (!serial) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+
+       serial_s *pHandle = (serial_s *)serial;
+
+       if (dbus_connection != NULL) {
+               dbus_connection_remove_filter(dbus_connection, __dbus_event_filter, pHandle);
+               dbus_connection = NULL;
+       }
+
+       if (pHandle->client_bus != NULL) {
+               dbus_g_connection_unref(pHandle->client_bus);
+               pHandle->client_bus = NULL;
+       }
+
+       if (pHandle->g_watch_id > 0) {
+               g_source_remove(pHandle->g_watch_id);
+               pHandle->g_watch_id = -1;
+       }
+
+       if (pHandle->client_socket > 0) {
+               close(pHandle->client_socket);
+               pHandle->client_socket = -1;
+       }
+
+       g_free(pHandle);
+       serial = NULL;
+
+       return SERIAL_ERROR_NONE;
+}
+
+int serial_write(serial_h serial, const char *data, int data_length)
+{
+       if (!serial) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+       int ret;
+       serial_s *pHandle = (serial_s *)serial;
+
+       ret = send(pHandle->client_socket, data, data_length, MSG_EOR);
+       if (ret == -1) {
+                ERR("Send failed. ");
+                return SERIAL_ERROR_OPERATION_FAILED;
+       }
+
+       return ret;
+}
+
+int serial_set_state_changed_cb(serial_h serial, serial_state_changed_cb callback, void *user_data)
+{
+       DBG("%s\n", __FUNCTION__);
+
+       if (!serial || !callback) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+
+       return (__serial_set_state_changed_cb(serial, callback, user_data));
+}
+
+int serial_unset_state_changed_cb(serial_h serial)
+{
+       DBG("%s\n", __FUNCTION__);
+
+       if (!serial) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+
+       return (__serial_set_state_changed_cb(serial, NULL, NULL));
+}
+
+int serial_set_data_received_cb(serial_h serial, serial_data_received_cb callback, void *user_data)
+{
+       DBG("%s\n", __FUNCTION__);
+
+       if (!serial || !callback) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+
+       return (__serial_set_data_received_cb(serial, callback, user_data));
+}
+
+int serial_unset_data_received_cb(serial_h serial)
+{
+       DBG("%s\n", __FUNCTION__);
+
+       if (!serial) {
+               ERR("Invalid parameter\n");
+               return SERIAL_ERROR_INVALID_PARAMETER;
+       }
+
+       return (__serial_set_data_received_cb(serial, NULL, NULL));
+}