API was added for OSP application
authorSangSoo Lee <constant.lee@samsung.com>
Thu, 4 Apr 2013 04:55:03 +0000 (13:55 +0900)
committerJaekyun Lee <jkyun.lee@samsung.com>
Tue, 16 Apr 2013 11:51:19 +0000 (20:51 +0900)
Change-Id: Id55017795835afab00a14da16fa71b2043d79e93

include/nfc.h
src/nfc.c

index 135ec58..cc7977d 100755 (executable)
@@ -1976,6 +1976,28 @@ int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
 int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
 
 
+/**
+ * @brief Sends data to NFC peer-to-peer target without permission check
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [in] message The message to send
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback funcation
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_p2p_send_completed_cb()
+ * @see @see nfc_p2p_target_discovered_cb()
+*/
+int nfc_p2p_send_no_permission(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
+
 
 
 /**
index 02b0685..3b26772 100644 (file)
--- a/src/nfc.c
+++ b/src/nfc.c
@@ -1866,6 +1866,46 @@ int nfc_p2p_send(nfc_p2p_target_h target , nfc_ndef_message_h message , nfc_p2p_
        return 0;
 }
 
+int nfc_p2p_send_no_permission(nfc_p2p_target_h target , nfc_ndef_message_h message , nfc_p2p_send_completed_cb callback, void *user_data){
+       int ret;
+
+       if( target == NULL || message == NULL  )
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       net_nfc_exchanger_data_h data_handle;
+       data_h rawdata;
+       net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
+       ret = net_nfc_create_exchanger_data(&data_handle,  rawdata);
+       net_nfc_free_data(rawdata);
+
+
+       if( ret != 0)
+               return _convert_error_code(__func__, ret);
+
+       ret = net_nfc_send_exchanger_data(data_handle ,(net_nfc_target_handle_h)target, NULL);
+
+       if( ret != 0 ){
+               net_nfc_free_exchanger_data(data_handle);
+               return _convert_error_code(__func__, ret);
+       }
+
+       g_nfc_context.on_p2p_send_completed_cb = callback;
+       g_nfc_context.on_p2p_send_completed_user_data = user_data;
+
+       ret = net_nfc_free_exchanger_data(data_handle);
+
+       if( ret != 0 ){
+               return _convert_error_code(__func__, ret);
+       }
+
+       return 0;
+}
+
 int nfc_p2p_connection_handover(nfc_p2p_target_h target , nfc_ac_type_e type, nfc_p2p_connection_handover_completed_cb callback, void *user_data){
        int ret;
        net_nfc_conn_handover_carrier_type_e net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;