Marge branch 'master' into tizen_2.1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 22 Mar 2013 00:01:14 +0000 (09:01 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 22 Mar 2013 00:01:14 +0000 (09:01 +0900)
Change-Id: Ib49eba9043584ba462d83338c35ef46012ced0f4

25 files changed:
AUTHORS [new file with mode: 0644]
LICENSE.APLv2 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
bluetooth-share.manifest
bt-share/include/applog.h
bt-share/include/bt-share-common.h
bt-share/include/bt-share-ipc.h
bt-share/include/bt-share-main.h
bt-share/include/bt-share-noti-handler.h
bt-share/include/bt-share-notification.h
bt-share/include/bt-share-resource.h
bt-share/include/bt-share-syspopup.h
bt-share/include/obex-event-handler.h
bt-share/src/bt-share-common.c
bt-share/src/bt-share-ipc.c
bt-share/src/bt-share-main.c
bt-share/src/bt-share-noti-handler.c
bt-share/src/bt-share-notification.c
bt-share/src/bt-share-syspopup.c
bt-share/src/obex-event-handler.c
lib/applog.h
lib/bluetooth-share-api.h
lib/bt-share-db.c
lib/bt-share-db.h
packaging/bluetooth-share.spec

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..46d1687
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Jinmin Jung <jinmin@samsung.com>
+DoHyun Pyun <dh79.pyun@samsung.com>
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..6b0b127
--- /dev/null
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+
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.
index f746c16..81a2e39 100644 (file)
@@ -12,6 +12,7 @@
     </define>
     <assign>
         <filesystem path="/usr/share/dbus-1/services/org.bluetooth.share.service" label="_"/>
+       <filesystem path="/usr/lib/libbluetooth-share-api.so.0.1.0" label="_"/>
     </assign>
     <request>
         <domain name="bt_share"/>
index 3865d40..01ddda7 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
index 924e38b..f399306 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -34,6 +30,19 @@ extern "C" {
 #define BT_SHARE_FAIL -1
 #define BT_SHARE_ERROR_NONE 0
 
+#define BT_TMP_DIR "/tmp/"
+#define BT_TMP_FILE BT_TMP_DIR"bluetooth_content_share"
+#define TXT_FILE_NAME BT_TMP_DIR"bluetooth_content_share.txt"
+#define HTML_FILE_NAME BT_TMP_DIR"bluetooth_content_share.html"
+#define TXT_FILE_FORMAT BT_TMP_DIR"bluetooth_content_share%s.txt"
+#define HTML_FILE_FORMAT BT_TMP_DIR"bluetooth_content_share%s.html"
+#define HTML_FORMAT "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/></head><body><a href=\"%s\">%s</a></body></html>"
+
+typedef enum {
+       BT_HTTP_FILE,
+       BT_TXT_FILE,
+} bt_file_t;
+
 typedef enum {
        BT_STATUS_OFF         = 0x0000,
        BT_STATUS_ON          = 0x0001,
@@ -44,7 +53,8 @@ typedef enum {
 
 int _bt_share_block_sleep(gboolean is_block);
 int _bt_set_transfer_indicator(gboolean state);
-
+char *_bt_share_create_transfer_file(char *text);
+void _bt_remove_tmp_file(char *file_path);
 
 #ifdef __cplusplus
 }
index 50f76c2..95a5cb1 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -110,6 +106,8 @@ typedef struct {
        char name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX];
        char *mode;
        char **file_path;
+       char **content;
+       char *type;
 } opc_transfer_info_t;
 
 typedef struct {
index 6f661be..76f6d04 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
index c7b9b70..d2ff61e 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -29,7 +25,8 @@ extern "C" {
 #endif
 
 #define STORAGE_PATH_LEN_MAX 30
-
+#define BT_DEFAULT_MEM_PHONE 0
+#define BT_DEFAULT_MEM_MMC 1
 
 #define BT_DOWNLOAD_PHONE_FOLDER "/opt/usr/media/Downloads"
 #define BT_DOWNLOAD_MMC_FOLDER "/opt/storage/sdcard"
@@ -37,6 +34,7 @@ extern "C" {
 #define BT_FTP_FOLDER "/opt/share/bt-ftp"
 
 void _bt_init_vconf_notification(void);
+void _bt_deinit_vconf_notification(void);
 #ifdef __cplusplus
 }
 #endif
index 8e848b2..b9e9bf6 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
index cc1be4c..fd89754 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -34,25 +30,22 @@ extern "C" {
 #define BT_COMMON_PKG          "ug-setting-bluetooth-efl"
 #define BT_COMMON_RES          "/usr/ug/res/locale"
 
-#define BT_STR_FILE_EXSIST_MSG \
-       dgettext(BT_COMMON_PKG, "IDS_BT_POP_PS_ALREADY_EXISTS_OVERWRITE_Q")
-#define BT_STR_FILE_DELETE_AUTHORIZE_MSG       \
-       dgettext(BT_COMMON_PKG, "Delete %s by %s ?")
-#define BT_STR_RECEIVING       dgettext(BT_COMMON_PKG, "IDS_BT_POP_RECEIVING_ING")
-#define BT_STR_SENDING         \
-       dgettext(BT_COMMON_PKG, "IDS_BT_POP_SHARING_ING")
 #define BT_STR_MEMORY_FULL     \
        dgettext(BT_COMMON_PKG, "IDS_BT_POP_MEMORYFULL")
-#define BT_STR_RECEIVCED               \
-       dgettext(BT_COMMON_PKG, "IDS_BT_BODY_RECEIVED")
-#define BT_STR_PD_FILES_RECEIVED       \
-       dgettext(BT_COMMON_PKG, "IDS_BT_POP_PD_FILES_RECEIVED")
 #define BT_STR_UNABLE_TO_SEND  \
        dgettext(BT_COMMON_PKG, "IDS_BT_POP_SENDINGFAIL")
-
-#define BT_STR_SEND_NOTI       "Bluetooth share: Sent"
-#define BT_STR_RECEIVED_NOTI   "Bluetooth share: Received"
-#define BT_TR_STATUS "%d successful, %d failed"
+#define BT_TR_STATUS \
+       dgettext(BT_COMMON_PKG, "IDS_BT_BODY_PD_SUCCESSFUL_PD_FAILED")
+#define BT_STR_RECEIVED \
+       dgettext(BT_COMMON_PKG, "IDS_BT_BODY_RECEIVED")
+#define BT_STR_SENT \
+       dgettext(BT_COMMON_PKG, "IDS_BT_BODY_SENT")
+#define BT_STR_SHARE \
+       dgettext(BT_COMMON_PKG, "IDS_BT_BODY_BLUETOOTH_SHARE")
+#define BT_STR_BLUETOOTH_ON \
+       dgettext(BT_COMMON_PKG, "IDS_BT_POP_ACTIVATED")
+#define BT_STR_BLUETOOTH_AVAILABLE \
+       dgettext(BT_COMMON_PKG, "IDS_BT_BODY_BLUETOOTH_AVAILABLE")
 
 /*==============  Image ================= */
 #define ICONDIR        "/opt/apps/org.tizen.bluetooth-share-ui/res/images"
@@ -60,7 +53,7 @@ extern "C" {
 
 #define BT_ICON_QP_SEND                ICONDIR"/Q02_icon_BT_transmit.png"
 #define BT_ICON_QP_RECEIVE     ICONDIR"/Q02_icon_BT_receive.png"
-#define BT_ICON_QP_BT_ON               ICONDIR"/Q02_QuickPanel_icon_bluetooth_noti.png"
+#define BT_ICON_QP_BT_ON               ICONDIR"/Q02_Notification_bluetooth.png"
 
 
 #ifdef __cplusplus
index 5b4276a..6190e47 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -97,10 +93,6 @@ int _bt_launch_system_popup(bt_app_event_type_t event_type,
 
 gboolean _bt_app_popup_memoryfull(gpointer user_data);
 
-//void _bt_app_obex_download_dup_file_cb(void *data, void *obj,
-//                                    void *event_info);
-
-
 #ifdef __cplusplus
 }
 #endif
index f75e0e4..2dc04c3 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
index 5e402e1..4fd3a35 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
 
 #include <pmapi.h>
 #include <glib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <vconf.h>
+#include <Ecore_File.h>
+
 #include "vconf-keys.h"
 #include "applog.h"
 #include "bt-share-common.h"
-#include <vconf.h>
 
 int _bt_share_block_sleep(gboolean is_block)
 {
@@ -112,3 +112,102 @@ int _bt_set_transfer_indicator(gboolean state)
        return 0;
 }
 
+static char *__bt_share_get_transfer_file_name(int file_type)
+{
+       int count = 0;
+       char *appendix;
+       char *file;
+       char *file_format;
+       char *file_name;
+
+       if (file_type == BT_HTTP_FILE) {
+               file_name = HTML_FILE_NAME;
+               file_format = HTML_FILE_FORMAT;
+       } else {
+               file_name = TXT_FILE_NAME;
+               file_format = TXT_FILE_FORMAT;
+       }
+
+       file = g_strdup(file_name);
+
+       /* While the file exists, increase the file name */
+       while (access(file, F_OK) == 0) {
+               g_free(file);
+
+               appendix = g_strdup_printf("_%d", count);
+               file = g_strdup_printf(file_format, appendix);
+               g_free(appendix);
+
+               count++;
+       }
+
+       return file;
+}
+
+void _bt_remove_tmp_file(char *file_path)
+{
+       if (g_str_has_prefix(file_path, BT_TMP_FILE) == TRUE) {
+               DBG("Remove the file: %s", file_path);
+               ecore_file_remove(file_path);
+       }
+}
+
+char *_bt_share_create_transfer_file(char *text)
+{
+       int fd;
+       int file_type;
+       char *file = NULL;
+       char *content;
+       char *url_sheme;
+       ssize_t write_size;
+
+       retv_if(text == NULL, NULL);
+
+       url_sheme = g_uri_parse_scheme(text);
+
+       if (url_sheme) {
+               /* HTTP file generate */
+               g_free(url_sheme);
+               file_type = BT_HTTP_FILE;
+       } else {
+               /* TXT file generate */
+               file_type = BT_TXT_FILE;
+       }
+
+       file = __bt_share_get_transfer_file_name(file_type);
+       retv_if(file == NULL, NULL);
+
+       fd = open(file, O_RDWR | O_CREAT, 0755);
+
+       if (fd < 0) {
+               ERR("Fail to open the file");
+               goto fail;
+       }
+
+       if (file_type == BT_HTTP_FILE) {
+               content = g_strdup_printf(HTML_FORMAT, text, text);
+       } else {
+               content = g_strdup(text);
+       }
+
+       DBG("content: \n%s", content);
+
+       write_size = write(fd, content, strlen(content));
+       g_free(content);
+       close(fd);
+       fd = -1;
+
+       if (write_size < 0) {
+               ERR("Fail to write in file");
+               goto fail;
+       }
+
+       return file;
+fail:
+       if (fd > 0)
+               close(fd);
+
+       g_free(file);
+       return NULL;
+}
+
index 0210f23..a13bdb9 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -42,6 +38,7 @@
 #include "bt-share-resource.h"
 #include "obex-event-handler.h"
 #include "bluetooth-share-api.h"
+#include "bt-share-common.h"
 
 GSList *bt_transfer_list = NULL;
 DBusConnection *dbus_connection = NULL;
@@ -58,6 +55,8 @@ static void __bt_tr_data_free(bt_tr_data_t *data)
        g_free(data->file_path);
        g_free(data->dev_name);
        g_free(data->addr);
+       g_free(data->type);
+       g_free(data->content);
        g_free(data);
 }
 
@@ -103,10 +102,10 @@ static opc_transfer_info_t *__add_transfer_info(DBusMessage *msg)
        char *filepath = NULL;
        char *mode = NULL;
        char *name = NULL;
+       char *type = NULL;
        opc_transfer_info_t *data;
        int i = 0;
        char *token = NULL;
-       char *tmp = NULL;
        char *ptr = NULL;
 
        retv_if(msg == NULL, NULL);
@@ -118,6 +117,7 @@ static opc_transfer_info_t *__add_transfer_info(DBusMessage *msg)
                                DBUS_TYPE_STRING, &filepath,
                                DBUS_TYPE_STRING, &mode,
                                DBUS_TYPE_STRING, &name,
+                               DBUS_TYPE_STRING, &type,
                                DBUS_TYPE_INVALID);
 
        retv_if(cnt <= 0, NULL);
@@ -132,23 +132,29 @@ static opc_transfer_info_t *__add_transfer_info(DBusMessage *msg)
        DBG(" filepath( %s )\n", filepath);
        DBG(" mode ( %s )\n", mode);
        DBG(" name ( %s )\n", name);
+       DBG(" type ( %s )\n", type);
 
        data = g_new0(opc_transfer_info_t, 1);
 
+       data->content = g_new0(char *, cnt + 1);
        data->file_path = g_new0(char *, cnt + 1);
        data->file_cnt = cnt;
        memcpy(data->addr, addr, BLUETOOTH_ADDRESS_LENGTH);
        memcpy(data->name, name, BLUETOOTH_DEVICE_NAME_LENGTH_MAX);
+       data->type = g_strdup(type);
 
        token = strtok_r(filepath, FILE_PATH_DELIM, &ptr);
        while ((token != NULL) && (i < cnt)) {
-               len = strlen(token);
+               if (g_strcmp0(type, "text") == 0) {
+                       data->file_path[i] = _bt_share_create_transfer_file(token);
+               } else {
+                       data->file_path[i] = g_strdup(token);
+               }
 
-               tmp = g_malloc0(len + 1);
+               DBG(" file path ( %s )\n", data->file_path[i]);
 
-               g_strlcpy(tmp, token, len + 1);
-               data->file_path[i] = tmp;
-               DBG("File [%d] [%s]\n", i, data->file_path[i]);
+               data->content[i] = g_strdup(token);
+               DBG("Content [%d] [%s]\n", i, data->content[i]);
                i++;
 
                token = strtok_r(NULL, FILE_PATH_DELIM, &ptr);
@@ -168,9 +174,13 @@ void _free_transfer_info(opc_transfer_info_t *node)
        ret_if(node == NULL);
 
        for (i = 0; i < node->file_cnt; i++) {
+               _bt_remove_tmp_file(node->file_path[i]);
                g_free(node->file_path[i]);
+               g_free(node->content[i]);
        }
        g_free(node->file_path);
+       g_free(node->content);
+       g_free(node->type);
        g_free(node);
 
        DBG("-\n");
@@ -389,9 +399,7 @@ void _bt_create_warning_popup(int error_type)
        /* Otherwise create the process and terminate it after popup shown */
        if (sysman_get_pid(UI_PKG_PATH) == -1) {
                char str[BT_TEXT_LEN_MAX] = {0,};
-               bundle *b = NULL;
-               b = bundle_create();
-               ret_if(b == NULL);
+               bundle *b;
 
                switch(error_type) {
                case BLUETOOTH_ERROR_SERVICE_NOT_FOUND:
@@ -402,10 +410,12 @@ void _bt_create_warning_popup(int error_type)
                        snprintf(str, BT_TEXT_LEN_MAX, "%s", BT_STR_UNABLE_TO_SEND);
                        break;
                default:
-                       bundle_free(b);
                        return;
                }
 
+               b = bundle_create();
+               ret_if(b == NULL);
+
                bundle_add(b, "launch-type", "warning_popup");
                bundle_add(b, "message", str);
 
@@ -507,15 +517,13 @@ static void __bt_create_send_data(opc_transfer_info_t *node)
        for (count = 0; count < node->file_cnt; count++) {
                bt_tr_data_t *tmp;
                tmp = g_malloc0(sizeof(bt_tr_data_t));
-               if (!tmp) {
-                       bt_share_close_db(db);
-                       return;
-               }
 
                tmp->tr_status = BT_TR_ONGOING;
                tmp->sid = session_id + 1;
                tmp->file_path = g_strdup(node->file_path[count]);
+               tmp->content = g_strdup(node->content[count]);
                tmp->dev_name =  g_strdup(node->name);
+               tmp->type =  g_strdup(node->type);
                tmp->timestamp = __bt_get_current_timedata();
                tmp->addr = __bt_conv_addr_type_to_addr_string(node->addr);
                bt_share_add_tr_data(db, BT_DB_OUTBOUND, tmp);
@@ -547,15 +555,12 @@ gboolean _bt_update_sent_data_status(int uid, bt_app_tr_status_t status)
        DBG("uid = %d  \n", uid);
        sqlite3 *db = NULL;
        bt_tr_data_t *tmp;
-       tmp = g_malloc0(sizeof(bt_tr_data_t));
-       if (!tmp)
-               return FALSE;
 
        db = bt_share_open_db();
-       if (!db) {
-               g_free(tmp);
+       if (!db)
                return FALSE;
-       }
+
+       tmp = g_malloc0(sizeof(bt_tr_data_t));
 
        tmp->tr_status = status;
        tmp->timestamp = __bt_get_current_timedata();
@@ -576,15 +581,12 @@ gboolean _bt_add_recv_transfer_status_data(char *device_name,
        bt_tr_data_t *tmp;
 
        DBG("Name [%s]\n", device_name);
-       tmp = g_malloc0(sizeof(bt_tr_data_t));
-       if (!tmp)
-               return FALSE;
 
        db = bt_share_open_db();
-       if (!db) {
-               g_free(tmp);
+       if (!db)
                return FALSE;
-       }
+
+       tmp = g_malloc0(sizeof(bt_tr_data_t));
 
        tmp->tr_status = status;
        tmp->file_path = g_strdup(filepath);
@@ -644,7 +646,7 @@ static void __bt_share_update_tr_info(int tr_uid, int tr_type)
                                        ad->send_data.tr_success, ad->send_data.tr_fail);
 
                                _bt_update_notification(ad->send_noti,
-                                               BT_STR_SEND_NOTI, str,
+                                               BT_STR_SENT, str,
                                                BT_ICON_QP_SEND);
                        } else {
                                _bt_delete_notification(ad->send_noti);
@@ -685,7 +687,7 @@ static void __bt_share_update_tr_info(int tr_uid, int tr_type)
                                        ad->recv_data.tr_success, ad->recv_data.tr_fail);
 
                                _bt_update_notification(ad->receive_noti,
-                                               BT_STR_RECEIVED_NOTI, str,
+                                               BT_STR_RECEIVED, str,
                                                BT_ICON_QP_RECEIVE);
                        } else {
                                _bt_delete_notification(ad->receive_noti);
index 5d6a6da..884d3ec 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -51,6 +47,7 @@ static void __bt_release_service(struct bt_appdata *ad)
        if (ad == NULL)
                return;
 
+       _bt_deinit_vconf_notification();
        _bt_delete_notification(ad->send_noti);
        _bt_delete_notification(ad->receive_noti);
        _bt_delete_notification(ad->opc_noti);
@@ -65,6 +62,8 @@ static void __bt_release_service(struct bt_appdata *ad)
 
        if (vconf_set_bool(BT_VCONF_OPP_SERVER_INIT, FALSE) < 0)
                ERR("Fail to set the vconf");
+
+       DBG("Terminating bluetooth-share daemon");
 }
 
 static void __bt_sigterm_handler(int signo)
@@ -130,7 +129,7 @@ static void __bt_update_notification_status_values()
                                NOTI_TR_TYPE_OUT, NULL, NULL);
                        _bt_set_notification_property(noti, QP_NO_DELETE | QP_NO_TICKER);
                        _bt_insert_notification(noti,
-                               BT_STR_SEND_NOTI, str,
+                               BT_STR_SENT, str,
                                BT_ICON_QP_SEND);
                        ad->send_noti = noti;
                }
@@ -168,7 +167,7 @@ static void __bt_update_notification_status_values()
                                NOTI_TR_TYPE_IN, NULL, NULL);
                        _bt_set_notification_property(noti, QP_NO_DELETE | QP_NO_TICKER);
                        _bt_insert_notification(noti,
-                               BT_STR_RECEIVED_NOTI, str,
+                               BT_STR_RECEIVED, str,
                                BT_ICON_QP_RECEIVE);
                        ad->receive_noti = noti;
                }
@@ -183,6 +182,43 @@ static void __bt_update_notification_status_values()
        return;
 }
 
