From f033f08179451d61adda0f7bc95fab713f79cfcf Mon Sep 17 00:00:00 2001 From: Lukasz Bardeli Date: Wed, 17 Dec 2014 12:09:07 +0100 Subject: [PATCH] [NFC] setPowered implementation [Verification] Code compiles without error; Change-Id: Ide0644d97f6b735dfe5804c46c6c0a104975a748 Signed-off-by: Lukasz Bardeli --- src/nfc/nfc.gyp | 4 +- src/nfc/nfc_adapter.cc | 158 +++++++++++++++++++++- src/nfc/nfc_adapter.h | 13 ++ src/nfc/nfc_api.js | 27 ++++ src/nfc/nfc_extension.cc | 2 +- src/nfc/nfc_instance.cc | 26 +++- src/nfc/nfc_instance.h | 8 +- src/nfc/nfc_util.cc | 284 +++++++++++++++++++++++++++++++++++++++ src/nfc/nfc_util.h | 70 ++++++++++ 9 files changed, 587 insertions(+), 5 deletions(-) create mode 100644 src/nfc/nfc_util.cc create mode 100644 src/nfc/nfc_util.h diff --git a/src/nfc/nfc.gyp b/src/nfc/nfc.gyp index 7d571fe6..fb11f635 100644 --- a/src/nfc/nfc.gyp +++ b/src/nfc/nfc.gyp @@ -13,7 +13,9 @@ 'nfc_instance.cc', 'nfc_instance.h', 'nfc_adapter.cc', - 'nfc_adapter.h' + 'nfc_adapter.h', + 'nfc_util.cc', + 'nfc_util.h' ], 'includes': [ '../common/pkg-config.gypi', diff --git a/src/nfc/nfc_adapter.cc b/src/nfc/nfc_adapter.cc index 173b55cb..1e0670c3 100644 --- a/src/nfc/nfc_adapter.cc +++ b/src/nfc/nfc_adapter.cc @@ -3,8 +3,10 @@ // found in the LICENSE file. #include "nfc_adapter.h" +#include "nfc_util.h" #include +#include #include "common/logger.h" #include "common/platform_exception.h" @@ -23,7 +25,37 @@ NFCAdapter::~NFCAdapter() { } -NFCAdapter* NFCAdapter::GetInstance(){ +static picojson::value createEventError(double callbackId, PlatformException ex) { + + picojson::value event = picojson::value(picojson::object()); + picojson::object& obj = event.get(); + NFCInstance::getInstance().InstanceReportError(ex, obj); + obj.insert(std::make_pair("callbackId", callbackId)); + + return event; +} + +static picojson::value createEventSuccess(double callbackId) { + picojson::value event = picojson::value(picojson::object()); + picojson::object& obj = event.get(); + NFCInstance::getInstance().InstanceReportSuccess(obj); + obj.insert(std::make_pair("callbackId", callbackId)); + + return event; +} + +static gboolean setPoweredCompleteCB(void * user_data) { + + double* callbackId = static_cast(user_data); + picojson::value event = createEventSuccess(*callbackId); + NFCInstance::getInstance().PostMessage(event.serialize().c_str()); + + delete callbackId; + callbackId = NULL; + return false; +} + +NFCAdapter* NFCAdapter::GetInstance() { static NFCAdapter instance; return &instance; } @@ -32,5 +64,129 @@ bool NFCAdapter::GetPowered() { return nfc_manager_is_activated(); } +#ifndef APP_CONTROL_SETTING_SUPPORT + +static void NFCSetActivationCompletedCallback(nfc_error_e error, void *user_data) +{ + double* callbackId = static_cast(user_data); + + if (NFC_ERROR_NONE != error) { + auto ex = PlatformException(NFCUtil::getNFCErrorString(error), + NFCUtil::getNFCErrorMessage(error)); + + picojson::value event = createEventError(*callbackId, ex); + + NFCInstance::getInstance().PostMessage(event.serialize().c_str()); + } else { + picojson::value event = createEventSuccess(*callbackId); + + NFCInstance::getInstance().PostMessage(event.serialize().c_str()); + } + delete callbackId; + callbackId = NULL; +} + +#endif + +void NFCAdapter::SetPowered(const picojson::value& args) { + + double* callbackId = new double(args.get("callbackId").get()); + bool powered = args.get("powered").get(); + + if (nfc_manager_is_activated() == powered) { + if (!g_idle_add(setPoweredCompleteCB, static_cast(callbackId))) { + delete callbackId; + callbackId = NULL; + LOGE("g_idle addition failed"); + throw UnknownException("SetPowered failed."); + } + return; + } + +#ifdef APP_CONTROL_SETTING_SUPPORT + app_control_h service = NULL; + int ret = app_control_create(&service); + if (ret != APP_CONTROL_ERROR_NONE) { + LOGE("app_control_create failed: %d", ret); + delete callbackId; + callbackId = NULL; + throw UnknownException("app_control_create failed"); + } + + ret = app_control_set_operation(service, + "http://tizen.org/appcontrol/operation/setting/nfc"); + if (ret != APP_CONTROL_ERROR_NONE) { + LOGE("app_control_set_operation failed: %d", ret); + delete callbackId; + callbackId = NULL; + throw UnknownException("app_control_set_operation failed"); + } + + ret = app_control_add_extra_data(service, "type", "nfc"); + if (ret != APP_CONTROL_ERROR_NONE) { + LOGE("app_control_add_extra_data failed: %d", ret); + delete callbackId; + callbackId = NULL; + throw UnknownException("app_control_add_extra_data failed"); + } + + ret = app_control_send_launch_request(service, [](app_control_h request, + app_control_h reply, app_control_result_e result, void *user_data){ + double* callbackId = static_cast(user_data); + try { + if (result == APP_CONTROL_RESULT_SUCCEEDED) { + char *type = NULL; + int ret = app_control_get_extra_data(reply, "nfc_status", + &type); + if (ret != APP_CONTROL_ERROR_NONE) { + LOGE("app_control_get_extra_data failed: %d", ret); + throw UnknownException("app_control_get_extra_data failed"); + } + + LOGD("app_control result: %s", type); + } else { + LOGE("NFC enable app control failed : %d", result); + throw UnknownException("NFC enable app control failed"); + } + } catch (PlatformException &ex) { + picojson::value event = createEventError(*callbackId, ex); + NFCInstance::getInstance().PostMessage(event.serialize().c_str()); + return; + } + + if (!g_idle_add(setPoweredCompleteCB, static_cast(callbackId))) { + LOGE("g_idle addition failed"); + PlatformException ex = PlatformException("UnknownError", "UnknownError"); + picojson::value event = createEventError(*callbackId, ex); + NFCInstance::getInstance().PostMessage(event.serialize().c_str()); + } + }, static_cast(callbackId)); + + if (ret != APP_CONTROL_ERROR_NONE) { + LOGE("app_control_send_launch_request failed: %d", ret); + delete callbackId; + callbackId = NULL; + throw UnknownException("app_control_send_operation failed"); + } + + ret = app_control_destroy(service); + if (ret != APP_CONTROL_ERROR_NONE) { + LOGE("app_control_destroy failed: %d", ret); + throw UnknownException("app_control_destroy failed"); + } +#else + int ret = nfc_manager_set_activation(args.get("powered").get(), + NFCSetActivationCompletedCallback, static_cast(callbackId)); + + if (NFC_ERROR_NONE != ret) { + LOGE("setPowered failed %d",ret); + delete callbackId; + callbackId = NULL; + NFCUtil::throwNFCException(ret, "setPowered failed."); + } +#endif +} + + }// nfc }// extension diff --git a/src/nfc/nfc_adapter.h b/src/nfc/nfc_adapter.h index e49c6fdb..e4294e43 100644 --- a/src/nfc/nfc_adapter.h +++ b/src/nfc/nfc_adapter.h @@ -5,14 +5,27 @@ #ifndef NFC_NFC_ADAPTER_H_ #define NFC_NFC_ADAPTER_H_ +#include "nfc/nfc_instance.h" + +#include "common/picojson.h" +#include + +#ifdef APP_CONTROL_SETTING_SUPPORT +#include +#endif + namespace extension { namespace nfc { +class NFCInstance; + class NFCAdapter { public: bool GetPowered(); + void SetPowered(const picojson::value& args); static NFCAdapter* GetInstance(); + NFCInstance *xwalk_instance; private: NFCAdapter(); virtual ~NFCAdapter(); diff --git a/src/nfc/nfc_api.js b/src/nfc/nfc_api.js index 0647b413..ed6401f6 100644 --- a/src/nfc/nfc_api.js +++ b/src/nfc/nfc_api.js @@ -115,7 +115,34 @@ function NFCAdapter() { }; NFCAdapter.prototype.setPowered = function() { + var args = validator_.validateArgs(arguments, [ + { + name : 'powered', + type : types_.BOOLEAN + }, + { + name : 'successCallback', + type : types_.FUNCTION, + optional : true, + nullable : true + }, + { + name : 'errorCallback', + type : types_.FUNCTION, + optional : true, + nullable : true + } + ]); + native_.call('NFCAdapter_setPowered', { + powered: args.powered + }, function(result) { + if (native_.isFailure(result)) { + args.errorCallback(result.error); + } else { + args.successCallback(); + } + }); }; NFCAdapter.prototype.setTagListener = function() { diff --git a/src/nfc/nfc_extension.cc b/src/nfc/nfc_extension.cc index 01a4e1bd..ecf02aa8 100644 --- a/src/nfc/nfc_extension.cc +++ b/src/nfc/nfc_extension.cc @@ -20,5 +20,5 @@ NFCExtension::NFCExtension() { NFCExtension::~NFCExtension() {} common::Instance* NFCExtension::CreateInstance() { - return new extension::nfc::NFCInstance; + return &extension::nfc::NFCInstance::getInstance();; } diff --git a/src/nfc/nfc_instance.cc b/src/nfc/nfc_instance.cc index b0edb6ee..a526af06 100644 --- a/src/nfc/nfc_instance.cc +++ b/src/nfc/nfc_instance.cc @@ -18,6 +18,11 @@ namespace nfc { using namespace common; using namespace extension::nfc; +NFCInstance& NFCInstance::getInstance() { + static NFCInstance instance; + return instance; +} + NFCInstance::NFCInstance() { using namespace std::placeholders; #define REGISTER_SYNC(c,x) \ @@ -69,6 +74,25 @@ NFCInstance::~NFCInstance() { } } +void NFCInstance::InstanceReportSuccess(picojson::object& out) { + out.insert(std::make_pair("status", picojson::value("success"))); +} + +void NFCInstance::InstanceReportSuccess(const picojson::value& result, picojson::object& out) { + out.insert(std::make_pair("status", picojson::value("success"))); + out.insert(std::make_pair("result", result)); +} + +void NFCInstance::InstanceReportError(picojson::object& out) { + out.insert(std::make_pair("status", picojson::value("error"))); +} + +void NFCInstance::InstanceReportError(const PlatformException& ex, picojson::object& out) { + out.insert(std::make_pair("status", picojson::value("error"))); + out.insert(std::make_pair("error", ex.ToJSON())); +} + + void NFCInstance::GetDefaultAdapter( const picojson::value& args, picojson::object& out) { @@ -117,7 +141,7 @@ void NFCInstance::SetExclusiveMode( void NFCInstance::SetPowered( const picojson::value& args, picojson::object& out) { - + NFCAdapter::GetInstance()->SetPowered(args); } void NFCInstance::GetPowered( diff --git a/src/nfc/nfc_instance.h b/src/nfc/nfc_instance.h index 81a1ec6d..9481fdce 100644 --- a/src/nfc/nfc_instance.h +++ b/src/nfc/nfc_instance.h @@ -14,10 +14,16 @@ namespace nfc { class NFCInstance: public common::ParsedInstance { public: + static NFCInstance& getInstance(); + + void InstanceReportSuccess(picojson::object& out); + void InstanceReportSuccess(const picojson::value& result, picojson::object& out); + void InstanceReportError(picojson::object& out); + void InstanceReportError(const common::PlatformException& ex, picojson::object& out); +private: NFCInstance(); virtual ~NFCInstance(); -private: void GetDefaultAdapter(const picojson::value& args, picojson::object& out); void SetExclusiveMode(const picojson::value& args, picojson::object& out); void SetPowered(const picojson::value& args, picojson::object& out); diff --git a/src/nfc/nfc_util.cc b/src/nfc/nfc_util.cc new file mode 100644 index 00000000..290a7409 --- /dev/null +++ b/src/nfc/nfc_util.cc @@ -0,0 +1,284 @@ +// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "nfc_util.h" + +#include + +#include "common/logger.h" +#include "common/platform_exception.h" + +using namespace common; + +namespace extension { +namespace nfc { + +UCharVector NFCUtil::toVector(const unsigned char *ch, const int size) +{ + UCharVector vec(ch, ch + size / sizeof(char)); + return vec; +} + +void NFCUtil::throwNFCException(const int errorCode, const char* message) +{ + switch(errorCode) { + case NFC_ERROR_INVALID_PARAMETER: + case NFC_ERROR_INVALID_NDEF_MESSAGE: + case NFC_ERROR_INVALID_RECORD_TYPE: + case NFC_ERROR_NOT_NDEF_FORMAT: + throw InvalidValuesException(message); + break; + case NFC_ERROR_SECURITY_RESTRICTED: + throw SecurityException(message); + break; + case NFC_ERROR_NOT_ACTIVATED: + case NFC_ERROR_NOT_SUPPORTED: + case NFC_ERROR_OPERATION_FAILED: + case NFC_ERROR_DEVICE_BUSY: + case NFC_ERROR_NO_DEVICE: + case NFC_ERROR_TIMED_OUT: + case NFC_ERROR_OUT_OF_MEMORY: + default: + throw UnknownException(message); + break; + } +} + +std::string NFCUtil::getNFCErrorString(const int error_code) +{ + LOGD("Error code : %d",error_code); + switch(error_code) { + case NFC_ERROR_ALREADY_ACTIVATED: + case NFC_ERROR_ALREADY_DEACTIVATED: + return ""; + case NFC_ERROR_INVALID_PARAMETER: + case NFC_ERROR_INVALID_NDEF_MESSAGE: + case NFC_ERROR_INVALID_RECORD_TYPE: + case NFC_ERROR_NOT_NDEF_FORMAT: + return INVALID_VALUES_ERROR_NAME_STR; + case NFC_ERROR_NO_DEVICE: + case NFC_ERROR_OUT_OF_MEMORY: + case NFC_ERROR_OPERATION_FAILED: + case NFC_ERROR_DEVICE_BUSY: + return UNKNOWN_ERROR_NAME_STR; + case NFC_ERROR_NOT_ACTIVATED: + return SERVICE_NOT_AVAILABLE_ERROR_NAME_STR; + case NFC_ERROR_NOT_SUPPORTED: + return NOT_SUPPORTED_ERROR_NAME_STR; + case NFC_ERROR_TIMED_OUT: + return TIMEOUT_ERROR_NAME_STR; + } + return UNKNOWN_ERROR_NAME_STR; +} + +std::string NFCUtil::getNFCErrorMessage(const int error_code) +{ + LOGD("Error code : %d",error_code); + switch(error_code) { + case NFC_ERROR_ALREADY_ACTIVATED: + case NFC_ERROR_ALREADY_DEACTIVATED: + return ""; + case NFC_ERROR_INVALID_PARAMETER: + return "Invalid Parameter"; + case NFC_ERROR_INVALID_NDEF_MESSAGE: + return "Invalid NDEF Message"; + case NFC_ERROR_INVALID_RECORD_TYPE: + return "Invalid Record Type"; + case NFC_ERROR_NO_DEVICE: + return "No Device"; + case NFC_ERROR_OUT_OF_MEMORY: + return "Out Of Memory"; + case NFC_ERROR_NOT_SUPPORTED: + return "NFC Not Supported"; + case NFC_ERROR_OPERATION_FAILED: + return "Operation Failed"; + case NFC_ERROR_DEVICE_BUSY: + return "Device Busy"; + case NFC_ERROR_NOT_ACTIVATED: + return "NFC Not Activated"; + case NFC_ERROR_TIMED_OUT: + return "Time Out"; + case NFC_ERROR_READ_ONLY_NDEF: + return "Read Only NDEF"; + case NFC_ERROR_NO_SPACE_ON_NDEF: + return "No Space On NDEF"; + case NFC_ERROR_NO_NDEF_MESSAGE: + return "No NDEF Message"; + case NFC_ERROR_NOT_NDEF_FORMAT: + return "Not NDEF Format"; + case NFC_ERROR_SECURITY_RESTRICTED: + return "Security Restricted"; + } + return "UnknownError"; +} + +std::string NFCUtil::toStringNFCTag(nfc_tag_type_e tag_type) +{ + switch (tag_type) { + case NFC_GENERIC_PICC: + return GENERIC_TARGET; + case NFC_ISO14443_A_PICC: + return ISO14443_A; + case NFC_ISO14443_4A_PICC: + return ISO14443_4A; + case NFC_ISO14443_3A_PICC: + return ISO14443_3A; + case NFC_MIFARE_MINI_PICC: + return MIFARE_MINI; + case NFC_MIFARE_1K_PICC: + return MIFARE_1K; + case NFC_MIFARE_4K_PICC: + return MIFARE_4K; + case NFC_MIFARE_ULTRA_PICC: + return MIFARE_ULTRA; + case NFC_MIFARE_DESFIRE_PICC: + return MIFARE_DESFIRE; + case NFC_ISO14443_B_PICC: + return ISO14443_B; + case NFC_ISO14443_4B_PICC: + return ISO14443_4B; + case NFC_ISO14443_BPRIME_PICC: + return ISO14443_BPRIME; + case NFC_FELICA_PICC: + return FELICA; + case NFC_JEWEL_PICC: + return JEWEL; + case NFC_ISO15693_PICC: + return ISO15693; + case NFC_UNKNOWN_TARGET: + default: + return UNKNOWN_TARGET; + } +} + +nfc_tag_type_e NFCUtil::toNfcTagString(const std::string& type_string) +{ + if (GENERIC_TARGET == type_string) { + return NFC_GENERIC_PICC; + } + else if (ISO14443_A == type_string) { + return NFC_ISO14443_A_PICC; + } + else if (ISO14443_4A == type_string) { + return NFC_ISO14443_4A_PICC; + } + else if (ISO14443_3A == type_string) { + return NFC_ISO14443_3A_PICC; + } + else if (MIFARE_MINI == type_string) { + return NFC_MIFARE_MINI_PICC; + } + else if (MIFARE_1K == type_string) { + return NFC_MIFARE_1K_PICC; + } + else if (MIFARE_4K == type_string) { + return NFC_MIFARE_4K_PICC; + } + else if (MIFARE_ULTRA == type_string) { + return NFC_MIFARE_ULTRA_PICC; + } + else if (MIFARE_DESFIRE == type_string) { + return NFC_MIFARE_DESFIRE_PICC; + } + else if (ISO14443_B == type_string) { + return NFC_ISO14443_B_PICC; + } + else if (ISO14443_4B == type_string) { + return NFC_ISO14443_4B_PICC; + } + else if (ISO14443_BPRIME == type_string) { + return NFC_ISO14443_BPRIME_PICC; + } + else if (FELICA == type_string) { + return NFC_FELICA_PICC; + } + else if (JEWEL == type_string) { + return NFC_JEWEL_PICC; + } + else if (ISO15693 == type_string) { + return NFC_ISO15693_PICC; + } + else if (UNKNOWN_TARGET == type_string) { + return NFC_UNKNOWN_TARGET; + } + else { + throw TypeMismatchException("No Match Tag Type"); + } +} + +std::string NFCUtil::toStringCardEmulationMode( + const nfc_se_card_emulation_mode_type_e mode) +{ + switch (mode) + { + case NFC_SE_CARD_EMULATION_MODE_OFF: + return OFF; + case NFC_SE_CARD_EMULATION_MODE_ON: + return ALWAYS_ON; + default: + LOGE("No Match Card Emulation mode: %x", mode); + throw TypeMismatchException("No Match Card Emulation mode"); + } +} + +nfc_se_card_emulation_mode_type_e NFCUtil::toCardEmulationMode( + const std::string &mode_string) +{ + if (mode_string == ALWAYS_ON) { + return NFC_SE_CARD_EMULATION_MODE_ON; + } else if (mode_string == OFF) { + return NFC_SE_CARD_EMULATION_MODE_OFF; + } else { + LOGE("No Match Card Emulation mode: %s", mode_string.c_str()); + throw TypeMismatchException("No Match Card Emulation mode"); + } +} + +std::string NFCUtil::toStringSecureElementType(const nfc_se_type_e type) +{ + switch (type) { + case NFC_SE_TYPE_ESE: + return ESE; + case NFC_SE_TYPE_UICC: + return UICC; + default: + LOGE("No Match Secure Element Type: %x", type); + throw TypeMismatchException("No Match Secure Element Type"); + } +} + +nfc_se_type_e NFCUtil::toSecureElementType(const std::string &type_string) +{ + if (type_string == ESE) { + return NFC_SE_TYPE_ESE; + } else if (type_string == UICC) { + return NFC_SE_TYPE_UICC; + } else { + LOGE("No Match Secure Element Type: %s", type_string.c_str()); + throw TypeMismatchException("No Match Secure Element Type"); + } +} + +void NFCUtil::setDefaultFilterValues(std::vector& filter) +{ + filter.push_back(NFC_GENERIC_PICC); + filter.push_back(NFC_ISO14443_A_PICC); + filter.push_back(NFC_ISO14443_3A_PICC); + filter.push_back(NFC_ISO14443_3A_PICC); + filter.push_back(NFC_MIFARE_MINI_PICC); + filter.push_back(NFC_MIFARE_1K_PICC); + filter.push_back(NFC_MIFARE_4K_PICC); + filter.push_back(NFC_MIFARE_ULTRA_PICC); + filter.push_back(NFC_MIFARE_DESFIRE_PICC); + filter.push_back(NFC_ISO14443_B_PICC); + filter.push_back(NFC_ISO14443_4B_PICC); + filter.push_back(NFC_ISO14443_BPRIME_PICC); + filter.push_back(NFC_FELICA_PICC); + filter.push_back(NFC_JEWEL_PICC); + filter.push_back(NFC_ISO15693_PICC); + filter.push_back(NFC_UNKNOWN_TARGET); +} + +} // NFC +} // DeviceApi diff --git a/src/nfc/nfc_util.h b/src/nfc/nfc_util.h new file mode 100644 index 00000000..d41f8180 --- /dev/null +++ b/src/nfc/nfc_util.h @@ -0,0 +1,70 @@ +// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +#ifndef __TIZEN_NFC_NFCUTIL_H_ +#define __TIZEN_NFC_NFCUTIL_H_ + +#include +#include +#include + +namespace extension { +namespace nfc { + +namespace { +const std::string GENERIC_TARGET = "GENERIC_TARGET"; +const std::string ISO14443_A = "ISO14443_A"; +const std::string ISO14443_4A = "ISO14443_4A"; +const std::string ISO14443_3A = "ISO14443_3A"; +const std::string MIFARE_MINI = "MIFARE_MINI"; +const std::string MIFARE_1K = "MIFARE_1K"; +const std::string MIFARE_4K = "MIFARE_4K"; +const std::string MIFARE_ULTRA = "MIFARE_ULTRA"; +const std::string MIFARE_DESFIRE = "MIFARE_DESFIRE"; +const std::string ISO14443_B = "ISO14443_B"; +const std::string ISO14443_4B = "ISO14443_4B"; +const std::string ISO14443_BPRIME = "ISO14443_BPRIME"; +const std::string FELICA = "FELICA"; +const std::string JEWEL = "JEWEL"; +const std::string ISO15693 = "ISO15693"; +const std::string UNKNOWN_TARGET = "UNKNOWN_TARGET"; + +const std::string ALWAYS_ON = "ALWAYS_ON"; +const std::string OFF = "OFF"; + +const std::string ESE = "ESE"; +const std::string UICC = "UICC"; + +const std::string UNKNOWN_ERROR_NAME_STR = "UnknownError"; +const std::string INVALID_VALUES_ERROR_NAME_STR = "InvalidValuesError"; +const std::string TIMEOUT_ERROR_NAME_STR = "TimeoutError"; +const std::string SERVICE_NOT_AVAILABLE_ERROR_NAME_STR = "ServiceNotAvailableError"; +const std::string NOT_SUPPORTED_ERROR_NAME_STR = "NotSupportedError"; +} + +typedef std::vector UCharVector; + +class NFCUtil +{ +public: + static UCharVector toVector(const unsigned char *ch, const int size); + static void throwNFCException(const int errorCode, const char * message); + static std::string getNFCErrorString(const int error_code); + static std::string getNFCErrorMessage(const int error_code); + static std::string toStringNFCTag(const nfc_tag_type_e tag_type); + static nfc_tag_type_e toNfcTagString(const std::string& type_string); + static std::string toStringCardEmulationMode( + const nfc_se_card_emulation_mode_type_e mode); + static nfc_se_card_emulation_mode_type_e toCardEmulationMode( + const std::string& mode_string); + static std::string toStringSecureElementType(const nfc_se_type_e type); + static nfc_se_type_e toSecureElementType(const std::string& type_string); + static void setDefaultFilterValues(std::vector& filter); +}; + +} // nfc +} // extension + +#endif // __TIZEN_NFC_NFCUTIL_H_ -- 2.34.1