From: Sehong Na Date: Sat, 31 May 2014 03:59:55 +0000 (+0900) Subject: Initialize Tizen 2.3 X-Git-Tag: 2.3a_release X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62ab5fd56dc05eaa5f28b33a0ded0c76a39ba6a2;p=framework%2Fconvergence%2Fsap-stack.git Initialize Tizen 2.3 --- 62ab5fd56dc05eaa5f28b33a0ded0c76a39ba6a2 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..fddd54a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,19 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(sap-stack C) + +IF(ARM_TARGET) + INSTALL(FILES files/arm/bin/sap-server DESTINATION ${BIN_INSTALL_DIR}) + INSTALL(FILES files/arm/bin/ft-service DESTINATION ${BIN_INSTALL_DIR}) + INSTALL(DIRECTORY files/arm/lib/ DESTINATION ${LIB_INSTALL_DIR}) +ELSE(ARM_TARGET) + INSTALL(FILES files/x86/bin/sap-server DESTINATION ${BIN_INSTALL_DIR}) + INSTALL(FILES files/x86/bin/ft-service DESTINATION ${BIN_INSTALL_DIR}) + INSTALL(DIRECTORY files/x86/lib/ DESTINATION ${LIB_INSTALL_DIR}) +ENDIF(ARM_TARGET) + +INSTALL(DIRECTORY files/include/ DESTINATION ${INCLUDE_INSTALL_DIR}/sap-service FILES_MATCHING PATTERN "*.h") +INSTALL(FILES files/sap-api.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(FILES files/sap-client-stub-api.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(FILES files/file-transfer.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appcessory) +INSTALL(FILES files/frameworkPolicyDelgate.xml DESTINATION ${BIN_INSTALL_DIR}) +INSTALL(FILES files/EFL_com.developer.samsung.tizen.privilege.samsung.accessory.protocol.smack DESTINATION ${SHARE_INSTALL_PREFIX}/privilege-control) diff --git a/Copyright b/Copyright new file mode 100644 index 0000000..df3a6f2 --- /dev/null +++ b/Copyright @@ -0,0 +1,6 @@ +Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + +PROPRIETARY/CONFIDENTIAL + +This software is the confidential and proprietary information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the suitability of the software, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAMSUNG shall not be liable for any damages suffered by licensee as a result of using, modifying or distributing this software or its derivatives. + diff --git a/files/EFL_com.developer.samsung.tizen.privilege.samsung.accessory.protocol.smack b/files/EFL_com.developer.samsung.tizen.privilege.samsung.accessory.protocol.smack new file mode 100644 index 0000000..5e0871a --- /dev/null +++ b/files/EFL_com.developer.samsung.tizen.privilege.samsung.accessory.protocol.smack @@ -0,0 +1,2 @@ +~APP~ sap w +~APP~ sap::vconf rl diff --git a/files/arm/bin/ft-service b/files/arm/bin/ft-service new file mode 100755 index 0000000..43cde85 Binary files /dev/null and b/files/arm/bin/ft-service differ diff --git a/files/arm/bin/sap-server b/files/arm/bin/sap-server new file mode 100755 index 0000000..f92ccfe Binary files /dev/null and b/files/arm/bin/sap-server differ diff --git a/files/arm/lib/libsap-api.so b/files/arm/lib/libsap-api.so new file mode 120000 index 0000000..f5066df --- /dev/null +++ b/files/arm/lib/libsap-api.so @@ -0,0 +1 @@ +libsap-api.so.1 \ No newline at end of file diff --git a/files/arm/lib/libsap-api.so.1 b/files/arm/lib/libsap-api.so.1 new file mode 120000 index 0000000..2388d9a --- /dev/null +++ b/files/arm/lib/libsap-api.so.1 @@ -0,0 +1 @@ +libsap-api.so.1.0.0 \ No newline at end of file diff --git a/files/arm/lib/libsap-api.so.1.0.0 b/files/arm/lib/libsap-api.so.1.0.0 new file mode 100755 index 0000000..228a5df Binary files /dev/null and b/files/arm/lib/libsap-api.so.1.0.0 differ diff --git a/files/arm/lib/libsap-client-stub-api.so b/files/arm/lib/libsap-client-stub-api.so new file mode 120000 index 0000000..cfbb315 --- /dev/null +++ b/files/arm/lib/libsap-client-stub-api.so @@ -0,0 +1 @@ +libsap-client-stub-api.so.1 \ No newline at end of file diff --git a/files/arm/lib/libsap-client-stub-api.so.1 b/files/arm/lib/libsap-client-stub-api.so.1 new file mode 120000 index 0000000..dc0dedd --- /dev/null +++ b/files/arm/lib/libsap-client-stub-api.so.1 @@ -0,0 +1 @@ +libsap-client-stub-api.so.1.0.0 \ No newline at end of file diff --git a/files/arm/lib/libsap-client-stub-api.so.1.0.0 b/files/arm/lib/libsap-client-stub-api.so.1.0.0 new file mode 100755 index 0000000..3a298ec Binary files /dev/null and b/files/arm/lib/libsap-client-stub-api.so.1.0.0 differ diff --git a/files/arm/lib/libwsm.so b/files/arm/lib/libwsm.so new file mode 100644 index 0000000..abb0e1d Binary files /dev/null and b/files/arm/lib/libwsm.so differ diff --git a/files/file-transfer.xml b/files/file-transfer.xml new file mode 100644 index 0000000..01c5804 --- /dev/null +++ b/files/file-transfer.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + diff --git a/files/frameworkPolicyDelgate.xml b/files/frameworkPolicyDelgate.xml new file mode 100644 index 0000000..6e22fd7 --- /dev/null +++ b/files/frameworkPolicyDelgate.xml @@ -0,0 +1,3 @@ + + + diff --git a/files/include/FTInterface.h b/files/include/FTInterface.h new file mode 100644 index 0000000..8e99bd7 --- /dev/null +++ b/files/include/FTInterface.h @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * PROPRIETARY/CONFIDENTIAL + * + * This software is the confidential and proprietary information of SAMSUNG + * ELECTRONICS ("Confidential Information"). You shall not disclose such + * Confidential Information and shall use it only in accordance with the terms + * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG + * make no representations or warranties about the suitability of the software, + * either express or implied, including but not limited to the implied + * warranties of merchantability, fitness for a particular purpose, or + * non-infringement. SAMSUNG shall not be liable for any damages suffered by + * licensee as a result of using, modifying or distributing this software or + * its derivatives. + * licensee arising out of or related to this software. + * + */ +#ifndef _FTINTERFACE_H_ +#define _FTINTERFACE_H_ + +#include "SAPInterface.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************//** + @brief The enum defines the status codes that may be used to convey generic result codes as needed for FT interaction. + @param TRANSFER_SUCCESS: FT Transfer is successfull. + @param TRANSFER_COMPLETE_FAIL_FILE_IO: This error is received when the file to be sent/received doesn't exist or the path is invalid + @param TRANSFER_COMPLETE_FAIL_PEER_UNRESPONSIVE: This error is received during file transfer the remote end is unresponsive + @param TRANSFER_COMPLETE_FAIL_PEER_CONN_LOST: This error is received when during file transfer service connection was lost (e.g. could be due to BT off) + @param TRANSFER_COMPLETE_FAIL_PEER_CANCELLED: This error is received when peer cancelled file transfer + @param TRANSFER_COMPLETE_FAIL_SPACE_NOT_AVAILABLE: This error is received when peer doesn't have enough space to store the file + ****************************************************************************/ +typedef enum tagFTResultVal +{ + TRANSFER_SUCCESS = 0, + TRANSFER_COMPLETE_FAIL_CHANNEL_IO = 1, + TRANSFER_COMPLETE_FAIL_FILE_IO = 2, + TRANSFER_COMPLETE_FAIL_CMD_DROPPED = 3, + TRANSFER_COMPLETE_FAIL_PEER_UNRESPONSIVE = 4, + TRANSFER_COMPLETE_FAIL_PEER_CONN_LOST = 5, + TRANSFER_COMPLETE_FAIL_PEER_CANCELLED = 9, + TRANSFER_COMPLETE_FAIL_SPACE_NOT_AVAILABLE = 11 +}FT_RESULT_VAL; + +/*********************************************************************************//** + @brief The function sendFile is called by app to send a file + @param pFilePath [in]: this is absolute file path for file to be send. If file doesn't exist, permission denied or invalid path, + App will be notified in FDefOnSendComplete() with error code TRANSFER_COMPLETE_FAIL_FILE_IO + @param pPeerAgent [in]: Peer Agent to which file is to be sent + @returns : returns file transfer dwTransactionId - Application should store this transaction id to track status of file transfer + ****************************************************************************/ +int sendFile(char* pFilePath, PeerAgent* pPeerAgent); + +/*********************************************************************************//** + @brief The function pushFile is called by app, which has multiple profile implementations in a single app. + @param pFilePath [in]: this is absolute file path for file to be send. If file doesn't exist, permission denied or invalid path, + App will be notified in FDefOnSendComplete() with error code TRANSFER_COMPLETE_FAIL_FILE_IO + @param pPeerAgent [in]: Peer Agent to which file is to be sent + @param dwLocalAgentId [in]: Local agent ID of the agent which intents to use file transfer utility. + @returns : returns file transfer dwTransactionId - Application should store this transaction id to track status of file transfer + ****************************************************************************/ +int pushFile(char* pFilePath, PeerAgent* pPeerAgent, unsigned int dwLocalAgentId); + +/**************************************************************************//** + @brief The function receiveFile is called by app to accept/reject a file req + @param dwTransactionId [in]: file transfer transaction Id + @param pFilePath [in]: this is absolute file path where file to be saved. If file path is invalid, + permission denied App will be notified in FDefOnReceiveComplete() with error code TRANSFER_COMPLETE_FAIL_FILE_IO + @param wConfirmReceive [in]: accept/reject status, for accept set 1, for reject set 0 + @returns : returns SAP_RESULT_VAL with SAP_SUCCESS in case of success and appropriate failure error if any error as per the SAP_STATUS_CODE ENUM + ****************************************************************************/ +SAP_RESULT_VAL receiveFile(int dwTransactionId, char* pFilePath, short int wConfirmReceive); + +/**************************************************************************//** + @brief The function cancelFile is called by app to cancel the file transfer + @param dwTransactionId [in]: transaction Id - Identifies the File transfer transaction to be cancelled + file sender App will receive this transaction Id as return value of sendFile() + file receiver App will receive this transaction Id in FDefOnSendFile() + @returns : returns SAP_RESULT_VAL with SAP_SUCCESS in case of success and appropriate failure error if any error as per the SAP_STATUS_CODE ENUM + ****************************************************************************/ +SAP_RESULT_VAL cancelFile(int dwTransactionId); + +/**************************************************************************//** + @brief This callback function gets triggered when App receive a file req + @param dwTransactionId [in]: transaction Id for file transfer + @param pFilePath [in] : This is source file path at sender side + Receiver will call receiveFile() to accept/reject the file transfer request + In receiveFile(), pFilePath is destination file path (Note: Since source file path could be from different File System, + call receiveFile with a path valid in destination File System. Application should take care of this) + @param dwAgentId [in]: Agent ID to which the call back is intended. + @returns : returns void. +* ***************************************************************************/ +typedef void (*FDefOnSendFile) (int dwTransactionId, char* pFilePath, unsigned int dwAgentId); + + +/**************************************************************************//** + @brief This callback function gets triggered when sending file is completed or error occurred during File transfer + @param dwTransactionId [in]: transaction ID for file transfer + @param pFilePath [in] : file path. + @param uwResult [in] : FT_RESULT_VAL: TRANSFER_SUCCESS if transfer is successful or appropriate Error code + @param dwAgentId [in]: Agent ID to which the call back is intended. + @returns : returns void +* ***************************************************************************/ +typedef void (*FDefOnSendComplete) (int dwTransactionId, char* pFilePath, unsigned short int uwResult, unsigned int dwAgentId); + +/**************************************************************************//** + @brief This callback function gets triggered when receive file is completed + @param dwTransactionId [in]: transaction ID for file transfer + @param pFilePath [in] : Received file path + @param uwResult [in] : FT_RESULT_VAL: TRANSFER_SUCCESS if transfer is successful or appropriate Error code + @param dwAgentId [in]: Agent ID to which the call back is intended. + @returns : returns void +* ***************************************************************************/ +typedef void (*FDefOnReceiveComplete) (int dwTransactionId, char* pFilePath, unsigned short int uwResult, unsigned int dwAgentId); + + +/**************************************************************************//** + @brief This callback function gets triggered to update file progress status to App + @param dwTransactionId [in]: transaction ID for file transfer + @param uwProgress [in] : send/receive file progress expressed as % (e.g. 10%, 90%) + @param dwAgentId [in]: Agent ID to which the call back is intended. + @returns : returns void +* ***************************************************************************/ +typedef void (*FDefOnFileProgress) (int dwTransactionId, unsigned short int uwProgress, unsigned int dwAgentId); + + +/***************************************************************************//** + @brief The structure tagFTNotification holds references to callback for application for various events from framework for file transfer + @param pFDefOnSendFile: Callback to indicate incoming file transfer request + @param pFDefOnSendComplete: Callback to indicate status of send file (both success and error) + @param pFDefOnReceiveComplete: Callback to indicate status of receive file (both success and error) + @param pFDefOnFileProgress: Callback to indicate progress of file transfer + ****************************************************************************/ +typedef struct tagFTNotification +{ + FDefOnSendFile pFDefOnSendFile;/// + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/sap.service b/packaging/sap.service new file mode 100644 index 0000000..aefc395 --- /dev/null +++ b/packaging/sap.service @@ -0,0 +1,16 @@ +[Unit] +Description=SAP service +After=deviced.service + +[Service] +Type=simple +ExecStart=/usr/bin/sap-server +ExecStopPost=/usr/bin/vconftool set -f -t int memory/private/sap/conn_status 0 -i -f -u 5000 -s system::vconf +ExecStopPost=/usr/bin/vconftool set -f -t int memory/private/sap/rfcomm_ready 0 -i -f -u 5000 -s system::vconf +ExecStopPost=/usr/bin/vconftool set -f -t bool memory/wms/wmanager_connected 0 -i -f -u 5000 -s system::vconf + +TimeoutStopSec=1s +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/packaging/sap.spec b/packaging/sap.spec new file mode 100644 index 0000000..6eb95e8 --- /dev/null +++ b/packaging/sap.spec @@ -0,0 +1,85 @@ +Name: sap +Summary: APPCESSORY +Version: 1.0.0 +Release: 0 +Group: Network & Connectivity/Other +License: Samsung Proprietary +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest +Source2: %{name}.service +Source3: %{name}.target +Source4: ft.service +BuildRequires: cmake +Requires: /usr/bin/vconftool +Requires: libstorage +Requires: /usr/bin/api_feature_loader +%ifarch %arm +%global ARM_DEF "-DARM_TARGET=Y" +%endif + +provides: libsap-api.so.1 libsap-client-stub-api.so.1 libwsm.so + +%description +APPCESSORY + +%package devel +Summary: APPCESSORY (devel) +Group: Network & Connectivity/Development +Requires: %{name} = %{version} + +%description devel +APPCESSORY (devel) + +%prep +%setup -q +cp %{SOURCE1} . +cp %{SOURCE2} . +cp %{SOURCE3} . +cp %{SOURCE4} . + +%build +%cmake . %{?ARM_DEF} -DBIN_INSTALL_DIR:PATH=%{_bindir} + +%install +rm -rf %{buildroot} +%make_install + +mkdir -p %{buildroot}%{_libdir}/systemd/system/sap.target.wants +mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants +cp -af %{SOURCE2} %{buildroot}%{_libdir}/systemd/system/ +cp -af %{SOURCE3} %{buildroot}%{_libdir}/systemd/system/ +cp -af %{SOURCE4} %{buildroot}%{_libdir}/systemd/system/ +ln -s %{_libdir}/systemd/system/sap.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/ +ln -s %{_libdir}/systemd/system/ft.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/ + +%post +/sbin/ldconfig +vconftool set -tf int memory/private/sap/conn_status 0 -u 5000 -s system::vconf -i +vconftool set -tf int memory/private/sap/rfcomm_ready 0 -u 5000 -s system::vconf -i + +api_feature_loader --verbose --dir=/usr/share/privilege-control/ + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%manifest %{name}.manifest +%attr(755,root,root) %{_bindir}/sap-server +%attr(755,root,root) %{_bindir}/ft-service +%{_bindir}/frameworkPolicyDelgate.xml +%{_libdir}/libsap-client-stub-api.so.* +%{_libdir}/libsap-api.so.* +%{_libdir}/libwsm.so +%{_libdir}/systemd/system/sap.service +%{_libdir}/systemd/system/sap.target +%{_libdir}/systemd/system/ft.service +%{_libdir}/systemd/system/multi-user.target.wants/sap.service +%{_libdir}/systemd/system/multi-user.target.wants/ft.service +/usr/share/appcessory/file-transfer.xml +/usr/share/privilege-control/*.smack + +%files devel +%defattr(-,root,root,-) +%{_includedir}/sap-service/* +%{_libdir}/pkgconfig/*.pc +%{_libdir}/*sap*.so diff --git a/packaging/sap.target b/packaging/sap.target new file mode 100644 index 0000000..4c90a74 --- /dev/null +++ b/packaging/sap.target @@ -0,0 +1,3 @@ +[Unit] +Description=SAP +StopWhenUnneeded=yes