+static notification_h __bt_update_notification_adapter_status(void)
+{
+       notification_h noti;
+       notification_error_e ret;
+
+       noti  = _bt_create_notification(BT_NOTI_T);
+       if (!noti)
+               return NULL;
+
+       ret = notification_set_property(noti, QP_NO_DELETE | QP_NO_TICKER);
+       if (ret != NOTIFICATION_ERROR_NONE) {
+               goto failed;
+       }
+
+       ret = notification_set_application(noti, "ug-bluetooth-efl");
+       if (ret != NOTIFICATION_ERROR_NONE) {
+               goto failed;
+       }
+
+       ret = notification_set_display_applist(noti,
+                        NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+       if (ret != NOTIFICATION_ERROR_NONE) {
+               goto failed;
+       }
+
+       _bt_insert_notification(noti,
+                       BT_STR_BLUETOOTH_ON, BT_STR_BLUETOOTH_AVAILABLE,
+                       BT_ICON_QP_BT_ON);
+       return noti;
+
+failed:
+       ERR("Fail to register notification");
+       notification_free(noti);
+       return NULL;
+
+}
+
 static gboolean __bt_dbus_request_name(void)
 {
        int ret_code = 0;
@@ -244,11 +280,11 @@ void _bt_terminate_app(void)
        }
 }
 
