Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.8
+Version: 0.4.9
Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
--- /dev/null
+Name: wrt-plugins-tizen
+Summary: JavaScript plugins for WebRuntime
+<<<<<<< HEAD
+Version: 0.4.8
+=======
+Version: 0.4.9
+>>>>>>> f5f8121... Update change log and spec for wrt-plugins-tizen_0.4.9
+Release: 0
+Group: Development/Libraries
+License: Apache License, Version 2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(capi-web-favorites)
+BuildRequires: pkgconfig(mm-fileinfo)
+BuildRequires: pkgconfig(libpcrecpp)
+BuildRequires: pkgconfig(calendar-service2)
+BuildRequires: pkgconfig(contacts-service2)
+BuildRequires: pkgconfig(msg-service)
+BuildRequires: pkgconfig(email-service)
+BuildRequires: pkgconfig(accounts-svc)
+BuildRequires: pkgconfig(tapi)
+BuildRequires: pkgconfig(icu-i18n)
+BuildRequires: pkgconfig(icu-io)
+BuildRequires: pkgconfig(icu-le)
+BuildRequires: pkgconfig(icu-lx)
+BuildRequires: pkgconfig(icu-uc)
+BuildRequires: pkgconfig(network)
+BuildRequires: pkgconfig(appsvc)
+BuildRequires: pkgconfig(devman)
+BuildRequires: pkgconfig(ewebkit2)
+BuildRequires: pkgconfig(dpl-efl)
+BuildRequires: pkgconfig(dpl-event-efl)
+BuildRequires: pkgconfig(wrt-plugins-types)
+BuildRequires: pkgconfig(wrt-plugins-commons)
+BuildRequires: pkgconfig(wrt-plugins-commons-javascript)
+BuildRequires: pkgconfig(wrt-plugins-plugin-manager)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(capi-network-nfc)
+BuildRequires: pkgconfig(capi-location-geocoder)
+BuildRequires: pkgconfig(capi-location-manager)
+BuildRequires: pkgconfig(capi-location-poi)
+BuildRequires: pkgconfig(capi-location-route)
+BuildRequires: pkgconfig(capi-network-bluetooth)
+BuildRequires: pkgconfig(capi-network-connection)
+BuildRequires: pkgconfig(capi-telephony-call)
+BuildRequires: pkgconfig(capi-telephony-sim)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(capi-system-runtime-info)
+BuildRequires: pkgconfig(sensor)
+BuildRequires: pkgconfig(capi-system-sensor)
+BuildRequires: pkgconfig(capi-system-power)
+BuildRequires: pkgconfig(pmapi)
+BuildRequires: pkgconfig(capi-system-system-settings)
+BuildRequires: pkgconfig(capi-system-device)
+BuildRequires: pkgconfig(capi-content-media-content)
+BuildRequires: pkgconfig(capi-media-metadata-extractor)
+BuildRequires: pkgconfig(smartcard-service-common)
+BuildRequires: pkgconfig(smartcard-service)
+BuildRequires: pkgconfig(pkgmgr)
+BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(capi-appfw-package-manager)
+BuildRequires: pkgconfig(capi-web-url-download)
+BuildRequires: pkgconfig(push)
+BuildRequires: pkgconfig(notification)
+BuildRequires: pkgconfig(message-port)
+BuildRequires: pkgconfig(sync-agent)
+BuildRequires: expat-devel
+BuildRequires: cmake
+BuildRequires: gettext-devel
+BuildRequires: boost-devel
+BuildRequires: boost-thread
+BuildRequires: boost-system
+BuildRequires: boost-filesystem
+
+%description
+JavaScript plugins for WebRuntime
+
+%package devel
+Summary: Wrt-plugin-tizen development headers
+Group: Development/Libraries
+Requires: %{name} = %{version}
+
+%description devel
+Wrt-plugin-tizen development headers
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "%{_libdir}/wrt-plugins"
+
+export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DDPL_LOG="ON"
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post
+
+%postun
+
+
+%files
+%manifest wrt-plugins-tizen.manifest
+%{_libdir}/wrt-plugins/*
+/usr/etc/tizen-apis/*
+
+%files devel
+%{_includedir}/*
+%{_libdir}/pkgconfig/*
SET(DESTINATION_NAME ${alarm_dest})
SET(TARGET_IMPL_NAME ${alarm_impl})
-PKG_SEARCH_MODULE(application REQUIRED capi-appfw-application)
+PKG_CHECK_MODULES(platform_pkgs_alarm REQUIRED capi-appfw-application)
INCLUDE_DIRECTORIES(
- ${application_INCLUDE_DIRS}
+ ${platform_pkgs_alarm_INCLUDE_DIRS}
${TOP}/Common
${TOP}/Application
${TOP}/TimeUtil
${CMAKE_INSTALL_RPATH}
${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${tizen_dest}
${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${application_dest}
- ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${timze_dest}
${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
)
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${application_LIBRARIES}
+ ${platform_pkgs_alarm_LIBRARIES}
+ ${application_impl}
+ ${tizen_impl}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${application_impl}
- ${application_config}
- ${tizen_impl}
- ${timeutil_impl}
- )
+ "-Wl,--no-as-needed" ${application_config}
+)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/alarm
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/alarm
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
SET(TARGET_IMPL_NAME ${application_impl})
SET(TARGET_CONFIG_NAME ${application_config})
-PKG_SEARCH_MODULE(app-manager REQUIRED capi-appfw-app-manager)
-PKG_SEARCH_MODULE(application REQUIRED capi-appfw-application)
-PKG_SEARCH_MODULE(package-manager REQUIRED capi-appfw-package-manager)
-PKG_SEARCH_MODULE(pkgmgr REQUIRED pkgmgr)
-PKG_SEARCH_MODULE(pkgmgr-info REQUIRED pkgmgr-info)
+PKG_CHECK_MODULES(platform_pkgs_application REQUIRED
+ capi-appfw-app-manager
+ capi-appfw-application
+ capi-appfw-package-manager
+ pkgmgr
+ pkgmgr-info
+)
INCLUDE_DIRECTORIES(
${TOP}/Common
${TOP}/Application
- ${app-manager_INCLUDE_DIRS}
- ${application_INCLUDE_DIRS}
- ${package-manager_INCLUDE_DIRS}
- ${pkgmgr_INCLUDE_DIRS}
- ${pkgmgr-info_INCLUDE_DIRS}
+ ${platform_pkgs_application_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
SET(SRCS_IMPL
ApplicationContext.cpp
- ApplicationControl.cpp
+ ApplicationControl.cpp
ApplicationControlData.cpp
RequestedApplicationControl.cpp
ApplicationFactory.cpp
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${app-manager_LIBRARIES}
- ${application_LIBRARIES}
- ${package-manager_LIBRARIES}
- ${pkgmgr_LIBRARIES}
- ${pkgmgr-info_LIBRARIES}
+ ${platform_pkgs_application_LIBRARIES}
)
SET(SRCS_CONFIG
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/application
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/application
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
std::map<std::string, void*>::iterator it =
m_devicePrivateObjectMap.find(deviceAddress);
- if (it != m_devicePrivateObjectMap.end())
+ if (type != FROM_SERVICE && it != m_devicePrivateObjectMap.end())
{
ThrowMsg(WrtDeviceApis::Commons::AlreadyInUseException, "connecting to same device address");
}
void BluetoothConverter::setBluetoothSocketNotifierCallback(JSStringRef propertyName, JSValueRef value,
JSObjectRef object, BluetoothSocketNotifierPrivateDataPtr& privData)
{
- JSValueRef successCallback = toFunction(value);
+ JSValueRef successCallback = toFunctionOrNull(value);
if(JSStringIsEqualToUTF8CString(propertyName, "onclose"))
{
m_emitter = emitter;
}
+EventBTServiceOnConnectEmitterPtr BluetoothServiceHandlerManager::getServiceHandlerListener()
+{
+ return m_emitter;
+}
std::string BluetoothServiceHandlerManager::getUUID()
{
virtual ~BluetoothServiceHandlerManager();
virtual void unRegister(const EventBTUnregisterRFCOMMServicePtr &event);
virtual void setServiceHandlerListener(const EventBTServiceOnConnectEmitterPtr& emitter);
+ virtual EventBTServiceOnConnectEmitterPtr getServiceHandlerListener();
virtual void setUUID(std::string uuid);
virtual std::string getUUID();
virtual void setRegisterSocket(int socket);
SET(DESTINATION_NAME ${bluetooth_dest})
SET(TARGET_IMPL_NAME ${bluetooth_impl})
+PKG_CHECK_MODULES(platform_pkgs_bluetooth REQUIRED capi-network-bluetooth)
+
+INCLUDE_DIRECTORIES(
+ ${TOP}/Common
+ ${platform_pkgs_bluetooth_INCLUDE_DIRS}
+)
+
SET(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_RPATH}
${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
)
-PKG_SEARCH_MODULE(capi-network-bluetooth REQUIRED capi-network-bluetooth)
-
-INCLUDE_DIRECTORIES(${capi-network-bluetooth_INCLUDE_DIRS}
- ${TOP}/Common
-)
-
SET(SRCS_PLATFORM_API_BLUETOOTH
BluetoothFactory.cpp
EventBTGetKnownDevices.cpp
IBluetoothServiceHandlerManager.cpp
IBluetoothSocketManager.cpp
)
+
SET(SRCS_PLATFORM_IMPLEMENTATION_BLUETOOTH
BluetoothAdapterManager.cpp
BluetoothDeviceManager.cpp
BluetoothServiceHandlerManager.cpp
BluetoothCBManager.cpp
)
+
SET(SRCS_IMPL
- ${SRCS_PLATFORM_IMPLEMENTATION_BLUETOOTH}
+ ${SRCS_PLATFORM_IMPLEMENTATION_BLUETOOTH}
${SRCS_PLATFORM_API_BLUETOOTH}
- BluetoothAdapterListener.cpp
- BluetoothSocketListener.cpp
+ BluetoothAdapterListener.cpp
+ BluetoothSocketListener.cpp
BluetoothDeviceManagerListener.cpp
- BluetoothClass.cpp
+ BluetoothClass.cpp
BluetoothMultiCallback.cpp
BluetoothConverter.cpp
- JSBluetoothAdapter.cpp
- JSBluetoothDevice.cpp
- JSBluetoothClass.cpp
- JSBluetoothClassDeviceMajor.cpp
- JSBluetoothClassDeviceMinor.cpp
+ JSBluetoothAdapter.cpp
+ JSBluetoothDevice.cpp
+ JSBluetoothClass.cpp
+ JSBluetoothClassDeviceMajor.cpp
+ JSBluetoothClassDeviceMinor.cpp
JSBluetoothClassDeviceService.cpp
JSBluetoothServiceHandler.cpp
- JSBluetoothManager.cpp
+ JSBluetoothManager.cpp
JSBluetoothSocket.cpp
JSBluetoothDevice.cpp
)
-SET(SRCS
- plugin_config.cpp
- plugin_initializer.cpp
-)
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${capi-network-bluetooth_LIBRARIES}
+ ${platform_pkgs_bluetooth_LIBRARIES}
+)
+
+SET(SRCS
+ plugin_config.cpp
+ plugin_initializer.cpp
)
ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/bluetooth
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/bluetooth
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
virtual ~IBluetoothServiceHandlerManager();
virtual void unRegister(const EventBTUnregisterRFCOMMServicePtr &event) = 0;
virtual void setServiceHandlerListener(const EventBTServiceOnConnectEmitterPtr& emitter) = 0;
+ virtual EventBTServiceOnConnectEmitterPtr getServiceHandlerListener() = 0;
virtual void setUUID(std::string uuid) = 0;
virtual std::string getUUID() = 0;
virtual void setRegisterSocket(int socket) = 0;
{
LogError("Unkwon Exception");
}
- return JSValueMakeNull(context);
+ return JSValueMakeUndefined(context);
}
JSValueRef JSBluetoothClass::hasService(JSContextRef context, JSObjectRef object,
JSStaticValue JSBluetoothServiceHandler::m_properties[] =
{
{"uuid", getUuid, NULL, kJSPropertyAttributeReadOnly},
- {"onconnect", NULL, setOnConnect, kJSPropertyAttributeNone},
+ {"onconnect", getOnConnect, setOnConnect, kJSPropertyAttributeNone},
{"name", getName, NULL, kJSPropertyAttributeReadOnly},
{"isConnected", getIsConnected, NULL, kJSPropertyAttributeReadOnly},
{0, 0, 0, 0}
try
{
JSBluetoothServiceHandlerPriv *priv = static_cast<JSBluetoothServiceHandlerPriv*>(JSObjectGetPrivate(object));
+ if (priv == NULL)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "private object null");
+ }
+
BluetoothConverter converter(priv->getContext());
JSValueRef successCallback = NULL;
JSValueRef errorCallback = NULL;
- if (priv == NULL)
+ if( JSValueIsNull(context, value) ||
+ JSObjectIsFunction(context, converter.toJSObjectRef(value)) )
+ {
+ LogDebug("Callable or null");
+ successCallback = converter.toFunctionOrNull(value);
+ }
+ else
{
- ThrowMsg(UnknownException, "private object null");
+ ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Non callable object");
}
JSCallbackManagerPtr cbm = JSCallbackManager::createObject(priv->getContext(), NULL, NULL);
-
if (cbm == NULL)
{
- ThrowMsg(ConversionException, "callback manager creation fail");
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "callback manager creation fail");
}
-
- successCallback = converter.toFunction(value);
cbm->setOnSuccess(successCallback);
cbm->setOnError(errorCallback);
- //cbm->setObject(object);
IBluetoothServiceHandlerManagerPtr BluetoothServiceHandlerManager(priv->getObject());
EventBTServiceOnConnectEmitterPtr emitter(new EventBTServiceOnConnectEmitter);
+ if (BluetoothServiceHandlerManager == NULL || emitter == NULL)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException,
+ "IBluetoothServiceHandlerManagerPtr or EventBTServiceOnConnectEmitterPtr is NULL");
+ }
emitter->setListener(&BluetoothAdapterListener::getInstance());
emitter->setEventPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData>(cbm));
BluetoothServiceHandlerManager->setServiceHandlerListener(emitter);
-
+
return true;
}
- catch (const WrtDeviceApis::Commons::Exception& ex)
+ catch (const WrtDeviceApis::Commons::ConversionException& ex)
{
LogError("Exception: " << ex.GetMessage());
+ *exception = JSTizenExceptionFactory::makeErrorObject(context,
+ JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
+ }
+ catch (const WrtDeviceApis::Commons::Exception& ex)
+ {
+ LogWarning("Exception: " << ex.GetMessage());
+ }
+
+ return false;
+}
+
+
+JSValueRef JSBluetoothServiceHandler::getOnConnect(JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef* exception)
+{
+ LogDebug("OK");
- switch (ex.getCode())
+ try
+ {
+ JSBluetoothServiceHandlerPriv *priv = static_cast<JSBluetoothServiceHandlerPriv*>(JSObjectGetPrivate(object));
+ if (priv == NULL)
{
- case WrtDeviceApis::Commons::ExceptionCodes::ConversionException:
- JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
- break;
- case WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException:
- JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::INVALID_VALUES_ERROR, "invalid parameter error");
- break;
- case WrtDeviceApis::Commons::ExceptionCodes::Exception:
- default:
- JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::UNKNOWN_ERROR, "Unkown error");
+ ThrowMsg(WrtDeviceApis::Commons::ConversionException, "private object null");
}
- }
- return false;
-}
+ IBluetoothServiceHandlerManagerPtr BluetoothServiceHandlerManager(priv->getObject());
+ if(BluetoothServiceHandlerManager == NULL)
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "IBluetoothServiceHandlerManagerPtr is null");
+ EventBTServiceOnConnectEmitterPtr emitter = BluetoothServiceHandlerManager->getServiceHandlerListener();
+ if(emitter == NULL)
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "EventBTServiceOnConnectEmitterPtr is null");
+ JSCallbackManagerPtr privData =
+ DPL::DynamicPointerCast<JSCallbackManager>(emitter->getEventPrivateData());
+
+ if(privData == NULL)
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "JSCallbackManagerPtr is null");
+
+ JSValueRef callback = privData->getOnSuccess();
+ if(callback == NULL)
+ {
+ LogDebug("callback is NULL");
+ }
+ else
+ {
+ LogDebug("callback is not NULL");
+ return callback;
+ }
+ }
+ catch (const WrtDeviceApis::Commons::Exception& ex)
+ {
+ LogWarning("Exception: " << ex.GetMessage());
+ }
+
+ return JSValueMakeNull(context);
+}
JSValueRef JSBluetoothServiceHandler::getUuid(JSContextRef context,
LogWarning("Exception: " << ex.GetMessage());
}
- return NULL;
+ return JSValueMakeUndefined(context);
}
LogWarning("Exception"<<ex.GetMessage());
}
- return NULL;
+ return JSValueMakeUndefined(context);
}
JSValueRef JSBluetoothServiceHandler::getIsConnected(JSContextRef context,
LogWarning("Exception"<<ex.GetMessage());
}
- return NULL;
+ return JSValueMakeUndefined(context);
}
const JSClassDefinition* JSBluetoothServiceHandler::getClassInfo()
static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
static JSValueRef getUuid(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
static bool setOnConnect(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
+ static JSValueRef getOnConnect(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
static void getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames);
static JSValueRef unregisterRFCOMMService(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
const JSValueRef arguments[], JSValueRef* exception);
m_function,
initialize,
finalize,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
NULL,
NULL,
hasInstance,
// {"protocol", getProperty, NULL, kJSPropertyAttributeReadOnly},
{"state", getProperty, NULL, kJSPropertyAttributeReadOnly},
{"peer", getProperty, NULL, kJSPropertyAttributeReadOnly},
- {"onerror", NULL, setProperty, kJSPropertyAttributeNone},
- {"onmessage", NULL, setProperty, kJSPropertyAttributeNone},
- {"onclose", NULL, setProperty, kJSPropertyAttributeNone},
+ {"onerror", getCallback, setProperty, kJSPropertyAttributeNone},
+ {"onmessage", getCallback, setProperty, kJSPropertyAttributeNone},
+ {"onclose", getCallback, setProperty, kJSPropertyAttributeNone},
{0, 0, 0, 0}
};
JSObjectRef JSBluetoothSocket::m_peer = NULL;
-
bool JSBluetoothSocket::setProperty(JSContextRef context,
JSObjectRef object,
JSStringRef propertyName,
JSValueRef* exception)
{
LogDebug("OK");
-
- try
+
+ try
{
JSBluetoothSocketPriv *priv = static_cast<JSBluetoothSocketPriv*>(JSObjectGetPrivate(object));
+ if (priv == NULL)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "private object is null");
+ }
+
IBluetoothSocketManagerPtr BluetoothSocketManager(priv->getObject());
BluetoothConverter converter(priv->getContext());
-
- if (priv == NULL)
+ if (BluetoothSocketManager == NULL)
{
- ThrowMsg(ConversionException, "private object null");
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "BluetoothManager is NULL");
}
EventBTSocketNotificationEmitterPtr emitter = BluetoothSocketManager->getSocketNotifier();
-
- if (BluetoothSocketManager == NULL || emitter == NULL)
+ if (emitter == NULL)
{
- LogError("BluetoothManager or event or listener NULL");
- Throw(WrtDeviceApis::Commons::UnknownException);
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "emitter is NULL");
}
-
- BluetoothSocketNotifierPrivateDataPtr privData =
+
+ BluetoothSocketNotifierPrivateDataPtr privData =
DPL::DynamicPointerCast<BluetoothSocketNotifierPrivateData>(emitter->getEventPrivateData());
if (privData == NULL)
{
- LogError("privData NULL");
- Throw(WrtDeviceApis::Commons::UnknownException);
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "BluetoothSocketNotifierPrivateData is NULL");
+ }
+
+ if(JSValueIsNull(context, value) ||
+ JSObjectIsFunction(context, converter.toJSObjectRef(value)) )
+ {
+ LogDebug("Callable or null");
+ converter.setBluetoothSocketNotifierCallback(propertyName, value, object, privData);
+ }
+ else
+ {
+ ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Non callable object");
}
- converter.setBluetoothSocketNotifierCallback(propertyName, value, object, privData);
emitter->setListener(&BluetoothSocketListener::getInstance());
emitter->setEventPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData>(privData));
return true;
}
- catch (WrtDeviceApis::Commons::Exception& ex)
+ catch (const WrtDeviceApis::Commons::ConversionException& ex)
{
LogError("Exception: " << ex.GetMessage());
-
- switch (ex.getCode())
- {
- case WrtDeviceApis::Commons::ExceptionCodes::ConversionException:
- JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
- break;
- case WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException:
- JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::INVALID_VALUES_ERROR, "invalid parameter error");
- break;
- case WrtDeviceApis::Commons::ExceptionCodes::Exception:
- default:
- JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::UNKNOWN_ERROR, "Unkown error");
- }
+ *exception = JSTizenExceptionFactory::makeErrorObject(context,
+ JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
}
- return false;
+ catch (WrtDeviceApis::Commons::Exception& ex)
+ {
+ LogWarning("Exception: " << ex.GetMessage());
+ }
+ return false;
}
void JSBluetoothSocket::initialize(JSContextRef context, JSObjectRef object)
BluetoothSocketManager->setReadData(readData);
return JSObjectMake(context, getClassRef(), priv);
}
+
JSValueRef JSBluetoothSocket::getProperty(JSContextRef context,
JSObjectRef object,
JSStringRef propertyName,
JSValueRef* exception)
{
- LogDebug("OK");
+ LogDebug("OK");
Try
{
+ if(JSStringIsEqualToUTF8CString(propertyName, "peer") && m_peer != NULL)
+ return m_peer;
+
JSBluetoothSocketPriv *priv = static_cast<JSBluetoothSocketPriv*>(JSObjectGetPrivate(object));
+ if (priv == NULL)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::ConversionException, "private object null");
+ }
+
IBluetoothSocketManagerPtr BluetoothSocketManager(priv->getObject());
BluetoothConverter converter(priv->getContext());
-
- if (priv == NULL)
+ if (BluetoothSocketManager == NULL)
{
- LogError("priv null");
- Throw(WrtDeviceApis::Commons::ConversionException);
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "BluetoothManager is NULL");
}
if(JSStringIsEqualToUTF8CString(propertyName, "uuid"))
std::string uuid = BluetoothSocketManager->getUUID();
return converter.toJSValueRef(uuid);
}
- else if(JSStringIsEqualToUTF8CString(propertyName, "protocol"))
- {
- unsigned short int protocol = BluetoothSocketManager->getProtocol();
- return converter.toBluetoothProtocolJSValue(protocol);
-
- }
else if(JSStringIsEqualToUTF8CString(propertyName, "state"))
{
unsigned short int state = BluetoothSocketManager->getState();
return converter.toBluetoothStateJSValue(state);
}
- else if(JSStringIsEqualToUTF8CString(propertyName, "peer"))
+ else
{
- if(m_peer == NULL)
- {
- BluetoothDeviceData device = BluetoothSocketManager->getPeer();
- m_peer = JSBluetoothDevice::createJSObject(priv->getContext(), device);
- }
-
+ BluetoothDeviceData device = BluetoothSocketManager->getPeer();
+ m_peer = JSBluetoothDevice::createJSObject(priv->getContext(), device);
return m_peer;
}
}
return JSValueMakeUndefined(context);
}
+JSValueRef JSBluetoothSocket::getCallback(JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef* exception)
+{
+ LogDebug("OK");
+
+ Try
+ {
+ JSBluetoothSocketPriv *priv = static_cast<JSBluetoothSocketPriv*>(JSObjectGetPrivate(object));
+ if (priv == NULL)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::ConversionException, "private object null");
+ }
+
+ IBluetoothSocketManagerPtr BluetoothSocketManager(priv->getObject());
+ BluetoothConverter converter(priv->getContext());
+ if (BluetoothSocketManager == NULL)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "BluetoothManager is NULL");
+ }
+
+ EventBTSocketNotificationEmitterPtr emitter = BluetoothSocketManager->getSocketNotifier();
+ if (emitter == NULL)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "emitter is NULL");
+ }
+
+ BluetoothSocketNotifierPrivateDataPtr privData =
+ DPL::DynamicPointerCast<BluetoothSocketNotifierPrivateData>(emitter->getEventPrivateData());
+
+ if (privData == NULL)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "privData NULL");
+ }
+
+ if(JSStringIsEqualToUTF8CString(propertyName, "onmessage"))
+ {
+ JSValueRef callback = privData->getOnMessage()->getOnSuccess();
+ if(callback == NULL)
+ {
+ LogDebug("callback is NULL");
+ }
+ else
+ {
+ LogDebug("callback is not NULL");
+ return callback;
+ }
+ }
+ else if(JSStringIsEqualToUTF8CString(propertyName, "onclose"))
+ {
+ JSValueRef callback = privData->getOnClose()->getOnSuccess();
+ if(callback == NULL)
+ {
+ LogDebug("callback is NULL");
+ }
+ else
+ {
+ LogDebug("callback is not NULL");
+ return callback;
+ }
+ }
+ else if(JSStringIsEqualToUTF8CString(propertyName, "onerror"))
+ {
+ JSValueRef callback = privData->getOnError()->getOnSuccess();
+ if(callback == NULL)
+ {
+ LogDebug("callback is NULL");
+ }
+ else
+ {
+ LogDebug("callback is not NULL");
+ return callback;
+ }
+ }
+ }
+ Catch(WrtDeviceApis::Commons::Exception)
+ {
+ LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ }
+
+ return JSValueMakeNull(context);
+}
+
JSValueRef JSBluetoothSocket::writeData(JSContextRef context, JSObjectRef object,
JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
JSTizenException::UNKNOWN_ERROR, "unknown error");
}
}
+
+
}
}
JSStringRef propertyName,
JSValueRef* exception);
+ static JSValueRef getCallback(JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef* exception);
+
static JSClassDefinition m_classInfo;
static JSStaticFunction m_function[];
static JSStaticValue m_properties[];
folders.push((it->second).get());
if ((it->second)->m_id != lastItemId) {
- LogDebug("not last");
+ LogDebug("not last item");
it++;
LogDebug("it->first:"<<it->first << " it->second:" <<(it->second)->m_id);
} else
SET(DESTINATION_NAME ${bookmark_dest})
SET(TARGET_IMPL_NAME ${bookmark_impl})
-PKG_SEARCH_MODULE(favorites REQUIRED capi-web-favorites)
+PKG_CHECK_MODULES(platform_pkgs_bookmark REQUIRED capi-web-favorites)
SET(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_RPATH}
${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
)
+INCLUDE_DIRECTORIES(
+ ${TOP}/Common
+ ${platform_pkgs_bookmark_INCLUDE_DIRS}
+)
+
SET(SRCS_IMPL
JSBookmarkManager.cpp
BookmarkManager.cpp
JSBookmarkItem.cpp
)
-INCLUDE_DIRECTORIES(
- ${TOP}/Common
- ${favorites_INCLUDE_DIRS}
-)
-
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${favorites_LIBRARIES}
+ ${platform_pkgs_bookmark_LIBRARIES}
)
SET(SRCS
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/bookmark
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/bookmark
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
#include <JSTizenException.h>
#include <SecurityExceptions.h>
#include <CommonsJavaScript/Converter.h>
-#include <ArgumentValidationChecker.h>
#include <GlobalContextManager.h>
#include "JSBookmarkManager.h"
#include "JSBookmarkFolder.h"
# -----------------------------------------------------------------------------
add_plugin(
+ TimeUtil
Tizen
Content
Calendar
Application
Messaging
Callhistory
- TimeUtil
Systeminfo
NFC
Log
SET(DESTINATION_NAME ${calendar_dest})
SET(TARGET_IMPL_NAME ${calendar_impl})
-PKG_SEARCH_MODULE(calendar REQUIRED calendar-service2)
-PKG_SEARCH_MODULE(icu REQUIRED icu-i18n)
+PKG_CHECK_MODULES(platform_pkgs_calendar REQUIRED calendar-service2 icu-i18n)
+
+INCLUDE_DIRECTORIES(
+ ${TOP}/Tizen
+ ${TOP}/TimeUtil
+ ${TOP}/Contact
+ ${TOP}/Common
+ ${platform_pkgs_calendar_INCLUDE_DIRS}
+)
SET(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_RPATH}
EventRecurrenceRule.cpp
EventId.cpp
EventAlarm.cpp
- CalendarUtility.cpp
-)
-
-INCLUDE_DIRECTORIES(
- ${TOP}/Tizen
- ${TOP}/TimeUtil
- ${TOP}/Contact
- ${TOP}/Common
- ${calendar_INCLUDE_DIRS}
- ${icu_INCLUDE_DIRS}
+ CalendarUtility.cpp
)
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${calendar_LIBRARIES}
- ${icu_LIBRARIES}
+ ${tizen_impl}
+ ${timeutil_impl}
+ ${contact_impl}
+ ${platform_pkgs_calendar_LIBRARIES}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${contact_impl}
- ${contact_config}
- ${tizen_impl}
- ${timeutil_impl}
- ${LIBS_COMMON}
+ "-Wl,--no-as-needed" ${contact_config}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/calendar
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/calendar
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
calendar_list_next(resultList);
}
- LogDebug("Length of found events: "<<event->getEvents()->size());
+ LogDebug("Length of found items: "<<event->getEvents()->size());
+
+ // Handle the recurring event range filter corner case.
+ int id = -1, parentCount = -1;
+ bool found = false;
+ resultList = calendarFilter->getNormalInstanceResultRecordList();
+ count = calendarFilter->getNormalInstanceResultRecordCount();
+ LogDebug("Number of found normal instances: "<<count);
+
+ currentRecord = NULL;
+ calendar_list_first(resultList);
+ while(count--) {
+ currentRecord = NULL;
+ ret = calendar_list_get_current_record_p(resultList, ¤tRecord);
+ if ( CALENDAR_ERROR_NONE != ret ) {
+ ThrowMsg(PlatformException, "Can't get a current record: "<<ret);
+ }
+
+ id = -1;
+ ret = calendar_record_get_int(currentRecord, _calendar_instance_normal_calendar_book.event_id, &id);
+ if (CALENDAR_ERROR_NONE != ret) {
+ ThrowMsg(PlatformException, "Can't get the normal instance parent id: "<<ret);
+ }
+
+ // Skip if the parent event is already found.
+ parentCount = event->getEvents()->size();
+ found = false;
+ while(parentCount--) {
+ if(id==event->getEvents()->at(parentCount)->getId()) {
+ LogDebug("Found the id: "<<id<<", thus skip this.");
+ found = true;
+ break;
+ }
+ }
+
+ if(false==found) {
+ LogDebug("Add the normal instance parent: "<<id);
+ DPL::ScopedPtr<EventWrapper> eventWrapper(new EventWrapper(getType()));
+ eventWrapper->loadEvent(id);
+ event->addEvent(eventWrapper->convertPlatformEventToAbstractEvent());
+ }
+
+ calendar_list_next(resultList);
+ }
+ LogDebug("Length of found items including normal instances: "<<event->getEvents()->size());
+
+ resultList = calendarFilter->getAlldayInstanceResultRecordList();
+ count = calendarFilter->getAlldayInstanceResultRecordCount();
+ LogDebug("Number of found allday instances: "<<count);
+
+ currentRecord = NULL;
+ calendar_list_first(resultList);
+ while(count--) {
+ currentRecord = NULL;
+ ret = calendar_list_get_current_record_p(resultList, ¤tRecord);
+ if ( CALENDAR_ERROR_NONE != ret ) {
+ ThrowMsg(PlatformException, "Can't get a current record: "<<ret);
+ }
+
+ id = -1;
+ ret = calendar_record_get_int(currentRecord, _calendar_instance_allday_calendar_book.event_id, &id);
+ if (CALENDAR_ERROR_NONE != ret) {
+ ThrowMsg(PlatformException, "Can't get the allday instance parent id: "<<ret);
+ }
+
+ // Skip if the parent event is already found.
+ parentCount = event->getEvents()->size();
+ found = false;
+ while(parentCount--) {
+ if(id==event->getEvents()->at(parentCount)->getId()) {
+ LogDebug("Found the id: "<<id<<", thus skip this.");
+ found = true;
+ break;
+ }
+ }
+
+ if(false==found) {
+ LogDebug("Add the allday instance parent: "<<id);
+ DPL::ScopedPtr<EventWrapper> eventWrapper(new EventWrapper(getType()));
+ eventWrapper->loadEvent(id);
+ event->addEvent(eventWrapper->convertPlatformEventToAbstractEvent());
+ }
+
+ calendar_list_next(resultList);
+ }
+ LogDebug("Length of found items including allday instances: "<<event->getEvents()->size());
event->setResult(true);
}
m_filter = NULL;
m_recordList = NULL;
m_recordCount = 0;
+ m_normalInstanceRecordList = NULL;
+ m_normalInstanceRecordCount = 0;
+ m_alldayInstanceRecordList = NULL;
+ m_alldayInstanceRecordCount = 0;
}
CalendarFilter::~CalendarFilter()
if(m_recordList) {
calendar_list_destroy(m_recordList, false);
}
+
+ if(m_normalInstanceRecordList) {
+ calendar_list_destroy(m_normalInstanceRecordList, true);
+ }
+ if(m_alldayInstanceRecordList) {
+ calendar_list_destroy(m_alldayInstanceRecordList, true);
+ }
}
void CalendarFilter::visitPreComposite(DeviceAPI::Tizen::FilterType& type, int depth)
}
calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
calendar_filter_add_filter(m_filter, subFilter2);
+
+ // Corner case handling routine for a recurring event range filter.
+ calendar_query_h normalQuery = NULL, alldayQuery = NULL;
+ calendar_filter_h normalFilter = NULL, alldayFilter = NULL;
+ calendar_query_create(_calendar_instance_normal_calendar_book._uri, &normalQuery);
+ calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &normalFilter);
+ calendar_query_create(_calendar_instance_allday_calendar_book._uri, &alldayQuery);
+ calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &alldayFilter);
+
+ LogDebug("Add a filter for normal instances.");
+ if (!initialValue->isNullOrUndefined()) {
+ calendar_filter_add_caltime(normalFilter, _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
+ }
+ if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
+ calendar_filter_add_operator(normalFilter, CALENDAR_FILTER_OPERATOR_AND);
+ }
+ if (!endValue->isNullOrUndefined()) {
+ calendar_filter_add_caltime(normalFilter, _calendar_instance_normal_calendar_book.end_time, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
+ }
+ LogDebug("Add a filter for allday instances.");
+ if (!initialValue->isNullOrUndefined()) {
+ calendar_filter_add_caltime(alldayFilter, _calendar_instance_allday_calendar_book.start_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+ }
+ if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
+ calendar_filter_add_operator(alldayFilter, CALENDAR_FILTER_OPERATOR_AND);
+ }
+ if (!endValue->isNullOrUndefined()) {
+ calendar_filter_add_caltime(alldayFilter, _calendar_instance_allday_calendar_book.end_time, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
+ }
+
+ int ret;
+ LogDebug("Query for normal instances.");
+ ret = calendar_query_set_filter(normalQuery, normalFilter);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Setting a normal filter failed: "<<ret);
+ }
+ ret = calendar_db_get_records_with_query(normalQuery, 0, 0, &m_normalInstanceRecordList);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Getting a normal record list failed: "<<ret);
+ }
+ ret = calendar_list_get_count(m_normalInstanceRecordList, &m_normalInstanceRecordCount);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Can't get the normal item count: "<<ret);
+ } else {
+ LogDebug("Normal instance item count: "<<m_normalInstanceRecordCount);
+ }
+ LogDebug("Query for allday instances.");
+ ret = calendar_query_set_filter(alldayQuery, alldayFilter);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Setting an allday filter failed: "<<ret);
+ }
+ ret = calendar_db_get_records_with_query(alldayQuery, 0, 0, &m_alldayInstanceRecordList);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Getting an allday record list failed: "<<ret);
+ }
+ ret = calendar_list_get_count(m_alldayInstanceRecordList, &m_alldayInstanceRecordCount);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Can't get the allday item count: "<<ret);
+ } else {
+ LogDebug("Allday instance item count: "<<m_alldayInstanceRecordCount);
+ }
+
+ LogDebug("Free queries and filters.");
+ if(normalQuery) {
+ calendar_query_destroy(normalQuery);
+ }
+ if(normalFilter) {
+ calendar_filter_destroy(normalFilter);
+ }
+ if(alldayQuery) {
+ calendar_query_destroy(alldayQuery);
+ }
+ if(alldayFilter) {
+ calendar_filter_destroy(alldayFilter);
+ }
}
LogDebug("Added caltime range filter with initial value: "<<startTime.time.utime<<", end value: "<<endTime.time.utime);
} else if(CALENDAR_FILTER_ATTRIBUTE_LATITUDE==attrName ||
return m_recordList;
}
+int CalendarFilter::getNormalInstanceResultRecordCount() const
+{
+ return m_normalInstanceRecordCount;
+}
+
+calendar_list_h CalendarFilter::getNormalInstanceResultRecordList() const
+{
+ return m_normalInstanceRecordList;
+}
+
+int CalendarFilter::getAlldayInstanceResultRecordCount() const
+{
+ return m_alldayInstanceRecordCount;
+}
+
+calendar_list_h CalendarFilter::getAlldayInstanceResultRecordList() const
+{
+ return m_alldayInstanceRecordList;
+}
+
int CalendarFilter::convertStringToIntValue(const std::string attrName, const std::string valueString)
{
LogDebug("attrName: "<<attrName<<", valueString: "<<valueString);
#include "CalendarEvent.h"
#include <calendar2.h>
-
-
namespace DeviceAPI {
namespace Calendar {
calendar_filter_h m_filter;
calendar_list_h m_recordList;
int m_recordCount;
+ // Corner case handling for recurring event range filter.
+ calendar_list_h m_normalInstanceRecordList;
+ int m_normalInstanceRecordCount;
+ calendar_list_h m_alldayInstanceRecordList;
+ int m_alldayInstanceRecordCount;
+
static std::map<std::string, unsigned int> m_eventAttributeMap;
static std::map<std::string, unsigned int> m_taskAttributeMap;
calendar_list_h getResultRecordList() const;
+ int getNormalInstanceResultRecordCount() const;
+
+ calendar_list_h getNormalInstanceResultRecordList() const;
+
+ int getAlldayInstanceResultRecordCount() const;
+
+ calendar_list_h getAlldayInstanceResultRecordList() const;
+
private:
int convertStringToIntValue(const std::string attrName, const std::string valueString);
};
SET(DESTINATION_NAME ${callhistory_dest})
SET(TARGET_IMPL_NAME ${callhistory_impl})
-PKG_SEARCH_MODULE(contacts-service REQUIRED contacts-service2)
-PKG_SEARCH_MODULE(glib REQUIRED glib-2.0)
-PKG_SEARCH_MODULE(libpcrecpp REQUIRED libpcrecpp)
+PKG_CHECK_MODULES(platform_pkgs_callhistory REQUIRED contacts-service2 glib-2.0 libpcrecpp)
INCLUDE_DIRECTORIES(
${TOP}/Common
${TOP}/Tizen
${TOP}/Contact
- ${contacts-service_INCLUDE_DIRS}
- ${glib_INCLUDE_DIRS}
- ${libpcrecpp_INCLUDE_DIRS}
- )
+ ${platform_pkgs_callhistory_INCLUDE_DIRS}
+)
SET(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_RPATH}
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${contacts-service_LIBRARIES}
- ${capicall_LIBRARIES}
- ${glib_LIBRARIES}
- ${libpcrecpp_LIBRARIES}
+ ${tizen_impl}
+ ${platform_pkgs_callhistory_LIBRARIES}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${tizen_impl}
- ${timeutil_impl}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/callhistory
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/callhistory
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
std::string tags("");
std::string direction("");
std::string number("");
-
+
if (query_log->phone_number != NULL) {
number.append(query_log->phone_number);
}
long CallHistory::addListener(const EventCallHistoryListenerEmitterPtr& emitter)
{
int ret =0;
+
if (CallHistory::m_watchers.size() == 0) {
WatcherPtr watcher(new Watcher(0, emitter));
ret = contacts_db_add_changed_cb(_contacts_phone_log._uri, callhistoryListenerCB, watcher.Get());
if (ret != CONTACTS_ERROR_NONE) {
LogDebug("callhistory query error [" << ret << "]");
}
-
+
if (parseRecord(&recordList, callHistoryListPtr)) {
if (callHistoryListPtr->size() > 0) {
watcher->setCurrentLogId((*callHistoryListPtr)[0]->getEntryId());
int ret = CONTACTS_ERROR_NONE;
for (;it < CallHistory::m_watchers.end();) {
+
+ LogDebug("removeListener : id ["<<id<<"]");
+ LogDebug("removeListener : handle() ["<<(*it)->getHandle()<<"]");
+
if (id == (*it)->getHandle()) {
flag = true;
ret = contacts_db_remove_changed_cb(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
continue;
}
++it;
- }
+ }
LogDebug("CallHistory Watcher is removed. (" << CallHistory::m_watchers.size() << ")");
if (!flag) {
if (record == NULL) {
ret = contacts_list_next(record_list);
- if ( !(ret==CONTACTS_ERROR_NONE || ret==CONTACTS_ERROR_NO_DATA) ){
+ if ( !(ret==CONTACTS_ERROR_NONE || ret==CONTACTS_ERROR_NO_DATA) ){
LogDebug("callhistory remove All error [" << ret << "]");
event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
}
if (error != CONTACTS_ERROR_NONE) {
event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
}
-
+
EventRequestReceiver<EventRemoveBatch>::ManualAnswer(event);
std::vector<EventRemoveBatchDataPtr>::iterator it;
if (error != CONTACTS_ERROR_NONE) {
event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
}
-
+
EventRequestReceiver<EventRemoveAll>::ManualAnswer(event);
std::vector<EventRemoveAllDataPtr>::iterator it;
contacts_query_h query = NULL;
contacts_filter_h filter = NULL;
contacts_list_h recordList = NULL;
-
+
if (missedCallListPtr->size() > 0) {
contacts_query_create(_contacts_phone_log._uri, &query);
contacts_filter_create(_contacts_phone_log._uri, &filter);
void removeBatch(const EventRemoveBatchPtr& event);
void removeAll(const EventRemoveAllPtr& event);
long addListener(const EventCallHistoryListenerEmitterPtr& emitter);
- void removeListener(const long id);
+ void removeListener(const long id);
class Watcher
{
private:
- long m_handle;
+ long m_handle;
EventCallHistoryListenerEmitterPtr m_emitter;
unsigned int m_currentLogId;
MissedCallListPtr m_missedCallList;
Watcher(long handle, const EventCallHistoryListenerEmitterPtr& emitter);
~Watcher();
- void setHandle(long handle)
+ void setHandle(long handle)
{
+ LogDebug("setHandle : handle ["<<handle<<"]");
m_handle = handle;
}
- long getHandle()
+ long getHandle()
{
+ LogDebug("getHandle : handle ["<<m_handle<<"]");
return m_handle;
}
void setCurrentLogId(unsigned int logId)
{
m_currentLogId = logId;
+ LogDebug("setCurrentLogId : logId ["<<logId);
+
}
unsigned int getCurrentLogId()
virtual void removeAll(const EventRemoveAllPtr& event) = 0;
virtual long addListener(const EventCallHistoryListenerEmitterPtr& emitter) = 0;
-
- virtual void removeListener(const long id) = 0;
-
+
+ virtual void removeListener(const long id) = 0;
+
protected:
ICallHistory();
virtual void OnRequestReceived(const EventCallHistoryPtr& event) = 0;
#include "CallHistoryFactory.h"
#include "ICallHistory.h"
#include <JSTizenExceptionFactory.h>
-#include <JSTizenException.h>
+#include <JSTizenException.h>
#include <SecurityExceptions.h>
+#include <JSUtil.h>
#include "JSCallHistoryEntry.h"
#include "JSCallHistory.h"
#include "CallHistoryAsyncCallbackManager.h"
#include "CallHistoryListenerManager.h"
+
+
using namespace std;
using namespace DPL;
using namespace WrtDeviceApis::Commons;
}
cbm->setObject(thisObject);
-
+
EventRemoveBatchPtr event(new EventRemoveBatch());
ICallHistoryPtr callHistory(priv->getObject());
ICallHistoryPtr callHistory(priv->getObject());
id = callHistory->addListener(emitter);
+ LogDebug("addChangeListener : id [" <<id<<"]");
+
CallHistoryListenerCancellerPtr canceller = CallHistoryListenerCancellerPtr(new CallHistoryListenerCanceller(gContext, thisObject, id));
DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast<DeviceAPI::Common::IListenerItem>(canceller);
CallHistoryListenerManagerSingleton::Instance().registerListener(listenerItem, gContext);
}
+ return JSUtil::toJSValueRef(context, id);
- return converter.toJSValueRefLong(id);
} catch(const WrtDeviceApis::Commons::ConversionException& ex) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
} catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
try {
long id = 0;
+
if (argumentCount >= 1) {
if (check.isNullOrUndefined(arguments[0])) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error : handle");
}
- id = static_cast<long>(converter.toLong(arguments[0]));
+ id=JSUtil::JSValueToLong(context, arguments[0]);
+ LogDebug("removeChangeListener : id [" <<id<<"]");
}
if (id != 0) {
SET(SRCS
- JSTizenException.cpp
- TizenExceptionData.cpp
- JSTizenExceptionFactory.cpp
- JSWebAPIError.cpp
- ArgumentValidationChecker.cpp
- CallbackUserData.cpp
- GlobalContextManager.cpp
- ArgumentValidator.cpp
- JSUtil.cpp
- PlatformException.cpp
- MultiCallbackUserData.cpp
- JSWebAPIErrorFactory.cpp
- JSWebAPIError2.cpp
- WebAPIError.cpp
+ JSTizenException.cpp
+ TizenExceptionData.cpp
+ JSTizenExceptionFactory.cpp
+ JSWebAPIError.cpp
+ ArgumentValidationChecker.cpp
+ CallbackUserData.cpp
+ GlobalContextManager.cpp
+ ArgumentValidator.cpp
+ JSUtil.cpp
+ PlatformException.cpp
+ MultiCallbackUserData.cpp
+ JSWebAPIErrorFactory.cpp
+ JSWebAPIError2.cpp
+ WebAPIError.cpp
)
ADD_LIBRARY(${COMMON_TARGET_NAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(${COMMON_TARGET_NAME}
- #${LIBS_WIDGETDB}
- ${LIBS_COMMON}
- #${wrt-plugins-plugin-manager_LIBRARIES}
+ ${LIBS_COMMON}
)
INSTALL(TARGETS ${COMMON_TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${COMMON_DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/common
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/common
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
return RunLineEx(buff, exception);
}
fclose(f);
+ return JSValueMakeUndefined(mGlobalContext);
}
void StandaloneConsole::RunLine(const char * line){
SET(TARGET_IMPL_NAME ${contact_impl})
SET(TARGET_CONFIG_NAME ${contact_config})
-PKG_SEARCH_MODULE(contacts-service REQUIRED contacts-service2)
-PKG_SEARCH_MODULE(pcrecpp REQUIRED libpcrecpp)
-PKG_SEARCH_MODULE(download REQUIRED capi-web-url-download)
+PKG_CHECK_MODULES(platform_pkgs_contact REQUIRED contacts-service2 libpcrecpp)
INCLUDE_DIRECTORIES(
${TOP}/Tizen
${TOP}/Common
- ${contacts-service_INCLUDE_DIRS}
- ${pcrecpp_INCLUDE_DIRS}
- ${download_INCLUDE_DIRS}
+ ${platform_pkgs_contact_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
)
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
+
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
- ${contacts-service_LIBRARIES}
- ${pcrecpp_LIBRARIES}
- ${download_LIBRARIES}
${LIBS_COMMON}
+ ${tizen_impl}
+ ${platform_pkgs_contact_LIBRARIES}
)
SET(SRCS_CONFIG
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
${TARGET_CONFIG_NAME}
- ${tizen_impl}
- ${timeutil_impl}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/contact
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/contact
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
, m_platformContactObjectList(NULL)
{
// LogDebug("entered");
+
+ m_notesJSObjIsSet = false;
+ m_groupIdsJSObjIsSet = false;
+ m_context = NULL;
+ m_groupIdsObj = NULL;
+ m_groupIdsJSValue = NULL;
}
Contact::~Contact()
{
if (m_platformContactObjectList != NULL)
contacts_list_destroy(m_platformContactObjectList, true);
+
+ if(groupIdsJSObjIsSet()){
+ JSContextRef contextRef = getContext();
+ JSObjectRef tempJSObject = getGroupIdsJSObj();
+ JSValueUnprotect(contextRef, tempJSObject);
+ }
+
+ if(notesJSObjIsSet()){
+ JSContextRef contextRef = getContext();
+ JSObjectRef tempJSObject = getNotesJSObj();
+ JSValueUnprotect(contextRef, tempJSObject);
+ }
}
string Contact::convertToString(const string &format)
m_platformContactObjectList = contacts_list;
}
+void Contact::setNotesJSObj(bool value, JSObjectRef initObj)
+{
+ m_notesJSObjIsSet = value;
+ m_notesObj = initObj;
+}
+
+bool Contact::notesJSObjIsSet() const
+{
+ return m_notesJSObjIsSet;
+}
+
+JSObjectRef Contact::getNotesJSObj()
+{
+ return m_notesObj;
+}
+
+JSValueRef Contact::getNotesJSValue()
+{
+ return m_notesJSValue;
+}
+
+void Contact::setGroupIdsJSObj(bool value, JSObjectRef initObj)
+{
+ m_groupIdsJSObjIsSet = value;
+ m_groupIdsObj = initObj;
+}
+
+bool Contact::groupIdsJSObjIsSet() const
+{
+ return m_groupIdsJSObjIsSet;
+}
+
+JSObjectRef Contact::getGroupIdsJSObj()
+{
+ return m_groupIdsObj;
+}
+
+JSValueRef Contact::getGroupIdsJSValue()
+{
+ return m_groupIdsJSValue;
+}
+
+void Contact::setContext(JSContextRef contextRef)
+{
+ if(m_context == NULL)
+ m_context = contextRef;
+}
+
+JSContextRef Contact::getContext()
+{
+ return m_context;
+}
+
} // Contact
} // DeviceAPI
contacts_record_h getPlatformContactObject() const { return m_platformContactObject; };
+ void setNotesJSObj(bool value, JSObjectRef initObj);
+ bool notesJSObjIsSet() const;
+ JSObjectRef getNotesJSObj();
+ JSValueRef getNotesJSValue();
+
+ void setGroupIdsJSObj(bool value, JSObjectRef initObj);
+ bool groupIdsJSObjIsSet() const;
+ JSObjectRef getGroupIdsJSObj();
+ JSValueRef getGroupIdsJSValue();
+
+ void setContext(JSContextRef contextRef);
+ JSContextRef getContext();
+
private:
contacts_record_h m_platformContactObject;
contacts_list_h m_platformContactObjectList;
+
+ bool m_notesJSObjIsSet;
+ JSObjectRef m_notesObj;
+ JSValueRef m_notesJSValue;
+
+ bool m_groupIdsJSObjIsSet;
+ JSObjectRef m_groupIdsObj;
+ JSValueRef m_groupIdsJSValue;
+
+ JSContextRef m_context;
};
} // Contact
m_isDefault(false)
{
m_types = ContactAddressTypeArrayPtr(new ContactAddressTypeArray());
+ is_typesSetJSArray = false;
+ m_context = NULL;
+ m_typesJsValue = NULL;
+ m_typesObj = NULL;
}
ContactAddress::~ContactAddress()
{
- //nothing to do
+ if(IsTypesSetJSArray()){
+ JSContextRef contextRef = getContext();
+ JSObjectRef tempJSObject = getTypesJSObj();
+ JSValueUnprotect(contextRef, tempJSObject);
+ }
}
std::string ContactAddress::getCountry() const
{
return result;
}
+void ContactAddress::setTypesJSArray(bool value, JSObjectRef initValue)
+{
+ is_typesSetJSArray = value;
+ m_typesObj = initValue;
+}
+
+JSValueRef ContactAddress::getTypesJSArray()
+{
+ return m_typesJsValue;
+}
+
+JSObjectRef ContactAddress::getTypesJSObj()
+{
+ return m_typesObj;
+}
+
+bool ContactAddress::IsTypesSetJSArray() const
+{
+ return is_typesSetJSArray;
+}
+
+
+void ContactAddress::setContext(JSContextRef contextRef)
+{
+ if(m_context == NULL)
+ m_context = contextRef;
+}
+
+JSContextRef ContactAddress::getContext()
+{
+ return m_context;
+}
+
} // Contact
} // DeviceAPI
#include <vector>
#include <dpl/shared_ptr.h>
#include "ContactTypes.h"
+#include <JavaScriptCore/JavaScript.h>
namespace DeviceAPI {
namespace Contact {
void clear();
ContactAddressPtr clone() const;
+ void setTypesJSArray(bool value, JSObjectRef initValue);
+ JSValueRef getTypesJSArray();
+ JSObjectRef getTypesJSObj();
+ bool IsTypesSetJSArray() const;
+
+ void setContext(JSContextRef contextRef);
+ JSContextRef getContext();
+
private:
std::string m_country;
bool m_countryIsSet;
bool m_isDefault;
ContactAddressTypeArrayPtr m_types;
+
+ bool is_typesSetJSArray;
+ JSValueRef m_typesJsValue;
+ JSObjectRef m_typesObj;
+
+ JSContextRef m_context;
+
};
} // Contact
ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
}
- return JSContact::getContact(m_context, jsValue);
+ ContactPtr tempContact = JSContact::getContact(m_context, jsValue);
+
+ const ScopedJSStringRef nameStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_NAME));
+ const ScopedJSStringRef addressesStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_ADDRESSES));
+ const ScopedJSStringRef groupIdsStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_GROUP_IDS));
+ const ScopedJSStringRef notesStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_NOTES));
+ const ScopedJSStringRef phoneNumbersStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_PHONE_NUMBERS));
+ const ScopedJSStringRef emailsStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_EMAILS));
+
+ JSObjectRef jsObject = toJSObjectRef(jsValue);
+ JSValueRef nameData = JSObjectGetProperty(m_context, jsObject, nameStr.get(), NULL);
+ JSValueRef addressesData = JSObjectGetProperty(m_context, jsObject, addressesStr.get(), NULL);
+ JSValueRef phoneNumbersData = JSObjectGetProperty(m_context, jsObject, phoneNumbersStr.get(), NULL);
+ JSValueRef emailsData = JSObjectGetProperty(m_context, jsObject, emailsStr.get(), NULL);
+ JSValueRef groupIdsData = JSObjectGetProperty(m_context, jsObject, groupIdsStr.get(), NULL);
+ JSValueRef notesData = JSObjectGetProperty(m_context, jsObject, notesStr.get(), NULL);
+
+ ContactNamePtr name;
+ ContactAddressArrayPtr addresses;
+ ContactPhoneNumberArrayPtr phoneNumbers;
+ ContactEmailAddressArrayPtr emails;
+ StringArrayPtr groupIds;
+ StringArrayPtr notes;
+
+ Validator validator(m_context);
+
+ if (!validator.isNullOrUndefined(nameData)) {
+ name = toContactName(nameData);
+ tempContact->setName(name);
+ }
+
+ if (!validator.isNullOrUndefined(addressesData)) {
+ addresses = toContactAddressArray(addressesData);
+ tempContact->setAddresses(addresses);
+ }
+
+ if (!validator.isNullOrUndefined(phoneNumbersData)) {
+ phoneNumbers = toContactPhoneNumberArray(phoneNumbersData);
+ tempContact->setPhoneNumbers(phoneNumbers);
+ }
+
+ if (!validator.isNullOrUndefined(emailsData)) {
+ emails = toContactEmailAddressArray(emailsData);
+ tempContact->setEmails(emails);
+ }
+
+ if (!validator.isNullOrUndefined(groupIdsData)) {
+ groupIds = toStringArray(groupIdsData);
+ tempContact->setGroupIds(groupIds);
+ }
+
+ if (!validator.isNullOrUndefined(notesData)) {
+ notes = toStringArray(notesData);
+ tempContact->setNotes(notes);
+ }
+
+ return tempContact;
+
+// return JSContact::getContact(m_context, jsValue);
}
ContactPtr ContactConverter::toContactFromInit(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const PersonArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSPersonArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
PersonArrayPtr ContactConverter::toPersonArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const ContactGroupArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactGroupArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactGroupArrayPtr ContactConverter::toContactGroupArray(const JSValueRef &jsValue)
const ScopedJSStringRef departmentStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_DEPARTMENT));
const ScopedJSStringRef titleStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_TITLE));
const ScopedJSStringRef roleStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_ROLE));
+ const ScopedJSStringRef logoURIStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_LOGO_URI));
JSObjectRef jsObject = toJSObjectRef(jsValue);
JSValueRef departmentData = JSObjectGetProperty(m_context, jsObject, departmentStr.get(), NULL);
JSValueRef titleData = JSObjectGetProperty(m_context, jsObject, titleStr.get(), NULL);
JSValueRef roleData = JSObjectGetProperty(m_context, jsObject, roleStr.get(), NULL);
+ JSValueRef logoURIData = JSObjectGetProperty(m_context, jsObject, logoURIStr.get(), NULL);
std::string name;
std::string department;
std::string title;
std::string role;
+ std::string logoURI;
ContactOrganizationPtr result(new ContactOrganization());
if (!result) {
result->setRole(role);
}
+ if (!validator.isNullOrUndefined(logoURIData)) {
+ if(!JSValueIsString(m_context, logoURIData))
+ ThrowMsg(WrtDeviceApis::Commons::ConversionException, "logoURI is not string");
+ logoURI = toString(logoURIData);
+ result->setLogoURI(logoURI);
+ }
+
return result;
}
JSValueRef ContactConverter::toJSValueRef(const ContactOrganizationArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactOrganizationArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactOrganizationArrayPtr ContactConverter::toContactOrganizationArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const ContactWebSiteArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactWebSiteArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactWebSiteArrayPtr ContactConverter::toContactWebSiteArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const ContactAnniversaryArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactAnniversaryArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactAnniversaryArrayPtr ContactConverter::toContactAnniversaryArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const ContactAddressArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactAddressArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactAddressArrayPtr ContactConverter::toContactAddressArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const ContactPhoneNumberArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactPhoneNumberArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactPhoneNumberArrayPtr ContactConverter::toContactPhoneNumberArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const ContactEmailAddressArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactEmailAddressArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactEmailAddressArrayPtr ContactConverter::toContactEmailAddressArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const ContactAddressTypeArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactAddressTypeArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactAddressTypeArrayPtr ContactConverter::toContactAddressTypeArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const ContactPhoneNumberTypeArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactPhoneNumberTypeArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactPhoneNumberTypeArrayPtr ContactConverter::toContactPhoneNumberTypeArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const ContactEmailAddressTypeArrayPtr &arg)
{
- return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactEmailAddressTypeArray::getClassRef(), arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
ContactEmailAddressTypeArrayPtr ContactConverter::toContactEmailAddressTypeArray(const JSValueRef &jsValue)
JSValueRef ContactConverter::toJSValueRef(const StringArrayPtr &arg)
{
- return JSStringArray::createArray(m_context, arg);
+ int size = arg->size();
+
+ JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+ if (!resultObject)
+ ThrowMsg(ConversionException, "Can not create array object.");
+
+ for(int i = 0; i < size; i++)
+ {
+ JSValueRef jsvalue = toJSValueRef(arg->at(i));
+ if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+ ThrowMsg(ConversionException, "Can not add object to array.");
+ }
+
+ return static_cast<JSValueRef>(resultObject);
}
//std::string ContactConverter::toAttributesOfInterest(const JSValueRef &value)
m_isDefault(false)
{
m_types = ContactEmailAddressTypeArrayPtr(new ContactEmailAddressTypeArray());
+ is_typesSetJSArray = false;
+ m_context = NULL;
+ m_typesJsValue = NULL;
+ m_typesObj = NULL;
}
ContactEmailAddress::~ContactEmailAddress()
{
+ if(IsTypesSetJSArray()){
+ JSContextRef contextRef = getContext();
+ JSObjectRef tempJSObject = getTypesJSObj();
+ JSValueUnprotect(contextRef, tempJSObject);
+ }
}
std::string ContactEmailAddress::getEmail() const
return result;
}
+void ContactEmailAddress::setTypesJSArray(bool value, JSObjectRef initValue)
+{
+ is_typesSetJSArray = value;
+ m_typesObj = initValue;
+}
+
+JSValueRef ContactEmailAddress::getTypesJSArray()
+{
+ return m_typesJsValue;
+}
+
+JSObjectRef ContactEmailAddress::getTypesJSObj()
+{
+ return m_typesObj;
+}
+
+bool ContactEmailAddress::IsTypesSetJSArray() const
+{
+ return is_typesSetJSArray;
+}
+
+void ContactEmailAddress::setContext(JSContextRef contextRef)
+{
+ if(m_context == NULL)
+ m_context = contextRef;
+}
+
+JSContextRef ContactEmailAddress::getContext()
+{
+ return m_context;
+}
+
} // Contact
} // DeviceAPI
#include <string>
#include <dpl/shared_ptr.h>
#include "ContactTypes.h"
+#include <JavaScriptCore/JavaScript.h>
namespace DeviceAPI {
namespace Contact {
void clear();
ContactEmailAddressPtr clone() const;
+ void setTypesJSArray(bool value, JSObjectRef initValue);
+ JSValueRef getTypesJSArray();
+ JSObjectRef getTypesJSObj();
+ bool IsTypesSetJSArray() const;
+
+ void setContext(JSContextRef contextRef);
+ JSContextRef getContext();
+
private:
std::string m_email;
bool m_emailIsSet;
bool m_isDefault;
ContactEmailAddressTypeArrayPtr m_types;
+
+ bool is_typesSetJSArray;
+ JSValueRef m_typesJsValue;
+ JSObjectRef m_typesObj;
+
+ JSContextRef m_context;
};
} // Contact
m_displayNameIsSet(false)
{
m_nicknames = StringArrayPtr(new StringArray());
+ is_typesSetJSArray = false;
+ m_context = NULL;
+ m_typesJsValue = NULL;
+ m_typesObj = NULL;
}
ContactName::~ContactName()
{
+ if(IsTypesSetJSArray()){
+ JSContextRef contextRef = getContext();
+ JSObjectRef tempJSObject = getTypesJSObj();
+ JSValueUnprotect(contextRef, tempJSObject);
+ }
}
std::string ContactName::getPrefix() const
return result;
}
+void ContactName::setTypesJSArray(bool value, JSObjectRef initValue)
+{
+ is_typesSetJSArray = value;
+ m_typesObj = initValue;
+}
+
+JSValueRef ContactName::getTypesJSArray()
+{
+ return m_typesJsValue;
+}
+
+JSObjectRef ContactName::getTypesJSObj()
+{
+ return m_typesObj;
+}
+
+bool ContactName::IsTypesSetJSArray() const
+{
+ return is_typesSetJSArray;
+}
+
+void ContactName::setContext(JSContextRef contextRef)
+{
+ if(m_context == NULL)
+ m_context = contextRef;
+}
+
+JSContextRef ContactName::getContext()
+{
+ return m_context;
+}
+
} // Contact
} // DeviceAPI
#include <vector>
#include <string>
#include <dpl/shared_ptr.h>
+#include <JavaScriptCore/JavaScript.h>
#include "ContactTypes.h"
namespace DeviceAPI {
void clear();
ContactNamePtr clone() const;
+ void setTypesJSArray(bool value, JSObjectRef initValue);
+ JSValueRef getTypesJSArray();
+ JSObjectRef getTypesJSObj();
+ bool IsTypesSetJSArray() const;
+
+ void setContext(JSContextRef contextRef);
+ JSContextRef getContext();
+
private:
std::string m_prefix;
bool m_prefixIsSet;
std::string m_displayName;
bool m_displayNameIsSet;
+
+ bool is_typesSetJSArray;
+ JSValueRef m_typesJsValue;
+ JSObjectRef m_typesObj;
+
+ JSContextRef m_context;
};
} // Contact
}
}
+ LogDebug("organization->getLogoURIIsSet() : " << organization->getLogoURIIsSet());
// ContactOrganization.logoURI
if(organization->getLogoURIIsSet())
{
+ LogDebug("organization->getLogoURI() : " << organization->getLogoURI());
string logoURI = organization->getLogoURI();
if(!logoURI.empty())
{
- logoURI = ContactUtility::convertUriToPath(logoURI);
+// logoURI = ContactUtility::convertUriToPath(logoURI);
+ LogDebug("logoURI.c_str() : " << logoURI.c_str());
errorCode = contacts_record_set_str(child_record, _contacts_company.logo, logoURI.c_str());
+ LogDebug("errorCode : " << errorCode);
if(errorCode != CONTACTS_ERROR_NONE)
{
LogWarning("importing logoURI N (err:" << errorCode << ", str:" << logoURI << ")");
m_isDefault(false)
{
m_types = ContactPhoneNumberTypeArrayPtr(new ContactPhoneNumberTypeArray());
+ is_typesSetJSArray = false;
+ m_context = NULL;
+ m_typesJsValue = NULL;
+ m_typesObj = NULL;
}
ContactPhoneNumber::~ContactPhoneNumber()
{
+ if(IsTypesSetJSArray()){
+ JSContextRef contextRef = getContext();
+ JSObjectRef tempJSObject = getTypesJSObj();
+ JSValueUnprotect(contextRef, tempJSObject);
+ }
}
std::string ContactPhoneNumber::getNumber() const
return result;
}
+void ContactPhoneNumber::setTypesJSArray(bool value, JSObjectRef initValue)
+{
+ is_typesSetJSArray = value;
+ m_typesObj = initValue;
+}
+
+JSObjectRef ContactPhoneNumber::getTypesJSObj()
+{
+ return m_typesObj;
+}
+
+JSValueRef ContactPhoneNumber::getTypesJSArray()
+{
+ return m_typesJsValue;
+}
+
+bool ContactPhoneNumber::IsTypesSetJSArray() const
+{
+ return is_typesSetJSArray;
+}
+
+void ContactPhoneNumber::setContext(JSContextRef contextRef)
+{
+ if(m_context == NULL)
+ m_context = contextRef;
+}
+
+JSContextRef ContactPhoneNumber::getContext()
+{
+ return m_context;
+}
+
} // Contact
} // DeviceAPI
#include <vector>
#include <dpl/shared_ptr.h>
#include "ContactTypes.h"
+#include <JavaScriptCore/JavaScript.h>
namespace DeviceAPI {
namespace Contact {
void clear();
ContactPhoneNumberPtr clone() const;
+ void setTypesJSArray(bool value, JSObjectRef initValue);
+ JSValueRef getTypesJSArray();
+ JSObjectRef getTypesJSObj();
+ bool IsTypesSetJSArray() const;
+
+ void setContext(JSContextRef contextRef);
+ JSContextRef getContext();
+
private:
std::string m_number;
bool m_numberIsSet;
bool m_isDefault;
ContactPhoneNumberTypeArrayPtr m_types;
+
+ bool is_typesSetJSArray;
+ JSValueRef m_typesJsValue;
+ JSObjectRef m_typesObj;
+
+ JSContextRef m_context;
};
} // Contact
LogDebug("entered");
AddressBookPtr addressBook;
AddressBookController *controller;
+ JSContextRef gContext;
Try {
controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
ThrowMsg(InvalidArgumentException, "No private object.");
}
addressBook = controller->getObject();
+ gContext = controller->getContext();
+
} Catch(Exception) {
LogError("No private object");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object");
string id;
- ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
Try {
id = converter->toString(arguments[0]);
} Catch(Exception) {
LogDebug("entered");
AddressBookPtr addressBook;
AddressBookController *controller;
+ JSContextRef gContext;
Try {
controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
ThrowMsg(InvalidArgumentException, "No private object.");
}
addressBook = controller->getObject();
+ gContext = controller->getContext();
} Catch(Exception) {
LogError("No private object");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object");
ContactPtr contact(NULL);
- ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
Try {
contact = converter->toContact(arguments[0]);
} Catch(Exception) {
LogDebug("entered");
AddressBookPtr addressBook;
AddressBookController *controller;
+ JSContextRef gContext;
Try {
controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
ThrowMsg(InvalidArgumentException, "No private object.");
}
addressBook = controller->getObject();
+ gContext = controller->getContext();
} Catch(Exception) {
LogError("No private object");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object");
ContactPtr contact(NULL);
- ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
Try {
contact = converter->toContact(arguments[0]);
} Catch(Exception) {
LogDebug("entered");
AddressBookPtr addressBook;
AddressBookController *controller;
+ JSContextRef gContext;
Try {
controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
ThrowMsg(InvalidArgumentException, "No private object.");
}
addressBook = controller->getObject();
+ gContext = controller->getContext();
} Catch(Exception) {
LogError("No private object");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object");
string contactId;
- ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
Try {
contactId = converter->toString(arguments[0]);
}
LogDebug("entered");
AddressBookPtr addressBook;
AddressBookController *controller;
+ JSContextRef gContext;
Try {
controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
ThrowMsg(InvalidArgumentException, "No private object.");
}
addressBook = controller->getObject();
+ gContext = controller->getContext();
} Catch(Exception) {
LogError("No private object");
return JSTizenExceptionFactory::postException(context, exception,
string id;
- ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
Try {
id = converter->toString(arguments[0]);
} Catch(Exception) {
LogDebug("entered");
AddressBookPtr addressBook;
AddressBookController *controller;
+ JSContextRef gContext;
Try {
controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
ThrowMsg(InvalidArgumentException, "No private object.");
}
addressBook = controller->getObject();
+ gContext = controller->getContext();
} Catch(Exception) {
LogError("No private object");
return JSTizenExceptionFactory::postException(context, exception,
ContactGroupPtr group(NULL);
- ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
Try {
group = converter->toContactGroup(arguments[0]);
} Catch(Exception) {
LogDebug("entered");
AddressBookPtr addressBook;
AddressBookController *controller;
+ JSContextRef gContext;
Try {
controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
ThrowMsg(InvalidArgumentException, "No private object.");
}
addressBook = controller->getObject();
+ gContext = controller->getContext();
} Catch(Exception) {
LogError("No private object");
return JSTizenExceptionFactory::postException(context, exception,
ContactGroupPtr contact(NULL);
- ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
Try {
contact = converter->toContactGroup(arguments[0]);
} Catch(Exception) {
LogDebug("entered");
AddressBookPtr addressBook;
AddressBookController *controller;
+ JSContextRef gContext;
Try {
controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
ThrowMsg(InvalidArgumentException, "No private object.");
}
addressBook = controller->getObject();
+ gContext = controller->getContext();
} Catch(Exception) {
LogError("No private object");
return JSTizenExceptionFactory::postException(context, exception,
string groupId;
- ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
Try {
groupId = converter->toString(arguments[0]);
}
LogDebug("entered");
AddressBookPtr addressBook;
AddressBookController *controller;
+ JSContextRef gContext;
Try {
controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
ThrowMsg(InvalidArgumentException, "No private object.");
}
addressBook = controller->getObject();
+ gContext = controller->getContext();
} Catch(Exception) {
LogError("No private object");
return JSTizenExceptionFactory::postException(context, exception,
string id;
- ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
EventAddressBookGetGroupsPtr dplEvent(new EventAddressBookGetGroups());
#include "plugin_config.h"
#include "ContactConverter.h"
#include "JSContact.h"
+#include "Contact.h"
#define FILTER_CLASS_NAME "Contact"
{
Try
{
- ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
ContactPtr contact = getPrivData(object);
ContactNamePtr contactName = contact->getName();
if(contactName == NULL)
Try
{
ContactPtr contact = getPrivData(object);
- ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
- BasicValidator validator =
- BasicValidatorFactory::getValidator(context, exception);
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+ BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
if(validator->isNullOrUndefined(value))
contact->unsetName();
else
{
Try
{
+ JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::getConverter(gContext);
ContactPtr contact = getPrivData(object);
return converter->toJSValueRef(contact->getAddresses());
}
{
Try
{
+ JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::getConverter(gContext);
ContactPtr contact = getPrivData(object);
return converter->toJSValueRef(contact->getPhoneNumbers());
}
{
Try
{
+ JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+
ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::getConverter(gContext);
ContactPtr contact = getPrivData(object);
return converter->toJSValueRef(contact->getEmails());
}
{
Try
{
- ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
ContactPtr contact = getPrivData(object);
- return converter->toJSValueRef(contact->getNotes());
+
+ DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+ if(newContactT->notesJSObjIsSet()){
+ return newContactT->getNotesJSObj();
+ }else{
+ JSValueRef tempJSValue = newContactT->getNotesJSValue();
+ tempJSValue = converter->toJSValueRef(newContactT->getNotes());
+
+ JSObjectRef convertedJSObject = newContactT->getNotesJSObj();
+ convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+ newContactT->setNotesJSObj(true, convertedJSObject);
+
+ JSValueProtect(gContext, convertedJSObject);
+ newContactT->setContext(gContext);
+ return tempJSValue;
+ }
}
Catch(WrtDeviceApis::Commons::Exception)
{
{
Try
{
+ JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+
ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ ContactConverterFactory::getConverter(gContext);
ContactPtr contact = getPrivData(object);
- return converter->toJSValueRef(contact->getGroupIds());
+ DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+
+ if(newContactT->groupIdsJSObjIsSet()){
+ return newContactT->getGroupIdsJSObj();
+ }else{
+ JSValueRef tempJSValue = newContactT->getGroupIdsJSValue();
+ tempJSValue = converter->toJSValueRef(newContactT->getGroupIds());
+
+ JSObjectRef convertedJSObject = newContactT->getGroupIdsJSObj();
+ convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+ newContactT->setGroupIdsJSObj(true, convertedJSObject);
+
+ JSValueProtect(gContext, convertedJSObject);
+ newContactT->setContext(gContext);
+ return tempJSValue;
+ }
}
Catch(WrtDeviceApis::Commons::Exception)
{
JSValueRef result;
Try {
- result = createJSObject(context, clonedContact);
+ JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(thisObject));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+ result = createJSObject(gContext, clonedContact);
} Catch(Exception) {
LogError("Error on conversion : " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
{
Try
{
- ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ JSContactAddressPriv *priv = static_cast<JSContactAddressPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
ContactAddressPtr contactAddress = getPrivData(object);
- return converter->toJSValueRef(contactAddress->getTypes());
+ if(contactAddress->IsTypesSetJSArray()){
+ return contactAddress->getTypesJSObj();
+ }else{
+ JSValueRef tempJSValue = contactAddress->getTypesJSArray();
+ tempJSValue = converter->toJSValueRef(contactAddress->getTypes());
+
+ JSObjectRef convertedJSObject = contactAddress->getTypesJSObj();
+ convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+ contactAddress->setTypesJSArray(true, convertedJSObject);
+
+ JSValueProtect(gContext, convertedJSObject);
+ contactAddress->setContext(gContext);
+ return tempJSValue;
+ }
}
Catch(WrtDeviceApis::Commons::Exception)
{
{
Try
{
- ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ JSContactEmailAddressPriv *priv = static_cast<JSContactEmailAddressPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
ContactEmailAddressPtr emailAddress = getPrivData(object);
- return JSContactEmailAddressTypeArray::createArray(context, emailAddress->getTypes());
+
+ if(emailAddress->IsTypesSetJSArray()){
+ return emailAddress->getTypesJSObj();
+ }else{
+ JSValueRef tempJSValue = emailAddress->getTypesJSArray();
+ tempJSValue = converter->toJSValueRef(emailAddress->getTypes());
+
+ JSObjectRef convertedJSObject = emailAddress->getTypesJSObj();
+ convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+ emailAddress->setTypesJSArray(true, convertedJSObject);
+
+ JSValueProtect(gContext, convertedJSObject);
+ emailAddress->setContext(gContext);
+ return tempJSValue;
+ }
}
Catch(WrtDeviceApis::Commons::Exception)
{
{
Try
{
- ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ JSContactNamePriv *priv = static_cast<JSContactNamePriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
ContactNamePtr contactName = getPrivData(object);
- return converter->toJSValueRef(contactName->getNicknames());
+
+ if(contactName->IsTypesSetJSArray()){
+ return contactName->getTypesJSObj();
+ }else{
+ JSValueRef tempJSValue = contactName->getTypesJSArray();
+ tempJSValue = converter->toJSValueRef(contactName->getNicknames());
+
+ JSObjectRef convertedJSObject = contactName->getTypesJSObj();
+ convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+ contactName->setTypesJSArray(true, convertedJSObject);
+
+ JSValueProtect(gContext, convertedJSObject);
+ contactName->setContext(gContext);
+ return tempJSValue;
+ }
}
Catch(WrtDeviceApis::Commons::Exception)
{
{
Try
{
- // NOTE: Currently not support this field
-// ContactOrganizationPtr organization = getPrivData(object);
-// ContactConverterFactory::ConverterType converter =
-// ContactConverterFactory::getConverter(context);
-// BasicValidator validator =
-// BasicValidatorFactory::getValidator(context, exception);
-// if(validator->isNullOrUndefined(value))
-// organization->unsetLogoURI();
-// else
-// organization->setLogoURI(converter->toString(value));
+ ContactOrganizationPtr organization = getPrivData(object);
+ ContactConverterFactory::ConverterType converter =
+ ContactConverterFactory::getConverter(context);
+ BasicValidator validator =
+ BasicValidatorFactory::getValidator(context, exception);
+ if(validator->isNullOrUndefined(value))
+ organization->unsetLogoURI();
+ else
+ organization->setLogoURI(converter->toString(value));
return true;
}
Catch(WrtDeviceApis::Commons::Exception)
{
Try
{
- ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
+ JSContactPhoneNumberPriv *priv = static_cast<JSContactPhoneNumberPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ JSContextRef gContext = priv->getContext();
+ ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
ContactPhoneNumberPtr contactPhoneNumber = getPrivData(object);
- return converter->toJSValueRef(contactPhoneNumber->getTypes());
+ if(contactPhoneNumber->IsTypesSetJSArray()){
+ return contactPhoneNumber->getTypesJSObj();
+ }else{
+ JSValueRef tempJSValue = contactPhoneNumber->getTypesJSArray();
+ tempJSValue = converter->toJSValueRef(contactPhoneNumber->getTypes());
+
+ JSObjectRef convertedJSObject = contactPhoneNumber->getTypesJSObj();
+ convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+ contactPhoneNumber->setTypesJSArray(true, convertedJSObject);
+
+ JSValueProtect(gContext, convertedJSObject);
+ contactPhoneNumber->setContext(gContext);
+ return tempJSValue;
+ }
}
Catch(WrtDeviceApis::Commons::Exception)
{
SET(DESTINATION_NAME ${content_dest})
SET(TARGET_IMPL_NAME ${content_impl})
-PKG_SEARCH_MODULE(mediacontent REQUIRED capi-content-media-content)
-PKG_SEARCH_MODULE(extractor REQUIRED capi-media-metadata-extractor)
+PKG_CHECK_MODULES(platform_pkgs_content REQUIRED capi-content-media-content capi-media-metadata-extractor)
INCLUDE_DIRECTORIES(
${TOP}/Common
${TOP}/Tizen
- ${mediacontent_INCLUDE_DIRS}
- ${extractor_INCLUDE_DIRS}
+ ${platform_pkgs_content_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
)
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
+
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${mediacontent_LIBRARIES}
- ${extractor_LIBRARIES}
+ ${tizen_impl}
+ ${platform_pkgs_content_LIBRARIES}
)
SET(SRCS
)
ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
+
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${tizen_impl}
- ${timeutil_impl}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/content
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/content
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
static PropertyStructArray folderProperties =
{
- {"id", PrimitiveType_String},
+ {"id", PrimitiveType_String},
{"directoryURI", PrimitiveType_String},
{"storageType", PrimitiveType_String},
- {"title", PrimitiveType_String},
+ {"title", PrimitiveType_String},
{"modifiedDate", PrimitiveType_Time},
{0, PrimitiveType_NoType}
};
{
{"id", PrimitiveType_String},
{"type", PrimitiveType_String},
- {"mimeType", PrimitiveType_String},
+ {"mimeType", PrimitiveType_String},
{"name", PrimitiveType_String},
{"title", PrimitiveType_String},
- {"contentURI", PrimitiveType_String},
- {"thumbnailURIs", PrimitiveType_String},
- {"description", PrimitiveType_String},
+ {"contentURI", PrimitiveType_String},
+ {"thumbnailURIs", PrimitiveType_String},
+ {"description", PrimitiveType_String},
{"rating", PrimitiveType_Int},
{"releasedDate", PrimitiveType_Time},
{"modifiedDate", PrimitiveType_Time},
{"artists", PrimitiveType_String},
{"width", PrimitiveType_String},
{"height", PrimitiveType_String},
- {"genres", PrimitiveType_String},
+ {"genres", PrimitiveType_String},
{0, PrimitiveType_NoType}
};
{\r
m_callback = new MultiCallbackUserData(globalCtx);\r
\r
- LOGD("[DENNIS] %s:%d, thread_id=%ld", __FUNCTION__, __LINE__, pthread_self());\r
- LOGD("[DENNIS] %s:%d, context=%p", __FUNCTION__, __LINE__, globalCtx);\r
+ LOGD("%s:%d, thread_id=%ld", __FUNCTION__, __LINE__, pthread_self());\r
+ LOGD("%s:%d, context=%p", __FUNCTION__, __LINE__, globalCtx);\r
\r
Validator validator(globalCtx);\r
\r
\r
void ContentListener::oncontentupdated(MediacontentMediaPtr content)\r
{\r
+\r
JSContextRef context = m_callback->getContext();\r
\r
MediaConverterFactory::ConverterType converter = MediaConverterFactory::getConverter(context);\r
LogError("media_filter_create Error: " << ret);
}
}
-
+
}
catch(const Exception &ex){
LogError("Exception: " << ex.DumpToString());
}
-
+
}
bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
-{
+{
string type = mediaPtr->getMediaType(); //media type.
string mediaId = mediaPtr->getMediaUUID();
if(type.compare("IMAGE") ==0 )
{
MediacontentImagePtr imagePtr = DPL::DynamicPointerCast<MediacontentImage>(mediaPtr);
-
+
if(imagePtr && (imagePtr->isChangedOrientaion()
|| imagePtr->isChangedLatitude() || imagePtr->isChangedLongitude()))
{
ret = false;
}
}
-
- if ( MEDIA_CONTENT_ERROR_NONE !=
- media_info_set_latitude(media, imagePtr->getImageLatitude())
- )
- {
- LogDebug("Error: set Latitude");
- ret = false;
- }
- if ( MEDIA_CONTENT_ERROR_NONE !=
- media_info_set_longitude(media, imagePtr->getImageLongitude())
- )
- {
- LogDebug("Error: set Longitude");
- ret = false;
- }
+ if ( MEDIA_CONTENT_ERROR_NONE !=
+ media_info_set_latitude(media, imagePtr->getImageLatitude())
+ )
+ {
+ LogDebug("Error: set Latitude");
+ ret = false;
+ }
+
+ if ( MEDIA_CONTENT_ERROR_NONE !=
+ media_info_set_longitude(media, imagePtr->getImageLongitude())
+ )
+ {
+ LogDebug("Error: set Longitude");
+ ret = false;
+ }
if ( MEDIA_CONTENT_ERROR_NONE != image_meta_update_to_db (img) )
{
LogDebug("Error: update db");
ret = false;
}
-
+
if ( MEDIA_CONTENT_ERROR_NONE != image_meta_destroy(img))
{
LogDebug("Error: destroy media info");
ret = false;
}
-
+
img = NULL;
-
+
}
else
{
}
if(type.compare("VIDEO") ==0 )
- {
+ {
MediacontentVideoPtr videoPtr = DPL::DynamicPointerCast<MediacontentVideo>(mediaPtr);
if (videoPtr && ( videoPtr->isChangedArtists () || videoPtr->isChangedAlbum()
|| videoPtr->isChangedLatitude() ||videoPtr->isChangedLongitude()) )
video_meta_h video = NULL;
if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_video(media, &video))
{
-#if 0 //NOT support
+#if 0 //NOT support
if ( videoPtr->isChangedPlayCount() )
{
if ( MEDIA_CONTENT_ERROR_NONE !=
{
LogDebug("Error: set play count");
ret = false;
-
+
}
}
-
+
if (videoPtr->isChangedPlayedTime())
{
if ( MEDIA_CONTENT_ERROR_NONE !=
LogDebug("Not support - Artist API");
ret = false;
}
-#endif
- if ( MEDIA_CONTENT_ERROR_NONE !=
- media_info_set_latitude(media, videoPtr->getVideoLatitude())
- )
- {
- LogDebug("Error: set Latitude");
- ret = false;
- }
+#endif
+ if ( MEDIA_CONTENT_ERROR_NONE !=
+ media_info_set_latitude(media, videoPtr->getVideoLatitude())
+ )
+ {
+ LogDebug("Error: set Latitude");
+ ret = false;
+ }
+
+ if ( MEDIA_CONTENT_ERROR_NONE !=
+ media_info_set_longitude(media, videoPtr->getVideoLongitude())
+ )
+ {
+ LogDebug("Error: set Latitude");
+ ret = false;
+ }
- if ( MEDIA_CONTENT_ERROR_NONE !=
- media_info_set_longitude(media, videoPtr->getVideoLongitude())
- )
- {
- LogDebug("Error: set Latitude");
- ret = false;
- }
-
if ( MEDIA_CONTENT_ERROR_NONE != video_meta_update_to_db (video) )
{
LogDebug("Error: update db");
ret = false;
}
-
+
if ( MEDIA_CONTENT_ERROR_NONE != video_meta_destroy(video))
{
LogDebug("Error: destroy video meta");
}
video = NULL;
-
- }
+
+ }
}
-
+
} //video
-
+
if(type.compare("AUDIO") ==0 )
{
-
+
MediacontentAudioPtr audioPtr = DPL::DynamicPointerCast<MediacontentAudio>(mediaPtr);
if (audioPtr && ( audioPtr->isChangedAudioArtist () || audioPtr->isChangedAudioAlbum()
|| audioPtr->isChangedAudioGenre() ||audioPtr->isChangedAudioComposer()
audio_meta_h audio=NULL;
if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_audio(media, &audio))
{
-#if 0 //NOT support
+#if 0 //NOT support
if ( audioPtr->isChangedPlayCount() )
{
if ( MEDIA_CONTENT_ERROR_NONE !=
{
LogDebug("Error: set play count");
ret = false;
- }
+ }
}
-
+
if (audioPtr->isChangedPlayedTime())
{
if ( MEDIA_CONTENT_ERROR_NONE !=
virtual void setMimeType(const string &value);
virtual void setDisplayName(const string &value, bool isChanged=false);
virtual void setTitle(const string &value);
- virtual void setFilePath(const string &value);
- virtual void setThumbnailPath(const string &value);
+ virtual void setFilePath(const string &value);
+ virtual void setThumbnailPath(const string &value);
virtual void setCreatedDate(const tm &value);
virtual void setReleasedDate(const tm &value);
virtual void setModifiedDate(const tm &value);
{"id", "id"},
{"directoryURI", "FOLDER_PATH"},
{"title", "FOLDER_NAME"},
- {"storageType", "FOLDER_STORAGE_TYPE"},
- {"modifiedDate", "FOLDER_MODIFIED_TIME"},
+ {"storageType", "FOLDER_STORAGE_TYPE"},
+ {"modifiedDate", "FOLDER_MODIFIED_TIME"},
};
map<string, string> MediaSearchVisitor::attrMediaEnumMap = {
//media item attribues.
- {"id", "MEDIA_ID"},
- {"type", "MEDIA_TYPE"},
+ {"id", "MEDIA_ID"},
+ {"type", "MEDIA_TYPE"},
{"mimeType", "MEDIA_MIME_TYPE"},
{"name", "MEDIA_DISPLAY_NAME"},
- {"title", "MEDIA_TITLE"},
+ {"title", "MEDIA_TITLE"},
{"contentURI", "MEDIA_PATH"},
{"thumbnailURIs", "MEDIA_THUMBNAIL_PATH"},
{"description", "MEDIA_DESCRIPTION"},
- {"rating", "MEDIA_RATING"},
+ {"rating", "MEDIA_RATING"},
{"createdDate", "MEDIA_ADDED_TIME"},
{"releaseDate", "MEDIA_DATETAKEN"},
- {"modifiedDate", "MEDIA_MODIFIED_TIME"},
+ {"modifiedDate", "MEDIA_MODIFIED_TIME"},
//media image,video,audio attribues.
{"geolocation.latitude", "MEDIA_LATITUDE"},
{"geolocation.longitude", "MEDIA_LONGITUDE"},
- {"album", "MEDIA_ALBUM"},
- {"artists", "MEDIA_ARTIST"},
- {"width", "MEDIA_WIDTH"},
- {"height", "MEDIA_HEIGHT"},
- {"genres", "MEDIA_GENRE"},
- {"size", "MEDIA_SIZE"},
+ {"album", "MEDIA_ALBUM"},
+ {"artists", "MEDIA_ARTIST"},
+ {"width", "MEDIA_WIDTH"},
+ {"height", "MEDIA_HEIGHT"},
+ {"genres", "MEDIA_GENRE"},
+ {"size", "MEDIA_SIZE"},
};
if( queryType == QUERY_FOLDER)
{
pos = attrFolderEnumMap.find(attrName);
-
+
if(attrFolderEnumMap.end() != pos)
{
platformAttr = pos->second;
else if(queryType == QUERY_MEDIA)
{
pos = attrMediaEnumMap.find(attrName);
-
+
if(attrMediaEnumMap.end() != pos)
{
platformAttr = pos->second;
valueStr = os.str();
}
operatorStr = operatorKey[cond];
- conditionStr = STR_LEFT_BRACKET + attrName + operatorStr + valueStr + STR_RIGHT_BRACKET;
+ conditionStr = STR_LEFT_BRACKET + attrName + operatorStr + valueStr + STR_RIGHT_BRACKET;
return conditionStr;
}
static bool mediaItemCallback(media_info_h info, void* user_data)
{
media_content_type_e type;
+ LogDebug("mediaItemCallback is called");
if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_media_type( info, &type) )
{
char *mime_type,
void *user_data)
{
+
ContentListener *listener = static_cast<ContentListener*>(user_data);
std::string err_msg;
if( error == MEDIA_CONTENT_ERROR_NONE)
err_msg = "";
if( update_item == MEDIA_ITEM_FILE)
{
- string uuid = uuid;
- string path = path;
- string condition = "MEDIA_ID=";
+ string condition = "MEDIA_ID=\"";
condition += uuid;
+ condition += "\"";
MediacontentMedia *p_content;
-
if(update_type == MEDIA_CONTENT_INSERT)
{
filter_h filter = NULL;
}
else if(update_type == MEDIA_CONTENT_UPDATE)
{
+
filter_h filter = NULL;
if ( MEDIA_CONTENT_ERROR_NONE == media_filter_create(&filter))
{
media_filter_destroy(filter);
}
-
}
else if(update_type == MEDIA_CONTENT_DELETE)
{
#define TIZEN_CONTENT_MEDIA_TYPE "type"
#define TIZEN_CONTENT_MEDIA_MIME_TYPE "mimeType"
#define TIZEN_CONTENT_MEDIA_NAME "name"
-#define TIZEN_CONTENT_MEDIA_TITLE "title"
+#define TIZEN_CONTENT_MEDIA_TITLE "title"
#define TIZEN_CONTENT_MEDIA_FILE_URL "contentURI"
#define TIZEN_CONTENT_MEDIA_THUMBNAILPATH "thumbnailURIs"
#define TIZEN_CONTENT_MEDIA_RELEASEDDATE "releaseDate"
static JSValueRef getPropertyDescription(
JSContextRef context,
- JSObjectRef object,
+ JSObjectRef object,
JSStringRef propertyName,
JSValueRef* exception);
SET(DESTINATION_NAME ${datacontrol_dest})
SET(TARGET_IMPL_NAME ${datacontrol_impl})
-PKG_SEARCH_MODULE(platform REQUIRED capi-appfw-application appsvc pkgmgr)
+PKG_CHECK_MODULES(platform_pkgs_datacontrol REQUIRED capi-appfw-application appsvc pkgmgr)
INCLUDE_DIRECTORIES(
- ${platform_INCLUDE_DIRS}
+ ${platform_pkgs_datacontrol_INCLUDE_DIRS}
${TOP}/Common
)
MappedDataControlConsumer.cpp
SelectDataObject.cpp
SqlDataControlConsumer.cpp
- SelectDataObject.cpp
+ SelectDataObject.cpp
DataControlConverter.cpp
DataControlListener.cpp
JSDataControlManager.cpp
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${platform_LIBRARIES}
+ ${tizen_impl}
+ ${platform_pkgs_datacontrol_LIBRARIES}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${tizen_impl}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/datacontrol
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/datacontrol
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
return toJSValueRef_(*arg, &DataSyncConverter::toJSValueRefSyncStatistics, this);
}
-JSValueRef DataSyncConverter::toFunctionOrNull(const JSValueRef& arg)
-{
- if (Validator(m_context).isCallback(arg)) {
- return arg;
- } else if (!JSValueIsNull(m_context, arg) && !JSValueIsUndefined(m_context, arg)) {
- ThrowMsg(ConversionException, "Not a function nor JS null.");
- }
- return NULL;
-}
-
}
}
JSValueRef toJSValueRefSyncStatistics(const SyncStatisticsPtr &arg);
JSValueRef toJSValueRefSyncStatisticsList(const SyncStatisticsListPtr &arg);
-
- JSValueRef toFunctionOrNull(const JSValueRef& arg);
};
}
OnDataSyncStateChangedPtr eventPtr(new OnDataSyncStateChanged());
DataSyncManager* thisDataSyncManager = (DataSyncManager*) user_data;
+ LogDebug("Get state info.");
sync_agent_get_event_data_param(request, &profileDirName);
sync_agent_get_event_data_param(request, &sync_type);
sync_agent_get_event_data_param(request, &progress);
int isFromServer, totalPerOperation, syncedPerOperation, totalPerDb, syncedPerDb;
+ LogDebug("Get progress info.");
sync_agent_get_event_data_param(request, &profileDirName);
sync_agent_get_event_data_param(request, &syncType);
sync_agent_get_event_data_param(request, &uri);
LogDebug("profileId from platform: "<<profileId);
char* profileName = NULL;
- char* profileDirName = NULL;
ret = sync_agent_ds_get_profile_name(profile_h, &profileName);
if (SYNC_AGENT_DS_SUCCESS!=ret) {
ThrowMsg(PlatformException, "Platform error while getting a profile name: "<<ret);
}
- ret = sync_agent_ds_get_profile_dir_name(profile_h, &profileDirName);
- if (SYNC_AGENT_DS_SUCCESS!=ret) {
- ThrowMsg(PlatformException, "Platform error while getting a profile dir name: "<<ret);
- }
- LogDebug("profileName: "<<profileName<<", profileDirName: "<<profileDirName);
+ LogDebug("profileName: "<<profileName<<", profileId: "<<profileId);
- profile->setProfileId(profileDirName);
+ std::stringstream ss;
+ ss<<profileId;
+ profile->setProfileId(ss.str());
if(profileName) {
free(profileName);
}
- if(profileDirName) {
- free(profileDirName);
- }
event->setResult(true);
}
sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
- ret = sync_agent_ds_create_profile_info(&profile_h);
- if (SYNC_AGENT_DS_SUCCESS!=ret) {
- ThrowMsg(PlatformException, "Platform error while creating a profile: "<<ret);
- }
-
- ret = sync_agent_ds_set_profile_dir_name(profile_h, (char*)(profile->getProfileId().c_str()));
+ int profileId;
+ std::stringstream ss(profile->getProfileId());
+ ss>>profileId;
+ ret = sync_agent_ds_get_profile(profileId, &profile_h);
if (SYNC_AGENT_DS_SUCCESS!=ret) {
- ThrowMsg(PlatformException, "Platform error while settting a profile dir name: "<<ret);
+ ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
}
ret = sync_agent_ds_set_profile_name(profile_h, (char*)(profile->getProfileName().c_str()));
sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
- ret = sync_agent_ds_create_profile_info(&profile_h);
- if (SYNC_AGENT_DS_SUCCESS!=ret) {
- ThrowMsg(PlatformException, "Platform error while creating a profile: "<<ret);
- }
-
- ret = sync_agent_ds_set_profile_dir_name(profile_h, (char*)(event->getProfileId().c_str()));
+ int profileId;
+ std::stringstream ss(event->getProfileId());
+ ss>>profileId;
+ ret = sync_agent_ds_get_profile(profileId, &profile_h);
if (SYNC_AGENT_DS_SUCCESS!=ret) {
- ThrowMsg(PlatformException, "Platform error while settting a profile dir name: "<<ret);
+ ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
}
ret = sync_agent_ds_delete_profile(profile_h);
if (SYNC_AGENT_DS_SUCCESS!=ret) {
- ThrowMsg(NotFoundException, "Platform error while deleting a profile: "<<ret);
+ ThrowMsg(PlatformException, "Platform error while deleting a profile: "<<ret);
}
event->setResult(true);
sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
- ret = sync_agent_ds_get_profile((char*)(event->getProfileId().c_str()), &profile_h);
+ int profileId;
+ std::stringstream ss(event->getProfileId());
+ ss>>profileId;
+ ret = sync_agent_ds_get_profile(profileId, &profile_h);
if (SYNC_AGENT_DS_SUCCESS!=ret) {
ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
}
profile_h = (ds_profile_h) iter->data;
SyncProfileInfoPtr profile( new SyncProfileInfo() );
- char *profileDirName = NULL;
- ret = sync_agent_ds_get_profile_dir_name(profile_h, &profileDirName);
+ int profileId;
+ ret = sync_agent_ds_get_profile_id(profile_h, &profileId);
if (SYNC_AGENT_DS_SUCCESS!=ret) {
- ThrowMsg(PlatformException, "Platform error while gettting a profile dir name: "<<ret);
+ ThrowMsg(PlatformException, "Platform error while gettting a profile id: "<<ret);
}
- profile->setProfileId(profileDirName);
- LogDebug("Processing a profile with id: "<<profileDirName);
+ std::stringstream ss;
+ ss<<profileId;
+ profile->setProfileId(ss.str());
+
+ LogDebug("Processing a profile with id: "<<profile->getProfileId());
char *profileName = NULL;
ret = sync_agent_ds_get_profile_name(profile_h, &profileName);
sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
sync_agent_event_error_e err= SYNC_AGENT_EVENT_FAIL;
- ret = sync_agent_ds_get_profile((char*)(event->getProfileId().c_str()), &profile_h);
+ int profileId;
+ std::stringstream ss(event->getProfileId());
+ ss>>profileId;
+ ret = sync_agent_ds_get_profile(profileId, &profile_h);
if (SYNC_AGENT_DS_SUCCESS!=ret) {
ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
}
sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
- ret = sync_agent_ds_get_profile((char*)(event->getProfileId().c_str()), &profile_h);
+ int profileId;
+ std::stringstream ss(event->getProfileId());
+ ss>>profileId;
+ ret = sync_agent_ds_get_profile(profileId, &profile_h);
if (SYNC_AGENT_DS_SUCCESS!=ret) {
ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
}
sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
- ret = sync_agent_ds_get_profile((char*)(event->getProfileId().c_str()), &profile_h);
+ int profileId;
+ std::stringstream ss(event->getProfileId());
+ ss>>profileId;
+ ret = sync_agent_ds_get_profile(profileId, &profile_h);
if (SYNC_AGENT_DS_SUCCESS!=ret) {
ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
}
int statistics_count = g_list_length(statistics_list);
LogDebug("statistics_count: "<<statistics_count);
+ sync_agent_ds_statistics_info *statistics = NULL;
for (int i = 0; i < statistics_count; i++) {
- sync_agent_ds_statistics_info *statistics = (sync_agent_ds_statistics_info *) g_list_nth_data(statistics_list, i);
+ statistics = (sync_agent_ds_statistics_info *) g_list_nth_data(statistics_list, i);
SyncStatisticsPtr statisticsPtr( new SyncStatistics() );
if(0==i) {
+ LogDebug("Statistics for contact.");
statisticsPtr->setServiceType(convertToSyncServiceType(SYNC_AGENT_CONTACT));
} else if(1==i) {
+ LogDebug("Statistics for event.");
statisticsPtr->setServiceType(convertToSyncServiceType(SYNC_AGENT_CALENDAR));
} else {
LogWarning("Unsupported category for statistics: "<<i);
continue;
}
- statisticsPtr->setSyncStatus(convertToSyncStatus(statistics->dbsynced));
+ LogDebug("dbsynced: "<<statistics->dbsynced);
+ statisticsPtr->setSyncStatus(convertToSyncStatus(statistics->dbsynced));
statisticsPtr->setClientToServerTotal(statistics->client2server_total);
statisticsPtr->setClientToServerAdded(statistics->client2server_nrofadd);
statisticsPtr->setClientToServerUpdated(statistics->client2server_nrofreplace);
if (argumentCount>=2) {
LogDebug("Process the listener callback.");
- if(converter.toFunctionOrNull(arguments[1])) {
+ if (JSValueIsObject(context, arguments[1])) {
LogDebug("Non-null callbacks.");
- JSObjectRef objectCallbacks = converter.toJSObjectRef(converter.toFunctionOrNull(arguments[1]));
+ JSObjectRef objectCallbacks = converter.toJSObjectRef(arguments[1]);
JSCallbackManagerPtr onProgressCbm(NULL), onCompletedCbm(NULL), onStoppedCbm(NULL), onFailedCbm(NULL);
Validator validator(context);
emitter->setEventPrivateData(DPL::StaticPointerCast<IEventPrivateData>(privData));
dplEvent->setEmitter(emitter);
+ } else if (JSValueIsNull(context, arguments[1]) || JSValueIsUndefined(context, arguments[1]) ) {
+ LogDebug("Null or undefined listener.");
+ } else {
+ ThrowMsg(ConversionException, "Wrong second parameter type.");
}
}
SET(DESTINATION_NAME ${download_dest})
SET(TARGET_IMPL_NAME ${download_impl})
-PKG_SEARCH_MODULE(download REQUIRED capi-web-url-download)
+PKG_CHECK_MODULES(platform_pkgs_download REQUIRED capi-web-url-download)
+
+INCLUDE_DIRECTORIES(
+ ${TOP}/Common
+ ${TOP}/Filesystem
+ ${platform_pkgs_download_INCLUDE_DIRS}
+)
SET(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_RPATH}
JSDownloadRequest.cpp
)
-INCLUDE_DIRECTORIES(
- ${TOP}/Common
- ${TOP}/Filesystem
- ${download_INCLUDE_DIRS}
-)
-
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${download_LIBRARIES}
+ ${tizen_impl}
+ ${filesystem_impl}
+ ${platform_pkgs_download_LIBRARIES}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${filesystem_impl}
- ${filesystem_config}
- ${tizen_impl}
- ${timeutil_impl}
+ "-Wl,--no-as-needed" ${filesystem_config}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/download
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/download
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
SET(TARGET_IMPL_NAME ${filesystem_impl})
SET(TARGET_CONFIG_NAME ${filesystem_config})
-PKG_SEARCH_MODULE(fs REQUIRED capi-appfw-application libpcrecpp ecore ecore-1)
+PKG_CHECK_MODULES(platform_pkgs_filesystem REQUIRED capi-appfw-application libpcrecpp ecore)
INCLUDE_DIRECTORIES(
- ${fs_INCLUDE_DIRS}
${TOP}/Common
+ ${platform_pkgs_filesystem_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
SET(SRCS_IMPL
IManager.cpp
IPath.cpp
- IStream.cpp
+ IStream.cpp
EventResolve.cpp
EventGetStorage.cpp
EventListStorages.cpp
PathUtils.cpp
StorageProperties.cpp
EventStoragestateChanged.cpp
- Manager.cpp
+ Manager.cpp
Node.cpp
Path.cpp
Stream.cpp
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
${LIBS_WIDGETDB}
- ${fs_LIBRARIES}
+ ${tizen_impl}
+ ${platform_pkgs_filesystem_LIBRARIES}
)
SET(SRCS_CONFIG
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
${TARGET_CONFIG_NAME}
- ${tizen_impl}
- ${timeutil_impl}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/filesystem
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/filesystem
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
SET(DESTINATION_NAME ${log_dest})
set(SRCS_DEVICEINTERACTION
- JSTizenLog.cpp
+ JSTizenLog.cpp
plugin_initializer.cpp
)
INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/log
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/log
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
\ No newline at end of file
SET(DESTINATION_NAME ${messageport_dest})
SET(TARGET_IMPL_NAME ${messageport_impl})
-PKG_SEARCH_MODULE(message-port REQUIRED message-port)
-PKG_SEARCH_MODULE(capi-appfw-app-manager REQUIRED capi-appfw-app-manager)
+PKG_CHECK_MODULES(platform_pkgs_messageport REQUIRED message-port)
INCLUDE_DIRECTORIES(
${TOP}/Common
- ${message-port_INCLUDE_DIRS}
- ${capi-appfw-app-manager_INCLUDE_DIRS}
-)
-
-LINK_DIRECTORIES(
- ${message-port_LIBRARY_DIRS}
+ ${platform_pkgs_messageport_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
)
-SET(SRCS_CONFIG
- plugin_config.cpp
-)
-
-ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_CONFIG})
-
-TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
- ${LIBS_COMMON}
-)
-
-SET(SRCS
+SET(SRCS_IMPL
ILocalMessagePort.cpp
IMessagePortManager.cpp
IRemoteMessagePort.cpp
LocalMessagePortController.cpp
MessagePortConverter.cpp
MessagePortListenerManager.cpp
+)
+
+ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
+
+TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
+ ${LIBS_COMMON}
+ ${platform_pkgs_messageport_LIBRARIES}
+)
+
+SET(SRCS
+ plugin_config.cpp
plugin_initializer.cpp
)
ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(${TARGET_NAME}
- ${LIBS_COMMON}
- ${message-port_LIBRARIES}
- ${capi-appfw-app-manager_LIBRARIES}
${TARGET_IMPL_NAME}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/messageport
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/messageport
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
<api-feature>
<name>http://tizen.org/privilege/messageport</name>
- <!-- device-capability>messageport</device-capability -->
+ <device-capability>messageport</device-capability>
</api-feature>
</plugin-properties>
SET(DESTINATION_NAME ${messaging_dest})
SET(TARGET_IMPL_NAME ${messaging_impl})
-PKG_SEARCH_MODULE(msg-service-module REQUIRED msg-service)
-PKG_SEARCH_MODULE(email-service-module REQUIRED email-service)
-PKG_SEARCH_MODULE(dbus REQUIRED dbus-1)
+PKG_CHECK_MODULES(platform_pkgs_messaging REQUIRED msg-service email-service dbus-1)
INCLUDE_DIRECTORIES(
- ${TOP}/Tizen
+ ${TOP}/Tizen
${TOP}/Common
${TOP}/Filesystem
- ${msg-service-module_INCLUDE_DIRS}
- ${email-service-module_INCLUDE_DIRS}
- ${dbus_INCLUDE_DIRS}
- ${INCLUDES_PLATFORM_IMPLEMENTATION_DBUS}
+ ${platform_pkgs_messaging_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_RPATH}
- ${wrt-deviceapis-filesystem_LIBRARY_DIRS}
${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${tizen_dest}
${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${filesystem_dest}
${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${timeutil_dest}
IMessagingServiceManager.cpp
IMessagingService.cpp
MessagingFactory.cpp
- Attachments.cpp
+ Attachments.cpp
IAttachment.cpp
AttachmentFactory.cpp
BccRecipient.cpp
CcRecipient.cpp
From.cpp
IBinarySms.cpp
- IEmptyMessage.cpp
+ IEmptyMessage.cpp
IEmail.cpp
IMessage.cpp
IMessaging.cpp
EventMessageReceived.cpp
EmitterMessageReceived.cpp
EmitterConversationReceived.cpp
- EmitterFolderReceived.cpp
+ EmitterFolderReceived.cpp
MessageFilterValidatorFactory.cpp
MessageFilterValidator.cpp
ConversationFilterValidatorFactory.cpp
ConversationFilterValidator.cpp
FolderFilterValidatorFactory.cpp
- FolderFilterValidator.cpp
+ FolderFilterValidator.cpp
StorageChangesMessageFilterValidatorFactory.cpp
StorageChangesMessageFilterValidator.cpp
- StorageChangesMessageGenerator.cpp
+ StorageChangesMessageGenerator.cpp
StorageChangesConversationFilterValidatorFactory.cpp
- StorageChangesConversationFilterValidator.cpp
- StorageChangesConversationGenerator.cpp
+ StorageChangesConversationFilterValidator.cpp
+ StorageChangesConversationGenerator.cpp
StorageChangesFolderFilterValidatorFactory.cpp
- StorageChangesFolderFilterValidator.cpp
+ StorageChangesFolderFilterValidator.cpp
StorageChangesFolderGenerator.cpp
MessagingServiceManager.cpp
MessagingService.cpp
Conversation.cpp
MessageFolder.cpp
ConversationQueryGenerator.cpp
- FolderQueryGenerator.cpp
+ FolderQueryGenerator.cpp
messageDB/MsgSqliteWrapper.cpp
messageDB/MessageStorageReader.cpp
DBus/Connection.cpp
)
SET(SRCS_IMPL
- ${SRCS_MESSAGING}
+ ${SRCS_MESSAGING}
)
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
${LIBS_WIDGETDB}
- ${msg-service-module_LIBRARIES}
- ${email-service-module_LIBRARIES}
- ${dbus_LIBRARIES}
- ${LIBS_PLATFORM_IMPLEMENTATION_DBUS}
- ${LIBS_PLATFORM_IMPLEMENTATION_FILESYSTEM}
- ${wrt-deviceapis-filesystem_LDFLAGS}
+ ${tizen_impl}
+ ${filesystem_impl}
+ ${platform_pkgs_messaging_LIBRARIES}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${filesystem_impl}
- ${filesystem_config}
- ${tizen_impl}
- ${timeutil_impl}
+ "-Wl,--no-as-needed" ${filesystem_config}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/messaging
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/messaging
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
SET(DESTINATION_NAME ${nfc_dest})
SET(TARGET_IMPL_NAME ${nfc_impl})
-PKG_SEARCH_MODULE(capi-network-nfc REQUIRED capi-network-nfc)
+PKG_CHECK_MODULES(platform_pkgs_nfc REQUIRED capi-network-nfc)
INCLUDE_DIRECTORIES(
${TOP}/Common
- ${capi-network-nfc_INCLUDE_DIRS}
+ ${platform_pkgs_nfc_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
- ${CMAKE_INSTALL_RPATH}
- ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
+${CMAKE_INSTALL_RPATH}
+${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
)
SET(SRCS_IMPL
- JSNFCManager.cpp
+ JSNFCManager.cpp
JSNFCAdapter.cpp
JSNFCTag.cpp
JSNdefMessage.cpp
JSNdefRecordMedia.cpp
JSNdefRecordArray.cpp
JSNFCTarget.cpp
- NFCConverter.cpp
- EventNFCChangedPrivateData.cpp
- NFCStaticController.cpp
- NFCAsyncCallbackManager.cpp
- NFCListenerManager.cpp
- ResponseDispatcher.cpp
- NFCFactory.cpp
- INFCAdapter.cpp
- INFCTag.cpp
- TagFilter.cpp
- INFCTarget.cpp
- NFCDefaultAdapter.cpp
- NFCAdapter.cpp
- NFCTag.cpp
- NdefMessage.cpp
- NdefRecord.cpp
- NFCTarget.cpp
- NFCUtil.cpp
+ NFCConverter.cpp
+ EventNFCChangedPrivateData.cpp
+ NFCStaticController.cpp
+ NFCAsyncCallbackManager.cpp
+ NFCListenerManager.cpp
+ ResponseDispatcher.cpp
+ NFCFactory.cpp
+ INFCAdapter.cpp
+ INFCTag.cpp
+ TagFilter.cpp
+ INFCTarget.cpp
+ NFCDefaultAdapter.cpp
+ NFCAdapter.cpp
+ NFCTag.cpp
+ NdefMessage.cpp
+ NdefRecord.cpp
+ NFCTarget.cpp
+ NFCUtil.cpp
)
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${capi-network-nfc_LIBRARIES}
+ ${platform_pkgs_nfc_LIBRARIES}
)
SET(SRCS
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/nfc
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/nfc
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
SET(TARGET_NAME ${networkbearerselection_target})
SET(DESTINATION_NAME ${networkbearerselection_dest})
-PKG_SEARCH_MODULE(capi-network-connection REQUIRED capi-network-connection)
+PKG_CHECK_MODULES(platform_pkgs_networkbearerselection REQUIRED capi-network-connection)
-SET(SRCS
+INCLUDE_DIRECTORIES(
+ ${TOP}/Common
+ ${platform_pkgs_networkbearerselection_INCLUDE_DIRS}
+)
+
+SET(SRCS
INetworkBearerSelection.cpp
NetworkBearerSelectionFactory.cpp
NetworkBearerSelection.cpp plugin_initializer.cpp
NetworkBearerSelectionResponseDispatcher.cpp
)
-INCLUDE_DIRECTORIES(
- ${capi-network-connection_INCLUDE_DIRS}
- ${TOP}/Common
-)
-
ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${LIBS_COMMON}
- ${capi-network-connection_LIBRARIES}
+ ${platform_pkgs_networkbearerselection_LIBRARIES}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/networkbearerselection
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/networkbearerselection
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
SET(TARGET_NAME ${notification_target})
SET(DESTINATION_NAME ${notification_dest})
SET(TARGET_IMPL_NAME ${notification_impl})
-SET(TARGET_CONFIG_NAME ${notification_config})
-PKG_SEARCH_MODULE(noti REQUIRED notification)
-PKG_SEARCH_MODULE(application REQUIRED capi-appfw-application)
+PKG_CHECK_MODULES(platform_pkgs_notification REQUIRED notification capi-appfw-application)
INCLUDE_DIRECTORIES(
${TOP}/Common
${TOP}/Application
${TOP}/Filesystem
- ${noti_INCLUDE_DIRS}
- ${application_INCLUDE_DIRS}
+ ${platform_pkgs_notification_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${noti_LIBRARIES}
- ${application_LIBRARIES}
- )
-
-SET(SRCS_CONFIG
- plugin_config.cpp
-)
-
-ADD_LIBRARY(${TARGET_CONFIG_NAME} SHARED ${SRCS_CONFIG})
-
-TARGET_LINK_LIBRARIES(${TARGET_CONFIG_NAME}
- ${LIBS_COMMON}
+ ${tizen_impl}
+ ${application_impl}
+ ${filesystem_impl}
+ ${platform_pkgs_notification_LIBRARIES}
)
SET(SRCS
+ plugin_config.cpp
plugin_initializer.cpp
)
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${TARGET_CONFIG_NAME}
- ${application_impl}
- ${application_config}
- ${filesystem_impl}
- ${filesystem_config}
- ${tizen_impl}
- ${timeutil_impl}
+ "-Wl,--no-as-needed" ${application_config}
+ "-Wl,--no-as-needed" ${filesystem_config}
)
-INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
+INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/notification
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/notification
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
void setUpdatedFlag(bool value)
{
+ if (value)
+ LogDebug("set True");
m_notiUpdated = value;
}
//
#include <algorithm>
-#include <dpl/log/log.h>
#include <CommonsJavaScript/ScopedJSStringRef.h>
#include <JSTizenExceptionFactory.h>
#include <JSTizenException.h>
#include "NotificationConverter.h"
#include "JSNotificationLineArray.h"
+#include "Logger.h"
#define FUNCTION_CONCAT "concat"
#define FUNCTION_JOIN "join"
LogWarning("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
-
}
Catch (WrtDeviceApis::Commons::InvalidArgumentException)
{
try
{
- AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
- TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ //AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
+ //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
if (argumentCount == 1)
reserveArguments = arguments[0];
try
{
- AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
- TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ //AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
+ //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
if (priv == NULL)
{
{NOTIFICATION_NUMBER, JSStatusNotification::getProperty, JSStatusNotification::setProperty, kJSPropertyAttributeNone },
{NOTIFICATION_THUMBNAILS, JSStatusNotification::getProperty, JSStatusNotification::setProperty, kJSPropertyAttributeNone },
{NOTIFICATION_SUB_ICON_PATH, JSStatusNotification::getProperty, JSStatusNotification::setProperty, kJSPropertyAttributeNone },
+ {NOTIFICATION_PROGRESS_TYPE, JSStatusNotification::getProperty, JSStatusNotification::setProperty, kJSPropertyAttributeNone },
{0, 0, 0, 0}
};
return true;
}
+
+ else if (property == NOTIFICATION_PROGRESS_TYPE)
+ {
+ notification->setProgressType(converter->toNotificationProgressType(value));
+ }
else if (property == NOTIFICATION_LINES)
{
else if (property == NOTIFICATION_TYPE)
{
LogDebug(" TYPE : " << notification->getNotiType());
- return converter->toJSValueRef(notification->getNotiType());
+ return converter->toJSValueRef("STATUS");
}
else if (property == NOTIFICATION_POSTED_TIME)
{
}
else if (property == NOTIFICATION_THUMBNAILS)
{
- return converter->toJSValueRef(notification->getThumbnails());
+ StringArrayPtr thumbnailsPtr = notification->getThumbnails();
+
+ std::vector<std::string>::iterator it;
+
+ int idx = 0;
+ for (it = thumbnailsPtr->begin(); it < thumbnailsPtr->end(); ++it)
+ {
+ std::string str = *it;
+ LogDebug(" thumbs : " << str);
+ str = DeviceAPI::Filesystem::Utils::toVirtualPath(context, str);
+ //str = path->getFullPath();
+
+ LogDebug(" thumbs : " << str);
+ *it = str;
+ idx ++;
+ }
+ return converter->toJSValueRef(thumbnailsPtr);
+
+ //return converter->toJSValueRef(notification->getThumbnails());
}
else if (property == NOTIFICATION_SUB_ICON_PATH )
{
strSubIcon = DeviceAPI::Filesystem::Utils::toVirtualPath(context, strSubIcon);
return converter->toJSValueRef(strSubIcon);
}
+ else if (property == NOTIFICATION_PROGRESS_TYPE)
+ {
+ return converter->toJSValueRef(notification->getProgressType());
+ }
else
{
ThrowMsg(WrtDeviceApis::Commons::ConversionException,"No attribute");
#endif
#define NOTIFICATION_APP_CONTROL "appControl"
#define NOTIFICATION_APP_ID "appId"
+#define NOTIFICATION_PROGRESS_TYPE "progressType"
#define NOTIFICATION_PROGRESS_VALUE "progressValue"
#define NOTIFICATION_LINES "detailInfo"
#define NOTIFICATION_BACKGROUND_IMAGE_PATH "backgroundImagePath"
*/
#include <algorithm>
-#include <dpl/log/log.h>
#include <CommonsJavaScript/Converter.h>
#include <CommonsJavaScript/ScopedJSStringRef.h>
#include <JSTizenExceptionFactory.h>
#include <JSTizenException.h>
#include "NotificationConverter.h"
#include "JSStringArray.h"
+#include "Logger.h"
#define FUNCTION_CONCAT "concat"
#define FUNCTION_JOIN "join"
}
}
+NotificationProgressType NotificationConverter::toNotificationProgressType(const JSValueRef arg)
+{
+ std::string strType = toString(arg);
+ LogDebug("progress Type : " << strType);
+ if ( strType.compare("BYTE") == 0 )
+ {
+ return NOTI_PROGRESS_TYPE_SIZE;
+ }
+ else if ( strType.compare("PERCENTAGE") == 0 )
+ {
+ return NOTI_PROGRESS_TYPE_PERCENTAGE;
+ }
+ else
+ {
+ ThrowMsg(WrtDeviceApis::Commons::ConversionException, "notification type not supported");
+ }
+}
+
+
void NotificationConverter::NotificationConverter::toNotificationFromDict( INotificationPtr& notification, const JSValueRef arg)
{
if (JSValueIsUndefined(m_context, arg) || JSValueIsNull(m_context, arg))
const ScopedJSStringRef numberStr(JSStringCreateWithUTF8CString(NOTIFICATION_NUMBER));
const ScopedJSStringRef thumbnailsStr(JSStringCreateWithUTF8CString(NOTIFICATION_THUMBNAILS));
const ScopedJSStringRef subIconPathStr(JSStringCreateWithUTF8CString(NOTIFICATION_SUB_ICON_PATH));
+ const ScopedJSStringRef progressTypeStr(JSStringCreateWithUTF8CString(NOTIFICATION_PROGRESS_TYPE));
DeviceAPI::Filesystem::IPathPtr path;
JSValueRef numberValue = JSObjectGetProperty(m_context, dictObject, numberStr.get(), NULL);
JSValueRef thumbnailsValue = JSObjectGetProperty(m_context, dictObject, thumbnailsStr.get(), NULL);
JSValueRef subIconPathValue = JSObjectGetProperty(m_context, dictObject, subIconPathStr.get(), NULL);
+ JSValueRef progressTypeValue = JSObjectGetProperty(m_context, dictObject, progressTypeStr.get(), NULL);
if (!JSValueIsUndefined(m_context, contentValue))
{
std::string appId = toString(appIdValue);
notification->setApplicationId(appId);
}
+
+ if (!JSValueIsUndefined(m_context, progressTypeValue))
+ {
+ notification->setProgressType(toNotificationProgressType(progressTypeValue));
+ }
if (!JSValueIsUndefined(m_context, progressValue))
{
- //unsigned short value = toULong(progressValue);
- double value = toDouble(progressValue);
- LogDebug(" Progress Value : " << value);
- notification->setProgressValue(value);
+ unsigned int progressVal = toULong(progressValue);
+ NotificationProgressType progressType = notification->getProgressType();
+
+ LogDebug(" progress type = " << progressType << "progressValue = " << progressVal);
+
+ if ( NOTI_PROGRESS_TYPE_SIZE == progressType)
+ {
+ notification->setProgressValue(progressVal);
+ }
+ else if ( NOTI_PROGRESS_TYPE_PERCENTAGE == progressType)
+ {
+ //check arrang.
+ if ( progressVal > 100 )
+ {
+ progressVal = 100;
+ }
+ double percentage = (double)progressVal/(double)100;
+ LogDebug(" Percentage Value = " << percentage);
+ notification->setProgressValue(percentage);
+ }
+
+ //double value = toDouble(progressValue);
+ //LogDebug(" Progress Value : " << value);
+ //notification->setProgressValue(value);
}
if (!JSValueIsUndefined(m_context, detailInfoValue))
subIconPath = path->getFullPath();
notification->setSubIconPath(subIconPath);
}
+
}
{
return toJSValueRef("PROGRESS");
}
+ else if ( NOTI_TYPE_THUMBNAIL == arg)
+ {
+ return toJSValueRef("THUMBNAIL");
+ }
+
+ return JSValueMakeUndefined(m_context);
+}
+
+JSValueRef NotificationConverter::toJSValueRef(const NotificationProgressType &arg)
+{
+ if ( NOTI_PROGRESS_TYPE_SIZE == arg)
+ {
+ return toJSValueRef("BYTE");
+ }
+ else if ( NOTI_PROGRESS_TYPE_PERCENTAGE== arg)
+ {
+ return toJSValueRef("PERCENTAGE");
+ }
return JSValueMakeUndefined(m_context);
}
#ifndef TIZENAPIS_TIZEN_NOTIFICATION_CONVERTER_H_
#define TIZENAPIS_TIZEN_NOTIFICATION_CONVERTER_H_
-#include <dpl/log/log.h>
#include <CommonsJavaScript/Converter.h>
#include <ApplicationControl.h>
//#include <ApplicationConverter.h>
#include <FilesystemUtils.h>
#include "INotification.h"
#include "NotificationLine.h"
+#include "Logger.h"
namespace DeviceAPI {
namespace Notification {
INotificationPtr toINotificationPtr(const JSValueRef arg);
DeviceAPI::Application::ApplicationControlPtr toIApplicationPtr(const JSValueRef arg);
void toNotificationFromDict(INotificationPtr& notification, const JSValueRef arg);
- NotificationType toNotificationType(const JSValueRef arg);
+ NotificationType toNotificationType(const JSValueRef arg);
NotificationLinePtr toNotificationLine(const JSValueRef &jsValue);
NotificationLineArrayPtr toNotificationLineArray(const JSValueRef &jsValue);
+ NotificationProgressType toNotificationProgressType(const JSValueRef arg);
JSValueRef toJSValueRef(const DeviceAPI::Application::ApplicationControlPtr &arg);
JSValueRef toJSValueRef(const INotificationPtr arg);
JSValueRef toJSValueRef(const NotificationLinePtr &arg);
JSValueRef toJSValueRef(const NotificationLineArrayPtr &arg);
+ JSValueRef toJSValueRef(const NotificationProgressType &arg);
// String Array
StringArrayPtr toStringArray(const JSValueRef &value);
}
//set content
- const char *contentStr = (notification->getContent()).c_str();
- LogDebug("Content :" << contentStr);
+ //const char *contentStr = (notification->getContent()).c_str();
+ LogDebug("Content :" << (notification->getContent()).c_str());
- if(notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contentStr,
+ if(notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, (notification->getContent()).c_str(),
NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
{
LogDebug("set Content Error");
}
else
{
- if ( notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, (notification->getSoundPath()).c_str())
+ if ( notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, notification->getSoundPath().c_str())
!= NOTIFICATION_ERROR_NONE)
{
ThrowMsg(WrtDeviceApis::Commons::UnknownException, "set notification sound error");
ret = notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
if (ret != NOTIFICATION_ERROR_NONE)
{
- LogError("notification_set_execute_option fail");
- ThrowMsg(WrtDeviceApis::Commons::PlatformException, "set execute option fail, Error Code : " << ret);
+i LogError("notification_set_execute_option fail");
}
bundle_free(service_data);
}
LogDebug(" notification_update_progress = " << ret);
- if ( NOTIFICATION_ERROR_NONE != ret)
+ if (NOTIFICATION_ERROR_NONE != ret)
{
- ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Notification Object update grogress fail, Error Code : ");
+ if ( NOTIFICATION_ERROR_NOT_EXIST_ID == ret)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "maybe, notification is not inserted yet.");
+ }
+ else
+ {
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Notification Object update grogress fail, Error Code : ");
+ }
}
+
#if 0
if ( NOTIFICATION_ERROR_NONE
namespace Notification{
#define DEFAULT_ICON_PATH "/opt/share/icons/default/"
+#define MAX_NOTIFICATION_LINE_LENGTH 2
+#define MAX_THUMBNAIL_LENGTH 4
extern "C" int service_create_event(bundle *data, struct service_s **service);
+extern "C" int service_to_bundle(service_h service, bundle **data);
#if 0
static void service_bundle_iterator(const char *key, const int type, const bundle_keyval_t *kv, void *user_data)
static bool service_extra_data_cb(service_h service, const char *key, void *user_data)
{
+ LogDebug("OK");
char **value = NULL;
int length = 0;
if (user_data != NULL && key != NULL)
{
- LogDebug("OK");
+ LogDebug("user data & key is existed");
DeviceAPI::Application::ApplicationControlPtr* appControl =
(DeviceAPI::Application::ApplicationControlPtr*)(user_data);
DeviceAPI::Application::ApplicationControlDataPtr data(new DeviceAPI::Application::ApplicationControlData());
+ LogDebug("key = " << key);
std::string keyStr = key;
std::vector<std::string> keyValue;
int index = 0;
if (service_get_extra_data_array((*appControl)->getService_h(), key, &value, &length) == SERVICE_ERROR_NONE)
{
+ LogDebug("extra_data_array length = " << length);
+
if (value != NULL && length != 0)
{
+ LogDebug("extra_data_length = " << length);
data->setKey(key);
for (index = 0; index < length; index++)
{
+ LogDebug("Value=" << value[index]);
keyValue.push_back(value[index]);
}
if(value)
free(value);
-
}
}
return true;
}
+
+static bool service_extra_data_delete_cb(service_h service, const char *key, void *user_data)
+{
+ LogDebug("OK");
+ if (key != NULL)
+ {
+ LogDebug("del key = " << key);
+
+ if (service_remove_extra_data(service, key) != SERVICE_ERROR_NONE)
+ {
+ LogDebug("remove extra data failed");
+ return false;
+ }
+ }
+ return true;
+}
+
+
+
}//namespace
int StatusNotification::getID()
std::string str = *it;
LogDebug(" thumbs : " << str);
+ if ( idx < MAX_THUMBNAIL_LENGTH )
+ setThumbnail(str, idx);
+#if 0
notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE;
switch (idx)
{
default :
type = NOTIFICATION_IMAGE_TYPE_NONE;
}
+
+ if ( idx < MAX_THUMBNAIL_LENGTH )
+ {
- if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
- {
- if (getThumbnail(idx).compare(str))
- {
- if (notification_set_image(m_notiHandle, type, str.c_str()) != NOTIFICATION_ERROR_NONE)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "set notification thumbnail error");
+ if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
+ {
+ if (getThumbnail(idx).compare(str))
+ {
+ if (notification_set_image(m_notiHandle, type, str.c_str()) != NOTIFICATION_ERROR_NONE)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "set notification thumbnail error");
+ }
+ setUpdatedFlag(true);
}
- setUpdatedFlag(true);
}
}
+
+#endif
idx ++;
}
+
+ if ( idx < MAX_THUMBNAIL_LENGTH)
+ {
+ setThumbnail("", idx); //set empty value
+ }
}
DeviceAPI::Application::ApplicationControlPtr appControl(new DeviceAPI::Application::ApplicationControl());
try {
-
if (m_service)
{
appControl->setService_h(m_service);
-
// mandatory
- int ret = service_get_operation(m_service, &tempStr);
- LogDebug("ret = " << ret);
- //if (service_get_operation(service, &tempStr) != SERVICE_ERROR_NONE)
- if(ret != SERVICE_ERROR_NONE)
- {
- LogDebug(" Opertation is Empty");
- }
- LogDebug("temp Str = " << tempStr);
-
- if (tempStr)
+ if(service_get_operation(m_service, &tempStr) == SERVICE_ERROR_NONE)
{
- appControl->setOperation(tempStr);
- free(tempStr);
- tempStr = NULL;
+ LogDebug("Operation Str = " << tempStr);
+ if (tempStr)
+ {
+ appControl->setOperation(tempStr);
+ free(tempStr);
+ tempStr = NULL;
+ }
}
// optional
if (service_get_mime(m_service, &tempStr) == SERVICE_ERROR_NONE)
{
+ LogDebug("Mime Str = " << tempStr);
if (tempStr)
{
appControl->setMime(tempStr);
// optional
if (service_get_uri(m_service, &tempStr) == SERVICE_ERROR_NONE)
{
+ LogDebug("Uri Str = " << tempStr);
if (tempStr)
{
appControl->setUri(tempStr);
}
}
+ if (service_get_category(m_service, &tempStr) == SERVICE_ERROR_NONE)
+ {
+ LogDebug("Category Str = " << tempStr);
+ if (tempStr)
+ {
+ appControl->setCategory(tempStr);
+ free(tempStr);
+ tempStr = NULL;
+ }
+ }
+
// optional
if ( service_foreach_extra_data(m_service, service_extra_data_cb,(void*)&appControl) != SERVICE_ERROR_NONE)
{
ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set mime error");
}
}
-
- std::vector<DeviceAPI::Application::ApplicationControlDataPtr> appControlDataArray = appControl->getAppControlDataArray();
- size_t index = 0;
- LogDebug (" App Control Datas Count : " << appControlDataArray.size());
-
- DeviceAPI::Application::ApplicationControlDataArray::iterator iter;
-
- for(iter = appControlDataArray.begin(); iter != appControlDataArray.end(); iter++)
+ //remove key
+ if ( service_foreach_extra_data(m_service, service_extra_data_delete_cb, NULL) != SERVICE_ERROR_NONE)
{
- DeviceAPI::Application::ApplicationControlDataPtr appControlData = *iter;
- std::string key = appControlData->getKey();
- LogDebug(" key : " << key);
-
- if (key.empty())
- continue;
-
- std::vector<std::string> value = appControlDataArray[index]->getValue();
- const char **arrayValue = (const char**)calloc(sizeof(char*), value.size());
-
- for (size_t indexArray = 0; indexArray < value.size(); indexArray++)
- {
- arrayValue[indexArray] = (char*)value[indexArray].c_str();
- LogDebug( " value : " << arrayValue[indexArray]);
- }
-
- const char* strKey = key.c_str();
- if ( value.size() == 1)
- {
- if (service_add_extra_data(m_service, strKey, arrayValue[0]) != SERVICE_ERROR_NONE)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");
- }
- }
- else
- {
- if (service_add_extra_data_array(m_service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");
- }
-
- }
-
- if (arrayValue)
- free(arrayValue);
- }
-
- }
-#if 0
- LogDebug("Entered");
- service_h service = NULL;
- int retcode = SERVICE_ERROR_NONE;
-
- LogDebug("m_service : " << m_service);
-
- if(service == NULL && service_create(&service) != SERVICE_ERROR_NONE)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service creation error");
- }
-
- if (service)
- {
-
- LogDebug("getOperation : " << appControl->getOperation().c_str());
- if (appControl->getOperation().size() != 0)
- {
- if (service_set_operation(service, appControl->getOperation().c_str()) != SERVICE_ERROR_NONE)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set operation error");
- }
- }
-
- // optional
- if (appControl->getUri().size() != 0)
- {
- if (service_set_uri(service, appControl->getUri().c_str() ) != SERVICE_ERROR_NONE)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set uri error");
- }
- }
-
- // optional
- if (appControl->getMime().size() != 0)
- {
- if (service_set_mime(service, appControl->getMime().c_str() ) != SERVICE_ERROR_NONE)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set mime error");
- }
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get notification service uri error");
}
-
+
std::vector<DeviceAPI::Application::ApplicationControlDataPtr> appControlDataArray = appControl->getAppControlDataArray();
size_t index = 0, indexArray = 0;
}
const char* strKey = key.c_str();
- if ( value.size() == 1)
+ LogDebug( " value size: " << value.size());
+ if (service_add_extra_data_array(m_service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE)
{
- if (service_add_extra_data(service, strKey, arrayValue[0]) != SERVICE_ERROR_NONE)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");
- }
- }
- else
- {
- if (service_add_extra_data_array(service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");
- }
-
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");
}
-
+
if (arrayValue)
free(arrayValue);
+ }
+ bundle *bundle_data=NULL;
+
+ if(service_to_bundle(m_service, &bundle_data) != SERVICE_ERROR_NONE)
+ {
+ ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service get bundle");
}
-
- if (m_service != NULL) //service destory.
+
+ if (bundle_data)
{
- service_destroy(m_service);
- m_service = NULL;
+ notification_set_execute_option(m_notiHandle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
+ NULL,NULL, bundle_data);
+ //bundle_free(bundle_data);
}
+
+ }
- m_service = service;
- }
- else
- {
- LogDebug(" Service is NULL ");
- }
-
- LogDebug("m_service : " << m_service);
-#endif
}
void StatusNotification::setApplicationId(const std::string& appId)
{
+ int retcode = 0;
LogDebug("m_service = " << m_service << " appId = " << appId);
if (!m_service)
{
LogDebug("info = " << line->getInformation());
LogDebug("sub info = " << line->getSubInformation());
- setInformation(line->getInformation(),index);
- setSubInformation(line->getSubInformation(),index);
+ if ( index < MAX_NOTIFICATION_LINE_LENGTH)
+ {
+ setInformation(line->getInformation(),index);
+ setSubInformation(line->getSubInformation(),index);
+ }
index ++;
- if (index>1)
- break;
}
-
+
+ //clean empty solt.`
+ for ( ;index < MAX_NOTIFICATION_LINE_LENGTH; index++)
+ {
+ setInformation("", index);
+ setSubInformation("", index);
+ }
}
}
// limitations under the License.
//
-#include <dpl/log/log.h>
#include <Commons/plugin_initializer_def.h>
#include <Commons/WrtAccess/WrtAccess.h>
-#include <Commons/Exception.h>
-#include <GlobalContextManager.h>
#include "JSNotificationManager.h"
#include "JSStatusNotification.h"
#include "JSNotificationLine.h"
+#include "Logger.h"
-using namespace DeviceAPI::Common;
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
SET(DESTINATION_NAME ${package_dest})
SET(TARGET_IMPL_NAME ${package_impl})
-PKG_SEARCH_MODULE(app-manager REQUIRED capi-appfw-app-manager)
-PKG_SEARCH_MODULE(package-manager REQUIRED capi-appfw-package-manager)
-PKG_SEARCH_MODULE(package REQUIRED pkgmgr)
-PKG_SEARCH_MODULE(package REQUIRED pkgmgr-info)
+PKG_CHECK_MODULES(platform_pkgs_package REQUIRED
+ capi-appfw-app-manager
+ capi-appfw-package-manager
+ pkgmgr
+ pkgmgr-info
+)
INCLUDE_DIRECTORIES(
${TOP}/Common
${TOP}/Package
- ${app-manager_INCLUDE_DIRS}
- ${package-manager_INCLUDE_DIRS}
- ${pkgmgr_INCLUDE_DIRS}
- ${pkgmgr-info_INCLUDE_DIRS}
+ ${platform_pkgs_package_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${app-manager_LIBRARIES}
- ${package-manager_LIBRARIES}
- ${pkgmgr_LIBRARIES}
- ${pkgmgr-info_LIBRARIES}
+ ${tizen_impl}
+ ${platform_pkgs_package_LIBRARIES}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${tizen_impl}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/package
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/package
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
SET(DESTINATION_NAME ${power_dest})
SET(TARGET_IMPL_NAME ${power_impl})
-PKG_SEARCH_MODULE(power REQUIRED capi-system-power pmapi capi-system-device)
+PKG_CHECK_MODULES(platform_pkgs_power REQUIRED capi-system-power pmapi capi-system-device)
+
+INCLUDE_DIRECTORIES(
+ ${TOP}/Common
+ ${platform_pkgs_power_INCLUDE_DIRS}
+)
SET(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_RPATH}
PowerManager.cpp
)
-INCLUDE_DIRECTORIES(
- ${TOP}/Common
- ${power_INCLUDE_DIRS}
-)
-
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${power_LIBRARIES}
+ ${tizen_impl}
+ ${platform_pkgs_power_LIBRARIES}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${tizen_impl}
- ${timeutil_impl}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/power
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/power
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
+
add_subdir(test)
SET(TARGET_NAME ${push_target})
SET(DESTINATION_NAME ${push_dest})
-PKG_SEARCH_MODULE(push REQUIRED push)
-PKG_SEARCH_MODULE(capi-appfw-application REQUIRED capi-appfw-application)
+PKG_CHECK_MODULES(platform_pkgs_push REQUIRED push capi-appfw-application)
+
+INCLUDE_DIRECTORIES(
+ ${TOP}/Common
+ ${TOP}/Application
+ ${platform_pkgs_push_INCLUDE_DIRS}
+)
SET(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_RPATH}
plugin_config.cpp
)
-INCLUDE_DIRECTORIES(
- ${TOP}/Application
- ${TOP}/Common
- ${push_INCLUDE_DIRS}
- ${capi-appfw-application_INCLUDE_DIRS}
-)
-
ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${LIBS_COMMON}
- ${push_LIBRARIES}
- ${capi-appfw-application_LIBRARIES}
${tizen_impl}
${application_impl}
- ${application_config}
- ${timeutil_impl}
+ "-Wl,--no-as-needed" ${application_config}
+ ${platform_pkgs_push_LIBRARIES}
)
INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/push
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/push
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
LogWarning("Exception: "<<_rethrown_exception.GetMessage());
}
}
- static int get_current_pkg_id(char** pkg_id)
+ static int get_current_app_id_and_pkg_id(char **app_id, char **pkg_id)
{
LogDebug("get_current_pkg_id enter");
int parent_pid = getppid();
return ret;
}
+ *app_id = _app_id;
*pkg_id = _pkg_id;
return ret;
}
PushManager::PushManager() : m_appId(NULL),
+ m_pkgId(NULL),
m_connectionState(PUSH_STATE_UNREGISTERED),
m_connectionHandle(NULL),
m_emitter(NULL)
LogInfo("Connecting to the push service...");
int ret;
- ret = get_current_pkg_id(&m_appId);
+ ret = get_current_app_id_and_pkg_id(&m_appId, &m_pkgId);
if (APP_ERROR_NONE!=ret) {
LogError("Error while getting app id: "<<ret);
return;
}
- LogInfo("Push App id: "<<m_appId);
+ LogInfo("Push App id: " << m_appId);
+ LogInfo("Push Package id: " << m_pkgId);
- ret = push_connect(m_appId, push_connection_state_cb, push_notify_cb, this, &m_connectionHandle);
+ ret = push_connect(m_pkgId, push_connection_state_cb, push_notify_cb, this, &m_connectionHandle);
if (PUSH_ERROR_NONE!=ret) {
LogError("Error while connecting to the push service: "<<ret);
return;
free(m_appId);
}
+ if(m_pkgId) {
+ free(m_pkgId);
+ }
+
push_disconnect(m_connectionHandle);
}
virtual ~PushManager();
char* m_appId;
+ char* m_pkgId;
push_state_e m_connectionState;
push_connection_h m_connectionHandle;
OnPushNotifiedEmitterPtr m_emitter;
SET(DESTINATION_NAME ${secureelement_dest})
SET(TARGET_IMPL_NAME ${secureelement_impl})
-PKG_SEARCH_MODULE(smartcard-service REQUIRED smartcard-service)
-PKG_SEARCH_MODULE(smartcard-service-common REQUIRED smartcard-service-common )
+PKG_CHECK_MODULES(platform_pkgs_secureelement REQUIRED smartcard-service smartcard-service-common)
INCLUDE_DIRECTORIES(
${TOP}/Common
- ${smartcard-service_INCLUDE_DIRS}
- ${smartcard-service-common_INCLUDE_DIRS}
+ ${platform_pkgs_secureelement_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
+ ${platform_pkgs_secureelement_LIBRARIES}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
- ${smartcard-service_LIBRARIES}
- ${smartcard-service-common_LIBRARIES}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/secureelement
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/secureelement
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)
SET(TARGET_NAME ${systemsetting_target})
SET(DESTINATION_NAME ${systemsetting_dest})
-PKG_SEARCH_MODULE(capi-system-system-settings REQUIRED capi-system-system-settings)
+PKG_CHECK_MODULES(platform_pkgs_systemsetting REQUIRED capi-system-system-settings)
INCLUDE_DIRECTORIES(
- ${capi-system-system-settings_INCLUDE_DIRS}
${TOP}/Common
${TOP}/Filesystem
+ ${platform_pkgs_systemsetting_INCLUDE_DIRS}
+)
+
+SET(CMAKE_INSTALL_RPATH
+ ${CMAKE_INSTALL_RPATH}
+ ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${filesystem_dest}
)
SET(SRCS
SystemSettingAsyncCallbackManager.cpp
)
-SET(CMAKE_INSTALL_RPATH
- ${CMAKE_INSTALL_RPATH}
- ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${filesystem_dest}
-)
-
ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${LIBS_COMMON}
- ${capi-system-system-settings_LIBRARIES}
${filesystem_impl}
- ${filesystem_config}
+ "-Wl,--no-as-needed" ${filesystem_config}
+ ${platform_pkgs_systemsetting_LIBRARIES}
)
INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/systemsetting
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/systemsetting
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
SET(DESTINATION_NAME ${systeminfo_dest})
SET(TARGET_IMPL_NAME ${systeminfo_impl})
-PKG_SEARCH_MODULE(capi-telephony-sim REQUIRED capi-telephony-sim)
-PKG_SEARCH_MODULE(capi-network-connection REQUIRED capi-network-connection)
-PKG_SEARCH_MODULE(capi-system-info REQUIRED capi-system-info)
-PKG_SEARCH_MODULE(capi-system-runtime-info REQUIRED capi-system-runtime-info)
-PKG_SEARCH_MODULE(capi-system-sensor REQUIRED capi-system-sensor)
-PKG_SEARCH_MODULE(sys_sensor REQUIRED sensor)
-
+PKG_CHECK_MODULES(platform_pkgs_systeminfo REQUIRED
+ capi-telephony-sim
+ capi-network-connection
+ capi-system-info
+ capi-system-runtime-info
+ capi-system-sensor
+ sensor
+)
INCLUDE_DIRECTORIES(
${TOP}/Common
- ${capi-telephony-sim_INCLUDE_DIRS}
- ${capi-network-connection_INCLUDE_DIRS}
- ${capi-system-info_INCLUDE_DIRS}
- ${capi-system-runtime-info_INCLUDE_DIRS}
- ${capi-system-sensor_INCLUDE_DIRS}
- ${sys_sensor_INCLUDE_DIRS}
+ ${platform_pkgs_systeminfo_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
EventGetSysteminfo.cpp
EventWatchSysteminfo.cpp
ISysteminfo.cpp
- Systeminfo.cpp
+ Systeminfo.cpp
JSDisplayInfo.cpp
JSStorageInfo.cpp
JSCpuInfo.cpp
JSCellularNetworkInfo.cpp
JSBatteryInfo.cpp
JSNetworkInfo.cpp
- JSSIMInfo.cpp
+ JSSIMInfo.cpp
JSDeviceOrientationInfo.cpp
JSBuildInfo.cpp
JSLocaleInfo.cpp
- JSDeviceCapabilitiesInfo.cpp
+ JSDeviceCapabilitiesInfo.cpp
JSPeripheralInfo.cpp
JSSysteminfo.cpp
SysteminfoAsyncCallbackManager.cpp
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
- ${capi-telephony-sim_LIBRARIES}
- ${capi-network-connection_LIBRARIES}
- ${capi-system-info_LIBRARIES}
- ${capi-system-runtime-info_LIBRARIES}
- ${capi-system-sensor_LIBRARIES}
- ${sys_sensor_LIBRARIES}
+ ${platform_pkgs_systeminfo_LIBRARIES}
)
SET(SRCS
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/systeminfo
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/systeminfo
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
SET(DESTINATION_NAME ${timeutil_dest})
SET(TARGET_IMPL_NAME ${timeutil_impl})
-PKG_SEARCH_MODULE(pkgs_time REQUIRED icu-i18n icu-io icu-le icu-lx icu-uc )
+PKG_CHECK_MODULES(platform_pkgs_time REQUIRED icu-i18n icu-io icu-le icu-lx icu-uc )
INCLUDE_DIRECTORIES(
${TOP}/Common
- ${pkgs_time_INCLUDE_DIRS}
+ ${platform_pkgs_time_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/timeutil
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/timeutil
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
}
TZDatePtr tzDate(privateObject->getObject());
- TZDateProperties result = tzDate->toUTC();
- return (static_cast<JSValueRef>(createJSObject(context, result)));
+ return createJSObject(context, tzDate->getTime(), tzDate->getUTCTimezoneName());
} Catch(NullPointerException) {
LogError("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
}
TZDatePtr tzDate(privateObject->getObject());
- TZDateProperties result = tzDate->toLocalTimezone();
- return (static_cast<JSValueRef>(createJSObject(context, result)));
+ return createJSObject(context, tzDate->getTime(), tzDate->getLocalTimezoneName());
} Catch(NullPointerException) {
LogError("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
return result;
}
+TZDateProperties TZDate::makeProperties() {
+ return _makeProperties(myCalendar);
+}
+
std::string TZDate::getTimezone()
{
return _getTimezoneName(myCalendar);
return result;
}
-TZDateProperties TZDate::toUTC() {
- LogDebug("entered");
+std::string TZDate::getUTCTimezoneName() {
+ UnicodeString id;
TimeUtilTools util;
- TZDateProperties result;
- Calendar *utcCalendar = myCalendar->clone();
- try {
- utcCalendar->setTimeZone(*(TimeZone::getGMT()));
- result = _makeProperties(utcCalendar);
- util.printDate(utcCalendar);
- delete utcCalendar;
- } catch (Commons::PlatformException) {
- delete utcCalendar;
- ThrowMsg(Commons::PlatformException, "Calendar error in toUTC");
- }
-
- return result;
+ TimeZone::getGMT()->getID(id);
+ std::string s_result = util.toString(id);
+ LogDebug(s_result);
+ return s_result;
}
-TZDateProperties TZDate::toLocalTimezone() {
- LogDebug("entered");
+std::string TZDate::getLocalTimezoneName() {
+ UnicodeString id;
TimeUtilTools util;
- TZDateProperties result;
- Calendar *localCalendar = myCalendar->clone();
-
- try {
- localCalendar->setTimeZone(*(TimeZone::createDefault()));
- result = _makeProperties(localCalendar);
- util.printDate(localCalendar);
- delete localCalendar;
- } catch (Commons::PlatformException) {
- delete localCalendar;
- ThrowMsg(Commons::PlatformException, "Calendar error in toLocalTimezone");
- }
- return result;
+ TimeZone::createDefault()->getID(id);
+ std::string s_result = util.toString(id);
+ LogDebug(s_result);
+ return s_result;
}
double TZDate::getTime() {
virtual long long difference(const TZDateProperties &prop);
virtual TZDateProperties addDuration(const DurationProperties &duration);
- virtual TZDateProperties toUTC();
- virtual TZDateProperties toLocalTimezone();
+ virtual std::string getUTCTimezoneName();
+ virtual std::string getLocalTimezoneName();
+ virtual TZDateProperties makeProperties();
virtual double getTime();
virtual bool setTime(const double time);
TimeUtilTools util;
UnicodeString timeFormat = util.getDateTimeFormat(TimeUtilTools::TIME_FORMAT, true);
timeFormat = timeFormat.findAndReplace("H", "h");
+ timeFormat = timeFormat.findAndReplace("K", "h");
+ timeFormat = timeFormat.findAndReplace("k", "h");
timeFormat = timeFormat.findAndReplace("a", "ap");
int32_t i = 0;
}
TZDatePtr tzDate = privateObject->getObject();
+ TZDatePtr utcTzDate(new TZDate(tzDate->getUTCTimezoneName()));
+ if (!utcTzDate->setTime(tzDate->getTime()))
+ ThrowMsg(Commons::ConversionException, "Can not set UTC Time");
- TZDateProperties utcProperties = tzDate->toUTC();
+ TZDateProperties utcProperties = utcTzDate->makeProperties();
struct tm utcTm;
memset(&utcTm, 0, sizeof(utcTm));
SET(TARGET_IMPL_NAME ${tizen_impl})
SET(TARGET_CONFIG_NAME ${tizen_config})
-PKG_SEARCH_MODULE(wrt-plugins-plugin-manager REQUIRED wrt-plugins-plugin-manager)
+PKG_CHECK_MODULES(platform_pkgs_tizen REQUIRED wrt-plugins-plugin-manager)
INCLUDE_DIRECTORIES(
${TOP}/Common
${TOP}/TimeUtil
- ${wrt-plugins-plugin-manager_INCLUDE_DIRS}
+ ${platform_pkgs_tizen_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
JSFeature.cpp
JSFeatureParam.cpp
PluginOnDemandPriv.cpp
+ JSTizen.cpp
)
ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
- ${LIBS_WIDGETDB}
${LIBS_COMMON}
- ${wrt-plugins-plugin-manager_LIBRARIES}
+ ${LIBS_WIDGETDB}
+ ${platform_pkgs_tizen_LIBRARIES}
+ ${timeutil_impl}
)
SET(SRCS_CONFIG
- JSTizen.cpp
plugin_config.cpp
)
ADD_LIBRARY(${TARGET_CONFIG_NAME} SHARED ${SRCS_CONFIG})
TARGET_LINK_LIBRARIES(${TARGET_CONFIG_NAME}
- ${LIBS_WIDGETDB}
${LIBS_COMMON}
- ${wrt-plugins-plugin-manager_LIBRARIES}
)
SET(SRCS
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${TARGET_IMPL_NAME}
${TARGET_CONFIG_NAME}
- ${timeutil_impl}
)
INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
INSTALL(
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/tizen
- FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/tizen
+ FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
)