#include <CommonsJavaScript/JSUtils.h>
#include <CommonsJavaScript/JSCallbackManager.h>
#include <CommonsJavaScript/Utils.h>
-#include <JSTizenExceptionFactory.h>
-#include <JSTizenException.h>
+#include <JSWebAPIErrorFactory.h>
#include <SecurityExceptions.h>
#include <GlobalContextManager.h>
#include <ArgumentValidator.h>
#include <JSUtil.h>
-#include <JSWebAPIException.h>
#include <PlatformException.h>
#include "JSNFCManager.h"
#include <Logger.h>
using namespace std;
-using namespace DPL;
+
using namespace DeviceAPI::Common;
using namespace WrtDeviceApis::Commons;
using namespace WrtDeviceApis::CommonsJavaScript;
NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
LoggerE("private object is null");
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
}
INFCAdapterPtr nfcAdapter(privateObject->getObject());
);
EventNFCChangedEmitterPtr emitter(new EventNFCChangedEmitter);
emitter->setListener(&NFCStaticController::getInstance());
- emitter->setEventPrivateData(StaticPointerCast<EventNFCChanged::PrivateDataType>(privateData));
+ emitter->setEventPrivateData(DPL::StaticPointerCast<EventNFCChanged::PrivateDataType>(privateData));
if (nfcAdapter->setTagListener(emitter, tagFilter) != 0)
Throw(WrtDeviceApis::Commons::UnknownException);
NFCListenerCancellerPtr canceller = NFCListenerCancellerPtr(new NFCListenerCanceller(global_context, thisObject, static_cast<long>(ID_NFCADAPTER_TAG_LISTENER)));
- IListenerItemPtr listenerItem = StaticPointerCast<IListenerItem>(canceller);
+ IListenerItemPtr listenerItem = DPL::StaticPointerCast<IListenerItem>(canceller);
NFCListenerManagerSingleton::Instance().registerListener(listenerItem, global_context);
return JSValueMakeUndefined(context);
} Catch (BasePlatformException) {
LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage());
- return JSWebAPIException::throwException(context, exception, _rethrown_exception);
+ return JSWebAPIErrorFactory::postException(context, exception, _rethrown_exception);
} Catch (ConversionException) {
LoggerE("JSNFCAdapter::setTagListener : ConversionException");
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (PlatformException) {
LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SERVICE_NOT_AVAILABLE_ERROR, "Service Not Available");
} Catch (WrtDeviceApis::Commons::UnknownException) {
LoggerE("UnknownException: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::Exception) {
LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
}
JSValueRef JSNFCAdapter::setPeerListener (JSContextRef context, JSObjectRef object,
NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
LoggerE("private object is null");
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
}
INFCAdapterPtr nfcAdapter(privateObject->getObject());
EventNFCChangedEmitterPtr emitter(new EventNFCChangedEmitter);
emitter->setListener(&NFCStaticController::getInstance());
- emitter->setEventPrivateData(StaticPointerCast<EventNFCChanged::PrivateDataType>(privateData));
+ emitter->setEventPrivateData(DPL::StaticPointerCast<EventNFCChanged::PrivateDataType>(privateData));
if (nfcAdapter->setPeerListener(emitter) != 0)
Throw(WrtDeviceApis::Commons::UnknownException);
NFCListenerCancellerPtr canceller = NFCListenerCancellerPtr(new NFCListenerCanceller(global_context, thisObject, static_cast<long>(ID_NFCADAPTER_PEER_LISTENER)));
- IListenerItemPtr listenerItem = StaticPointerCast<IListenerItem>(canceller);
+ IListenerItemPtr listenerItem = DPL::StaticPointerCast<IListenerItem>(canceller);
NFCListenerManagerSingleton::Instance().registerListener(listenerItem, global_context);
return JSValueMakeUndefined(context);
} Catch (BasePlatformException) {
LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage());
- return JSWebAPIException::throwException(context, exception, _rethrown_exception);
+ return JSWebAPIErrorFactory::postException(context, exception, _rethrown_exception);
} Catch (ConversionException) {
LoggerE("JSNFCAdapter::setPeerListener : ConversionException");
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (PlatformException) {
LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SERVICE_NOT_AVAILABLE_ERROR, "Service Not Available");
} Catch (WrtDeviceApis::Commons::UnknownException) {
LoggerE("UnknownException: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::Exception) {
LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
}
JSValueRef JSNFCAdapter::unsetTagListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject,
size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
LoggerE("private object is null");
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
}
Try {
nfcAdapter->unsetTagListener();
NFCListenerCancellerPtr canceller = NFCListenerCancellerPtr(new NFCListenerCanceller(privateObject->getContext(), thisObject, static_cast<long>(ID_NFCADAPTER_TAG_LISTENER)));
- IListenerItemPtr listenerItem = StaticPointerCast<IListenerItem>(canceller);
+ IListenerItemPtr listenerItem = DPL::StaticPointerCast<IListenerItem>(canceller);
NFCListenerManagerSingleton::Instance().unregisterListener(listenerItem);
return JSValueMakeUndefined(context);
} Catch (NullPointerException) {
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (PlatformException) {
LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SERVICE_NOT_AVAILABLE_ERROR, "Service Not Available");
} Catch (WrtDeviceApis::Commons::Exception) {
LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
}
JSValueRef JSNFCAdapter::unsetPeerListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject,
NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
LoggerE("private object is null");
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
}
Try {
nfcAdapter->unsetPeerListener();
NFCListenerCancellerPtr canceller = NFCListenerCancellerPtr(new NFCListenerCanceller(privateObject->getContext(), thisObject, static_cast<long>(ID_NFCADAPTER_PEER_LISTENER)));
- IListenerItemPtr listenerItem = StaticPointerCast<IListenerItem>(canceller);
+ IListenerItemPtr listenerItem = DPL::StaticPointerCast<IListenerItem>(canceller);
NFCListenerManagerSingleton::Instance().unregisterListener(listenerItem);
return JSValueMakeUndefined(context);
} Catch (NullPointerException) {
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (PlatformException) {
LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SERVICE_NOT_AVAILABLE_ERROR, "Service Not Available");
} Catch (WrtDeviceApis::Commons::Exception) {
LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
}
JSValueRef JSNFCAdapter::getCachedMessage (JSContextRef context, JSObjectRef object,
NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
LoggerE("private object is null");
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
}
JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
LoggerE("Exception: " << _rethrown_exception.GetMessage());
} Catch (PlatformException) {
LoggerE("Exception: " << _rethrown_exception.GetMessage());
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SERVICE_NOT_AVAILABLE_ERROR, "Service Not Available");
} Catch(NullPointerException) {
LoggerE("Exception: " << _rethrown_exception.GetMessage());
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (WrtDeviceApis::Commons::Exception) {
LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown Error");
}
JSValueRef JSNFCAdapter::setPowered (JSContextRef context, JSObjectRef object,
NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
LoggerE("private object is null");
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
}
INFCAdapterPtr nfcAdapter(privateObject->getObject());
NFCConverter nfcConverter(context);
EventNFCChangedSetPoweredPtr event(new EventNFCChangedSetPowered(state));
- event->setPrivateData( StaticPointerCast<IEventPrivateData>(callbackManager) );
+ event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager) );
event->setForAsynchronousCall(&NFCStaticController::getInstance());
+ callbackManager->setObject(thisObject);
nfcAdapter->setPowered(event);
NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
return JSValueMakeUndefined(context);
} Catch (BasePlatformException) {
LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage());
- return JSWebAPIException::throwException(context, exception, _rethrown_exception);
+ return JSWebAPIErrorFactory::postException(context, exception, _rethrown_exception);
} Catch (ConversionException) {
LoggerE("ConversionException");
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (PlatformException) {
LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
- callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"));
+ callbackManager->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::SERVICE_NOT_AVAILABLE_ERROR, "Service Not Available"));
return JSValueMakeUndefined(context);
} Catch (WrtDeviceApis::Commons::UnknownException) {
LoggerE("UnknownException: " << _rethrown_exception.GetMessage());
} Catch(NullPointerException) {
LoggerE("Exception: " << _rethrown_exception.GetMessage());
- return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (WrtDeviceApis::Commons::Exception) {
LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
- callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error"));
+ callbackManager->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR,"Unknown Error"));
return JSValueMakeUndefined(context);
}