-int main(int argc, char *argv[])
+int main(void)
 {
-       DBG("+");
        int ret;
        struct bt_appdata ad;
+       DBG("Starting bluetooth-share daemon");
        memset(&ad, 0, sizeof(struct bt_appdata));
        app_state = &ad;
 
@@ -290,11 +326,14 @@ int main(int argc, char *argv[])
                return -1;
        }
 
+       notification_h noti;
+       noti = __bt_update_notification_adapter_status();
+
        main_loop = g_main_loop_new(NULL, FALSE);
        g_main_loop_run(main_loop);
 
+       _bt_delete_notification(noti);
        __bt_release_service(&ad);
 
-       DBG("-");
        return 0;
 }
index fb1be1b..80f2eb4 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
index fde1cf1..d2ea655 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
 #include "bt-share-main.h"
 #include "obex-event-handler.h"
 #include "bluetooth-share-api.h"
+#include "bt-share-resource.h"
 
 #define BT_PERCENT_STR_LEN 5
 #define BT_PRIV_ID_STR_LEN 8
+#define BT_NOTI_STR_LEN_MAX 50
 
 notification_h _bt_create_notification(bt_qp_type_t type)
 {
@@ -100,6 +98,8 @@ int _bt_update_notification(notification_h noti,
                                char *icon_path)
 {
        DBG("+\n");
+       char str[BT_NOTI_STR_LEN_MAX] = {0,};
+
        if (!noti)
                return BT_SHARE_FAIL;
 
@@ -112,16 +112,22 @@ int _bt_update_notification(notification_h noti,
        }
 
        if (title) {
-               ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
-                                                               title, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+               snprintf(str, sizeof(str), "%s: %s", BT_STR_SHARE, title);
+
+               ret = notification_set_text(noti,
+                                       NOTIFICATION_TEXT_TYPE_TITLE,
+                                       str, NULL,
+                                       NOTIFICATION_VARIABLE_TYPE_NONE);
                if (ret != NOTIFICATION_ERROR_NONE) {
                        ERR("Fail to notification_set_text\n");
                }
        }
 
        if (content) {
-               ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
-                                                               content, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+               ret = notification_set_text(noti,
+                                       NOTIFICATION_TEXT_TYPE_CONTENT,
+                                       content, NULL,
+                                       NOTIFICATION_VARIABLE_TYPE_NONE);
                if (ret != NOTIFICATION_ERROR_NONE) {
                        ERR("Fail to notification_set_text\n");
                }
index 2b84969..82ea414 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
 #include "bt-share-resource.h"
 #include "obex-event-handler.h"
 
-
-
-
 extern struct bt_appdata *app_state;
 #define BT_POPUP_SYSPOPUP_TIMEOUT_FOR_MULTIPLE_POPUPS 200
 #define BT_SYSPOPUP_EVENT_LEN_MAX 50
 
-
-
-
 static gboolean __bt_system_popup_timer_cb(gpointer user_data)
 {
        int ret = 0;
@@ -51,16 +41,14 @@ static gboolean __bt_system_popup_timer_cb(gpointer user_data)
                ERR("There is some problem with the user data..popup can not be created\n");
                return FALSE;
        }
-       ret = syspopup_launch("bt-syspopup", b);
 
+       ret = syspopup_launch("bt-syspopup", b);
        if (0 > ret) {
                ERR("launching sys-popup failed\n");
-               return TRUE;
-       } else {
-               DBG("Hurray Popup launched \n");
-               bundle_free(b);
-               return FALSE;
        }
+
+       bundle_free(b);
+       return FALSE;
 }
 
 int _bt_launch_system_popup(bt_app_event_type_t event_type,
index 0e966a0..0a0026d 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share
+ * bluetooth-share
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -174,9 +170,13 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
                DBG("BLUETOOTH_EVENT_OPC_CONNECTED, result [%d] \n", param->result);
                if (param->result != BLUETOOTH_ERROR_NONE) {
                        _bt_create_warning_popup(param->result);
-
                        if (NULL != node && node->file_cnt > send_index) {
                                info = (bt_tr_data_t *)(ad->tr_next_data)->data;
+                               if (info == NULL) {
+                                       DBG("info is NULL");
+                                       return;
+                               }
+
                                s_id = info->sid;
                                DBG("info->sid = %d info->id = %d\n", info->sid, info->id);
                                while (NULL != ad->tr_next_data) {
@@ -206,12 +206,12 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
                                                        NOTI_TR_TYPE_OUT, NULL, NULL);
                                        _bt_set_notification_property(noti, QP_NO_DELETE);
                                        _bt_insert_notification(noti,
-                                                               BT_STR_SEND_NOTI, str,
+                                                               BT_STR_SENT, str,
                                                                BT_ICON_QP_SEND);
                                        ad->send_noti = noti;
                                } else {
                                        _bt_update_notification(ad->send_noti,
-                                                               BT_STR_SEND_NOTI, str,
+                                                               BT_STR_SENT, str,
                                                                BT_ICON_QP_SEND);
                                }
                        }
@@ -328,15 +328,17 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
                                        NOTI_TR_TYPE_OUT, NULL, NULL);
                        _bt_set_notification_property(noti, QP_NO_DELETE);
                        _bt_insert_notification(noti,
-                                               BT_STR_SEND_NOTI, str,
+                                               BT_STR_SENT, str,
                                                BT_ICON_QP_SEND);
                        ad->send_noti = noti;
                } else {
                        _bt_update_notification(ad->send_noti,
-                                               BT_STR_SEND_NOTI, str,
+                                               BT_STR_SENT, str,
                                                BT_ICON_QP_SEND);
                }
 
+               _bt_remove_tmp_file(client_info->filename);
+
                if (param->result != BLUETOOTH_ERROR_NONE) {
                        _bt_update_sent_data_status(ad->current_tr_uid,
                                                        BT_TR_FAIL);
@@ -389,12 +391,12 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
                                                NOTI_TR_TYPE_OUT, NULL, NULL);
                                _bt_set_notification_property(noti, QP_NO_DELETE);
                                _bt_insert_notification(noti,
-                                                       BT_STR_SEND_NOTI, str,
+                                                       BT_STR_SENT, str,
                                                        BT_ICON_QP_SEND);
                                ad->send_noti = noti;
                        } else {
                                _bt_update_notification(ad->send_noti,
-                                                       BT_STR_SEND_NOTI, str,
+                                                       BT_STR_SENT, str,
                                                        BT_ICON_QP_SEND);
                        }
                }
