// limitations under the License.
//
-
#include "JSNdefMessage.h"
#include "JSNdefRecord.h"
#include "JSNdefRecordText.h"
#include "JSNdefRecordMedia.h"
#include "NFCConverter.h"
#include <GlobalContextManager.h>
-#include <dpl/log/log.h>
#include <ArgumentValidator.h>
#include <Commons/Exception.h>
#include <CommonsJavaScript/PrivateObject.h>
#include "NFCFactory.h"
#include "plugin_config.h"
+#include <Logger.h>
using namespace DeviceAPI::Common;
using namespace WrtDeviceApis::Commons;
JSClassRef JSNdefMessage::m_jsClassRef = JSClassCreate(JSNdefMessage::getClassInfo());
JSObjectRef JSNdefMessage::createJSObject(JSContextRef context, void *messageHandle) {
- LogDebug("entered");
+ LoggerD("entered");
INdefMessagePtr ndefMessage = NFCFactory::getInstance().createNDEFMessageObject(messageHandle);
return createJSObject(context, ndefMessage);
}
JSObjectRef JSNdefMessage::createJSObject(JSContextRef context) {
- LogDebug("entered");
+ LoggerD("entered");
INdefMessagePtr ndefMessage = NFCFactory::getInstance().createNDEFMessageObject();
return createJSObject(context, ndefMessage);
}
JSObjectRef JSNdefMessage::createJSObject(JSContextRef context, INdefMessagePtr message) {
- LogDebug("entered");
+ LoggerD("entered");
NFCConverter convert(context);
JSValueRef records = convert.toJSNdefRecordArray(message);
}
JSObjectRef JSNdefMessage::createJSObject(JSContextRef context, std::vector<void *> ndefRcords) {
- LogDebug("entered");
+ LoggerD("entered");
INdefMessagePtr ndefMessage = NFCFactory::getInstance().createNDEFMessageObject(ndefRcords);
return createJSObject(context, ndefMessage);
}
JSObjectRef JSNdefMessage::createJSObject(JSContextRef context, std::vector<unsigned char> rawdata) {
- LogDebug("entered");
+ LoggerD("entered");
INdefMessagePtr ndefMessage = NFCFactory::getInstance().createNDEFMessageObject(rawdata);
return createJSObject(context, ndefMessage);
}
void JSNdefMessage::initialize(JSContextRef context, JSObjectRef object)
{
- LogDebug("entered");
+ LoggerD("entered");
}
void JSNdefMessage::finalize(JSObjectRef object)
{
- LogDebug( "entered" );
+ LoggerD( "entered" );
NdefMessagePrivObject *priv = static_cast<NdefMessagePrivObject*>(JSObjectGetPrivate(object));
if (priv) {
INdefMessagePtr ndefMessage(priv->getObject());
- LogDebug("getRecordesPtr:"<<ndefMessage->getRecordesPtr());
+ LoggerD("getRecordesPtr:"<<ndefMessage->getRecordesPtr());
JSValueUnprotect(priv->getContext(), (JSValueRef)(ndefMessage->getRecordesPtr()));
JSObjectSetPrivate(object, NULL);
- LogDebug("Deleting NdefMessage object");
+ LoggerD("Deleting NdefMessage object");
delete priv;
}
}
JSObjectRef JSNdefMessage::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
- LogDebug("entered");
+ LoggerD("entered");
Try {
ArgumentValidator validator(ctx, argumentCount, arguments);
for (std::size_t i = 0; i < JSGetArrayLength(ctx, objArg); ++i) {
JSValueRef element = JSGetArrayElement(ctx, objArg, i);
bool bNdefRecord = convert.isNdefRecord(element);
- LogDebug("isNdefRecord : " << bNdefRecord);
+ LoggerD("isNdefRecord : " << bNdefRecord);
if (bNdefRecord)
isRecordArray = true;
else
*exception = error;
return error;
} Catch (WrtDeviceApis::Commons::UnknownException) {
- LogError("PlatformException: " << _rethrown_exception.GetMessage());
+ LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::Exception) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
*exception = error;
JSValueRef JSNdefMessage::getProperty(JSContextRef context, JSObjectRef object,
JSStringRef propertyName, JSValueRef* exception)
{
- LogDebug("Enter");
+ LoggerD("Enter");
Try {
NdefMessagePrivObject* privateObject = static_cast<NdefMessagePrivObject*>(JSObjectGetPrivate(object));
if (!privateObject) {
- LogError("Private object is not set.");
+ LoggerE("Private object is not set.");
ThrowMsg(NullPointerException, "Private object not initialized");
}
INdefMessagePtr ndefMessage(privateObject->getObject());
NFCConverter convert(context);
- LogDebug("propertyName : " << convert.toString(propertyName));
+ LoggerD("propertyName : " << convert.toString(propertyName));
if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFMESSAGE_RECORDCOUNT)) {
std::vector<void *> records = convert.toVectorOfRecordHandles(static_cast<JSValueRef>(ndefMessage->getRecordesPtr()));
return convert.toJSValueRefLong(records.size());
return static_cast<JSValueRef>(ndefMessage->getRecordesPtr());
}
} Catch (ConversionException) {
- LogError("ConversionException: " << _rethrown_exception.GetMessage());
+ LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
} Catch (NullPointerException) {
- LogError("NullPointerException: " << _rethrown_exception.GetMessage());
+ LoggerE("NullPointerException: " << _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());
}
return JSValueMakeUndefined(context);
}
bool JSNdefMessage::setProperty(JSContextRef context, JSObjectRef object,
JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
{
- LogDebug("Enter");
+ LoggerD("Enter");
Try {
if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFMESSAGE_RECORDS)) {
NdefMessagePrivObject* privateObject = static_cast<NdefMessagePrivObject*>(JSObjectGetPrivate(object));
if (!privateObject) {
- LogError("Private object is not set.");
+ LoggerE("Private object is not set.");
ThrowMsg(NullPointerException, "Private object not initialized");
}
if (JSValueIsNull(context, value) || JSValueIsUndefined(context, value) || !JSIsArrayValue(context, value)) {
- LogError("value is invald.");
+ LoggerE("value is invald.");
ThrowMsg(ConversionException, "value is invald.");
}
INdefMessagePtr ndefMessage(privateObject->getObject());
return true;
}
} Catch (NullPointerException) {
- LogError("NullPointerException: " << _rethrown_exception.GetMessage());
+ LoggerE("NullPointerException: " << _rethrown_exception.GetMessage());
} Catch (ConversionException) {
- LogError("ConversionException: " << _rethrown_exception.GetMessage());
+ LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
} Catch (InvalidArgumentException) {
- LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage());
+ LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage());
} Catch (PlatformException) {
- LogError("PlatformException: " << _rethrown_exception.GetMessage());
+ LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::UnknownException) {
- LogError("PlatformException: " << _rethrown_exception.GetMessage());
+ LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::Exception) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
return false;
const JSValueRef arguments[],
JSValueRef* exception)
{
- LogDebug("Entered ");
+ LoggerD("Entered ");
Try {
NdefMessagePrivObject* privateObject = static_cast<NdefMessagePrivObject*>(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");
}
INdefMessagePtr newMessage = NFCFactory::getInstance().createNDEFMessageObject(records);
return convert.toJSValueRef(newMessage->toByte());
} Catch (ConversionException) {
- LogError("ConversionException: " << _rethrown_exception.GetMessage());
+ LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (WrtDeviceApis::Commons::UnknownException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
} Catch (PlatformException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
} Catch(NullPointerException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (WrtDeviceApis::Commons::Exception) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");