wrt-plugins-tizen_0.4.23
[framework/web/wrt-plugins-tizen.git] / src / SecureElement / JSSEService.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 285af13..ff34db2
@@ -15,9 +15,6 @@
 // limitations under the License.
 //
 
-
-#include <dpl/log/log.h>
-
 #include <CommonsJavaScript/Validator.h>
 #include <CommonsJavaScript/Converter.h>
 #include <Commons/Exception.h>
@@ -37,6 +34,7 @@
 #include "SEListenerManager.h"
 #include "SEConverter.h"
 #include "plugin_config.h"
+#include <Logger.h>
 
 using namespace DeviceAPI::Common;
 using namespace WrtDeviceApis::Commons;
@@ -87,27 +85,27 @@ void JSSEService::initialize(JSContextRef context, JSObjectRef object)
                        ISEServicePtr seService( SEFactory::getInstance().createSEServiceObject() );
                        priv = new SEServicePrivObject(context, seService);
                        if(!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
-                               LogError("Object can't store private data.");
+                               LoggerE("Object can't store private data.");
                                delete priv;
                        }
                } Catch (UnsupportedException) {
-                       LogError("UnsupportedException: " << _rethrown_exception.GetMessage());
+                       LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage());
                } Catch (WrtDeviceApis::Commons::UnknownException) {
-                       LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage());
+                       LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage());
                } Catch (PlatformException) {
-                       LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage());
+                       LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage());
                } Catch (WrtDeviceApis::Commons::Exception) {
-                       LogError("Exception: " << _rethrown_exception.GetMessage());
+                       LoggerE("Exception: " << _rethrown_exception.GetMessage());
                }
        }
 }
 
 void JSSEService::finalize(JSObjectRef object)
 {
-       LogDebug( "entered" );
+       LoggerD( "entered" );
        SEServicePrivObject *priv = static_cast<SEServicePrivObject*>( JSObjectGetPrivate( object ) ) ;
        JSObjectSetPrivate(object, NULL);
-       LogDebug("Deleting SEService object");
+       LoggerD("Deleting SEService object");
        delete priv;
 }
 
@@ -140,7 +138,7 @@ JSValueRef JSSEService::getReaders(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       LogDebug("Entered ");
+       LoggerD("Entered ");
 
     AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -159,13 +157,13 @@ JSValueRef JSSEService::getReaders(JSContextRef context,
                        onErrorForCbm = arguments[1];
                }
        } catch (const BasePlatformException &err) {
-        LogError(err.getName() << ": " << err.getMessage());
+        LoggerE(err.getName() << ": " << err.getMessage());
         return JSWebAPIException::throwException(context, exception, err);
     }
 
        SEServicePrivObject* privateObject = static_cast<SEServicePrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
-               LogError("private object is null");
+               LoggerE("private object is null");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
@@ -181,12 +179,12 @@ JSValueRef JSSEService::getReaders(JSContextRef context,
                SEAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, privateObject->getContext());
                return JSValueMakeUndefined(context);
        } Catch (ConversionException) {
-               LogError("ConversionException");
+               LoggerE("ConversionException");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (WrtDeviceApis::Commons::UnknownException) {
-               LogError("UnknownException: " << _rethrown_exception.GetMessage());
+               LoggerE("UnknownException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
        callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error"));
@@ -200,7 +198,7 @@ JSValueRef JSSEService::registerSEListener(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       LogDebug("Entered ");
+       LoggerD("Entered ");
 
     AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -220,14 +218,14 @@ JSValueRef JSSEService::registerSEListener(JSContextRef context,
                seListener = convert.toSEListener(arguments[0]);
        } else {
                /* 1st argument must be SEListener. */
-               LogError("SEListener must has onSEReady and onSENotReady");
+               LoggerE("SEListener must has onSEReady and onSENotReady");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
 
        SEServicePrivObject* privateObject = static_cast<SEServicePrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
-               LogError("private object is null");
+               LoggerE("private object is null");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
@@ -246,12 +244,12 @@ JSValueRef JSSEService::registerSEListener(JSContextRef context,
 
                return convert.toJSValueRefLong(static_cast<long>(emitter->getId()));
        } Catch (ConversionException) {
-               LogError("ConversionException");
+               LoggerE("ConversionException");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (WrtDeviceApis::Commons::UnknownException) {
-               LogError("UnknownException: " << _rethrown_exception.GetMessage());
+               LoggerE("UnknownException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR,"Unknown Error");
@@ -259,7 +257,7 @@ JSValueRef JSSEService::registerSEListener(JSContextRef context,
 
 JSValueRef JSSEService::unregisterSEListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject,
                size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
-       LogDebug("Enter");
+       LoggerD("Enter");
 
     AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -274,7 +272,7 @@ JSValueRef JSSEService::unregisterSEListener(JSContextRef context, JSObjectRef o
 
        SEServicePrivObject* privateObject = static_cast<SEServicePrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
-               LogError("private object is null");
+               LoggerE("private object is null");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
@@ -290,14 +288,14 @@ JSValueRef JSSEService::unregisterSEListener(JSContextRef context, JSObjectRef o
 
                return JSValueMakeUndefined(context);
        } Catch (ConversionException) {
-               LogError("ConversionException");
+               LoggerE("ConversionException");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (NullPointerException) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (WrtDeviceApis::Commons::NotFoundException) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Not Found ID");
        } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
 }
@@ -309,14 +307,14 @@ JSValueRef JSSEService::shutdown(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       LogDebug("Entered ");
+       LoggerD("Entered ");
 
     AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        SEServicePrivObject* privateObject = static_cast<SEServicePrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
-               LogError("private object is null");
+               LoggerE("private object is null");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
@@ -325,9 +323,9 @@ JSValueRef JSSEService::shutdown(JSContextRef context,
                seService->shutdown();
                return JSValueMakeUndefined(context);
        } Catch (WrtDeviceApis::Commons::UnknownException) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
 }