@@ -530,12 +532,12 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
                                        NOTI_TR_TYPE_IN, NULL, NULL);
                                _bt_set_notification_property(noti, QP_NO_DELETE);
                                _bt_insert_notification(noti,
-                                               BT_STR_RECEIVED_NOTI, str,
+                                               BT_STR_RECEIVED, str,
                                                BT_ICON_QP_RECEIVE);
                                ad->receive_noti = noti;
                        } else {
                                _bt_update_notification(ad->receive_noti,
-                                               BT_STR_RECEIVED_NOTI, str,
+                                               BT_STR_RECEIVED, str,
                                                BT_ICON_QP_RECEIVE);
                        }
                }
@@ -552,15 +554,34 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
 
 void _bt_get_default_storage(char *storage)
 {
-       int val = -1;
-       if (-1 == vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, (void *)&val)) {
+       int val;
+       int err;
+       char *path;
+
+       if (vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
+                                               (void *)&val)) {
                DBG("vconf error\n");
-               val = 0;
+               val = BT_DEFAULT_MEM_PHONE;
        }
-       if (val == 0) /* Phone memory is 0, MMC is 1 */
-               g_strlcpy(storage, BT_DOWNLOAD_PHONE_FOLDER, STORAGE_PATH_LEN_MAX);
+
+       if (val == BT_DEFAULT_MEM_MMC)
+               path = BT_DOWNLOAD_MMC_FOLDER;
        else
