net_nfc_error_e net_nfc_client_manager_get_server_state_sync(
unsigned int *state);
+net_nfc_error_e net_nfc_client_manager_configure_discovery_sync(int mode);
+
bool net_nfc_client_manager_is_activated(void);
/* TODO : move to internal header */
NFC_SE_POWER_MODE_OFF = 0x02, /**< Power Off */
} nfc_se_power_type_e;
+typedef enum {
+ NFC_DISCOVERY_MODE_STOP = 0x00,
+ NFC_DISCOVERY_MODE_CONFIG_POLLING = 0x01,
+ NFC_DISCOVERY_MODE_CONFIG_LISTENING = 0x02,
+ NFC_DISCOVERY_MODE_CONFIG_P2P = 0x04,
+ NFC_DISCOVERY_MODE_CONFIG_ALL = NFC_DISCOVERY_MODE_CONFIG_POLLING |
+ NFC_DISCOVERY_MODE_CONFIG_LISTENING |
+ NFC_DISCOVERY_MODE_CONFIG_P2P,
+ NFC_DISCOVERY_MODE_CONFIG_DEFAULT = NFC_DISCOVERY_MODE_CONFIG_LISTENING,
+ NFC_DISCOVERY_MODE_CONFIG = NFC_DISCOVERY_MODE_CONFIG_DEFAULT,
+ NET_NFC_DISCOVERY_MODE_START_LISTENING = NFC_DISCOVERY_MODE_CONFIG_LISTENING,
+ NFC_DISCOVERY_MODE_START_POLLING = NFC_DISCOVERY_MODE_CONFIG_POLLING,
+ NFC_DISCOVERY_MODE_START_ALL = NFC_DISCOVERY_MODE_CONFIG_ALL,
+ NFC_DISCOVERY_MODE_START_DEFAULT = NFC_DISCOVERY_MODE_CONFIG_DEFAULT,
+ NFC_DISCOVERY_MODE_START = NFC_DISCOVERY_MODE_START_DEFAULT,
+ NFC_DISCOVERY_MODE_RESUME = NFC_DISCOVERY_MODE_START
+} nfc_discovery_mode_e;
+
/**
* @brief The handle to the Connection Handover message
* @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
int nfc_se_foreach_registered_handlers(nfc_card_emulation_category_type_e category, nfc_se_registered_handler_cb callback, void *user_data);
+int nfc_manager_configure_discovery(int mode);
+
#ifdef __cplusplus
}
#endif
}
+NET_NFC_EXPORT_API
+net_nfc_error_e net_nfc_client_manager_configure_discovery_sync(int mode)
+{
+ net_nfc_error_e out_result = NET_NFC_OK;
+ GError *error = NULL;
+
+ net_nfc_client_manager_init();
+
+ if (manager_proxy == NULL)
+ return NET_NFC_NOT_INITIALIZED;
+
+ /* prevent executing daemon when nfc is off */
+ if (net_nfc_client_manager_is_activated() == false)
+ return NET_NFC_NOT_ACTIVATED;
+
+ if (net_nfc_gdbus_manager_call_configure_discovery_sync(manager_proxy,
+ mode,
+ &out_result,
+ NULL,
+ &error) == FALSE) {
+ DEBUG_ERR_MSG("can not call ConfigureDiscovery : %s", error->message);
+
+ out_result = NET_NFC_IPC_FAIL;
+
+ g_error_free(error);
+ }
+
+ return out_result;
+}
+
net_nfc_error_e net_nfc_client_manager_init(void)
{
GError *error = NULL;
/* LCOV_EXCL_STOP */
}
+int nfc_manager_configure_discovery(int mode)
+{
+ int ret;
+
+ LOG_BEGIN();
+
+ CHECK_SUPPORTED(NFC_FEATURE);
+
+ /* LCOV_EXCL_START */
+ CHECK_INIT();
+ CHECK_ACTIVATED();
+
+ ret = net_nfc_client_manager_configure_discovery_sync(mode);
+
+ return nfc_common_convert_error_code(__func__, ret);
+ /* LCOV_EXCL_STOP */
+}
+
bool nfc_manager_is_activated(void)
{
int ret;
#include <unistd.h>
#include <nfc.h>
+#include <nfc_internal.h>
#define BUFFER_LEN 10
#define PRT(format, args...) printf("%s:%d() "format, __FUNCTION__, __LINE__, ##args)
tc_table_t tc_table[] = {
/* manage api*/
{"NFC Initialize Test", 1},
- {"NFC Tag NDEF Read", 2},
- {"NFC Tag NDEF Write", 3},
- {"NFC Deinitialize Test", 4},
+ {"NFC Configure discovery (CE only) Test", 2},
+ {"NFC Configure discovery (Tag only) Test", 3},
+ {"NFC Tag NDEF Read", 4},
+ {"NFC Tag NDEF Write", 5},
+ {"NFC Deinitialize Test", 6},
+ {"NFC Configure discovery (ALL enable) Test", 7},
+ {"NFC Configure discovery (ALL disable) Test", 8},
/* -----------*/
{"Finish" , 0x00ff},
break;
case 2:
{
+ TC_PRT("nfc configure discovery : CE only start");
+ ret = nfc_manager_configure_discovery(NFC_DISCOVERY_MODE_CONFIG_LISTENING);
+ TC_PRT("nfc configure discovery : CE only end : %d", ret);
+ }
+ break;
+ case 3:
+ {
+ TC_PRT("nfc configure discovery : Tag only start");
+ ret = nfc_manager_configure_discovery(NFC_DISCOVERY_MODE_CONFIG_POLLING);
+ TC_PRT("nfc configure discovery : Tag only end : %d", ret);
+ }
+ break;
+ case 4:
+ {
TC_PRT("Tag read start");
nfc_tag_h current_tag = NULL;
nfc_manager_get_connected_tag(¤t_tag);
TC_PRT("Tag read end");
}
break;
- case 3:
+ case 5:
{
TC_PRT("Tag write start");
TC_PRT("Tag write end");
}
break;
- case 4:
+ case 6:
{
TC_PRT("nfc deinitialize start");
TC_PRT("nfc deinitialize end");
}
break;
+ case 7:
+ {
+ TC_PRT("nfc configure discovery : All enable start");
+ ret = nfc_manager_configure_discovery(NFC_DISCOVERY_MODE_RESUME);
+ TC_PRT("nfc configure discovery : All enable end : %d", ret);
+ }
+ break;
+ case 8:
+ {
+ TC_PRT("nfc configure discovery : All disable start");
+ ret = nfc_manager_configure_discovery(NFC_DISCOVERY_MODE_STOP);
+ TC_PRT("nfc configure discovery : All enable end : %d", ret);
+ }
+ break;
default:
tc_usage_print();
break;