-               g_strlcpy(storage, BT_DOWNLOAD_MMC_FOLDER, STORAGE_PATH_LEN_MAX);
+               path = BT_DOWNLOAD_PHONE_FOLDER;
+
+       if (access(path, W_OK) == 0) {
+               g_strlcpy(storage, path, STORAGE_PATH_LEN_MAX);
+               DBG("Storage path = [%s]\n", storage);
+               return;
+       }
+
+       if (mkdir(BT_DOWNLOAD_PHONE_FOLDER, 0755) < 0) {
+               err = -errno;
+               DBG("mkdir: %s(%d)", strerror(-err), -err);
+       }
+
+       g_strlcpy(storage, BT_DOWNLOAD_PHONE_FOLDER, STORAGE_PATH_LEN_MAX);
+
        DBG("Default storage : %s\n", storage);
 }
 
@@ -569,11 +590,25 @@ void _bt_app_obex_download_dup_file_cb(void *data, void *obj,
                                       void *event_info)
 {
        bt_obex_server_authorize_into_t *server_auth_info = data;
+       char storage[STORAGE_PATH_LEN_MAX] = { 0, };
+       char temp_filename[BT_FILE_PATH_LEN_MAX] = { 0, };
 
        DBG("response : %d\n", (int)event_info);
 
        if ((int)event_info == POPUP_RESPONSE_OK) {
                DBG("OK button pressed \n");
+
+               _bt_get_default_storage(storage);
+               snprintf(temp_filename, BT_FILE_PATH_LEN_MAX, "%s/%s",
+                                   storage, server_auth_info->filename);
+
+               if (remove(temp_filename) != 0) {
+                       ERR("File remove failed\n");
+                       bluetooth_obex_server_reject_authorize();
+                       return;
+               }
+
+               DBG("temp_filename %s", temp_filename);
                bluetooth_obex_server_accept_authorize(server_auth_info->filename);
        } else if ((int)event_info == POPUP_RESPONSE_CANCEL) {
                bluetooth_obex_server_reject_authorize();
index 8a05cc1..1c201b8 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share-api
+ * bluetooth-share-api
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
index 1a2f0ba..a71ebba 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share-api
+ * bluetooth-share-api
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -50,6 +46,8 @@ typedef struct {
        char *file_path;
        char *dev_name;
        char *addr;
+       char *type;
+       char *content;
 }bt_tr_data_t;
 
 
index 82c9ca8..26a6175 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share-api
+ * bluetooth-share-api
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
@@ -101,9 +97,9 @@ static int __bt_db_insert_record(sqlite3 *db, int db_table, bt_tr_data_t *data)
        retvm_if(data == NULL, BT_SHARE_ERR_INTERNAL, "Insert data is null");
 
        snprintf(query, BT_DB_QUERY_LEN,
-               "INSERT INTO %s (id, sid, tr_status, file_path, dev_name, timestamp, addr) VALUES(?, '%d', '%d', '%s', '%s', '%d', '%s');",
+               "INSERT INTO %s (id, sid, tr_status, file_path, dev_name, timestamp, addr, type, content) VALUES(?, '%d', '%d', '%s', '%s', '%d', '%s', '%s', '%s');",
                TABLE(db_table), data->sid, data->tr_status, data->file_path,
-               data->dev_name, data->timestamp, data->addr);
+               data->dev_name, data->timestamp, data->addr, data->type, data->content);
 
        ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
        if (ret != SQLITE_OK)
@@ -179,6 +175,8 @@ static bt_tr_data_t *__bt_db_get_record_by_id(sqlite3 *db, int db_table, int id)
                data->dev_name = g_strdup(TEXT(stmt, idx++));
                data->timestamp = INT(stmt, idx++);
                data->addr = g_strdup(TEXT(stmt, idx++));
+               data->type = g_strdup(TEXT(stmt, idx++));
+               data->content = g_strdup(TEXT(stmt, idx++));
        } else {
                goto error;
        }
@@ -228,6 +226,8 @@ static GSList *__bt_db_get_record_list(sqlite3 *db, const char*query)
                data->dev_name = g_strdup(TEXT(stmt, idx++));
                data->timestamp = INT(stmt, idx++);
                data->addr = g_strdup(TEXT(stmt, idx++));
+               data->type = g_strdup(TEXT(stmt, idx++));
+               data->content = g_strdup(TEXT(stmt, idx++));
 
                slist = g_slist_append(slist, data);
 
@@ -247,7 +247,7 @@ static unsigned int __bt_db_get_last_session_id(sqlite3 *db, int db_table)
        char query[BT_DB_QUERY_LEN] = {0, };
        sqlite3_stmt *stmt = NULL;
 
-       retvm_if(db == NULL, NULL, "DB handler is null");
+       retvm_if(db == NULL, BT_SHARE_ERR_INTERNAL, "DB handler is null");
 
        snprintf(query, BT_DB_QUERY_LEN,
                "SELECT * FROM %s WHERE id=(SELECT MAX(id) FROM %s);",
@@ -285,6 +285,8 @@ static void __bt_release_memory(bt_tr_data_t *data)
        g_free(data->file_path);
        g_free(data->dev_name);
        g_free(data->addr);
+       g_free(data->type);
+       g_free(data->content);
        g_free(data);
 }
 
@@ -436,7 +438,7 @@ EXPORT_API GSList *bt_share_get_tr_data_list_by_status(sqlite3 *db, int db_table
 
 EXPORT_API unsigned int bt_share_get_last_session_id(sqlite3 *db, int db_table)
 {
-       retvm_if(db == NULL, NULL, "DB handle is NULL");
+       retvm_if(db == NULL, BT_SHARE_ERR_INTERNAL, "DB handle is NULL");
 
        return __bt_db_get_last_session_id(db, db_table);
 }
index 74b275f..2c25bc1 100644 (file)
@@ -1,17 +1,13 @@
 /*
- *  bluetooth-share-api
+ * bluetooth-share-api
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *           GirishAshok Joshi <girish.joshi@samsung.com>
- *           DoHyun Pyun <dh79.pyun@samsung.com>
+ * 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
+ *              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,
index b2e49a8..2c91b43 100644 (file)
@@ -2,11 +2,15 @@
 
 Name:       bluetooth-share
 Summary:    Bluetooth file share Agent
-Version:    0.0.46
+Version:    0.0.47
 Release:    2
 Group:      TO_BE/FILLED_IN
 License:    Apache License, Version 2.0
 Source0:    %{name}-%{version}.tar.gz
+Requires(post): vconf
+Requires(post): coreutils
+Requires(post): sqlite
+Requires(post): smack-utils
 BuildRequires:  cmake
 BuildRequires:  gettext-tools
 BuildRequires:  pkgconfig(appcore-efl)
@@ -49,6 +53,9 @@ Development package for libbluetooth-share
 %setup -q
 
 %build
+export CFLAGS+=" -fpie -fvisibility=hidden"
+export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
+
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
 make
 
@@ -87,7 +94,9 @@ then
                file_path TEXT,
                dev_name TEXT,
                timestamp INTEGER default 0,
-               addr TEXT
+               addr TEXT,
+               type TEXT,
+               content TEXT
        );
        create table if not exists outbound (
                id INTEGER PRIMARY KEY autoincrement,
@@ -96,7 +105,9 @@ then
                file_path TEXT,
                dev_name TEXT,
                timestamp INTEGER default 0,
-               addr TEXT
+               addr TEXT,
+               type TEXT,
+               content TEXT
        );
        '
 fi