Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.19
+Version: 0.4.20
Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
BuildRequires: pkgconfig(capi-telephony-sim)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(capi-system-runtime-info)
-BuildRequires: pkgconfig(capi-telephony-network-info)
BuildRequires: pkgconfig(sensor)
BuildRequires: pkgconfig(capi-system-sensor)
BuildRequires: pkgconfig(capi-system-power)
Name: wrt-plugins-tizen-${module_name}
Description: wrt-plugins-tizen-${module_name}
Version: @CMAKE_PROJECT_VERSION@
-Requires: capi-telephony-sim capi-network-connection capi-system-info capi-system-runtime-info capi-system-sensor sensor capi-telephony-network-info
+Requires: capi-telephony-sim capi-network-connection capi-system-info capi-system-runtime-info capi-system-sensor sensor
Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
Cflags: -I${includedir}/${module_name}
\ No newline at end of file
service_add_extra_data(m_service_handle, ALARM_ALSOLUTE_RECURRENCE_TYPE_KEY, ALARM_ALSOLUTE_RECURRENCE_TYPE_NONE);
m_recurrenceType = AbsoluteRecurrence::NoRecurrence;
m_id = -1;
+ m_interval = -1;
}
AlarmAbsolute::AlarmAbsolute(service_h handle)
{
service_clone(&m_service_handle, handle);
m_id = -1;
+ m_interval = -1;
}
AlarmAbsolute::~AlarmAbsolute()
m_isRecurrence = false;
service_create(&m_service_handle);
service_add_extra_data(m_service_handle, ALARM_TYPE_KEY, ALARM_TYPE_RELATIVE_VALUE);
- m_Period = 0;
+ m_Period = -1;
m_id = -1;
}
AlarmRelative::AlarmRelative(service_h handle)
{
service_clone(&m_service_handle, handle);
- m_Period = 0;
+ m_Period = -1;
m_id = -1;
}
priv->setByDayRecurrence(daysOfTheWeek);
}
} else {
- long long interval = validator.toLongLong(1);
- priv->setInterval(interval);
+ unsigned long long interval = validator.toULongLong(1);
+ if (!JSValueIsNull(ctx, arguments[1])) {
+ priv->setInterval(interval);
+ } else {
+ priv->setInterval(-1);
+ }
}
}
if(alarmType == AbsoluteRecurrence::Interval) {
Converter converter(ctx);
int interval = privateData->getInterval();
- return converter.toJSValueRef(interval);
+ if (interval == -1 ) {
+ return JSValueMakeNull(ctx);
+ } else {
+ return converter.toJSValueRef(interval);
+ }
} else {
return JSValueMakeNull(ctx);
}
JSObjectRef JSAlarmRelative::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
try {
- AlarmRelativePtr priv = AlarmRelativePtr(new AlarmRelative());
- if (!priv) {
- throw TypeMismatchException("Private object is null");
- }
-
ArgumentValidator validator(ctx, argumentCount, arguments);
unsigned long long delay = validator.toULongLong(0);
unsigned long long period = validator.toULongLong(1, true, 0);
-
- priv->setDelay(validator.toULongLong(0));
-
- return JSValueToObject(ctx, createJSObject(ctx, delay, period), exception);
+ if ((argumentCount > 1) && !JSValueIsNull(ctx, arguments[1])) {
+ return JSValueToObject(ctx, createJSObject(ctx, delay, period), exception);
+ } else {
+ return JSValueToObject(ctx, createJSObject(ctx, delay, -1), exception);
+ }
} catch (const BasePlatformException& err) {
JSObjectRef exceptionObj = JSWebAPIException::makeJSWebAPIException(ctx, err);
*exception = exceptionObj;
period = privateData->getPeriod();
LogInfo("JSAlarmRelative interval = " << period);
- if(period <= 0) {
+ if(period < 0) {
return JSValueMakeNull(ctx);
} else {
return converter.toJSValueRef(period);
#define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
+namespace DeviceAPI {
+namespace Alarm {
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
using namespace WrtDeviceApis::CommonsJavaScript;
&ConstructorClassOptions)
PLUGIN_CLASS_MAP_END
+} // Alarm
+} // DeviceAPI
return ++m_watchIdAcc;
}
+
+bool AppManagerWrapper::app_callback(package_info_app_component_type_e comp_type, const char *app_id, void *user_data)
+{
+ if(app_id == NULL) {
+ LogWarning("app_manager listener gave a NULL package name.");
+ return true;
+ }
+
+ std::vector<std::string> *applist = (std::vector<std::string> *)user_data;
+ applist->push_back(app_id);
+
+ return true;
+}
+
+
void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_type,
const char *appId,
void *user_data)
void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_type,
const char *appId)
{
- if(appId == NULL)
- {
- LogWarning("app_manager listener gave a NULL package name.");
- return;
- }
+ package_info_h package_info;
+ std::vector<std::string> applist;
- switch(event_type)
- {
- case APP_MANAGER_EVENT_INSTALLED:
- appListAppInstalled(appId);
- break;
- case APP_MANAGER_EVENT_UNINSTALLED:
+ if (event_type == APP_MANAGER_EVENT_UNINSTALLED) {
appListAppUninstalled(appId);
- break;
- case APP_MANAGER_EVENT_UPDATED:
- appListAppUpdated(appId);
- break;
- default:
- LogWarning("app_manager listener gave wrong event_type : " << event_type);
- break;
+ } else {
+ int ret = package_manager_get_package_info(appId, &package_info);
+ if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ LogDebug("Cannot create package info by : " << appId);
+ return;
+ }
+
+ ret = package_info_foreach_app_from_package(package_info, PACKAGE_INFO_ALLAPP, app_callback, (void *)&applist);
+ if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ LogDebug("failed while getting appids");
+ return;
+ }
+
+ ret = package_info_destroy(package_info);
+ if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ LogDebug("Cannot destroy package info");
+ }
+
+ for (size_t i = 0; i < applist.size(); i++) {
+ switch(event_type)
+ {
+ case APP_MANAGER_EVENT_INSTALLED:
+ appListAppInstalled(applist.at(i).c_str());
+ break;
+ case APP_MANAGER_EVENT_UPDATED:
+ appListAppUpdated(applist.at(i).c_str());
+ break;
+ default:
+ LogWarning("app_manager listener gave wrong event_type : " << event_type);
+ break;
+ }
+ }
}
}
+
void AppManagerWrapper::appListAppInstalled(const char *appId)
{
LogDebug("app installed : " << appId);
#include <app_manager.h>
#include <package-manager.h>
+#include <package_manager.h>
+#include <package_info.h>
+
#include "ApplicationInformation.h"
// To get app size and installed time
bool initializeAppInfo(ApplicationInformationPtr &appInfo);
private:
+
+ static bool app_callback(package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
+
// callback for app_manager_set_app_list_changed_cb
static void appListChangedCallback(app_manger_event_type_e event_type,
const char *package,
#include "JSBluetoothDevice.h"
#include "JSBluetoothServiceHandler.h"
#include "JSBluetoothSocket.h"
+#include "GlobalContextManager.h"
using namespace DeviceAPI::Common;
{
LogDebug("Entered");
- BluetoothAdapterPtr object = static_cast<BluetoothAdapterPtr>(userData);
- if(!object) {
+ BluetoothAdapterPtr adapter = static_cast<BluetoothAdapterPtr>(userData);
+ if(!adapter) {
LogWarning("userData is NULL");
return true;
}
}
std::vector<BluetoothDeviceSharedPtr>::iterator iter;
- for(iter = object->mFoundDevices.begin(); iter != object->mFoundDevices.end(); ++iter) {
+ for(iter = adapter->knownDevices.begin(); iter != adapter->knownDevices.end(); ++iter) {
BluetoothDeviceSharedPtr foundDevice = *iter;
if(!strcmp(foundDevice->getAddress().c_str(), deviceInfo->remote_address)) {
}
}
- if(iter == object->mFoundDevices.end()) {
+ if(iter == adapter->knownDevices.end()) {
LogDebug("Add a device into foundDevices");
BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo));
- object->mFoundDevices.push_back(device);
+ adapter->knownDevices.push_back(device);
}
return true;
mConnectedSocket.clear();
}
+void BluetoothAdapter::unloadFrame(JSContextRef context)
+{
+ LogDebug("Entered");
+
+ LogDebug("Clean mUserDataList");
+ for(int i = 0; i <= DESTROY_BONDING; i++) {
+ if(mUserDataList[i]) {
+ MultiCallbackUserDataPtr callback = mUserDataList[i];
+ if(!GlobalContextManager::getInstance()->isAliveGlobalContext(callback->getContext())) {
+ LogDebug("reset an userData");
+ mUserDataList[i].reset();
+ }
+ }
+ }
+
+ LogDebug("Clean mConnReqMap");
+ for(ConnReqMultiMapT::iterator iter = mConnReqMap.begin(); iter != mConnReqMap.end(); ) {
+ ConnReqMultiMapT::iterator temp = iter++;
+ MultiCallbackUserDataPtr callback = temp->second->mUserData;
+ if(!callback && !GlobalContextManager::getInstance()->isAliveGlobalContext(callback->getContext())) {
+ LogDebug("erase a connectionRequest");
+ mConnReqMap.erase(temp);
+ }
+ }
+}
+
void BluetoothAdapter::unregisterUUID(std::string &uuid)
{
LogDebug("Entered");
{
LogDebug("Entered");
- ConnReqMultiMapT::iterator iter;
mConnReqMap.erase(remoteAddress);
if(mRegisteredUUID.size() == 0 && mConnReqMap.size() == 0 && mConnectedSocket.size() == 0) {
if(mUserDataList[SET_NAME] == NULL) {
bt_adapter_set_name_changed_cb(onNameChangedCB, this);
- mUserDataList[SET_NAME] = static_cast<MultiCallbackUserDataPtr>(userData);
+ mUserDataList[SET_NAME] = userData;
} else {
LogError("Already requested");
UnknownException *error = new UnknownException("Already requested");
}
if(mUserDataList[SET_POWERED] == NULL) {
- mUserDataList[SET_POWERED] = static_cast<MultiCallbackUserDataPtr>(userData);
+ mUserDataList[SET_POWERED] = userData;
} else {
// Already requested
LogError("Already requested");
if(mUserDataList[SET_VISIBLE] == NULL) {
bt_adapter_set_visibility_mode_changed_cb(onVisibilityChangedCB, this);
- mUserDataList[SET_VISIBLE] = static_cast<MultiCallbackUserDataPtr>(userData);
+ mUserDataList[SET_VISIBLE] = userData;
} else {
UnknownException *error = new UnknownException("Already requested");
BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error);
LogDebug("Entered");
if(mUserDataList[DISCOVER_DEVICES] == NULL) {
- mUserDataList[DISCOVER_DEVICES] = static_cast<MultiCallbackUserDataPtr>(userData);
+ mUserDataList[DISCOVER_DEVICES] = userData;
if(mUserDataList[STOP_DISCOVERY] == NULL)
bt_adapter_set_device_discovery_state_changed_cb(onDiscoveryStateChangedCB, this);
} else {
+ LogError("Already requested");
UnknownException *error = new UnknownException("Already requested");
BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error);
return;
}
if(mUserDataList[STOP_DISCOVERY] == NULL) {
- mUserDataList[STOP_DISCOVERY] = static_cast<MultiCallbackUserDataPtr>(userData);
+ mUserDataList[STOP_DISCOVERY] = userData;
if(mUserDataList[DISCOVER_DEVICES] == NULL)
bt_adapter_set_device_discovery_state_changed_cb(onDiscoveryStateChangedCB, this);
if(mUserDataList[CREATE_BONDING] == NULL) {
bt_device_set_bond_created_cb(onBondCreatedCB, this);
mCreateBondingAddress = address;
- mUserDataList[CREATE_BONDING] = static_cast<MultiCallbackUserDataPtr>(userData);
+ mUserDataList[CREATE_BONDING] = userData;
} else {
LogError("Already requested");
UnknownException *error = new UnknownException("Already requested");
if(mUserDataList[DESTROY_BONDING] == NULL) {
bt_device_set_bond_destroyed_cb(onBondDestroyedCB, this);
mDestroyBondingAddress = address;
- mUserDataList[DESTROY_BONDING] = static_cast<MultiCallbackUserDataPtr>(userData);
+ mUserDataList[DESTROY_BONDING] = userData;
} else {
LogDebug("Already requested");
UnknownException *error = new UnknownException("Already requested");
{
LogDebug("Entered");
- if(mEnabled == true) {
+ if(mEnabled == true) {
+ knownDevices = mFoundDevices;
if(bt_adapter_foreach_bonded_device(foreachBondedDevicesCB, this) == BT_ERROR_NONE) {
- if(mFoundDevices.size() > 0) { // There are found devices
+ if(knownDevices.size() > 0) { // There are found devices
LogDebug("There are found devices");
- int num = mFoundDevices.size();
+ int num = knownDevices.size();
JSObjectRef devices[num];
for(int i = 0; i < num; i++) {
- JSObjectRef deviceObj = JSBluetoothDevice::createJSObject(userData->getContext(), mFoundDevices[i]);
+ JSObjectRef deviceObj = JSBluetoothDevice::createJSObject(userData->getContext(), knownDevices[i]);
devices[i] = deviceObj;
}
static bool isBluetoothSupported();
static bool isValidAddress(std::string &address);
static bool isValidUUID(std::string &uuid);
- //void unloadFrame();
+ void unloadFrame(JSContextRef context);
private:
BluetoothAdapter();
Common::MultiCallbackUserDataPtr mUserDataList[DESTROY_BONDING + 1];
std::vector<std::string> mDisappearedDevices;
std::vector<BluetoothDeviceSharedPtr> mFoundDevices;
+ std::vector<BluetoothDeviceSharedPtr> knownDevices;
};
typedef BluetoothAdapter* BluetoothAdapterPtr;
JSValueRef BluetoothClass::getServices(JSContextRef context)
{
LogDebug("Enter");
+/*
JSValueRef service = mLocalProperty.getProperty(context, BLUETOOTH_CLASS_SERVICES);
if(service == NULL) {
service = JSUtil::toJSValueRef_(context, mServices);
}
return service;
+*/
+ return JSUtil::toJSValueRef_(context, mServices);
}
bool BluetoothClass::hasService(unsigned long service)
unsigned long mMajor;
unsigned long mMinor;
std::vector<unsigned long> mServices;
- Common::PropertyBag mLocalProperty;
+ //Common::PropertyBag mLocalProperty;
};
typedef boost::shared_ptr<BluetoothClass> BluetoothClassSharedPtr;
JSValueRef BluetoothDevice::getDeviceClass(JSContextRef context)
{
LogDebug("Enter");
+ /*
JSValueRef deviceClass = mLocalProperty.getProperty(context, BLUETOOTH_DEVICE_DEVICE_CLASS);
if(deviceClass == NULL) {
deviceClass = JSBluetoothClass::createJSObject(context, mDeviceClass);
}
return deviceClass;
+ */
+ return JSBluetoothClass::createJSObject(context, mDeviceClass);
}
bool BluetoothDevice::isBonded() const
JSValueRef BluetoothDevice::getUUIDs(JSContextRef context)
{
LogDebug("Enter");
-
+/*
if(isUpdated == true) {
mLocalProperty.setProperty(context, BLUETOOTH_DEVICE_UUIDS, JSUtil::toJSValueRef(context, mUUIDs));
isUpdated = false;
}
return mLocalProperty.getProperty(context, BLUETOOTH_DEVICE_UUIDS);
+*/
+ return JSUtil::toJSValueRef(context, mUUIDs);
}
std::string mAddress;
BluetoothClassSharedPtr mDeviceClass;
std::vector<std::string> mUUIDs;
- Common::PropertyBag mLocalProperty;
+ //Common::PropertyBag mLocalProperty;
bool isUpdated;
};
JSValueRef BluetoothSocket::getPeer(JSContextRef context)
{
LogDebug("Enter");
+ /*
JSValueRef peer = mLocalProperty.getProperty(context, BLUETOOTH_SOCKET_PEER);
if(peer == NULL && mPeer != NULL) {
peer = JSBluetoothDevice::createJSObject(context, mPeer);
}
return peer;
+ */
+ return JSBluetoothDevice::createJSObject(context, mPeer);
}
MultiCallbackUserDataPtr BluetoothSocket::getOnMessage() const
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_SET_NAME);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
}
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
+ }
+
+ BluetoothAdapter::getInstance()->setName(name, callback);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
- BluetoothAdapter::getInstance()->setName(name, callback);
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_SET_POWERED);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
BluetoothAdapter::getInstance()->setPowered(state, callback);
-
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_SET_VISIBLE);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
BluetoothAdapter::getInstance()->setVisible(mode, timeout, callback);
-
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_DISCOVER_DEVICES);
throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported");
}
- MultiCallbackUserDataPtr callback(
- new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
- if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiMultiCallbackUserData");
- }
-
// Validate arguments
ArgumentValidator validator(context, argumentCount, arguments);
// successCallback
JSObjectRef successCallback = validator.toCallbackObject(0, false, "onstarted", "ondevicefound", "ondevicedisappeared", "onfinished", NULL);
- // onstarted
- JSValueRef onstartedValue = JSUtil::getProperty(context , successCallback, "onstarted");
- if(!JSValueIsUndefined(context, onstartedValue)) {
- LogDebug("There is a onstarted()");
- callback->setCallback("onstarted", JSUtil::JSValueToObject(context, onstartedValue));
- }
-
- // ondevicefound
- JSValueRef ondevicefoundValue = JSUtil::getProperty(context , successCallback, "ondevicefound");
- if(!JSValueIsUndefined(context, ondevicefoundValue)) {
- LogDebug("There is a ondevicefound()");
- callback->setCallback("ondevicefound", JSUtil::JSValueToObject(context, ondevicefoundValue));
- }
-
- // ondevicedisappeared
- JSValueRef ondevicedisappearedValue = JSUtil::getProperty(context , successCallback, "ondevicedisappeared");
- if(!JSValueIsUndefined(context, ondevicedisappearedValue)) {
- LogDebug("There is a ondevicedisappeared()");
- callback->setCallback("ondevicedisappeared", JSUtil::JSValueToObject(context, ondevicedisappearedValue));
- }
-
- // onfinished
- JSValueRef onfinishedValue = JSUtil::getProperty(context , successCallback, "onfinished");
- if(!JSValueIsUndefined(context, onfinishedValue)) {
- LogDebug("There is a onfinished()");
- callback->setCallback("onfinished", JSUtil::JSValueToObject(context, onfinishedValue));
- }
-
// errorCallback
JSObjectRef errorCallback = validator.toFunction(1, true);
- callback->setCallback("error", errorCallback);
+ MultiCallbackUserDataPtr callback(
+ new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
+ if(!callback){
+ LogWarning("Can't create MultiMultiCallbackUserData");
+ }
+ else {
+ // onstarted
+ JSValueRef onstartedValue = JSUtil::getProperty(context , successCallback, "onstarted");
+ if(!JSValueIsUndefined(context, onstartedValue)) {
+ LogDebug("There is a onstarted()");
+ callback->setCallback("onstarted", JSUtil::JSValueToObject(context, onstartedValue));
+ }
+
+ // ondevicefound
+ JSValueRef ondevicefoundValue = JSUtil::getProperty(context , successCallback, "ondevicefound");
+ if(!JSValueIsUndefined(context, ondevicefoundValue)) {
+ LogDebug("There is a ondevicefound()");
+ callback->setCallback("ondevicefound", JSUtil::JSValueToObject(context, ondevicefoundValue));
+ }
+
+ // ondevicedisappeared
+ JSValueRef ondevicedisappearedValue = JSUtil::getProperty(context , successCallback, "ondevicedisappeared");
+ if(!JSValueIsUndefined(context, ondevicedisappearedValue)) {
+ LogDebug("There is a ondevicedisappeared()");
+ callback->setCallback("ondevicedisappeared", JSUtil::JSValueToObject(context, ondevicedisappearedValue));
+ }
+
+ // onfinished
+ JSValueRef onfinishedValue = JSUtil::getProperty(context , successCallback, "onfinished");
+ if(!JSValueIsUndefined(context, onfinishedValue)) {
+ LogDebug("There is a onfinished()");
+ callback->setCallback("onfinished", JSUtil::JSValueToObject(context, onfinishedValue));
+ }
+
+ callback->setCallback("error", errorCallback);
+ }
+
// perform
BluetoothAdapter::getInstance()->discoverDevices(callback);
-
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_STOP_DISCOVERY);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
BluetoothAdapter::getInstance()->stopDiscovery(callback);
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_GET_KNOWN_DEVICES);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
BluetoothAdapter::getInstance()->getKnownDevices(callback);
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_GET_DEVICE);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
BluetoothAdapter::getInstance()->getDevice(address, callback);
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_CREATE_BONDING);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
BluetoothAdapter::getInstance()->createBonding(address, callback);
-
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_DESTROY_BONDING);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
BluetoothAdapter::getInstance()->destroyBonding(address, callback);
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Entered");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_REGISTER_RFCOMMSERVICE_BY_UUID);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
BluetoothAdapter::getInstance()->registerRFCOMMServiceByUUID(uuid, name, callback);
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Enter");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_CLASS_API_HAS_SERVICE);
if(service > 65535) {
throw InvalidValuesException("Invalid value");
}
-
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSUtil::toJSValueRef(context, priv->mClass->hasService(service));
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Enter");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_DEVICE_API_CONNECT_TO_SERVICE_BY_UUID);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
BluetoothAdapter::getInstance()->connectToServiceByUUID(remoteAddress, uuid, callback);
-
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSStringRef propertyName,
JSValueRef* exception);
- static bool setProperty(JSContextRef context,
- JSObjectRef object,
- JSStringRef propertyName,
- JSValueRef value,
- JSValueRef* exception);
-
static JSValueRef connectToServiceByUUID(JSContextRef context,
JSObjectRef object,
JSObjectRef thisObject,
JSValueRef* exception)
{
LogDebug("Enter");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_MANAGER_API_GET_DEFAULT_ADAPTER);
try {
if(!BluetoothAdapter::isBluetoothSupported()) {
throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported");
- }
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ }
+
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSBluetoothAdapter::createJSObject(context);
} catch (const BasePlatformException &err) {
JSValueRef* exception)
{
LogDebug("Enter");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SERVICE_HANDLER_API_UNREGISTER);
MultiCallbackUserDataPtr callback(
new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
if(!callback){
- throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+ LogWarning("Can't create MultiCallbackUserData");
+ }
+ else {
+ callback->setCallback("success", successCallback);
+ callback->setCallback("error", errorCallback);
}
- callback->setCallback("success", successCallback);
- callback->setCallback("error", errorCallback);
priv->unregister(callback);
-
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Enter");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SOCKET_API_WRITE_DATA);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
// Private Object
BluetoothSocketPtr priv = static_cast<BluetoothSocketPtr>(JSObjectGetPrivate(thisObject));
if (!priv) {
- throw TypeMismatchException("Private object is NULL.");
+ throw DeviceAPI::Common::UnknownException("Private object is NULL.");
}
ArgumentValidator validator(context, argumentCount, arguments);
JSValueRef element = JSGetArrayElement(context, dataArrayObj, i);
buffer[i] = static_cast<char>(JSUtil::JSValueToByte(context, element));
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSUtil::toJSValueRef(context, priv->writeData(buffer, size));
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Enter");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SOCKET_API_READ_DATA);
// Private Object
BluetoothSocketPtr priv = static_cast<BluetoothSocketPtr>(JSObjectGetPrivate(thisObject));
if (!priv) {
- throw TypeMismatchException("Private object is NULL.");
+ throw DeviceAPI::Common::UnknownException("Private object is NULL.");
}
std::vector<signed char> data = priv->readData();
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSUtil::toJSValueRef_(context, data);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("Enter");
- TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
// Access Check
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SOCKET_API_CLOSE);
// Private Object
BluetoothSocketPtr priv = static_cast<BluetoothSocketPtr>(JSObjectGetPrivate(thisObject));
if (!priv) {
- throw TypeMismatchException("Private object is NULL.");
+ throw DeviceAPI::Common::UnknownException("Private object is NULL.");
}
priv->close();
- TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIException::throwException(context, exception, err);
#include <GlobalContextManager.h>
#include "JSBluetoothManager.h"
-//#include "BluetoothAdapter.h"
+#include "BluetoothAdapter.h"
#include <TimeTracer.h>
#include <Logger.h>
{
LogDebug("[Tizen\\Bluetooth] on_frame_unload_callback (%p)", context);
GlobalContextManager::getInstance()->removeGlobalContext(static_cast<JSContextRef>(context));
+ BluetoothAdapter::getInstance()->unloadFrame(static_cast<JSContextRef>(context));
}
PLUGIN_ON_WIDGET_START(on_widget_start_callback)
LogDebug("Filter validation has passed.");
}
- calendarFilter->setCalendarIdForEvent(calendarId);
genericFilter->travel(filterTraversal, 0);
if(getIsUnified()) {
{CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE, _calendar_event.freq}
};
+std::map<std::string, unsigned int> CalendarFilter::m_normalInstanceAttributeMap = {
+ {CALENDAR_FILTER_ATTRIBUTE_ID_UID, _calendar_instance_normal_calendar_book.event_id},
+ {CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE, _calendar_instance_normal_calendar_book.last_modified_time},
+ {CALENDAR_FILTER_ATTRIBUTE_DESCRIPTION, _calendar_instance_normal_calendar_book.description},
+ {CALENDAR_FILTER_ATTRIBUTE_SUMMARY, _calendar_instance_normal_calendar_book.summary},
+ {CALENDAR_FILTER_ATTRIBUTE_START_DATE, _calendar_instance_normal_calendar_book.start_time},
+ {CALENDAR_FILTER_ATTRIBUTE_LOCATION, _calendar_instance_normal_calendar_book.location},
+ {CALENDAR_FILTER_ATTRIBUTE_LATITUDE, _calendar_instance_normal_calendar_book.latitude},
+ {CALENDAR_FILTER_ATTRIBUTE_LONGITUDE, _calendar_instance_normal_calendar_book.longitude},
+ //{CALENDAR_FILTER_ATTRIBUTE_ORGANIZER, _calendar_instance_normal_calendar_book.organizer_name},
+ {CALENDAR_FILTER_ATTRIBUTE_VISIBILITY, _calendar_instance_normal_calendar_book.sensitivity},
+ {CALENDAR_FILTER_ATTRIBUTE_STATUS, _calendar_instance_normal_calendar_book.event_status},
+ {CALENDAR_FILTER_ATTRIBUTE_ALARMS, _calendar_instance_normal_calendar_book.has_alarm},
+ //{CALENDAR_FILTER_ATTRIBUTE_CATEGORIES, _calendar_instance_normal_calendar_book.categories},
+ {CALENDAR_FILTER_ATTRIBUTE_PRIORITY, _calendar_instance_normal_calendar_book.priority},
+ {CALENDAR_FILTER_ATTRIBUTE_IS_DETACHED, _calendar_instance_normal_calendar_book.original_event_id},
+ /*{CALENDAR_FILTER_ATTRIBUTE_IS_ALL_DAY, _calendar_instance_normal_calendar_book.is_allday}, no meaning for instance. */
+ //{CALENDAR_FILTER_ATTRIBUTE_ATTENDEES, _calendar_instance_normal_calendar_book.has_attendee},
+ {CALENDAR_FILTER_ATTRIBUTE_END_DATE, _calendar_instance_normal_calendar_book.end_time},
+ {CALENDAR_FILTER_ATTRIBUTE_AVAILABILITY, _calendar_instance_normal_calendar_book.busy_status},
+ {CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE, _calendar_instance_normal_calendar_book.has_rrule}
+};
+
+std::map<std::string, unsigned int> CalendarFilter::m_alldayInstanceAttributeMap = {
+ {CALENDAR_FILTER_ATTRIBUTE_ID_UID, _calendar_instance_allday_calendar_book.event_id},
+ {CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE, _calendar_instance_allday_calendar_book.last_modified_time},
+ {CALENDAR_FILTER_ATTRIBUTE_DESCRIPTION, _calendar_instance_allday_calendar_book.description},
+ {CALENDAR_FILTER_ATTRIBUTE_SUMMARY, _calendar_instance_allday_calendar_book.summary},
+ {CALENDAR_FILTER_ATTRIBUTE_START_DATE, _calendar_instance_allday_calendar_book.start_time},
+ {CALENDAR_FILTER_ATTRIBUTE_LOCATION, _calendar_instance_allday_calendar_book.location},
+ {CALENDAR_FILTER_ATTRIBUTE_LATITUDE, _calendar_instance_allday_calendar_book.latitude},
+ {CALENDAR_FILTER_ATTRIBUTE_LONGITUDE, _calendar_instance_allday_calendar_book.longitude},
+ //{CALENDAR_FILTER_ATTRIBUTE_ORGANIZER, _calendar_instance_allday_calendar_book.organizer_name},
+ {CALENDAR_FILTER_ATTRIBUTE_VISIBILITY, _calendar_instance_allday_calendar_book.sensitivity},
+ {CALENDAR_FILTER_ATTRIBUTE_STATUS, _calendar_instance_allday_calendar_book.event_status},
+ {CALENDAR_FILTER_ATTRIBUTE_ALARMS, _calendar_instance_allday_calendar_book.has_alarm},
+ //{CALENDAR_FILTER_ATTRIBUTE_CATEGORIES, _calendar_instance_allday_calendar_book.categories},
+ {CALENDAR_FILTER_ATTRIBUTE_PRIORITY, _calendar_instance_allday_calendar_book.priority},
+ {CALENDAR_FILTER_ATTRIBUTE_IS_DETACHED, _calendar_instance_allday_calendar_book.original_event_id},
+ /*{CALENDAR_FILTER_ATTRIBUTE_IS_ALL_DAY, _calendar_instance_allday_calendar_book.is_allday}, no meaning for instance. */
+ //{CALENDAR_FILTER_ATTRIBUTE_ATTENDEES, _calendar_instance_allday_calendar_book.has_attendee},
+ {CALENDAR_FILTER_ATTRIBUTE_END_DATE, _calendar_instance_allday_calendar_book.end_time},
+ {CALENDAR_FILTER_ATTRIBUTE_AVAILABILITY, _calendar_instance_allday_calendar_book.busy_status},
+ {CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE, _calendar_instance_allday_calendar_book.has_rrule}
+};
+
std::map<std::string, unsigned int> CalendarFilter::m_taskAttributeMap = {
{CALENDAR_FILTER_ATTRIBUTE_ID, _calendar_todo.id},
{CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE, _calendar_todo.last_modified_time},
m_filter = NULL;
m_recordList = NULL;
m_recordCount = 0;
+ m_normalInstanceQuery = NULL;
+ m_normalInstanceFilter = NULL;
m_normalInstanceRecordList = NULL;
m_normalInstanceRecordCount = 0;
+ m_alldayInstanceQuery = NULL;
+ m_alldayInstanceFilter = NULL;
m_alldayInstanceRecordList = NULL;
m_alldayInstanceRecordCount = 0;
- m_calendarId = UNDEFINED_CALENDAR_ID;
+ m_enableInstanceSearch = false;
}
CalendarFilter::~CalendarFilter()
{
- LogDebug("Clear internal structs for filter.");
+ LogDebug("Clear internal structs for filters.");
if(m_query) {
calendar_query_destroy(m_query);
}
if(m_filter) {
calendar_filter_destroy(m_filter);
}
+ if(m_normalInstanceQuery) {
+ calendar_query_destroy(m_normalInstanceQuery);
+ }
+ if(m_normalInstanceFilter) {
+ calendar_filter_destroy(m_normalInstanceFilter);
+ }
+ if(m_alldayInstanceQuery) {
+ calendar_query_destroy(m_alldayInstanceQuery);
+ }
+ if(m_alldayInstanceFilter) {
+ calendar_filter_destroy(m_alldayInstanceFilter);
+ }
// Child record will be freed in the caller function.
if(m_recordList) {
LogDebug("Composite type: "<<type);
if(type == DeviceAPI::Tizen::UNION_FILTER) {
calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
+ calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_OR);
+ calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_OR);
} else if(type == DeviceAPI::Tizen::INTERSECTION_FILTER) {
calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
}
}
calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], intMatchFlag, value);
} else {
calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], intMatchFlag, value);
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, value);
+ calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, value);
}
LogDebug("Added int filter with value: "<<value);
} else if(CALENDAR_FILTER_ATTRIBUTE_ID_UID==attrName ||
calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], intMatchFlag, id);
} else {
calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], intMatchFlag, id);
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, id);
+ calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, id);
// Include the detached events.
calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
calendar_filter_add_int(m_filter, _calendar_event.original_event_id, CALENDAR_MATCH_EQUAL, id);
+ calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_OR);
+ calendar_filter_add_int(m_normalInstanceFilter, _calendar_instance_normal_calendar_book.original_event_id, CALENDAR_MATCH_EQUAL, id);
+ calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_OR);
+ calendar_filter_add_int(m_alldayInstanceFilter, _calendar_instance_allday_calendar_book.original_event_id, CALENDAR_MATCH_EQUAL, id);
}
LogDebug("Added int filter with id: "<<id);
} else if(CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE==attrName ||
calendar_filter_add_lli(m_filter, m_taskAttributeMap[attrName], intMatchFlag, time);
} else {
calendar_filter_add_lli(m_filter, m_eventAttributeMap[attrName], intMatchFlag, time);
+ calendar_filter_add_lli(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, time);
+ calendar_filter_add_lli(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, time);
}
LogDebug("Added lli filter with value: "<<time);
} else if(CALENDAR_FILTER_ATTRIBUTE_DESCRIPTION==attrName ||
calendar_filter_add_str(m_filter, m_taskAttributeMap[attrName], strMatchFlag, matchValue->getString().c_str());
} else {
calendar_filter_add_str(m_filter, m_eventAttributeMap[attrName], strMatchFlag, matchValue->getString().c_str());
+ calendar_filter_add_str(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], strMatchFlag, matchValue->getString().c_str());
+ calendar_filter_add_str(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], strMatchFlag, matchValue->getString().c_str());
}
LogDebug("Added str filter with value: "<<matchValue->getString());
} else if(CALENDAR_FILTER_ATTRIBUTE_IS_ALL_DAY==attrName) {
calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, matchValue->getBool() ? 1 : 0);
} else {
calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, matchValue->getBool() ? 1 : 0);
+ if(matchValue->getBool()) {
+ // Exclude the normal instance table.
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[CALENDAR_FILTER_ATTRIBUTE_ID_UID], CALENDAR_MATCH_EQUAL, -999);
+ } else {
+ // Exclude the allday instance table.
+ calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[CALENDAR_FILTER_ATTRIBUTE_ID_UID], CALENDAR_MATCH_EQUAL, -999);
+ }
}
LogDebug("Added int filter with value: "<<matchValue->getBool());
} else if(CALENDAR_FILTER_ATTRIBUTE_START_DATE==attrName ||
calendar_filter_add_caltime(m_filter, m_taskAttributeMap[attrName], intMatchFlag, calTime);
} else {
calendar_filter_add_caltime(m_filter, m_eventAttributeMap[attrName], intMatchFlag, calTime);
+ calendar_filter_add_caltime(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, calTime);
+ calendar_filter_add_caltime(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, calTime);
}
LogDebug("Added caltime filter with value: "<<time);
} else if(CALENDAR_FILTER_ATTRIBUTE_LATITUDE==attrName ||
calendar_filter_add_double(m_filter, m_taskAttributeMap[attrName], intMatchFlag, matchValue->getDouble());
} else {
calendar_filter_add_double(m_filter, m_eventAttributeMap[attrName], intMatchFlag, matchValue->getDouble());
+ calendar_filter_add_double(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, matchValue->getDouble());
+ calendar_filter_add_double(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, matchValue->getDouble());
}
LogDebug("Added double filter with value: "<<matchValue->getDouble());
} else if(CALENDAR_FILTER_ATTRIBUTE_ALARMS==attrName ||
if( matchValue->isNullOrUndefined() ) {
calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
} else {
- calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+ calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
}
} else {
calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
if( DeviceAPI::Tizen::MATCH_EXACTLY==matchFlag ) {
if( matchValue->isNullOrUndefined() ) {
calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
- } else {
- calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
- }
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
+ calendar_filter_add_int(m_alldayInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
+ } else {
+ calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+ calendar_filter_add_int(m_alldayInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+
+ }
} else {
calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+ calendar_filter_add_int(m_alldayInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
}
}
LogDebug("Added int filter.");
calendar_filter_add_str(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str());
} else {
calendar_filter_add_str(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str());
+ calendar_filter_add_str(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str());
+ calendar_filter_add_str(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str());
}
LogDebug("Added str filter for categories with value: "<<matchValue->getString());
} else if(CALENDAR_FILTER_ATTRIBUTE_IS_DETACHED==attrName) {
LogWarning("isDetached not supported for a task.");
} else {
calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+ calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
}
LogDebug("Added int filter for isDetached with value 0.");
} else if(CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE==attrName) {
if( DeviceAPI::Tizen::MATCH_EXACTLY==matchFlag ) {
if( matchValue->isNullOrUndefined() ) {
calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
+ calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
} else {
calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+ calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
}
LogDebug("Added int filter for rrule EXACTLY flag.");
} else {
calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+ calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+ calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
LogDebug("Added int filter for rrule.");
}
}
if(CalendarEvent::TASK_TYPE==m_type) {
calendar_filter_h subFilter = NULL;
calendar_filter_create(_calendar_todo._uri, &subFilter);
- if (!initialValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(subFilter, m_taskAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
- }
- if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
- calendar_filter_add_operator(subFilter, CALENDAR_FILTER_OPERATOR_AND);
- }
- if (!endValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(subFilter, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
- }
- calendar_filter_add_filter(m_filter, subFilter);
calendar_filter_h subFilter2 = NULL;
calendar_filter_create(_calendar_todo._uri, &subFilter2);
if (!initialValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(subFilter2, m_taskAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+ calendar_filter_add_caltime(subFilter2, m_taskAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
}
if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
calendar_filter_add_operator(subFilter2, CALENDAR_FILTER_OPERATOR_AND);
}
if (!endValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(subFilter2, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
+ calendar_filter_add_caltime(subFilter2, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
}
- calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
- calendar_filter_add_filter(m_filter, subFilter2);
- } else {
- calendar_filter_h subFilter = NULL;
- calendar_filter_create(_calendar_event._uri, &subFilter);
+ calendar_filter_add_filter(subFilter, subFilter2);
+
+ calendar_filter_h subFilter3 = NULL;
+ calendar_filter_create(_calendar_todo._uri, &subFilter3);
if (!initialValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(subFilter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
+ calendar_filter_add_caltime(subFilter3, m_taskAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
}
if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
- calendar_filter_add_operator(subFilter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(subFilter3, CALENDAR_FILTER_OPERATOR_AND);
}
if (!endValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(subFilter, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
+ calendar_filter_add_caltime(subFilter3, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
}
+ calendar_filter_add_operator(subFilter, CALENDAR_FILTER_OPERATOR_OR);
+ calendar_filter_add_filter(subFilter, subFilter3);
+
calendar_filter_add_filter(m_filter, subFilter);
+ } else {
+ calendar_filter_h subFilter = NULL;
+ calendar_filter_create(_calendar_event._uri, &subFilter);
calendar_filter_h subFilter2 = NULL;
- calendar_filter_create(_calendar_event._uri, &subFilter2);
+ calendar_filter_create(_calendar_event._uri, &subFilter2);
if (!initialValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(subFilter2, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+ calendar_filter_add_caltime(subFilter2, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
}
if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
calendar_filter_add_operator(subFilter2, CALENDAR_FILTER_OPERATOR_AND);
}
if (!endValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(subFilter2, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
+ calendar_filter_add_caltime(subFilter2, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
}
- calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
- calendar_filter_add_filter(m_filter, subFilter2);
+ calendar_filter_add_filter(subFilter, 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.");
+ calendar_filter_h subFilter3 = NULL;
+ calendar_filter_create(_calendar_event._uri, &subFilter3);
if (!initialValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(normalFilter, _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
+ calendar_filter_add_caltime(subFilter3, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
}
if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
- calendar_filter_add_operator(normalFilter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(subFilter3, 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);
+ calendar_filter_add_caltime(subFilter3, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
}
- LogDebug("Add a filter for allday instances.");
+ calendar_filter_add_operator(subFilter, CALENDAR_FILTER_OPERATOR_OR);
+ calendar_filter_add_filter(subFilter, subFilter3);
+
+ calendar_filter_add_filter(m_filter, subFilter);
+
+ LogDebug("Query for normal instances.");
+ calendar_filter_h subFilterNormal = NULL;
+ calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &subFilterNormal);
+
if (!initialValue->isNullOrUndefined()) {
- calendar_filter_add_caltime(alldayFilter, _calendar_instance_allday_calendar_book.start_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+ calendar_filter_add_caltime(subFilterNormal, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
}
if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
- calendar_filter_add_operator(alldayFilter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(subFilterNormal, 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);
+ calendar_filter_add_caltime(subFilterNormal, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
}
-
- int ret;
- LogDebug("Query for normal instances.");
- if(UNDEFINED_CALENDAR_ID!=m_calendarId) {
- LogDebug("Set the calendar id for normal instances: "<<m_calendarId);
- calendar_filter_add_operator(normalFilter, CALENDAR_FILTER_OPERATOR_AND);
- calendar_filter_add_int(normalFilter, _calendar_instance_normal_calendar_book.calendar_book_id, CALENDAR_MATCH_EQUAL, m_calendarId);
- }
- 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);
- }
+ calendar_filter_add_filter(m_normalInstanceFilter, subFilterNormal);
LogDebug("Query for allday instances.");
- if(UNDEFINED_CALENDAR_ID!=m_calendarId) {
- LogDebug("Set the calendar id for allday instances: "<<m_calendarId);
- calendar_filter_add_operator(alldayFilter, CALENDAR_FILTER_OPERATOR_AND);
- calendar_filter_add_int(alldayFilter, _calendar_instance_allday_calendar_book.calendar_book_id, CALENDAR_MATCH_EQUAL, m_calendarId);
- }
- 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);
- }
-
+ calendar_filter_h subFilterAllday = NULL;
+ calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &subFilterAllday);
+ if (!initialValue->isNullOrUndefined()) {
+ calendar_filter_add_caltime(subFilterAllday, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+ }
+ if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
+ calendar_filter_add_operator(subFilterAllday, CALENDAR_FILTER_OPERATOR_AND);
+ }
+ if (!endValue->isNullOrUndefined()) {
+ calendar_filter_add_caltime(subFilterAllday, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
+ }
+ calendar_filter_add_filter(m_alldayInstanceFilter, subFilterAllday);
- 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("Enable the instance table search.");
+ m_enableInstanceSearch = true;
}
LogDebug("Added caltime range filter with initial value: "<<startTime.time.utime<<", end value: "<<endTime.time.utime);
} else if(CALENDAR_FILTER_ATTRIBUTE_LATITUDE==attrName ||
} else {
if (!initialValue->isNullOrUndefined()) {
calendar_filter_add_double(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, initialValue->getDouble());
+ calendar_filter_add_double(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, initialValue->getDouble());
+ calendar_filter_add_double(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, initialValue->getDouble());
}
if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
}
if (!endValue->isNullOrUndefined()) {
calendar_filter_add_double(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getDouble());
+ calendar_filter_add_double(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getDouble());
+ calendar_filter_add_double(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getDouble());
}
}
LogDebug("Added double range filter with initial value: "<<initialValue->getDouble()<<", end value: "<<endValue->getDouble());
} else {
if (!initialValue->isNullOrUndefined()) {
calendar_filter_add_lli(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, getTimeTFromTZDateAny(initialValue));
+ calendar_filter_add_lli(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, getTimeTFromTZDateAny(initialValue));
+ calendar_filter_add_lli(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, getTimeTFromTZDateAny(initialValue));
}
if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
}
if (!endValue->isNullOrUndefined()) {
calendar_filter_add_lli(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, getTimeTFromTZDateAny(endValue));
+ calendar_filter_add_lli(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, getTimeTFromTZDateAny(endValue));
+ calendar_filter_add_lli(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, getTimeTFromTZDateAny(endValue));
}
}
LogDebug("Added lli range filter with initial value: "<<getTimeTFromTZDateAny(initialValue)<<", end value: "<<getTimeTFromTZDateAny(endValue));
calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getLong());
}
} else {
- if (!initialValue->isNullOrUndefined()) {
- calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, initialValue->getLong());
- }
- if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
- calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
- }
- if (!endValue->isNullOrUndefined()) {
- calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getLong());
- }
+ LogWarning("progress not supported for an event");
}
LogDebug("Added double range filter with initial value: "<<initialValue->getLong()<<", end value: "<<endValue->getLong());
} else {
m_type = CalendarEvent::EVENT_TYPE;
calendar_query_create(_calendar_event._uri, &m_query);
calendar_filter_create(_calendar_event._uri, &m_filter);
+
+ calendar_query_create(_calendar_instance_normal_calendar_book._uri, &m_normalInstanceQuery);
+ calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &m_normalInstanceFilter);
+ calendar_query_create(_calendar_instance_allday_calendar_book._uri, &m_alldayInstanceQuery);
+ calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &m_alldayInstanceFilter);
}
}
void CalendarFilter::setCalendarId(int calendarId, bool isFilterSet)
{
if( isFilterSet ) {
- calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_h m_superFilter = NULL;
+ calendar_filter_h m_normalInstanceSuperFilter = NULL;
+ calendar_filter_h m_alldayInstanceSuperFilter = NULL;
+ if(CalendarEvent::TASK_TYPE==m_type) {
+ calendar_filter_create(_calendar_todo._uri, &m_superFilter);
+ calendar_filter_add_filter(m_superFilter, m_filter);
+ } else {
+ calendar_filter_create(_calendar_event._uri, &m_superFilter);
+ calendar_filter_add_filter(m_superFilter, m_filter);
+ }
+ calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &m_normalInstanceSuperFilter);
+ calendar_filter_add_filter(m_normalInstanceSuperFilter, m_normalInstanceFilter);
+ calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &m_alldayInstanceSuperFilter);
+ calendar_filter_add_filter(m_alldayInstanceSuperFilter, m_alldayInstanceFilter);
+
+ m_filter = m_superFilter;
+ m_normalInstanceFilter= m_normalInstanceSuperFilter;
+ m_alldayInstanceFilter = m_alldayInstanceSuperFilter;
+ calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
+ calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
}
if(CalendarEvent::TASK_TYPE==m_type) {
} else {
if(CALENDAR_BOOK_FILTER_ALL==calendarId) {
calendar_filter_add_int(m_filter, _calendar_event.calendar_book_id, CALENDAR_MATCH_GREATER_THAN, calendarId);
+ calendar_filter_add_int(m_normalInstanceFilter, _calendar_instance_normal_calendar_book.calendar_book_id, CALENDAR_MATCH_GREATER_THAN, calendarId);
+ calendar_filter_add_int(m_alldayInstanceFilter, _calendar_instance_allday_calendar_book.calendar_book_id, CALENDAR_MATCH_GREATER_THAN, calendarId);
} else {
calendar_filter_add_int(m_filter, _calendar_event.calendar_book_id, CALENDAR_MATCH_EQUAL, calendarId);
+ calendar_filter_add_int(m_normalInstanceFilter, _calendar_instance_normal_calendar_book.calendar_book_id, CALENDAR_MATCH_EQUAL, calendarId);
+ calendar_filter_add_int(m_alldayInstanceFilter, _calendar_instance_allday_calendar_book.calendar_book_id, CALENDAR_MATCH_EQUAL, calendarId);
}
+
+ /* No matching is_deleted field for instance tables. */
calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
calendar_filter_add_int(m_filter, _calendar_event.is_deleted, CALENDAR_MATCH_EQUAL, 0);
}
}
-void CalendarFilter::setCalendarIdForEvent(int calendarId)
-{
- m_calendarId = calendarId;
-}
-
void CalendarFilter::setSortMode(DeviceAPI::Tizen::SortModeArrayPtr attr)
{
std::string attrName;
calendar_query_set_sort(m_query, m_taskAttributeMap[attrName], true);
} else {
calendar_query_set_sort(m_query, m_eventAttributeMap[attrName], true);
+ calendar_query_set_sort(m_normalInstanceQuery, m_normalInstanceAttributeMap[attrName], true);
+ calendar_query_set_sort(m_alldayInstanceQuery, m_alldayInstanceAttributeMap[attrName], true);
}
} else {
if(CalendarEvent::TASK_TYPE==m_type) {
calendar_query_set_sort(m_query, m_taskAttributeMap[attrName], false);
} else {
calendar_query_set_sort(m_query, m_eventAttributeMap[attrName], false);
+ calendar_query_set_sort(m_normalInstanceQuery, m_normalInstanceAttributeMap[attrName], false);
+ calendar_query_set_sort(m_alldayInstanceQuery, m_alldayInstanceAttributeMap[attrName], false);
}
}
} else {
} else {
LogDebug("Item count: "<<m_recordCount);
}
+
+ if(m_enableInstanceSearch) {
+ LogDebug("Perform query for instances.");
+ ret = calendar_query_set_filter(m_normalInstanceQuery, m_normalInstanceFilter);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Setting a normal instance filter failed: "<<ret);
+ }
+ ret = calendar_db_get_records_with_query(m_normalInstanceQuery, 0, 0, &m_normalInstanceRecordList);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Getting a normal instance record list failed: "<<ret);
+ }
+ ret = calendar_list_get_count(m_normalInstanceRecordList, &m_normalInstanceRecordCount);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Can't get a normal instance item count: "<<ret);
+ } else {
+ LogDebug("Normal instance item count: "<<m_normalInstanceRecordCount);
+ }
+
+ ret = calendar_query_set_filter(m_alldayInstanceQuery, m_alldayInstanceFilter);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Setting an allday instance filter failed: "<<ret);
+ }
+ ret = calendar_db_get_records_with_query(m_alldayInstanceQuery, 0, 0, &m_alldayInstanceRecordList);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Getting an allday instance record list failed: "<<ret);
+ }
+ ret = calendar_list_get_count(m_alldayInstanceRecordList, &m_alldayInstanceRecordCount);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Can't get an allday instance item count: "<<ret);
+ } else {
+ LogDebug("Allday instance item count: "<<m_alldayInstanceRecordCount);
+ }
+ } else {
+ LogDebug("No need to perform query for instances.");
+ }
}
int CalendarFilter::getResultRecordCount() const
calendar_filter_h m_filter;
calendar_list_h m_recordList;
int m_recordCount;
- // Corner case handling for recurring event range filter.
+
+ // Additional filters for recurring event range filter.
+ calendar_query_h m_normalInstanceQuery;
+ calendar_filter_h m_normalInstanceFilter;
calendar_list_h m_normalInstanceRecordList;
int m_normalInstanceRecordCount;
+ calendar_query_h m_alldayInstanceQuery;
+ calendar_filter_h m_alldayInstanceFilter;
calendar_list_h m_alldayInstanceRecordList;
int m_alldayInstanceRecordCount;
- int m_calendarId;
+
+ bool m_enableInstanceSearch;
static std::map<std::string, unsigned int> m_eventAttributeMap;
+ static std::map<std::string, unsigned int> m_normalInstanceAttributeMap;
+ static std::map<std::string, unsigned int> m_alldayInstanceAttributeMap;
static std::map<std::string, unsigned int> m_taskAttributeMap;
public:
void setType(CalendarEvent::CalendarType type);
void setCalendarId(int calendarId, bool isFilterSet);
- void setCalendarIdForEvent(int calendarId);
void setSortMode(DeviceAPI::Tizen::SortModeArrayPtr attr);
if(!initialValue->isNullOrUndefined() && initialValue->getPriv() == NULL)
return false;
- if(!endValue->isNullOrUndefined() && initialValue->getPriv() == NULL)
+ if(!endValue->isNullOrUndefined() && endValue->getPriv() == NULL)
return false;
return true;
if (dplEvent->getResult()) {
if( dplEvent->getCalendar() ) {
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return converter.toJSValueRefCalendar(dplEvent->getCalendar());
} else {
LogError("Default calendar not found.");
#include <JSWebAPIError.h>
#include <ArgumentValidator.h>
#include <TimeTracer.h>
+#include <Logger.h>
#include "JSCallHistoryEntry.h"
#include "JSCallHistory.h"
bool bSuccess = false;
bool bError = false;
-
- try{
- ArgumentValidator validator(context, argumentCount, arguments);
-
- JSObjectRef successCB = validator.toFunction(0);
- if(successCB)
- bSuccess = true;
-
- JSObjectRef errCB = validator.toFunction(1, true);
- if(errCB)
- bError = true;
-
- unsigned long limit = validator.toULong(4, true);
- unsigned long offset = validator.toULong(5, true);
-
- }catch(const BasePlatformException& err){
- return JSWebAPIError::throwException(context, exception, err);
- }
-
-
if (argumentCount < 1) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
}
JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
- try {
+
+ try{
+ ArgumentValidator validator(context, argumentCount, arguments);
+
+ JSObjectRef successCB = validator.toFunction(0);
+ if(successCB)
+ bSuccess = true;
+
+ JSObjectRef errCB = validator.toFunction(1, true);
+ if(errCB)
+ bError = true;
+
+ unsigned long limit = validator.toULong(4, true);
+ unsigned long offset = validator.toULong(5, true);
+
if (argumentCount >= 1) {
if (JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0])) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : success callback ");
event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
if (argumentCount >= 3) {
- if (!check.isNullOrUndefined(arguments[2])) {
+ if(!JSValueIsNull(context, arguments[2])){
FilterPtr filter = filterConverter->toFilter(arguments[2]);
if(filter == NULL){
}else{
event ->setFilter(filter);
}
+ }else if(JSValueIsUndefined(context, arguments[2])) {
+ throw DeviceAPI::Common::TypeMismatchException("Filter is undefined");
}
}
if (argumentCount >= 4) {
- if (!check.isNullOrUndefined(arguments[3])) {
- event->setSortMode(filterConverter->toSortMode(arguments[3]));
+ if (!JSValueIsNull(context, arguments[3])) {
+ DeviceAPI::Tizen::SortModePtr sortMode = filterConverter->toSortMode(arguments[3]);
+
+ if(sortMode == NULL){
+ throw DeviceAPI::Common::TypeMismatchException("Invalid Sortmode");
+ }else{
+ event->setSortMode(filterConverter->toSortMode(arguments[3]));
+ }
+ }else if(JSValueIsUndefined(context, arguments[3])) {
+ throw DeviceAPI::Common::TypeMismatchException("Sortmode is undefined");
}
}
}
callHistory->find(event);
CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
- } catch(const BasePlatformException& err) {
+ } catch(const BasePlatformException& err){
+ return JSWebAPIError::throwException(context, exception, err);
+ } catch(const BasePlatformException& err) {
return JSWebAPIError::throwException(context, exception, err);
} catch(const WrtDeviceApis::Commons::ConversionException& ex) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
#define CALLHISTORY "callhistory"
+namespace DeviceAPI {
+namespace CallHistory {
+
using namespace WrtDeviceApis::Commons;
using namespace WrtDeviceApis::CommonsJavaScript;
NULL)
PLUGIN_CLASS_MAP_END
+} // CallHistory
+} // DeviceAPI
JSWebAPIError2.cpp
WebAPIError.cpp
PropertyBag.cpp
+ JSArray.cpp
)
ADD_LIBRARY(${COMMON_TARGET_NAME} SHARED ${SRCS})
--- /dev/null
+#include "JSArray.h"
+#include "PlatformException.h"
+
+namespace DeviceAPI {
+namespace Common {
+
+JSArrayBase::JSArrayBase( JSContextRef context, JSObjectRef array ):mContext(context), mArray(array){
+ if(!JSIsArrayValue(context, array)){
+ throw TypeMismatchException("The type is not array");
+ }
+ JSValueProtect(context, array);
+}
+
+JSArrayBase::JSArrayBase( JSContextRef context):mContext(context){
+ JSValueRef exception = NULL;
+ mArray = JSObjectMakeArray( context, 0, NULL, &exception);
+ if(exception != NULL){
+ throw UnknownException(context, exception);
+ }
+}
+
+JSArrayBase::~JSArrayBase(){
+ JSValueUnprotect(mContext, mArray);
+}
+
+size_t JSArrayBase::size() const {
+ return JSGetArrayLength(mContext, mArray);
+}
+
+void JSArrayBase::resize(size_t size){
+ JSUtil::setProperty(mContext, mArray, "length", JSUtil::toJSValueRef(mContext, static_cast<double>(size)), NULL, NULL);
+}
+
+JSValueRef JSArrayBase::get(int index) const{
+ return JSGetArrayElement(mContext, mArray, index);
+}
+
+bool JSArrayBase::set( int index, JSValueRef value){
+ bool t = JSSetArrayElement(mContext, mArray, index, value);
+ return t;
+}
+
+bool JSArrayBase::append( JSValueRef value ){
+ return set( size(), value);
+}
+
+}//Common
+}//DeviceAPI
--- /dev/null
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef __TIZEN_COMMON_JSARRAY_H__
+#define __TIZEN_COMMON_JSARRAY_H__
+#include <JavaScriptCore/JavaScript.h>
+#include <vector>
+#include "JSUtil.h"
+
+namespace DeviceAPI {
+namespace Common {
+
+class JSArrayBase{
+public:
+ JSArrayBase( JSContextRef context, JSObjectRef array );
+ JSArrayBase( JSContextRef context );
+
+ virtual ~JSArrayBase();
+ size_t size() const;
+ void resize(size_t size);
+ JSValueRef get(int index) const;
+ bool set(int index, JSValueRef value);
+ bool append(JSValueRef value);
+
+protected:
+ JSContextRef mContext;
+ JSObjectRef mArray;
+};
+
+
+template <typename T>
+class JSArray : protected JSArrayBase{
+ friend class ItemProxy;
+public:
+ typedef JSValueRef (*ToJSFunction)(JSContextRef, T);
+ typedef T (*ToNativeFunction)(JSContextRef, JSValueRef );
+
+
+ JSArray( JSContextRef context, JSObjectRef array, ToNativeFunction nativefun, ToJSFunction jsfun)
+ :JSArrayBase(context,array),mToNative(nativefun), mToJs(jsfun) {
+ }
+ JSArray( JSContextRef context, ToNativeFunction nativefun, ToJSFunction jsfun)
+ :JSArrayBase(context),mToNative(nativefun), mToJs(jsfun) {
+ }
+
+ ~JSArray(){
+ }
+
+ class ItemProxy {
+ JSArray<T> *mArray;
+ int mIndex;
+ public:
+ ItemProxy(JSArray<T>* array, int index):mArray(array), mIndex(index){
+ }
+ operator T(){
+ return mArray->mToNative(mArray->mContext, mArray->get(mIndex));
+ }
+ ItemProxy& operator=( const T native){
+ JSValueRef v = mArray->mToJs(mArray->mContext, native);
+ mArray->set(mIndex, v);
+ return *this;
+ }
+ ItemProxy& operator=( const ItemProxy& other){
+ JSValueRef v = other.mArray->get(other.mIndex);
+ mArray->set(mIndex, v);
+ return *this;
+ }
+
+ };
+ size_t size() const{
+ return JSArrayBase::size();
+ }
+
+ void resize(size_t size){
+ JSArrayBase::resize(size);
+ }
+
+ bool append( T v){
+ return JSArrayBase::set( size(), mToJs(mContext, v));
+ }
+
+ ItemProxy operator[]( int index ){
+ return ItemProxy(this, index);
+ }
+
+ operator JSObjectRef(){
+ return mArray;
+ }
+
+ operator std::vector<T>(){
+ std::vector<T> v;
+ size_t length = size();
+ for( unsigned int i = 0 ; i < length ; i++){
+ JSValueRef t = get(i);
+ T tmp = mToNative(mContext, t);
+ v.push_back(tmp);
+ }
+ return v;
+ }
+
+ void operator=( const std::vector<T>& list ){
+ overwrite(list);
+ }
+
+ void operator=( const JSArray<T>& rhs){
+ resize(rhs.size());
+ for(unsigned int i = 0 ; i < rhs.size(); i++){
+ set(i, rhs.get(i));
+ }
+ }
+
+protected:
+ void overwrite( const std::vector<T>& list ){
+ unsigned int i;
+ unsigned int listSize = list.size();
+ resize(listSize);
+ for( i = 0 ; i < listSize ; i++){
+ JSValueRef v = mToJs(mContext, list[i]);
+ set(i, v);
+ }
+ }
+
+
+
+
+private:
+ ToNativeFunction mToNative;
+ ToJSFunction mToJs;
+};
+
+
+class JSStringArray : public JSArray<std::string>{
+ static JSValueRef makeJSValue(JSContextRef ctx, std::string v){
+ return JSUtil::toJSValueRef(ctx, v);
+ }
+ public:
+ JSStringArray(JSContextRef ctx, JSObjectRef array): JSArray<std::string>(ctx, array, JSUtil::JSValueToString, makeJSValue){}
+ JSStringArray(JSContextRef ctx): JSArray<std::string>(ctx, JSUtil::JSValueToString, makeJSValue){}
+ void operator=( const std::vector<std::string>& list ){overwrite(list);}
+};
+
+
+class JSLongArray : public JSArray<long>{
+ static JSValueRef makeJSValue(JSContextRef ctx, long v){
+ return JSUtil::toJSValueRef(ctx, v);
+ }
+ public:
+ JSLongArray(JSContextRef ctx, JSObjectRef array): JSArray<long>(ctx, array, JSUtil::JSValueToLong, makeJSValue){}
+ JSLongArray(JSContextRef ctx): JSArray<long>(ctx, JSUtil::JSValueToLong, makeJSValue){}
+ void operator=( const std::vector<long>& list ){overwrite(list);}
+
+};
+
+
+
+
+}
+}
+#endif //__TIZEN_COMMON_JSARRAY_H__
+
#include <GlobalContextManager.h>
#include <string>
#include <vector>
+#include <iostream>
+#include <termios.h>
#undef LOG_TAG
#define LOG_TAG "TIZEN_DEVICEAPI"
using namespace std;
using namespace DeviceAPI::Common;
-
namespace DeviceAPI {
namespace Test {
setProperty(mGlobalContext, mGlobalObject, name, module, kJSPropertyAttributeReadOnly);
}
+
+int getch(void)
+{
+ int ch;
+ struct termios buf;
+ struct termios save;
+
+ tcgetattr(0, &save);
+ buf = save;
+ buf.c_lflag &= ~(ICANON|ECHO);
+ buf.c_cc[VMIN] = 1;
+ buf.c_cc[VTIME] = 0;
+ tcsetattr(0, TCSAFLUSH, &buf);
+ ch = getchar();
+ tcsetattr(0, TCSAFLUSH, &save);
+ return ch;
+}
+
+struct termios gSave;
+
+void onExit(void)
+{
+ tcsetattr(0, TCSAFLUSH, &gSave);
+}
+
+class LineBuffer{
+ vector<string> mHistory;
+ string mLine;
+ int mHistoryIndex;
+ char mCurrentPos;
+public:
+ LineBuffer():mHistoryIndex(0), mCurrentPos(0){
+ tcgetattr(0, &gSave);
+ atexit(onExit);
+ }
+ ~LineBuffer(){
+ tcsetattr(0, TCSAFLUSH, &gSave);
+ }
+
+ void backSpace( int length ){
+ for( int i =0 ; i < length ; i++){
+ putchar('\b');
+ putchar(' ');
+ putchar('\b');
+ }
+ }
+ void applyHistory( unsigned int index ){
+ if( mHistory.size() > index ){
+ mLine = mHistory[index];
+ mCurrentPos = mLine.size();
+ }
+ }
+ bool checkSpecialKeys(int a){
+ if( a == 8 ){
+ if( mLine.size() != 0){
+ mCurrentPos--;
+ mLine.erase(mCurrentPos);
+ }
+ return true;
+ }
+ if( a == 27 ){
+ a = getch(); // 91
+ a = getch();
+ switch( a ){
+ case 65:
+ //UP
+ if( mHistoryIndex > 0 ){
+ applyHistory(--mHistoryIndex);
+ }
+ break;
+ case 66:
+ //DOWN
+ if( (unsigned)mHistoryIndex < mHistory.size() ){
+ applyHistory(++mHistoryIndex);
+ }
+ break;
+ case 67:
+ //RIGHT
+ break;
+ case 68:
+ //LEFT
+ break;
+ case 51:
+ getch();
+ backSpace(1);
+ break;
+ default:
+ getch();
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+ string Prompt(const char * prompt){
+ printf("%s", prompt);
+ mCurrentPos = 0;
+ mLine.clear();
+ while(1){
+ int a = getch();
+ backSpace(mLine.size());
+ if( a == 10 )
+ break;
+
+ if(!checkSpecialKeys(a)){
+ mLine.insert(mCurrentPos,1, a);
+ mCurrentPos++;
+ }
+ cout << mLine;
+ }
+ cout << mLine;
+ if( mLine.size() > 0 ){
+ mHistory.push_back(mLine);
+ mHistoryIndex = mHistory.size();
+ }
+ return mLine;
+ }
+
+};
+
+
+
void StandaloneConsole::commandline(StandaloneConsole* console){
pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock(&lock);
printf("command line mode ( \"quit\" for exit )\n");
+ LineBuffer linebuff;
while(1){
- char line[1024];
- printf(">");
- if( gets(line) == NULL )
- break;
- if( strcmp(line, "quit") == 0 )
+ string line = linebuff.Prompt(">");
+ printf("\n");
+
+ if( line == "quit" )
break;
- if( strcmp(line, "gc") == 0 ){
+ if( line == "gc" ){
console->GarbageCollect();
continue;
}
- if( strcmp(line, "") == 0 )
+ if( line.size() == 0 )
continue;
- _Command *cmd = new _Command(line, console, &lock);
+ _Command *cmd = new _Command(line.c_str(), console, &lock);
// for thread safety
ecore_idler_add(commandDispath, cmd);
pthread_mutex_lock(&lock);
item = g_items[index];
}
- // 2. Verify pairs of begin, end
- if (item->on_tracing)
- {
- LOGE("[%s] (Name : %s) is not 'end'ed!",__FUNCTION__, item->name);
- item->mismatch_count ++;
- return -1;
- }
- // 3. Gets the timestamp
+ // 2. Gets the timestamp
gettimeofday( &t, NULL );
item->timestamp = t.tv_sec*1000000L + t.tv_usec;
#ifdef TIME_TRACER_UNIT_MSEC
item->timestamp = ( item->timestamp >= 1000) ? item->timestamp/1000 : 0;
#endif
- //set tracing on
- item->on_tracing = 1;
+
if (item->first_timestamp == 0) // in case of first
{
//set first timestamp
if (g_first_time > item->first_timestamp)
g_first_time = item->first_timestamp;
}
+
+ // 3. Verify pairs of begin, end
+ if (item->on_tracing)
+ {
+ LOGE("[%s] (Name : %s) is not 'end'ed!",__FUNCTION__, item->name);
+ item->mismatch_count ++;
+ return -1;
+ }
+
+ //set tracing on
+ item->on_tracing = 1;
+
if (show)
{
LOGE("[%s][BEGIN] %s (at %s:%d)", __FUNCTION__,name, filename, line );
INCLUDE_DIRECTORIES(
${TOP}/Tizen
- ${TOP}/Common
+ ${INCLUDE_COMMON}
${platform_pkgs_contact_INCLUDE_DIRS}
)
#include <ArgumentValidator.h>
#include <JSWebAPIError.h>
#include <JSUtil.h>
+#include <TimeTracer.h>
using namespace std;
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
AddressBookController *controller;
JSContextRef gContext;
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
AddressBookController *controller;
JSContextRef gContext;
}
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
JSContextRef gContext;
AddressBookController *controller;
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
// return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
AddressBookController *controller;
JSContextRef gContext;
}
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
JSContextRef gContext;
AddressBookController *controller;
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
// return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
AddressBookController *controller;
break;
}
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
JSContextRef gContext;
AddressBookController *controller;
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
// return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
JSContextRef gContext;
AddressBookController *controller;
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
// return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
JSContextRef gContext;
AddressBookController *controller;
LogError("Error on conversion : " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
JSContextRef gContext;
AddressBookController *controller;
break;
}
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
AddressBookController *controller;
JSContextRef gContext;
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, "Internal error");
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
AddressBookController *controller;
JSContextRef gContext;
break;
}
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
AddressBookController *controller;
JSContextRef gContext;
break;
}
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
AddressBookController *controller;
break;
}
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AddressBookPtr addressBook;
AddressBookController *controller;
JSContextRef gContext;
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, "Internal error");
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
#include "Contact.h"
#include <ArgumentValidator.h>
#include <JSWebAPIError.h>
+#include <TimeTracer.h>
#define FILTER_CLASS_NAME "Contact"
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactPtr contact(NULL);
Try {
LogError("Error on conversion : " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactPtr contact(NULL);
Try {
LogError("Error on conversion : " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
#include "ContactFilterConverter.h"
#include <ArgumentValidator.h>
#include <JSWebAPIError.h>
+#include <TimeTracer.h>
namespace DeviceAPI {
namespace Contact {
JSValueRef* exception)
{
LogDebug("Entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerPtr contactManager;
JSContextRef gContext;
ContactManagerController *controller;
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
// return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("Entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerController *priv =
static_cast<ContactManagerController*>(JSObjectGetPrivate(thisObject));
if (!priv) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return resultValue;
}
JSValueRef* exception)
{
LogDebug("Entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerController *priv =
static_cast<ContactManagerController*>(JSObjectGetPrivate(thisObject));
if (!priv) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return resultValue;
}
JSValueRef* exception)
{
LogDebug("Entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerController *priv =
static_cast<ContactManagerController*>(JSObjectGetPrivate(thisObject));
if (!priv) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return resultValue;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerPtr addressBook;
ContactManagerController *controller;
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerPtr addressBook;
ContactManagerController *controller;
}
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerPtr addressBook;
JSContextRef gContext;
ContactManagerController *controller;
JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
// return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerPtr addressBook;
ContactManagerController *controller;
}
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerPtr addressBook;
JSContextRef gContext;
ContactManagerController *controller;
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
// return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerPtr addressBook;
JSContextRef gContext;
ContactManagerController *controller;
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
// return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerPtr addressBook;
JSContextRef gContext;
ContactManagerController *controller;
LogError("Error on conversion : " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
ContactManagerPtr addressBook;
JSContextRef gContext;
ContactManagerController *controller;
break;
}
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
#include "JSPerson.h"
#include <ArgumentValidator.h>
#include <JSWebAPIError.h>
+#include <TimeTracer.h>
#define FILTER_CLASS_NAME "Person"
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PersonPtr person(NULL);
Try
break;
}
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PersonPtr person(NULL);
Try
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, "Internal error");
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
#include <Commons/plugin_initializer_def.h>
#include <Commons/WrtAccess/WrtAccess.h>
+#include <TimeTracer.h>
#include "JSContactManager.h"
#include "JSContact.h"
#include "JSContactGroup.h"
#include "ContactAsyncCallbackManager.h"
#include "ContactListenerManager.h"
+namespace DeviceAPI {
+namespace Contact {
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
void on_widget_start_callback(int widgetId)
{
LogDebug("[Tizen\\contact] on_widget_start_callback (" << widgetId << ")");
+ TIME_TRACER_INIT();
Try
{
WrtAccessSingleton::Instance().initialize(widgetId);
void on_widget_stop_callback(int widgetId)
{
LogDebug("[Tizen\\contact] on_widget_stop_callback (" << widgetId << ")");
+ TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Contact");
+ TIME_TRACER_RELEASE();
Try
{
WrtAccessSingleton::Instance().deinitialize(widgetId);
(js_class_template_getter)DeviceAPI::Contact::JSContactEmailAddress::getClassRef,
NULL)
PLUGIN_CLASS_MAP_END
+
+} // Contact
+} // DeviceAPI
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
+namespace DeviceAPI {
+namespace DataControl {
void on_widget_start_callback(int widgetId)
{
(js_class_template_getter)DeviceAPI::DataControl::JSDataControlManager::getClassRef,NULL)
PLUGIN_CLASS_MAP_END
+} // DataControl
+} // DeviceAPI
PKG_CHECK_MODULES(platform_pkgs_filesystem REQUIRED capi-appfw-application libpcrecpp ecore)
INCLUDE_DIRECTORIES(
- ${TOP}/Common
+ ${INCLUDE_COMMON}
${platform_pkgs_filesystem_INCLUDE_DIRS}
)
#include <JSTizenExceptionFactory.h>
#include <JSTizenException.h>
#include <SecurityExceptions.h>
+#include <TimeTracer.h>
#include "FilesystemUtils.h"
#include "Converter.h"
#include "plugin_config.h"
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
LogError("Private object is not set.");
try {
int widgetId = WrtAccessSingleton::Instance().getWidgetId();
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return converter.toJSValueRef(privateObject->getObject()->getNode()->toUri(widgetId));
} catch(const WrtDeviceApis::Commons::ConversionException& ex) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
} catch(const WrtDeviceApis::Commons::Exception& ex) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
} catch(const WrtDeviceApis::Commons::Exception& ex) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
} catch(const WrtDeviceApis::Commons::Exception& ex) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
IPathPtr src = Utils::fromVirtualPath(globalContext, converter.toString(reserveArguments[0]));
IPathPtr dest = Utils::fromVirtualPath(globalContext, converter.toString(reserveArguments[1]));
bool overwrite = converter.toBool(reserveArguments[2]);;
-
+
if (NT_DIRECTORY != privateObject->getObject()->getNode()->getType()) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::IO_ERROR, "IO error"));
return JSValueMakeUndefined(context);
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
} catch(const WrtDeviceApis::Commons::Exception& ex) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
PrivateObjectDefPtr privData(new PrivateObjectDef(node, privateObject->getObject()->getParentPermissions()));
privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
} catch (const WrtDeviceApis::Commons::PlatformException& ex) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::IO_ERROR, ex.GetMessage());
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
PrivateObjectDefPtr privData(new PrivateObjectDef(node, privateObject->getObject()->getParentPermissions()));
privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
/*
IPathPtr path = converter.toPath(argv[0]);
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
node->setPermissions(privateObject->getObject()->getNode()->getPermissions());
PrivateObjectDefPtr privData(new PrivateObjectDef(node, privateObject->getObject()->getParentPermissions()));
privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
/*
IPathPtr path = converter.toPath(argv[0]);
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
} catch(const WrtDeviceApis::Commons::Exception& ex) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("<<<");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
}
LogDebug(">>>");
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
}
#include <JSTizenExceptionFactory.h>
#include <JSTizenException.h>
#include <SecurityExceptions.h>
+#include <TimeTracer.h>
#include "Converter.h"
#include "Encodings.h"
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown error");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ TIME_TRACER_ITEM_BEGIN("read(UTF8)", 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
// utf8, iso8859-1, skip
if (!strcmp(currentCharSet.c_str(), Encodings::UTF8) || !strcmp(currentCharSet.c_str(), Encodings::ISO88591))
{
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return converter.toJSValueRef(std::string(text.Get()));
}
else
{
Utils::toUTF8String(currentCharSet, text.Get(), count, outStr);
+ TIME_TRACER_ITEM_END("read(UTF8)", 0);
return converter.toJSValueRef(outStr);
}
} catch(const WrtDeviceApis::Commons::ConversionException& ex) {
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
ThrowMsg(InvalidArgumentException, "Invalid argument");
}
-
DPL::ScopedArray<unsigned char> data(privateObject->getObject()->getBytes(count));
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return converter.toJSValueRef(data.Get(), privateObject->getObject()->getCount());
} catch(const WrtDeviceApis::Commons::ConversionException& ex) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
DPL::ScopedArray<unsigned char> data(privateObject->getObject()->getBytes(count));
std::string base64 = WrtDeviceApis::Commons::Base64::encode(data.Get(), privateObject->getObject()->getCount());
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return converter.toJSValueRef(base64);
} catch(const WrtDeviceApis::Commons::ConversionException& ex) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::IO_ERROR, ex.GetMessage());
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::IO_ERROR, ex.GetMessage());
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::IO_ERROR, ex.GetMessage());
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
} // Tizen1_0
#include <Commons/WrtAccess/WrtAccess.h>
#include <WidgetDB/WidgetDBMgr.h>
#include <WidgetDB/IWidgetDB.h>
+#include <TimeTracer.h>
#include "JSFile.h"
#include "FilesystemUtils.h"
namespace {
-const char* PLUGIN_NAME = "filesystem";
+const char* PLUGIN_NAME = "FileSystemManager";
const char* PROPERTY_MAXPATHLENGTH = "maxPathLength";
JSValueRef getFunctionOrNull(JSContextRef ctx, JSValueRef arg)
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSValueMakeUndefined(context);
} catch(const WrtDeviceApis::Commons::Exception& ex) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSValueMakeUndefined(context);
} catch(const WrtDeviceApis::Commons::Exception& ex) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSValueMakeUndefined(context);
} catch(const WrtDeviceApis::Commons::Exception& ex) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
const JSValueRef argv[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
return JSValueMakeUndefined(context);
} catch(const WrtDeviceApis::Commons::Exception& ex) {
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
{
LogDebug("<<<");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
}
snprintf(buf, size, "removable%d", storage);
lable.append(buf);
}
- LogDebug(lable);
+ LogDebug(lable << "state" << state);
storageItem->setId(storage);
storageItem->setLabel(lable);
Try {
parent = Node::resolve(IPath::create(dest->getPath()));
}
+ Catch(Commons::NotFoundException)
+ {
+ event->setExceptionCode(_rethrown_exception.getCode());
+ ReThrowMsg(Commons::NotFoundException, "could not find a destination path.");
+ }
Catch (Commons::Exception)
{
event->setExceptionCode(_rethrown_exception.getCode());
Try {
parent = Node::resolve(IPath::create(dest->getPath()));
}
+
+ Catch(Commons::NotFoundException)
+ {
+ event->setExceptionCode(_rethrown_exception.getCode());
+ ReThrowMsg(Commons::NotFoundException, "could not find a destination path.");
+ }
Catch(Commons::Exception)
{
LogError("Exception: " << _rethrown_exception.GetMessage());
void Path::reset(const std::string& str)
{
if (!isValid(str)) {
- ThrowMsg(Commons::InvalidArgumentException,
+ LogDebug(str << "empty string");
+ ThrowMsg(Commons::NotFoundException,
"Not a valid path: " + str + ".");
}
#include <dpl/log/log.h>
#include <Commons/WrtAccess/WrtAccess.h>
#include <Commons/plugin_initializer_def.h>
+#include <TimeTracer.h>
#include "JSFilesystemManager.h"
#include "JSFile.h"
#include "JSFilestream.h"
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
+namespace DeviceAPI {
+namespace Filesystem {
+
void on_widget_start_callback(int widgetId)
{
+ TIME_TRACER_INIT();
Try {
WrtAccessSingleton::Instance().initialize(widgetId);
} Catch (Commons::Exception) {
void on_widget_stop_callback(int widgetId)
{
+ TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"FileSystem");
+ TIME_TRACER_RELEASE();
Try {
WrtAccessSingleton::Instance().deinitialize(widgetId);
} Catch (Commons::Exception) {
#undef FILESYSTEM
+} // Filesystem
+} // DeviceAPI
#define TIZEN_WANING(FM,ARG...) {LOGW("%s[%s]%s" FM, YELLOW_COLOR, __FUNCTION__, NORMAL_COLOR, ##ARG);}
#define TIZEN_ERROR(FM,ARG...) {LOGE("%s[%s]%s" FM, RED_COLOR, __FUNCTION__, NORMAL_COLOR, ##ARG);}
-namespace TizenApis {
-namespace Tizen1_0 {
+namespace DeviceAPI {
+namespace Log {
using namespace WrtDeviceApis::Commons;
using namespace WrtDeviceApis;
return JSValueMakeUndefined(context);
}
-} // Tizen1_0
-} // TizenApis
+} // Log
+} // DeviceAPI
#include <JavaScriptCore/JavaScript.h>
-namespace TizenApis {
-namespace Tizen1_0 {
+namespace DeviceAPI {
+namespace Log {
class DeviceController;
#define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
+namespace DeviceAPI {
+namespace Log {
+
void on_widget_start_callback(int widgetId)
{
LogDebug("[TizenLog] on_widget_start_callback ("<<widgetId<<")");
PLUGIN_CLASS_MAP_BEGIN
PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "log",
- (js_class_template_getter)TizenApis::Tizen1_0::JSTizenLog::getClassRef, NULL)
+ (js_class_template_getter)DeviceAPI::Log::JSTizenLog::getClassRef, NULL)
PLUGIN_CLASS_MAP_END
+
+} // Log
+} // DeviceAPI
PKG_CHECK_MODULES(platform_pkgs_messageport REQUIRED message-port)
INCLUDE_DIRECTORIES(
- ${TOP}/Common
+ ${INCLUDE_COMMON}
${platform_pkgs_messageport_INCLUDE_DIRS}
)
#include <CommonsJavaScript/JSUtils.h>
#include <JSWebAPIException.h>
#include <ArgumentValidator.h>
+#include <TimeTracer.h>
#include "EventLocalMessagePortAddMessagePortListener.h"
#include "EventLocalMessagePortRemoveMessagePortListener.h"
#include "MessagePortListenerManager.h"
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
LocalMessagePortPtr localMessagePort;
JSContextRef gContext;
LocalMessagePortController *controller;
UnknownException("Internal error"));
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
LocalMessagePortPtr localMessagePort;
JSContextRef gContext;
LocalMessagePortController *controller;
}
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
#include <CommonsJavaScript/Validator.h>
#include <JSWebAPIException.h>
#include <ArgumentValidator.h>
+#include <TimeTracer.h>
#include "IMessagePortManager.h"
#include "MessagePortFactory.h"
#include "JSLocalMessagePort.h"
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
MessagePortManagerPtr messagePortManager;
JSContextRef gContext;
JSMessagePortManagerPriv *priv;
UnknownException("Internal error"));
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
MessagePortManagerPtr messagePortManager;
JSContextRef gContext;
JSMessagePortManagerPriv *priv;
UnknownException("Internal error"));
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
MessagePortManagerPtr messagePortManager;
JSContextRef gContext;
JSMessagePortManagerPriv *priv;
UnknownException("Internal error"));
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
MessagePortManagerPtr messagePortManager;
JSContextRef gContext;
JSMessagePortManagerPriv *priv;
UnknownException("Internal error"));
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return result;
}
#include <CommonsJavaScript/JSUtils.h>
#include <CommonsJavaScript/JSPendingOperation.h>
#include <JSWebAPIException.h>
+#include <TimeTracer.h>
#include "EventRemoteMessagePortSendMessage.h"
#include "JSLocalMessagePort.h"
#include "MessagePortJSUtil.h"
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
RemoteMessagePortPtr remoteMessagePort(NULL);
try
}
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
#include <Commons/plugin_initializer_def.h>
#include <Commons/WrtAccess/WrtAccess.h>
+#include <TimeTracer.h>
#include "JSMessagePortManager.h"
+namespace DeviceAPI {
+namespace MessagePort {
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
void on_widget_start_callback(int widgetId)
{
LogDebug("[Tizen\\MessagePort] on_widget_start_callback (" << widgetId << ")");
+ TIME_TRACER_INIT();
Try
{
WrtAccessSingleton::Instance().initialize(widgetId);
void on_widget_stop_callback(int widgetId)
{
LogDebug("[Tizen\\MessagePort] on_widget_stop_callback (" << widgetId << ")");
+ TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"MessagePort");
+ TIME_TRACER_RELEASE();
Try
{
WrtAccessSingleton::Instance().deinitialize(widgetId);
void on_frame_unload_callback(const void * context)
{
LogDebug("[Tizen\\MessagePort] on_frame_unload_callback (" << context << ")");
-
-// TizenApis::Tizen1_0::MessagePort::MessagePortAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
-// TizenApis::Tizen1_0::MessagePort::MessagePortListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
}
PLUGIN_ON_WIDGET_START(on_widget_start_callback)
(js_class_template_getter)DeviceAPI::MessagePort::JSMessagePortManager::getClassRef,
NULL)
PLUGIN_CLASS_MAP_END
+
+} // MessagePort
+} // DeviceAPI
(!validator.isNullOrUndefined(result.messagesRemoved) && !validator.isCallback(result.messagesRemoved)))
{
LogError("java script call back set error");
- Throw(WrtDeviceApis::Commons::InvalidArgumentException);
+ Throw(WrtDeviceApis::Commons::ConversionException);
}
return result;
NULL, //deleteProperty,
JSMessage::getPropertyNames, //getPropertyNames,
NULL, //callAsFunction,
- constructor, //callAsConstructor,
+ NULL, //callAsConstructor,
NULL, //hasInstance,
NULL, //convertToType,
};
return m_jsClassRef;
}
+ static JSObjectRef constructor(JSContextRef ctx,
+ JSObjectRef constructor,
+ size_t argumentCount,
+ const JSValueRef arguments[],
+ JSValueRef* exception);
+
static JSValueRef createJSObject(JSContextRef context,
EmailAccountInfo& account,
MessageType msgType,
JSValueRef possibleInstance,
JSValueRef* exception);
- static JSObjectRef constructor(JSContextRef ctx,
- JSObjectRef constructor,
- size_t argumentCount,
- const JSValueRef arguments[],
- JSValueRef* exception);
/**
* The callback invoked when converting an object to a particular JavaScript type.
NULL, //deleteProperty,
getPropertyNames,
NULL, //callAsFunction,
- constructor, //callAsConstructor,
+ NULL, //callAsConstructor,
NULL, //hasInstance,
NULL, //convertToType,
};
{
LogDebug("entered");
- JSMessageAttachmentPrivate* priv = static_cast<JSMessageAttachmentPrivate*>(JSObjectGetPrivate(constructor));
- JSContextRef globalContext = priv ? priv->getContext() : context;
try
{
if(path.size() != 0)
{
- DeviceAPI::Filesystem::IPathPtr src = DeviceAPI::Filesystem::Utils::fromVirtualPath(globalContext, path);
+ DeviceAPI::Filesystem::IPathPtr src = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, path);
if (src)
{
LogDebug("path size() : " << path.size());
{
JSClassRef jsClassRef = JSClassCreate(getClassInfo());
LogDebug("jsClassRef success");
- JSMessageAttachmentPrivate* priv = new JSMessageAttachmentPrivate(globalContext, attachment);
+ JSMessageAttachmentPrivate* priv = new JSMessageAttachmentPrivate(context, attachment);
LogDebug("priv success");
- JSObjectRef jsObjRef = JSObjectMake(globalContext, jsClassRef, static_cast<void*>(priv));
+ JSObjectRef jsObjRef = JSObjectMake(context, jsClassRef, static_cast<void*>(priv));
LogDebug("JSObjectMake success");
JSClassRelease(jsClassRef);
if (NULL == jsObjRef) {
static const JSClassDefinition* getClassInfo();
static JSClassRef getClassRef();
static JSObjectRef createJS( JSContextRef context, const IAttachmentPtr &msg);
+ static JSObjectRef constructor(JSContextRef ctx,
+ JSObjectRef constructor,
+ size_t argumentCount,
+ const JSValueRef arguments[],
+ JSValueRef* exception);
private:
JSObjectRef object,
JSStringRef propertyName);
- static JSObjectRef constructor(JSContextRef ctx,
- JSObjectRef constructor,
- size_t argumentCount,
- const JSValueRef arguments[],
- JSValueRef* exception);
static JSValueRef getProperty(JSContextRef context,
JSObjectRef object,
DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
return JSWebAPIError::throwException(context, exception, err);
}
-
- return JSValueMakeUndefined(context);
}
JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef function, JSObjectRef thisObject,
DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
return JSWebAPIError::throwException(context, exception, err);
}
-
- return JSValueMakeUndefined(context);
}
#if 0
JSValueRef JSMessagingService::cancelOperation(JSContextRef context, JSObjectRef function, JSObjectRef thisObject,
DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
return JSWebAPIError::throwException(context, exception, err);
}
-
- return JSValueMakeUndefined(context);
}
JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
return JSWebAPIError::throwException(context, exception, err);
}
-
- return JSValueMakeUndefined(context);
}
DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
return JSWebAPIError::throwException(context, exception, err);
}
-
- return JSValueMakeUndefined(context);
}
JSValueRef JSMessagingStorage::removeChangeListener(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount,
#define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
+namespace DeviceAPI {
+namespace Messaging {
+
+namespace Options{
+
+class_definition_options_t TizenOptions =
+{
+ JS_CLASS,
+ CREATE_INSTANCE,
+ NONE_NOTICE,
+ USE_OVERLAYED, //ignored
+ NULL,
+ NULL
+};
+
+class_definition_options_t MessagingInterfaceOptions = {
+ JS_INTERFACE,
+ CREATE_INSTANCE,
+ NONE_NOTICE,
+ USE_OVERLAYED, //ignored
+ NULL, // JSWidget::acquireGlobalContext,
+ NULL,
+ NULL
+};
+
+}
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
"messaging",
(js_class_template_getter)DeviceAPI::Messaging::JSMessagingServiceManager::getClassRef,
NULL)
- PLUGIN_CLASS_MAP_ADD_CLASS(
- WRT_JS_EXTENSION_OBJECT_TIZEN,
- "Message",
- (js_class_template_getter)DeviceAPI::Messaging::JSMessage::getClassRef,
- NULL)
- PLUGIN_CLASS_MAP_ADD_CLASS(
- WRT_JS_EXTENSION_OBJECT_TIZEN,
- "MessageAttachment",
- (js_class_template_getter)DeviceAPI::Messaging::JSMessageAttachment::getClassRef,
- NULL)
+ PLUGIN_CLASS_MAP_ADD_INTERFACE(WRT_JS_EXTENSION_OBJECT_TIZEN,
+ "Message",
+ (js_class_template_getter)DeviceAPI::Messaging::JSMessage::getClassRef,
+ (js_class_constructor_cb_t)DeviceAPI::Messaging::JSMessage::constructor,
+ &Options::MessagingInterfaceOptions)
+
+ PLUGIN_CLASS_MAP_ADD_INTERFACE(WRT_JS_EXTENSION_OBJECT_TIZEN,
+ "MessageAttachment",
+ (js_class_template_getter)DeviceAPI::Messaging::JSMessageAttachment::getClassRef,
+ (js_class_constructor_cb_t)DeviceAPI::Messaging::JSMessageAttachment::constructor,
+ &Options::MessagingInterfaceOptions)
PLUGIN_CLASS_MAP_END
+
+} // Messaging
+} // DeviceAPI
bool bEnabled = !mode;
LogDebug("system handeler enable?" << bEnabled);
// If exclusive mode is true, system handler has to be disabled.
- if (nfc_manager_set_system_handler_enable(!bEnabled) != NFC_ERROR_NONE)
+ if (nfc_manager_set_system_handler_enable(bEnabled) != NFC_ERROR_NONE)
ThrowMsg(UnknownException, "Failed to set exclusive mode.");
LogDebug("End");
}
PKG_CHECK_MODULES(platform_pkgs_notification REQUIRED notification capi-appfw-application)
INCLUDE_DIRECTORIES(
- ${TOP}/Common
+ ${INCLUDE_COMMON}
${TOP}/Application
${TOP}/Filesystem
${platform_pkgs_notification_INCLUDE_DIRS}
JSUtil::toJSValueRef(context, priv->getMainText()), kJSPropertyAttributeNone);
// subText
- JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT,
- JSUtil::toJSValueRef(context, priv->getSubText()), kJSPropertyAttributeNone);
+ std::string subText = priv->getSubText();
+
+ if ( subText.empty())
+ {
+ JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT, JSValueMakeNull(context), kJSPropertyAttributeNone);
+ }
+ else
+ {
+ JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT,
+ JSUtil::toJSValueRef(context, priv->getSubText()), kJSPropertyAttributeNone);
+ }
}
#include <GlobalContextManager.h>
#include <MultiCallbackUserData.h>
#include <PlatformException.h>
+#include <TimeTracer.h>
#include "plugin_config.h"
#include "JSStatusNotification.h"
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
throw TypeMismatchException("Private object is NULL.");
}
- LogDebug("priv=" << priv);
+ LogInfo("priv=" << priv);
ArgumentValidator validator(context, argumentCount, arguments);
// notification
JSObjectRef notificationObj = validator.toObject(0, JSStatusNotification::getClassRef());
- LogDebug("Notification Obj: " << notificationObj);
+ LogInfo("Notification Obj: " << notificationObj);
StatusNotification *notification = JSStatusNotification::getPrivateObject(context, notificationObj);
- LogDebug("Notification : " << notification);
+ LogInfo("Notification : " << notification);
if (!notification) {
throw TypeMismatchException("Notification's private object is NULL.");
if(stream.fail())
throw TypeMismatchException("Notification's ID conversion is failed.");
+ LogInfo ("posted notification id : " << stream.str());
+
+ //delete notificaiton ID
+ JSStringRef propertyIDName = JSStringCreateWithUTF8CString(NOTIFICATION_ID);
+ JSObjectDeleteProperty(context, notificationObj, propertyIDName, 0);
+ JSStringRelease(propertyIDName);
+
+ //sencond
JSUtil::setProperty(context, notificationObj, NOTIFICATION_ID,
- JSUtil::toJSValueRef(context, stream.str()), kJSPropertyAttributeNone);
+ JSUtil::toJSValueRef(context, stream.str()), kJSPropertyAttributeReadOnly);
}
else
{
throw DeviceAPI::Common::UnknownException("Notification ID value is invalied.");
}
+ //delete posted time
+ JSStringRef propertyPostedTimeName = JSStringCreateWithUTF8CString(NOTIFICATION_POSTED_TIME);
+ JSObjectDeleteProperty(context, notificationObj, propertyPostedTimeName, 0);
+ JSStringRelease(propertyPostedTimeName);
+
//posted time
JSUtil::setProperty(context, notificationObj, NOTIFICATION_POSTED_TIME,
- JSUtil::makeDateObject(context,notification->getPostedTime()), kJSPropertyAttributeNone);
-
-//set notification ID.
-//set notification postedTime.
+ JSUtil::makeDateObject(context,notification->getPostedTime()), kJSPropertyAttributeReadOnly);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIError::throwException(context, exception, err);
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
// perform
priv->update(notification);
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIError::throwException(context, exception, err);
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
// perform
priv->remove(id);
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIError::throwException(context, exception, err);
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ LogInfo("remove All");
try {
// Private Object
NotificationManager *priv = static_cast<NotificationManager*>(JSObjectGetPrivate(thisObject));
// perform
priv->removeAll();
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
return JSWebAPIError::throwException(context, exception, err);
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
try {
// Private Object
NotificationManager *priv = static_cast<NotificationManager*>(JSObjectGetPrivate(thisObject));
// id
std::string id = validator.toString(0);
-
+ LogDebug("get notification id :" << id);
JSObjectRef obj = JSObjectMake(context, JSStatusNotification::getClassRef(), NULL); //make object
StatusNotification* noti = priv->get(id); // perform
JSStatusNotification::setPrivateObject(context, obj, noti);
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return obj;
} catch (const BasePlatformException &err) {
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
try {
// Private Object
NotificationManager *priv = static_cast<NotificationManager*>(JSObjectGetPrivate(thisObject));
if (exception != NULL) {
throw DeviceAPI::Common::UnknownException(context, exception);
}
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return jsResult;
} catch (const BasePlatformException &err) {
kJSClassAttributeNone,
"StatusNotification",
NULL, //ParentClass
- NULL, //StaticValues
+ m_property, //StaticValues
NULL, //StaticFunctions
initialize, //Initialize
finalize, //Finalize
NULL //ConvertToType
};
+JSStaticValue JSStatusNotification::m_property[] =
+{
+ {STATUS_NOTIFICATION_PROGRESS_TYPE, JSStatusNotification::getProperty, JSStatusNotification::setProperty, kJSPropertyAttributeNone },
+ {STATUS_NOTIFICATION_PROGRESS_VALUE, JSStatusNotification::getProperty, JSStatusNotification::setProperty, kJSPropertyAttributeNone },
+ {0, 0, 0, 0}
+};
+
+bool JSStatusNotification::setProperty(JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef value,
+ JSValueRef* exception)
+{
+
+ StatusNotification *priv = static_cast<StatusNotification*>(JSObjectGetPrivate(object));
+ LogDebug("statusNotification :" << priv);
+ if (!priv) {
+ throw TypeMismatchException("StatusNotification's private object is NULL.");
+ }
+
+ try {
+ std::string property;
+ size_t jsSize = JSStringGetMaximumUTF8CStringSize(propertyName);
+ if (jsSize > 0) {
+ jsSize = jsSize + 1;
+ char* buffer = new char[jsSize];
+ size_t written = JSStringGetUTF8CString(propertyName, buffer, jsSize);
+ if (written > jsSize) {
+ throw InvalidValuesException("Conversion could not be fully performed.");
+ }
+ property = buffer;
+ delete[] buffer;
+ }
+
+ LogInfo("property =" << property);
+
+ if ( property == STATUS_NOTIFICATION_PROGRESS_TYPE)
+ {
+ std::string strProgressType = JSUtil::JSValueToString(context, value);
+ LogInfo("Progress Type : " << strProgressType);
+
+ NotificationProgressType progType = NOTI_PROGRESS_TYPE_NONE;
+ if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0)
+ progType = NOTI_PROGRESS_TYPE_PERCENTAGE;
+ else if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
+ progType = NOTI_PROGRESS_TYPE_SIZE;
+ else
+ throw InvalidValuesException("Invalid Progress Type.");
+
+ priv->setProgressType(progType); //set progress Type
+
+ return true;
+
+ }
+ else if ( property == STATUS_NOTIFICATION_PROGRESS_VALUE)
+ {
+ // progressValue
+ unsigned long progressVal = JSUtil::JSValueToULong(context, value);
+ LogInfo("Progress Value : " << progressVal);
+
+ if ( priv->getProgressType() == NOTI_PROGRESS_TYPE_PERCENTAGE)
+ {
+ if ( 100 < progressVal )
+ throw InvalidValuesException("The percentage progress value must be between 0 and 100");
+ priv->setProgressValue((double)progressVal/(double)100);
+ }
+ else
+ {
+ priv->setProgressValue((double)progressVal);
+ }
+
+ return true;
+ }
+
+ }
+ catch ( const BasePlatformException& err)
+ {
+ LogWarning(" notification convertion is failed. " << err.getName().c_str() << ":" << err.getMessage().c_str());
+ }
+
+
+ return false;
+}
+
+JSValueRef JSStatusNotification::getProperty(JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef* exception)
+{
+
+ StatusNotification *priv = static_cast<StatusNotification*>(JSObjectGetPrivate(object));
+ LogDebug("statusNotification :" << priv);
+ if (!priv) {
+ throw TypeMismatchException("StatusNotification's private object is NULL.");
+ }
+
+ try {
+
+ std::string property;
+ size_t jsSize = JSStringGetMaximumUTF8CStringSize(propertyName);
+ if (jsSize > 0) {
+ jsSize = jsSize + 1;
+ char* buffer = new char[jsSize];
+ size_t written = JSStringGetUTF8CString(propertyName, buffer, jsSize);
+ if (written > jsSize) {
+ throw InvalidValuesException("Conversion could not be fully performed.");
+ }
+ property = buffer;
+ delete[] buffer;
+ }
+
+ LogInfo("property =" << property);
+ if ( property == STATUS_NOTIFICATION_PROGRESS_TYPE)
+ {
+ std::string type;
+ if ( NOTI_PROGRESS_TYPE_PERCENTAGE == priv->getProgressType())
+ {
+ type = TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE;
+ }
+ else if ( NOTI_PROGRESS_TYPE_SIZE== priv->getProgressType())
+ {
+ type = TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE;
+ }
+
+ return JSUtil::toJSValueRef(context, type);
+
+ }
+ else if ( property == STATUS_NOTIFICATION_PROGRESS_VALUE)
+ {
+ // progressValue
+
+ LogInfo("Progress Type=" << priv->getProgressType());
+
+ // progressValue
+ unsigned long progressVal = 0;
+ if ( NOTI_PROGRESS_TYPE_PERCENTAGE == priv->getProgressType())
+ {
+ progressVal = (unsigned long)( (priv->getProgressValue()*100) );
+ }
+ else if ( NOTI_PROGRESS_TYPE_SIZE== priv->getProgressType())
+ {
+ progressVal = (unsigned long)priv->getProgressValue();
+ }
+
+ LogInfo("Progress Value=" << progressVal);
+
+ return JSUtil::toJSValueRef(context, progressVal);
+ }
+
+ }
+ catch ( const BasePlatformException& err)
+ {
+ LogWarning(" notification convertion is failed. " << err.getName().c_str() << ":" << err.getMessage().c_str());
+ return NULL;
+ }
+
+}
+
JSClassRef JSStatusNotification::m_jsClassRef = JSClassCreate(JSStatusNotification::getClassInfo());
priv->setTitle(validator.toString(1, false, "")); //title
- JSObjectRef notiInitDict = validator.toObject(2, true);
-
+ JSObjectRef notiInitDict = validator.toObject(2, true);
+
if (notiInitDict)
{
//content
{
LogWarning("notification's icon path convertion is failed." << err.getMessage().c_str());
}
-
+
}
setPrivateObject(context, obj, priv);
JSValueRef appId = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_APP_ID);
priv->setApplicationId(JSUtil::JSValueToString(context, appId));
+#if 0
// progressType
JSValueRef progressType = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_PROGRESS_TYPE);
std::string strProgressType = JSUtil::JSValueToString(context, progressType);
{
priv->setProgressValue((double)JSUtil::JSValueToULong(context, progressValue));
}
-
+ #endif
return priv;
}
//type
std::string typeVal(NOTIFICATION_TYPE_VALUE);
JSUtil::setProperty(context, object, NOTIFICATION_TYPE,
- JSUtil::toJSValueRef(context, typeVal), kJSPropertyAttributeNone);
+ JSUtil::toJSValueRef(context, typeVal), kJSPropertyAttributeReadOnly);
std::string type;
throw TypeMismatchException("status type mismatch.");
JSUtil::setProperty(context, object, STATUS_NOTIFICATION_STATUS_TYPE,
- JSUtil::toJSValueRef(context, type), kJSPropertyAttributeNone);
+ JSUtil::toJSValueRef(context, type), kJSPropertyAttributeReadOnly);
//id
if (priv->getID() >= 0)
throw TypeMismatchException("Notification's ID conversion is failed.");
JSUtil::setProperty(context, object, NOTIFICATION_ID,
- JSUtil::toJSValueRef(context, stream.str()), kJSPropertyAttributeNone);
+ JSUtil::toJSValueRef(context, stream.str()), kJSPropertyAttributeReadOnly);
}
else
{
JSUtil::setProperty(context, object, NOTIFICATION_ID,
- JSValueMakeNull(context), kJSPropertyAttributeNone);
+ JSValueMakeNull(context), kJSPropertyAttributeReadOnly);
}
//postedTime
if (priv->getPostedTime() > 0)
{
JSUtil::setProperty(context, object, NOTIFICATION_POSTED_TIME,
- JSUtil::makeDateObject(context,priv->getPostedTime()), kJSPropertyAttributeNone);
+ JSUtil::makeDateObject(context,priv->getPostedTime()), kJSPropertyAttributeReadOnly);
}
else
{
JSUtil::setProperty(context, object, NOTIFICATION_POSTED_TIME,
- JSValueMakeNull(context), kJSPropertyAttributeNone);
+ JSValueMakeNull(context), kJSPropertyAttributeReadOnly);
}
//title
if (!thumbnails[i].empty())
{
LogInfo("Thumbnail :" << thumbnails[i]);
- tumbnailvalueArray[i] = JSUtil::toJSValueRef(context, thumbnails[i]);
+ tumbnailvalueArray[i] = JSUtil::toJSValueRef(context, DeviceAPI::Filesystem::Utils::toVirtualPath(context, thumbnails[i]));
}
}
JSUtil::setProperty(context, object, STATUS_NOTIFICATION_APP_ID,
JSUtil::toJSValueRef(context, priv->getApplicationId()), kJSPropertyAttributeNone);
+#if 0
// progressType & Value
LogInfo("Progress Type=" << priv->getProgressType());
LogInfo("Progress Value =" << progressVal);
JSUtil::setProperty(context, object, STATUS_NOTIFICATION_PROGRESS_VALUE,
JSUtil::toJSValueRef(context, progressVal), kJSPropertyAttributeNone);
-
+#endif
// detailInfo
std::vector<NotificationDetailInfo*> detailInfo = priv->getDetailInfos();
LogInfo("detail Info Size : " << detailInfo.size());
static StatusNotification* getPrivateObject(JSContextRef context, JSObjectRef object);
static void setPrivateObject(JSContextRef context, JSObjectRef object, StatusNotification *priv);
+ static bool setProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
+ static JSValueRef getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
private:
/**
if ( notification )
{
- LogDebug(" notification id = " << notification->getID());
+ LogInfo(" notification id = " << notification->getID());
notification_h handle = (notification_h)notification->getNotificationHandle();
- LogDebug("notification hanel :" << handle);
+ LogInfo("notification hanel :" << handle);
if ( handle )
{
}
else
{
- notification_set_property(handle, 0);
- notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+ if (notification->getLaunchFlag())
+ {
+ LogInfo("Notification Launch Flag True");
+ notification_set_property(handle, 0);
+ notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+ }
+ else
+ {
+ LogInfo("Notification Launch Flag False");
+ notification_set_property(handle, NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
+ }
+
//bundle_free(service_data);
}
}
-
+
//check layout.
int type = (int)notification->getNotiType();
notification_ly_type_e noti_layout = NOTIFICATION_LY_NONE;
int ret = notification_set_layout(handle, noti_layout);
LogDebug("set Layout result= " << ret);
+
+ bundle *service_data = NULL;
+ service_h service = notification->getService();
+ if (service)
+ {
+ if (service_to_bundle(service, &service_data)!= SERVICE_ERROR_NONE)
+ {
+ throw UnknownException("Can't create bundle");
+ }
+ else
+ {
+ if (notification->getLaunchFlag())
+ {
+ LogInfo("Notification Launch Flag True");
+ notification_set_property(handle, 0);
+ notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+ }
+ else
+ {
+ LogInfo("Notification Launch Flag False");
+ notification_set_property(handle, NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
+ }
+
+ }
+ }
+
+ notification->setLaunchFlag(false);
+
LogDebug(" get Title = " << notification->getTitle());
ret = notification_update(handle);
LogDebug(" notification_update = " << ret);
m_service(NULL),
m_notiHandle(NULL),
m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
- m_notiUpdated(false)
+ m_notiUpdated(false),
+ m_launchFlag(false)
{
LogInfo("statusType =" << statusType);
m_service(NULL),
m_notiHandle(NULL),
m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
- m_notiUpdated(false)
+ m_notiUpdated(false),
+ m_launchFlag(false)
{
LogInfo("noti : " << noti);
m_service(NULL),
m_notiHandle(NULL),
m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
- m_notiUpdated(false)
+ m_notiUpdated(false),
+ m_launchFlag(false)
{
LogInfo("priv ID : " << privID);
LogInfo("getOperation : " << control->getOperation().c_str());
if (control->getOperation().size() != 0)
{
+ m_launchFlag = true; //default attribute
if (service_set_operation(m_service, control->getOperation().c_str()) != SERVICE_ERROR_NONE)
{
throw UnknownException("service set operation error");
if (m_service)
{
- if (service_set_app_id(m_service, appId.c_str())!= SERVICE_ERROR_NONE)
+ if (!appId.empty())
{
- throw DeviceAPI::Common::UnknownException ("service set appId error");
+ m_launchFlag = true;
+ if (service_set_app_id(m_service, appId.c_str())!= SERVICE_ERROR_NONE)
+ {
+ throw DeviceAPI::Common::UnknownException ("service set appId error");
+ }
}
}
return m_notiUpdated;
}
+ bool getLaunchFlag()
+ {
+ return m_launchFlag;
+ }
+
+ void setLaunchFlag(bool value)
+ {
+ m_launchFlag = value;
+ }
+
NotificationType getNotiType()
{
return m_notiType;
notification_h m_notiHandle;
NotificationProgressType m_progressType;
bool m_notiUpdated;
+ bool m_launchFlag;
std::vector<std::string> m_thumbs; //thumbnail images path
std::vector<NotificationDetailInfo*> m_detailInfos; // detail Info
#include <Logger.h>
#include <GlobalContextManager.h>
+#include <TimeTracer.h>
#include "JSNotificationManager.h"
#include "JSStatusNotification.h"
void on_widget_start_callback(int widgetId)
{
LogDebug("[Tizen\\Notification] on_widget_start_callback (%d)" << widgetId);
+ TIME_TRACER_INIT();
try {
WrtAccessSingleton::Instance().initialize(widgetId);
} catch (...) {
void on_widget_stop_callback(int widgetId)
{
LogDebug("[Tizen\\Notification] on_widget_stop_callback (%d)" << widgetId);
+ TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Notification");
+ TIME_TRACER_RELEASE();
try {
WrtAccessSingleton::Instance().deinitialize(widgetId);
} catch (...) {
)
INCLUDE_DIRECTORIES(
- ${TOP}/Common
+ ${INCLUDE_COMMON}
${TOP}/Package
${platform_pkgs_package_INCLUDE_DIRS}
)
#include <JSUtil.h>
#include <GlobalContextManager.h>
+#include <TimeTracer.h>
#include <dlog.h>
#include "JSPackageManager.h"
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_INSTALL);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
PackageInstallEventCallback *pkgInstallEventCB = new PackageInstallEventCallback(GlobalContextManager::getInstance()->getGlobalContext(context), onprogressCb, oncompleteCb, onerrorCb);
PackageManager::getInstance()->install(path, pkgInstallEventCB);
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_INSTALL);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
PackageInstallEventCallback *pkgInstallEventCB = new PackageInstallEventCallback(GlobalContextManager::getInstance()->getGlobalContext(context), onprogressCb, oncompleteCb, onerrorCb);
PackageManager::getInstance()->uninstall(id, pkgInstallEventCB);
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_GET_PACKAGES_INFO);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
}
PackageManager::getInstance()->getPackagesInfo(callback);
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_GET_PACKAGE_INFO);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
//LogDebug("id = " << id);
PackageInformation* pkgInfo = PackageManager::getInstance()->getPackageInfo(id);
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSPackageInformation::createJSObject(context, pkgInfo);
} catch (const BasePlatformException &err) {
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_SET_PACKAGE_INFO_EVENT_LISTENER);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
PackageInfoEventCallback *pkginfoEventCB = new PackageInfoEventCallback(oninstalledCb, onupdatedCb, onuninstalledCb);
PackageManager::getInstance()->setPackageInfoEventListener(pkginfoEventCB);
-
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_UNSET_PACKAGE_INFO_EVENT_LISTENER);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
try {
PackageManager::getInstance()->unsetPackageInfoEventListener();
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch(const BasePlatformException& err) {
ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &id);
if ((ret != PMINFO_R_OK) || (id == NULL)) {
LogDebug("Fail to get id. return NULL.");
+ delete pkgInfo;
return NULL;
} else {
pkgInfo->m_id = id;
ret = package_manager_get_package_info(id, &package_info);
if (ret != PACKAGE_MANAGER_ERROR_NONE) {
LogDebug("Cannot create package info by : " << id);
+ delete pkgInfo;
return NULL;
}
g_idle_add(getCompleteCB, data);
}
-static void package_event_cb(const char *type, const char *package,
- package_manager_event_type_e event_type,
- package_manager_event_state_e event_state,
- int progress,
- package_manager_error_e error,
- void *user_data)
-{
- LogDebug("event callback is called!!! : event_state " << event_state << " : package " << package << " : event_type " << event_type );
- if (event_state == PACAKGE_MANAGER_EVENT_STATE_COMPLETED) {
- PackageInfoEventCallback *eventCB = (PackageInfoEventCallback *)user_data;
-
- switch(event_type) {
- case PACAKGE_MANAGER_EVENT_TYPE_INSTALL: {
- pkgmgrinfo_pkginfo_h handle;
- int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
- if (ret != PMINFO_R_OK) {
- LogDebug("fail to find pkg info with given pkg : " << package);
- // Do not throw exception. No one can handle exception because this code is called from async callback.
- //throw NotFoundException("Can't find given package");
- break;
- }
-
- PackageInformation* pkgInfo = create_pkg_info(handle);
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- if (pkgInfo == NULL) {
- LogDebug("Fail to get pkg info. skip callback call for pkgid " << package);
- } else {
- CallbackUserData *callback = eventCB->getOnInstalled();
- if (callback) {
- callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
- }
- }
+static void package_event_cb(app_manger_event_type_e event_type, const char *package, void *user_data)
+{
+ PackageInfoEventCallback *eventCB = (PackageInfoEventCallback *)user_data;
+
+ switch(event_type) {
+ case APP_MANAGER_EVENT_INSTALLED: {
+ pkgmgrinfo_pkginfo_h handle;
+ int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
+ if (ret != PMINFO_R_OK) {
+ LogDebug("fail to find pkg info with given pkg : " << package);
+ // Do not throw exception. No one can handle exception because this code is called from async callback.
+ //throw NotFoundException("Can't find given package");
break;
}
- case PACAKGE_MANAGER_EVENT_TYPE_UNINSTALL: {
- LogDebug("uninstall : " << package);
- CallbackUserData *callback = eventCB->getOnUninstalled();
+
+ PackageInformation* pkgInfo = create_pkg_info(handle);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+
+ if (pkgInfo == NULL) {
+ LogDebug("Fail to get pkg info. skip callback call for pkgid " << package);
+ } else {
+ CallbackUserData *callback = eventCB->getOnInstalled();
if (callback) {
- Converter converter(callback->getContext());
- callback->callSuccessCallback(converter.toJSValueRef(package));
+ callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
}
+ }
+ break;
+ }
+ case APP_MANAGER_EVENT_UNINSTALLED: {
+ LogDebug("uninstall : " << package);
+ CallbackUserData *callback = eventCB->getOnUninstalled();
+ if (callback) {
+ Converter converter(callback->getContext());
+ callback->callSuccessCallback(converter.toJSValueRef(package));
+ }
+ break;
+ }
+ case APP_MANAGER_EVENT_UPDATED: {
+ pkgmgrinfo_pkginfo_h handle;
+ int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
+ if (ret != PMINFO_R_OK) {
+ // Do not throw exception. No one can handle exception because this code is called from async callback.
+ //throw NotFoundException("Can't find given package");
break;
}
- case PACAKGE_MANAGER_EVENT_TYPE_UPDATE: {
- pkgmgrinfo_pkginfo_h handle;
- int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
- if (ret != PMINFO_R_OK) {
- // Do not throw exception. No one can handle exception because this code is called from async callback.
- //throw NotFoundException("Can't find given package");
- break;
+
+ PackageInformation* pkgInfo = create_pkg_info(handle);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+
+ if (pkgInfo == NULL) {
+ LogDebug("Fail to get pkg info. skip callback call for pkgid " << package);
+ } else {
+ CallbackUserData *callback = eventCB->getOnUpdated();
+ if (callback) {
+ callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
}
+ }
+ break;
+ }
+ default:
+ LogDebug("Fail!! Unknown event type is entered : " << event_type);
+ break;
+ }
- PackageInformation* pkgInfo = create_pkg_info(handle);
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
+
+}
- if (pkgInfo == NULL) {
- LogDebug("Fail to get pkg info. skip callback call for pkgid " << package);
- } else {
- CallbackUserData *callback = eventCB->getOnUpdated();
- if (callback) {
- callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
- }
- }
- break;
+static int app_list_changed_cb_broker(int id, const char *type, const char *package, const char *key, const char *val, const void *msg, void *data)
+{
+ static app_manger_event_type_e event_type;
+
+ if (!strcasecmp(key, "start"))
+ {
+ if (!strcasecmp(val, "install"))
+ {
+ event_type = APP_MANAGER_EVENT_INSTALLED;
}
- default:
- LogDebug("Fail!! Unknown event type is entered : " << event_type);
- break;
+ else if (!strcasecmp(val, "uninstall"))
+ {
+ event_type = APP_MANAGER_EVENT_UNINSTALLED;
+ }
+ else if (!strcasecmp(val, "update"))
+ {
+ event_type = APP_MANAGER_EVENT_UPDATED;
+ }
+ }
+ else if (!strcasecmp(key, "end") && !strcasecmp(val, "ok"))
+ {
+ if (event_type >= 0)
+ {
+ package_event_cb(event_type, package, data);
}
}
+
+ return APP_MANAGER_ERROR_NONE;
}
void PackageManager::setPackageInfoEventListener(PackageInfoEventCallback * eventCB)
{
LogDebug("enter");
- int ret = 0;
if (m_manager_handle == NULL) {
- ret = package_manager_create(&m_manager_handle);
- if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ m_manager_handle = pkgmgr_client_new(PC_LISTENING);
+ if (m_manager_handle == NULL) {
throw UnknownException("Fail to create package manager handle");
}
}
-
- ret = package_manager_set_event_cb(m_manager_handle, package_event_cb, eventCB);
- if (ret != PACKAGE_MANAGER_ERROR_NONE) {
- throw UnknownException("Fail to set event cb");
- }
+
+ pkgmgr_client_listen_status(m_manager_handle, app_list_changed_cb_broker, eventCB);
}
void PackageManager::unsetPackageInfoEventListener()
{
LogDebug("enter");
- int ret = 0;
if (m_manager_handle == NULL) {
LogDebug("no package manager handle registered");
return;
}
-
- ret = package_manager_unset_event_cb(m_manager_handle);
- if (ret != PACKAGE_MANAGER_ERROR_NONE) {
- throw UnknownException("Fail to unset event cb");
- }
- ret = package_manager_destroy(m_manager_handle);
- if (ret != PACKAGE_MANAGER_ERROR_NONE) {
- throw UnknownException("Fail to destroy package manager handle");
- } else {
- m_manager_handle = NULL;
- }
+ pkgmgr_client_free(m_manager_handle);
+ m_manager_handle = NULL;
}
PackageManager* PackageManager::getInstance(){
PackageManager::~PackageManager()
{
LogDebug("Destroy PackageManager");
+
if (m_manager_handle != NULL) {
- package_manager_destroy(m_manager_handle);
- }
+ pkgmgr_client_free(m_manager_handle);
+ m_manager_handle = NULL;
+ }
+
}
#include <Commons/Exception.h>
#include <package_manager.h>
+#include <package-manager.h>
#include "PackageInformation.h"
private:
PackageManager();
~PackageManager();
- package_manager_h m_manager_handle;
+ pkgmgr_client *m_manager_handle;
};
#include <Commons/plugin_initializer_def.h>
#include <Commons/WrtAccess/WrtAccess.h>
#include <GlobalContextManager.h>
+#include <TimeTracer.h>
#include "JSPackageManager.h"
using namespace WrtDeviceApis;
void on_widget_start_callback(int widgetId) {
LogDebug("[Tizen2_1\\Package] on_widget_start_callback ("<<widgetId<<")");
+ TIME_TRACER_INIT();
Try {
WrtAccessSingleton::Instance().initialize(widgetId);
} Catch(WrtDeviceApis::Commons::Exception) {
void on_widget_stop_callback(int widgetId) {
LogDebug("[Tizen2_1\\Package] on_widget_stop_callback ("<<widgetId<<")");
+ TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Package");
+ TIME_TRACER_RELEASE();
Try {
WrtAccessSingleton::Instance().deinitialize(widgetId);
} Catch(WrtDeviceApis::Commons::Exception) {
PKG_CHECK_MODULES(platform_pkgs_power REQUIRED capi-system-power pmapi capi-system-device)
INCLUDE_DIRECTORIES(
- ${TOP}/Common
+ ${INCLUDE_COMMON}
${platform_pkgs_power_INCLUDE_DIRS}
)
#include <JSUtil.h>
#include <JSWebAPIException.h>
#include <ArgumentValidator.h>
+#include <TimeTracer.h>
#include "JSPowerManager.h"
#include "plugin_config.h"
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_REQUEST);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
try{
ArgumentValidator validator(context, argumentCount, arguments);
string resource_str = validator.toString(0);
PowerResource resource(resource_str.c_str());
PowerState state(state_str.c_str());
PowerManager::getInstance()->request( resource , state );
-
}catch(const BasePlatformException& err){
return JSWebAPIException::throwException(context, exception, err);
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
try{
ArgumentValidator validator(context, argumentCount, arguments);
}catch(const BasePlatformException& err){
return JSWebAPIException::throwException(context, exception, err);
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
try{
ArgumentValidator validator(context, argumentCount, arguments);
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Out of memory");
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
CallbackUserData *callback = static_cast<CallbackUserData*>(JSObjectGetPrivate(thisObject));
if( callback != NULL ){
JSObjectSetPrivate(thisObject, NULL);
delete callback;
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
try{
double brightness = PowerManager::getInstance()->getScreenBrightness();
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSUtil::toJSValueRef(context, brightness);
}catch(const BasePlatformException& err){
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
try{
}catch(const BasePlatformException& err){
return JSWebAPIException::throwException(context, exception, err);
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
try{
bool state = PowerManager::getInstance()->isScreenOn();
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSUtil::toJSValueRef(context,state);
}catch(const BasePlatformException& err){
return JSWebAPIException::throwException(context, exception, err);
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
try{
PowerManager::getInstance()->restoreScreenBrightness();
}catch(const BasePlatformException& err){
return JSWebAPIException::throwException(context, exception, err);
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);}
JSValueRef JSPowerManager::turnScreenOn(JSContextRef context,
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
}catch(const BasePlatformException& err){
return JSWebAPIException::throwException(context, exception, err);
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
JSValueRef* exception)
{
LogDebug("entered");
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
}catch(const BasePlatformException& err){
return JSWebAPIException::throwException(context, exception, err);
}
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
}
throw InvalidValuesException("invalid PowerState");
int ret=0;
- int native_state = POWER_STATE_SCREEN_OFF;
switch( state ){
case PowerState::SCREENDIM :
- native_state = POWER_STATE_SCREEN_DIM;
case PowerState::SCREENNORMAL :
- native_state = POWER_STATE_NORMAL;
case PowerState::CPUAWAKE :
- ret = power_lock_state( state.mState == PowerState::SCREENDIM ? POWER_STATE_SCREEN_DIM : POWER_STATE_NORMAL, 0);
- if( POWER_ERROR_NONE!=ret )
+ {
+ int native_state = POWER_STATE_SCREEN_OFF;
+ if( state == PowerState::SCREENDIM )
+ native_state = POWER_STATE_SCREEN_DIM;
+ else if( state == PowerState::SCREENNORMAL )
+ native_state = POWER_STATE_NORMAL;
+ else
+ native_state = POWER_STATE_SCREEN_OFF;
+
+ ret = power_lock_state( (power_state_e)native_state , 0);
+ if( POWER_ERROR_NONE!=ret ){
+ LOGE("power_lock_state(%d) error %d",native_state, ret);
throw UnknownException("power_lock_state error");
+ }
break;
+ }
case PowerState::SCREENBRIGHT :
{
int maxBrightness;
}
ret = device_set_brightness(0, maxBrightness);
- if( DEVICE_ERROR_NONE!=ret)
- throw UnknownException("Platform error while setting max brightness:");
+ if( DEVICE_ERROR_NONE!=ret){
+ LOGE("Platform error while setting %d brightness: %d", maxBrightness, ret);
+ throw UnknownException("Platform error while setting max brightness");
+ }
LOGI("Succeeded setting the brightness to a max level: %d", maxBrightness);
ret = power_lock_state(POWER_STATE_NORMAL, 0);
- if( POWER_ERROR_NONE!=ret )
+ if( POWER_ERROR_NONE!=ret ){
+ LOGE("Platform error while locking state %d", ret);
throw UnknownException("Platform error while locking state");
+ }
mBrightStateEnable = true;
power_state_e platform_state = power_get_state();
broadcastScreenState(PowerState::SCREENBRIGHT);
break;
}
+ case PowerState::SCREENOFF:
+ LOGE("SCREEN_OFF state cannot be requested");
+ throw InvalidValuesException("SCREEN_OFF state cannot be requested");
+
default :
throw UnknownException("Platform error while locking state");
}
LOGI("Platform return value from dim unlock: %d", ret);
ret = device_set_brightness_from_settings(0);
- if( DEVICE_ERROR_NONE!=ret)
+ if( DEVICE_ERROR_NONE!=ret){
+ LOGE("Platform error while setting restore brightness %d", ret);
throw UnknownException("Platform error while setting restore brightness");
+ }
mBrightStateEnable = false;
power_state_e platform_state = power_get_state();
double PowerManager::getScreenBrightness(){
int ret, brightness;
ret = device_get_brightness(0, &brightness);
- if( DEVICE_ERROR_NONE!=ret )
+ if( DEVICE_ERROR_NONE!=ret ){
+ LOGE("Platform error while get brightness %d", ret);
throw UnknownException("Platform error while get brightness");
+ }
LOGI("Brightness value: %d", brightness);
return brightness/100.0;
}
LOGE("Platform error while setting restore brightness: %d", ret);
throw UnknownException("Platform error while getting max brightness");
}
-
- ret = device_set_brightness(0, (int)(brightness*maxBrightness));
- if( DEVICE_ERROR_NONE!=ret )
+ int nativeBrightness = (int)(brightness*maxBrightness);
+ ret = device_set_brightness(0, nativeBrightness);
+ if( DEVICE_ERROR_NONE!=ret ){
+ LOGE("Platform error while setting %d brightness : %d",nativeBrightness, ret);
throw UnknownException("Platform error while setting brightness.");
- LOGI("Set the brightness value: %d", (int)(brightness*maxBrightness));
+ }
+ LOGI("Set the brightness value: %d", nativeBrightness);
}
bool PowerManager::isScreenOn(){
else
ret = pm_change_state(LCD_OFF);
- if( ret<0 )
+ if( ret<0 ){
+ LOGE("Platform error while changing screen state %d", ret);
throw UnknownException("Platform error while changing screen state");
+ }
}
void PowerManager::restoreScreenBrightness(){
int ret;
ret = device_set_brightness_from_settings(0);
- if( DEVICE_ERROR_NONE!=ret)
+ if( DEVICE_ERROR_NONE!=ret){
+ LOGE("Platform error while restoring brightness %d", ret);
throw UnknownException("Platform error while restoring brightness");
+ }
}
PowerManager* PowerManager::getInstance(){
#include <Commons/Exception.h>
#include "JSPowerManager.h"
#include <GlobalContextManager.h>
+#include <TimeTracer.h>
namespace DeviceAPI {
namespace Power {
void on_widget_start_callback(int widgetId)
{
LogDebug("[Tizen\\Power] on_widget_start_callback (" << widgetId << ")");
+ TIME_TRACER_INIT();
Try {
WrtAccessSingleton::Instance().initialize(widgetId);
void on_widget_stop_callback(int widgetId)
{
LogDebug("[Tizen\\Power] on_widget_stop_callback (" << widgetId << ")");
+ TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Power");
+ TIME_TRACER_RELEASE();
Try {
WrtAccessSingleton::Instance().deinitialize(widgetId);
PKG_CHECK_MODULES(platform_pkgs_push REQUIRED push capi-appfw-application)
INCLUDE_DIRECTORIES(
- ${TOP}/Common
- ${TOP}/Common/TimeTracer
+ ${INCLUDE_COMMON}
${TOP}/Application
${platform_pkgs_push_INCLUDE_DIRS}
)
#include <PlatformException.h>
#include <JSApplicationControl.h>
+#include <TimeTracer.h>
#include "plugin_config.h"
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_REGISTER_SERVICE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
// perform
priv->registerService(appControl, callback);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
LogError(err.getName() << ": " << err.getMessage());
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_UNREGISTER_SERVICE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
// perform
priv->unregisterService(callback);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
LogError(err.getName() << ": " << err.getMessage());
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_CONNECT_SERVICE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
// perform
priv->connectService(callback);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
LogError(err.getName() << ": " << err.getMessage());
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_DISCONNECT_SERVICE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
// perform
priv->disconnectService();
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeUndefined(context);
} catch (const BasePlatformException &err) {
LogError(err.getName() << ": " << err.getMessage());
const JSValueRef arguments[],
JSValueRef* exception)
{
+ TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_GET_REGISTRATION_ID);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
// perform
std::string ret = priv->getRegistrationId();
if (ret.empty()) {
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
return JSValueMakeNull(context);
} else {
- return JSUtil::toJSValueRef(context, ret);
+ TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+ return JSUtil::toJSValueRef(context, ret);
}
} catch (const BasePlatformException &err) {
LogError(err.getName() << ": " << err.getMessage());
#include "JSPushManager.h"
+#include <TimeTracer.h>
#include <Logger.h>
using namespace WrtDeviceApis;
void on_widget_start_callback(int widgetId)
{
LogDebug("[Tizen\\Push] on_widget_start_callback (%d)", widgetId);
+ TIME_TRACER_INIT();
try {
WrtAccessSingleton::Instance().initialize(widgetId);
} catch (...) {
void on_widget_stop_callback(int widgetId)
{
LogDebug("[Tizen\\Push] on_widget_stop_callback (%d)", widgetId);
+ TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Push");
+ TIME_TRACER_RELEASE();
try {
WrtAccessSingleton::Instance().deinitialize(widgetId);
} catch (...) {
#include <Commons/WrtAccess/WrtAccess.h>
#include "JSSEService.h"
+namespace DeviceAPI {
+namespace SecureElement {
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "seService", (js_class_template_getter)DeviceAPI::SecureElement::JSSEService::getClassRef, NULL)
PLUGIN_CLASS_MAP_END
+} // SecureElement
+} // DeviceAPI
PKG_CHECK_MODULES(platform_pkgs_systemsetting REQUIRED capi-system-system-settings)
INCLUDE_DIRECTORIES(
- ${TOP}/Common
+ ${INCLUDE_COMMON}
${TOP}/Filesystem
${platform_pkgs_systemsetting_INCLUDE_DIRS}
)
#include <JSTizenExceptionFactory.h>
#include <JSTizenException.h>
#include <SecurityExceptions.h>
+#include <TimeTracer.h>
#include "JSSystemSetting.h"
#include "SystemSettingResponseDispatcher.h"
JSCallbackManagerPtr callbackManager(JSCallbackManager::createObject(priv->getContext(), onSuccessForCbm, onErrorForCbm, true, true));
callbackManager->setObject(thisObject);
+ std::string strSettingType;
Try {
+ strSettingType = converter->toString(arguments[0]);
+ TIME_TRACER_ITEM_BEGIN(strSettingType.c_str(), 0);
settingType = converter->toSettingType(arguments[0]);
settingValue = converter->toString(arguments[1]);
-
Try{
DeviceAPI::Filesystem::IPathPtr src = DeviceAPI::Filesystem::Utils::fromVirtualPath(priv->getContext(), settingValue);
if (src)
}
LogDebug("end");
+ TIME_TRACER_ITEM_END(strSettingType.c_str(), 0);
return JSValueMakeUndefined(context);
}
JSCallbackManagerPtr callbackManager(JSCallbackManager::createObject(priv->getContext(), onSuccessForCbm, onErrorForCbm, true, true));
callbackManager->setObject(thisObject);
+ std::string strGettingType;
Try {
-
+ strGettingType = converter->toString(arguments[0]);
+ TIME_TRACER_ITEM_BEGIN(strGettingType.c_str(), 0);
SettingType settingType = converter->toSettingType(arguments[0]);
ISystemSettingPtr SystemSettings(priv->getObject());
}
LogDebug("end");
+ TIME_TRACER_ITEM_BEGIN(strGettingType.c_str(), 0);
return JSValueMakeUndefined(context);
}
#include <dpl/log/log.h>
#include <Commons/plugin_initializer_def.h>
#include <Commons/WrtAccess/WrtAccess.h>
+#include <TimeTracer.h>
#include "JSSystemSetting.h"
#include "SystemSettingAsyncCallbackManager.h"
//#include "MessageListenerManager.h"
+namespace DeviceAPI {
+namespace SystemSetting {
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
void on_widget_start_callback(int widgetId)
{
LogDebug("[Tizen\\SystemSetting ] on_widget_start_callback (" << widgetId << ")");
+ TIME_TRACER_INIT();
Try
{
WrtAccessSingleton::Instance().initialize(widgetId);
void on_widget_stop_callback(int widgetId)
{
LogDebug("[Tizen\\SystemSetting ] on_widget_stop_callback (" << widgetId << ")");
+ TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"SystemSetting");
+ TIME_TRACER_RELEASE();
Try
{
WrtAccessSingleton::Instance().deinitialize(widgetId);
PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "systemsetting", (js_class_template_getter)DeviceAPI::SystemSetting::JSSystemSetting::getClassRef, NULL)
PLUGIN_CLASS_MAP_END
+} // SystemSetting
+} // DeviceAPI
capi-system-info
capi-system-runtime-info
capi-system-sensor
- capi-telephony-network-info
sensor
)
// limitations under the License.
//
+#include <fstream>
+#include <pcrecpp.h>
#include <memory>
#include <dpl/log/log.h>
#include <JSTizenExceptionFactory.h>
#include <JSTizenException.h>
#include <SecurityExceptions.h>
+#include <sensor.h>
+#include <sensors.h>
+#include <system_info.h>
#include "JSDeviceCapabilitiesInfo.h"
#include "plugin_config.h"
Converter convert(context);
if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BLUETOOTH)) {
+ bool bluetooth = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetooth) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("bluetooth : " << bluetooth);
+ deviceCapabilitiesInfo->bluetooth = bluetooth;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->bluetooth);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NFC)) {
+ bool nfc = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_NFC_SUPPORTED, &nfc) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("nfc : " << nfc);
+ deviceCapabilitiesInfo->nfc = nfc;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->nfc);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NFC_RESERVED_PUSH)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->nfcReservedPush);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MULTITOUCHCOUNT)) {
+ int multiTouchCount = 0;
+ if (system_info_get_value_int(SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT, &multiTouchCount) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("multiTouchCount : " << multiTouchCount);
+ deviceCapabilitiesInfo->multiTouchCount = multiTouchCount;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->multiTouchCount);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_INPUTKEYBOARD)) {
+ char* inputKeyboard = NULL;
+ if (system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &inputKeyboard) == SYSTEM_INFO_ERROR_NONE) {
+ if (inputKeyboard != NULL) {
+ LogDebug("inputKeyboard : " << inputKeyboard);
+ deviceCapabilitiesInfo->inputKeyboard = inputKeyboard;
+ free(inputKeyboard);
+ }
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyboard);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_INPUTKEYBOARD_LAYOUT)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyboardLayout);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WIFI)) {
+ bool wifi = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wifi) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("wifi : " << wifi);
+ deviceCapabilitiesInfo->wifi = wifi;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->wifi);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WIFIDIRECT)) {
+ bool wifiDirect = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, &wifiDirect) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("wifiDirect : " << wifiDirect);
+ deviceCapabilitiesInfo->wifiDirect = wifiDirect;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->wifiDirect);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLES)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->opengles);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLES_TEXTURE_FORMAT)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->openglestextureFormat);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLESVERSION1_1)) {
+ char* openglesVersion = NULL;
+ if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) {
+ if (openglesVersion!= NULL) {
+ LogDebug("openglesVersion : " << openglesVersion);
+ if (strcmp(openglesVersion, "1.0") == 0) {
+ deviceCapabilitiesInfo->openglesVersion1_1 = true;
+ } else if (strcmp(openglesVersion, "1.0/2.0") == 0) {
+ deviceCapabilitiesInfo->openglesVersion1_1 = true;
+ }
+ free(openglesVersion);
+ }
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->openglesVersion1_1);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLESVERSION2_0)) {
+ char* openglesVersion = NULL;
+ if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) {
+ if (openglesVersion!= NULL) {
+ LogDebug("openglesVersion : " << openglesVersion);
+ if (strcmp(openglesVersion, "2.0") == 0) {
+ deviceCapabilitiesInfo->openglesVersion2_0 = true;
+ } else if (strcmp(openglesVersion, "1.0/2.0") == 0) {
+ deviceCapabilitiesInfo->openglesVersion2_0 = true;
+ }
+ free(openglesVersion);
+ }
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->openglesVersion2_0);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_FMRADIO)) {
+ bool fmRadio = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, &fmRadio) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("fmRadio : " << fmRadio);
+ deviceCapabilitiesInfo->fmRadio = fmRadio;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->fmRadio);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMVERSION)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_CAPABILITIES);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ char* platformVersion = NULL;
+ if (system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &platformVersion) == SYSTEM_INFO_ERROR_NONE) {
+ if (platformVersion) {
+ LogDebug("platformVersion : " << platformVersion);
+ deviceCapabilitiesInfo->platformVersion = platformVersion;
+ free(platformVersion);
+ }
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->platformVersion);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMNAME)) {
+ char* platformName = NULL;
+ if (system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &platformName) == SYSTEM_INFO_ERROR_NONE) {
+ if (platformName) {
+ LogDebug("platformName : " << platformName);
+ deviceCapabilitiesInfo->platformName = platformName;
+ free(platformName);
+ }
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->platformName);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WEBAPIVERSION)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_CAPABILITIES);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+ std::ifstream file("/usr/etc/system-info.ini");
+ std::string line;
+ std::string webApiVersionMajor = "";
+ std::string webApiVersionMinor = "";
+
+ if(!file) {
+ LogDebug("api/native version info file not found");
+ } else {
+ while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
+ if (pcrecpp::RE("platform.web.api.version=(\\w+).(\\w+)").PartialMatch(line, &webApiVersionMajor, &webApiVersionMinor)) {
+ deviceCapabilitiesInfo->webApiVersion = webApiVersionMajor;
+ deviceCapabilitiesInfo->webApiVersion += ".";
+ deviceCapabilitiesInfo->webApiVersion += webApiVersionMinor;
+ LogDebug("web api version : " << deviceCapabilitiesInfo->webApiVersion);
+ break;
+ }
+ }
+ file.close();
+ }
+
return convert.toJSValueRef(deviceCapabilitiesInfo->webApiVersion);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NATIVEAPIVERSION)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_CAPABILITIES);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+ std::ifstream file("/usr/etc/system-info.ini");
+ std::string line;
+ std::string nativeApiVersionMajor = "";
+ std::string nativeApiVersionMinor = "";
+
+ if(!file) {
+ LogDebug("api/native version info file not found");
+ } else {
+ while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
+ if (pcrecpp::RE("platform.native.api.version=(\\w+).(\\w+)").PartialMatch(line, &nativeApiVersionMajor, &nativeApiVersionMinor )) {
+ deviceCapabilitiesInfo->nativeApiVersion = nativeApiVersionMajor;
+ deviceCapabilitiesInfo->nativeApiVersion += ".";
+ deviceCapabilitiesInfo->nativeApiVersion += nativeApiVersionMinor;
+ LogDebug("native api version : " << deviceCapabilitiesInfo->nativeApiVersion);
+ break;
+ }
+ }
+ file.close();
+ }
+
return convert.toJSValueRef(deviceCapabilitiesInfo->nativeApiVersion);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERAFRONT)) {
+ bool cameraFront = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, &cameraFront) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("cameraFront : " << cameraFront);
+ deviceCapabilitiesInfo->cameraFront = cameraFront;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->cameraFront);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERA)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->camera);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERAFRONTFLASH)) {
+ bool cameraFrontFlash = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, &cameraFrontFlash) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("cameraFrontFlash : " << cameraFrontFlash);
+ deviceCapabilitiesInfo->cameraFrontFlash = cameraFrontFlash;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->cameraFrontFlash);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERABACK)) {
+ bool cameraBack = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, &cameraBack) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("cameraBack : " << cameraBack);
+ deviceCapabilitiesInfo->cameraBack = cameraBack;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->cameraBack);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERABACKFLASH)) {
+ bool cameraBackFlash = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, &cameraBackFlash) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("cameraBackFlash : " << cameraBackFlash);
+ deviceCapabilitiesInfo->cameraBackFlash = cameraBackFlash;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->cameraBackFlash);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATION)) {
+ bool location = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_CPS_SUPPORTED, &location) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("location : " << location);
+ deviceCapabilitiesInfo->location = location;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->location);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATIONGPS)) {
+ bool locationGps = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &locationGps) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("locationGps : " << locationGps);
+ deviceCapabilitiesInfo->locationGps = locationGps;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->locationGps);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATIONWPS)) {
+ bool locationWps = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_WPS_SUPPORTED, &locationWps) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("locationWps : " << locationWps);
+ deviceCapabilitiesInfo->locationWps = locationWps;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->locationWps);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MICROPHONE)) {
+ bool microphone = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED, µphone) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("microphone : " << microphone);
+ deviceCapabilitiesInfo->microphone = microphone;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->microphone);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_USBHOST)) {
+ bool usbHost = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, &usbHost) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("usbHost : " << usbHost);
+ deviceCapabilitiesInfo->usbHost = usbHost;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->usbHost);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_USBACCESSORY)) {
+ bool usbAccessory = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, &usbAccessory) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("usbAccessory : " << usbAccessory);
+ deviceCapabilitiesInfo->usbAccessory = usbAccessory;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->usbAccessory);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENOUTPUTRCA)) {
+ bool screenOutputRca = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_RCA_SUPPORTED, &screenOutputRca) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("screenOutputRca : " << screenOutputRca);
+ deviceCapabilitiesInfo->screenOutputRca = screenOutputRca;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->screenOutputRca);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENOUTPUTHDMI)) {
+ bool screenOutputHdmi = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_HDMI_SUPPORTED, &screenOutputHdmi) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("screenOutputHdmi : " << screenOutputHdmi);
+ deviceCapabilitiesInfo->screenOutputHdmi = screenOutputHdmi;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->screenOutputHdmi);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMCORECPUARCH)) {
+ char* platformCoreCpuArch = NULL;
+ if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &platformCoreCpuArch) == SYSTEM_INFO_ERROR_NONE) {
+ if (platformCoreCpuArch) {
+ LogDebug("platformCoreCpuArch : " << platformCoreCpuArch);
+ deviceCapabilitiesInfo->platformCoreCpuArch = platformCoreCpuArch;
+ free(platformCoreCpuArch);
+ }
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->platformCoreCpuArch);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMCOREFPUARCH)) {
+ char* platformCoreFpuArch = NULL;
+ if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &platformCoreFpuArch) == SYSTEM_INFO_ERROR_NONE) {
+ if (platformCoreFpuArch) {
+ LogDebug("platformCoreFpuArch : " << platformCoreFpuArch);
+ deviceCapabilitiesInfo->platformCoreFpuArch = platformCoreFpuArch;
+ free(platformCoreFpuArch);
+ }
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->platformCoreFpuArch);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SIPVOIP)) {
+ bool sipVoip = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED, &sipVoip) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("sipVoip : " << sipVoip);
+ deviceCapabilitiesInfo->sipVoip = sipVoip;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->sipVoip);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_DUID)) {
+ char* duid = NULL;
+ if (system_info_get_value_string(SYSTEM_INFO_KEY_DEVICE_UUID, &duid) == SYSTEM_INFO_ERROR_NONE) {
+ if (duid) {
+ LogDebug("duid : " << duid);
+ deviceCapabilitiesInfo->duid = duid;
+ free(duid);
+ }
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->duid);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SPEECH_ROCOGNITION)) {
+ bool speechRecognition = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED, &speechRecognition) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("speechRecognition : " << speechRecognition);
+ deviceCapabilitiesInfo->speechRecognition = speechRecognition;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->speechRecognition);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SPEECH_SYNTHESIS)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->speechSynthesis);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_ACCELEROMETER)) {
+ bool isAccelerometer = false;
+ if (sensor_is_supported(SENSOR_ACCELEROMETER, &isAccelerometer) == SENSOR_ERROR_NONE) {
+ LogDebug("accelerometer : " << isAccelerometer);
+ deviceCapabilitiesInfo->accelerometer = isAccelerometer;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->accelerometer);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_ACCELEROMETER_WAKEUP)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->accelerometerWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BAROMETER)) {
+ bool isBarometer = false;
+ if (system_info_get_value_bool(SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED, &isBarometer) == SYSTEM_INFO_ERROR_NONE) {
+ LogDebug("barometer : " << isBarometer);
+ deviceCapabilitiesInfo->barometer = isBarometer;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->barometer);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BAROMETER_WAKEUP)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->barometerWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_GYROSCOPE)) {
+ bool isGyroscope = false;
+ if (sensor_is_supported(SENSOR_GYROSCOPE, &isGyroscope) == SENSOR_ERROR_NONE) {
+ LogDebug("gyroscope : " << isGyroscope);
+ deviceCapabilitiesInfo->gyroscope = isGyroscope;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->gyroscope);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_GYROSCOPE_WAKEUP)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->gyroscopeWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MAGNETOMETER)) {
+ bool isMagnetometer = false;
+ if (sensor_is_supported(SENSOR_MAGNETIC, &isMagnetometer) == SENSOR_ERROR_NONE) {
+ LogDebug("magnetometer : " << isMagnetometer);
+ deviceCapabilitiesInfo->magnetometer = isMagnetometer;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->magnetometer);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MAGNETOMETER_WAKEUP)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->magnetometerWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PHOTOMETER_WAKEUP)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->photometerWakeup);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PROXIMITY)) {
+ bool isProximity = false;
+ if (sensor_is_supported(SENSOR_PROXIMITY, &isProximity) == SENSOR_ERROR_NONE) {
+ LogDebug("proximity : " << isProximity);
+ deviceCapabilitiesInfo->proximity = isProximity;
+ }
return convert.toJSValueRef(deviceCapabilitiesInfo->proximity);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PROXIMITY_WAKEUP)) {
return convert.toJSValueRef(deviceCapabilitiesInfo->proximityWakeup);
#include <JSTizenExceptionFactory.h>
#include <JSTizenException.h>
#include <SecurityExceptions.h>
+#include <sim.h>
#include "JSSIMInfo.h"
#include "plugin_config.h"
{
LogDebug("Enter");
JSSIMPriv *priv = static_cast<JSSIMPriv*>(JSObjectGetPrivate(object));
+ int ret = SIM_ERROR_NONE;
if (NULL == priv) {
LogError("Private object not set.");
return JSValueMakeUndefined(context);
if (JSStringIsEqualToUTF8CString(propertyName, SIM_OPERATORNAME_PROPERTY)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ char* fullName = NULL;
+ char* shortName = NULL;
+ ret = sim_get_cphs_operator_name(&fullName, &shortName);
+ if (ret == SIM_ERROR_NONE) {
+ if (fullName) {
+ SIMInfo->operatorName = fullName;
+ LogDebug("operatorName : " << SIMInfo->operatorName);
+ free(fullName);
+ } else if (shortName) {
+ SIMInfo->operatorName = shortName;
+ LogDebug("operatorName : " << SIMInfo->operatorName);
+ free(shortName);
+ }
+ }
return convert.toJSValueRef(SIMInfo->operatorName);
} else if (JSStringIsEqualToUTF8CString(propertyName, SIM_MSISDN_PROPERTY)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_PARTNER_VALUE);
- TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ char* msisdn = NULL;
+ ret = sim_get_subscriber_number(&msisdn);
+ if (ret == SIM_ERROR_NONE) {
+ if (msisdn) {
+ SIMInfo->msisdn = msisdn;
+ LogDebug("msisdn : " << SIMInfo->msisdn);
+ free(msisdn);
+ }
+ }
return convert.toJSValueRef(SIMInfo->msisdn);
} else if (JSStringIsEqualToUTF8CString(propertyName, SIM_ICCID_PROPERTY)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
- TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ char* iccId = NULL;
+ ret = sim_get_icc_id(&iccId);
+ if (ret == SIM_ERROR_NONE) {
+ if (iccId) {
+ SIMInfo->iccid = iccId;
+ LogDebug("iccid : " << SIMInfo->iccid);
+ free(iccId);
+ }
+ }
return convert.toJSValueRef(SIMInfo->iccid);
} else if (JSStringIsEqualToUTF8CString(propertyName, SIM_MCC_PROPERTY)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
- TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ char* mcc = NULL;
+ ret = sim_get_mcc(&mcc);
+ if (ret == SIM_ERROR_NONE) {
+ if (mcc) {
+ SIMInfo->mcc = atoi(mcc);
+ LogDebug("mcc : " << SIMInfo->mcc);
+ free(mcc);
+ }
+ }
return convert.toJSValueRef(SIMInfo->mcc);
} else if (JSStringIsEqualToUTF8CString(propertyName, SIM_MNC_PROPERTY)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
- TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
- return convert.toJSValueRef(SIMInfo->mnc);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ char* mnc = NULL;
+ ret = sim_get_mnc(&mnc);
+ if (ret == SIM_ERROR_NONE) {
+ if (mnc) {
+ SIMInfo->mnc = atoi(mnc);
+ LogDebug("mnc : " << SIMInfo->mnc);
+ free(mnc);
+ }
+ }
+ return convert.toJSValueRef(SIMInfo->mnc);
} else if (JSStringIsEqualToUTF8CString(propertyName, SIM_MSIN_PROPERTY)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_PARTNER_VALUE);
- TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
- return convert.toJSValueRef(SIMInfo->msin);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ char* msin = NULL;
+ ret = sim_get_msin(&msin);
+ if (ret == SIM_ERROR_NONE) {
+ if (msin) {
+ SIMInfo->msin = msin;
+ LogDebug("msin : " << SIMInfo->msin);
+ free(msin);
+ }
+ }
+ return convert.toJSValueRef(SIMInfo->msin);
} else if (JSStringIsEqualToUTF8CString(propertyName, SIM_SPN_PROPERTY)) {
AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
- TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
- return convert.toJSValueRef(SIMInfo->spn);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ char* spn = NULL;
+ ret = sim_get_spn(&spn);
+ if (ret == SIM_ERROR_NONE) {
+ if (spn) {
+ SIMInfo->spn = spn;
+ LogDebug("spn : " << SIMInfo->spn);
+ free(spn);
+ }
+ }
+ return convert.toJSValueRef(SIMInfo->spn);
}
}
Catch(Exception)
// limitations under the License.
//
-#include <fstream>
#include <stddef.h>
#include <cassert>
-#include <pcrecpp.h>
#include <dpl/log/log.h>
#include <math.h>
#include <Commons/Exception.h>
}
}
+void CellularNetworkValueCallback(keynode_t *node, void *event_ptr)
+{
+ if(event_ptr) {
+ ((Systeminfo*)event_ptr)->getWatchValue(WATCH_TYPE_CELLULARNETWORK);
+ }
+}
+
void DisplayValueCallback(keynode_t *node, void* event_ptr)
{
if(event_ptr) {
{
LogDebug("enter");
DeviceCapabilitiesPropertiesPtr deviceCapabilities(new DeviceCapabilitiesProperties());
- bool bluetooth = false, nfc = false, wifi = false, wifiDirect = false, fmRadio = false, cameraFront = false,
- cameraFrontFlash = false, cameraBack = false, cameraBackFlash = false, isAccelerometer = false, isGyroscope = false,
- isMagnetometer = false, isProximity = false, location = false, locationGps = false, locationWps = false,
- microphone = false, usbHost = false, usbAccessory = false, screenOutputRca = false, screenOutputHdmi = false,
- sipVoip = false, speechRecognition = false, isBarometer = false;
- int multiTouchCount = 0;
- char* inputKeyboard = NULL;
- char* platformVersion = NULL;
- char* platformName = NULL;
- char* platformCoreCpuArch = NULL;
- char* platformCoreFpuArch = NULL;
- char* duid = NULL;
- char* openglesVersion = NULL;
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetooth) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("bluetooth : " << bluetooth);
- deviceCapabilities->bluetooth = bluetooth;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_NFC_SUPPORTED, &nfc) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("nfc : " << nfc);
- deviceCapabilities->nfc = nfc;
- }
- if (system_info_get_value_int(SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT, &multiTouchCount) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("multiTouchCount : " << multiTouchCount);
- deviceCapabilities->multiTouchCount = multiTouchCount;
- }
-
- if (system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &inputKeyboard) == SYSTEM_INFO_ERROR_NONE) {
- if (inputKeyboard != NULL) {
- LogDebug("inputKeyboard : " << inputKeyboard);
- deviceCapabilities->inputKeyboard = inputKeyboard;
- free(inputKeyboard);
- }
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wifi) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("wifi : " << wifi);
- deviceCapabilities->wifi = wifi;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, &wifiDirect) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("wifiDirect : " << wifiDirect);
- deviceCapabilities->wifiDirect = wifiDirect;
- }
-
- if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) {
- if (openglesVersion!= NULL) {
- LogDebug("openglesVersion : " << openglesVersion);
- if (strcmp(openglesVersion, "1.0") == 0) {
- deviceCapabilities->openglesVersion1_1 = true;
- deviceCapabilities->openglesVersion2_0 = false;
- } else if (strcmp(openglesVersion, "2.0") == 0) {
- deviceCapabilities->openglesVersion1_1 = false;
- deviceCapabilities->openglesVersion2_0 = true;
- } else if (strcmp(openglesVersion, "1.0/2.0") == 0) {
- deviceCapabilities->openglesVersion1_1 = true;
- deviceCapabilities->openglesVersion2_0 = true;
- }
- free(openglesVersion);
- }
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, &fmRadio) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("fmRadio : " << fmRadio);
- deviceCapabilities->fmRadio = fmRadio;
- }
-
- if (system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &platformVersion) == SYSTEM_INFO_ERROR_NONE) {
- if (platformVersion) {
- LogDebug("platformVersion : " << platformVersion);
- deviceCapabilities->platformVersion = platformVersion;
- free(platformVersion);
- }
- }
-
- if (system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &platformName) == SYSTEM_INFO_ERROR_NONE) {
- if (platformName) {
- LogDebug("platformName : " << platformName);
- deviceCapabilities->platformName = platformName;
- free(platformName);
- }
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, &cameraFront) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("cameraFront : " << cameraFront);
- deviceCapabilities->cameraFront = cameraFront;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, &cameraFrontFlash) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("cameraFrontFlash : " << cameraFrontFlash);
- deviceCapabilities->cameraFrontFlash = cameraFrontFlash;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, &cameraBack) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("cameraBack : " << cameraBack);
- deviceCapabilities->cameraBack = cameraBack;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, &cameraBackFlash) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("cameraBackFlash : " << cameraBackFlash);
- deviceCapabilities->cameraBackFlash = cameraBackFlash;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_CPS_SUPPORTED, &location) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("location : " << location);
- deviceCapabilities->location = location;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &locationGps) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("locationGps : " << locationGps);
- deviceCapabilities->locationGps = locationGps;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_WPS_SUPPORTED, &locationWps) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("locationWps : " << locationWps);
- deviceCapabilities->locationWps = locationWps;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED, µphone) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("microphone : " << microphone);
- deviceCapabilities->microphone = microphone;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, &usbHost) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("usbHost : " << usbHost);
- deviceCapabilities->usbHost = usbHost;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, &usbAccessory) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("usbAccessory : " << usbAccessory);
- deviceCapabilities->usbAccessory = usbAccessory;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_RCA_SUPPORTED, &screenOutputRca) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("screenOutputRca : " << screenOutputRca);
- deviceCapabilities->screenOutputRca = screenOutputRca;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_HDMI_SUPPORTED, &screenOutputHdmi) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("screenOutputHdmi : " << screenOutputHdmi);
- deviceCapabilities->screenOutputHdmi = screenOutputHdmi;
- }
-
- if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &platformCoreCpuArch) == SYSTEM_INFO_ERROR_NONE) {
- if (platformCoreCpuArch) {
- LogDebug("platformCoreCpuArch : " << platformCoreCpuArch);
- deviceCapabilities->platformCoreCpuArch = platformCoreCpuArch;
- free(platformCoreCpuArch);
- }
- }
-
- if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &platformCoreFpuArch) == SYSTEM_INFO_ERROR_NONE) {
- if (platformCoreFpuArch) {
- LogDebug("platformCoreFpuArch : " << platformCoreFpuArch);
- deviceCapabilities->platformCoreFpuArch = platformCoreFpuArch;
- free(platformCoreFpuArch);
- }
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED, &sipVoip) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("sipVoip : " << sipVoip);
- deviceCapabilities->sipVoip = sipVoip;
- }
-
- if (system_info_get_value_string(SYSTEM_INFO_KEY_DEVICE_UUID, &duid) == SYSTEM_INFO_ERROR_NONE) {
- if (duid) {
- LogDebug("duid : " << duid);
- deviceCapabilities->duid = duid;
- free(duid);
- }
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED, &speechRecognition) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("speechRecognition : " << speechRecognition);
- deviceCapabilities->speechRecognition = speechRecognition;
- }
-
- if (system_info_get_value_bool(SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED, &isBarometer) == SYSTEM_INFO_ERROR_NONE) {
- LogDebug("barometer : " << isBarometer);
- deviceCapabilities->barometer = isBarometer;
- }
-
- if (sensor_is_supported(SENSOR_ACCELEROMETER, &isAccelerometer) == SENSOR_ERROR_NONE) {
- LogDebug("accelerometer : " << isAccelerometer);
- deviceCapabilities->accelerometer = isAccelerometer;
- }
-
- if (sensor_is_supported(SENSOR_MAGNETIC, &isMagnetometer) == SENSOR_ERROR_NONE) {
- LogDebug("magnetometer : " << isMagnetometer);
- deviceCapabilities->magnetometer = isMagnetometer;
- }
-
- if (sensor_is_supported(SENSOR_GYROSCOPE, &isGyroscope) == SENSOR_ERROR_NONE) {
- LogDebug("gyroscope : " << isGyroscope);
- deviceCapabilities->gyroscope = isGyroscope;
- }
-
- if (sensor_is_supported(SENSOR_PROXIMITY, &isProximity) == SENSOR_ERROR_NONE) {
- LogDebug("proximity : " << isProximity);
- deviceCapabilities->proximity = isProximity;
- }
-
- std::ifstream file("/usr/etc/system-info.ini");
- std::string line;
- std::string webApiVersionMajor = "";
- std::string webApiVersionMinor = "";
- std::string nativeApiVersionMajor = "";
- std::string nativeApiVersionMinor = "";
-
- if(!file) {
- LogDebug("api/native version info file not found");
- } else {
- while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
- if (pcrecpp::RE("platform.native.api.version=(\\w+).(\\w+)").PartialMatch(line, &nativeApiVersionMajor, &nativeApiVersionMinor )) {
- deviceCapabilities->nativeApiVersion = nativeApiVersionMajor;
- deviceCapabilities->nativeApiVersion += ".";
- deviceCapabilities->nativeApiVersion += nativeApiVersionMinor;
- LogDebug("native api version : " << deviceCapabilities->nativeApiVersion);
- break;
- }
- }
- while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
- if (pcrecpp::RE("platform.web.api.version=(\\w+).(\\w+)").PartialMatch(line, &webApiVersionMajor, &webApiVersionMinor)) {
- deviceCapabilities->webApiVersion = webApiVersionMajor;
- deviceCapabilities->webApiVersion += ".";
- deviceCapabilities->webApiVersion += webApiVersionMinor;
- LogDebug("web api version : " << deviceCapabilities->webApiVersion);
- break;
- }
- }
- file.close();
- }
-
return deviceCapabilities;
}
break;
case WATCH_TYPE_CELLULARNETWORK:
if ((m_EventMgrPtr->getEventCellularNetworkList()).size() == 1) {
+ vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, CellularNetworkValueCallback);
if (m_networkRegist == REGIST_CELLULAR) {
connection_unset_ip_address_changed_cb(m_connectionHandle);
m_networkRegist = REGIST_NOT;
for (EventPeripheralList::iterator it = eventList.begin(); it != eventList.end(); it++) {
(*it)->getWatchValue();
}
+ } else if (watchType == WATCH_TYPE_CELLULARNETWORK) {
+ EventWifiNetworkList eventListCellular = m_EventMgrPtr->getEventCellularNetworkList();
+ if (eventListCellular.size() > 0) {
+ for (EventCellularNetworkList::iterator it = eventListCellular.begin(); it != eventListCellular.end(); it++) {
+ (*it)->getWatchValue();
+ }
+ }
}
}
break;
case WATCH_TYPE_CELLULARNETWORK:
if ((m_EventMgrPtr->getEventCellularNetworkList()).size() == 1) {
+ vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, CellularNetworkValueCallback, (void *)this);
if (m_networkRegist == REGIST_NOT) {
connection_set_ip_address_changed_cb(m_connectionHandle, NetworkValueCallback, (void *)this);
m_networkRegist = REGIST_CELLULAR;
connection_type_e connectionType;
connection_profile_h profileHandle = NULL;
connection_address_family_e addressFamily = CONNECTION_ADDRESS_FAMILY_IPV4;
- network_info_service_state_e serviceState;
char* ipAddr = NULL;
char* apn = NULL;
char* imei = NULL;
- char* mcc = NULL;
- char* mnc = NULL;
- bool isRoaming = false;
- int cellId = 0, lac = 0, isFlightMode = 0;
+ int plmn = 0, cellId = 0, lac = 0, isRoaming = 0, isFlightMode = 0;
- TIME_TRACER_ITEM_BEGIN("(cellular)lac", 0);
- if (network_info_get_lac(&lac) == NETWORK_INFO_ERROR_NONE) {
- cellularNetwork->lac = lac;
+ TIME_TRACER_ITEM_BEGIN("(cellular)mcc", 0);
+ if (vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &plmn) == 0) {
+ cellularNetwork->mcc = plmn / 100;
+ cellularNetwork->mnc = plmn % 100;
}
- TIME_TRACER_ITEM_END("(cellular)lac", 0);
+ TIME_TRACER_ITEM_END("(cellular)mcc", 0);
- TIME_TRACER_ITEM_BEGIN("(cellular)cellId", 0);
- if (network_info_get_cell_id(&cellId) == NETWORK_INFO_ERROR_NONE) {
+ TIME_TRACER_ITEM_BEGIN("(cellular)cellId", 0);
+ if (vconf_get_int(VCONFKEY_TELEPHONY_CELLID, &cellId) == 0) {
cellularNetwork->cellId = cellId;
}
- TIME_TRACER_ITEM_END("(cellular)cellId", 0);
+ TIME_TRACER_ITEM_END("(cellular)cellId", 0);
- TIME_TRACER_ITEM_BEGIN("(cellular)isRoaming", 0);
- if (network_info_is_roaming(&isRoaming) == NETWORK_INFO_ERROR_NONE) {
- cellularNetwork->isRoaming = isRoaming;
+ TIME_TRACER_ITEM_BEGIN("(cellular)lac", 0);
+ if (vconf_get_int(VCONFKEY_TELEPHONY_LAC, &lac) == 0) {
+ cellularNetwork->lac = lac;
}
- TIME_TRACER_ITEM_END("(cellular)isRoaming", 0);
+ TIME_TRACER_ITEM_END("(cellular)lac", 0);
- TIME_TRACER_ITEM_BEGIN("(cellular)mcc", 0);
- if (network_info_get_mcc(&mcc) == NETWORK_INFO_ERROR_NONE) {
- cellularNetwork->mcc = converter.toInt(mcc);
- free(mcc);
- }
- TIME_TRACER_ITEM_END("(cellular)mcc", 0);
-
- TIME_TRACER_ITEM_BEGIN("(cellular)mnc", 0);
- if (network_info_get_mnc(&mnc) == NETWORK_INFO_ERROR_NONE) {
- cellularNetwork->mnc = converter.toInt(mnc);
- free(mnc);
+ TIME_TRACER_ITEM_BEGIN("(cellular)isRoaming", 0);
+ if (vconf_get_int(VCONFKEY_TELEPHONY_SVC_ROAM, &isRoaming) == 0) {
+ if (isRoaming) {
+ cellularNetwork->isRoaming = true;
+ } else {
+ cellularNetwork->isRoaming = false;
+ }
}
- TIME_TRACER_ITEM_END("(cellular)mnc", 0);
+ TIME_TRACER_ITEM_END("(cellular)isRoaming", 0);
TIME_TRACER_ITEM_BEGIN("(cellular)isFlightMode", 0);
- if (network_info_get_service_state(&serviceState) == NETWORK_INFO_ERROR_NONE) {
- if (serviceState == NETWORK_INFO_SERVICE_STATE_RADIO_OFF) {
- cellularNetwork->isFlightMode = true;
+ if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &isFlightMode) == 0) {
+ if (isFlightMode) {
+ cellularNetwork->isFlightMode = true;
} else {
cellularNetwork->isFlightMode = false;
}
PROPERTY_GET_SYSTEMINFO_DEFINITION(SIM) {
Converter converter(context);
SIMPropertiesPtr SIM(new SIMProperties());
-
- char* fullName = NULL;
- char* shortName = NULL;
- char* msisdn = NULL;
- char* iccId = NULL;
- char* mcc = NULL;
- char* mnc = NULL;
- char* msin = NULL;
- char* spn = NULL;
- int ret = SIM_ERROR_NONE;
-
- TIME_TRACER_ITEM_BEGIN("(sim)operatorName", 0);
- ret = sim_get_cphs_operator_name(&fullName, &shortName);
- TIME_TRACER_ITEM_END("(sim)operatorName", 0);
- if (ret == SIM_ERROR_NONE) {
- if (fullName) {
- SIM->operatorName = fullName;
- LogDebug("operatorName : " << SIM->operatorName);
- free(fullName);
- } else if (shortName) {
- SIM->operatorName = shortName;
- LogDebug("operatorName : " << SIM->operatorName);
- free(shortName);
- }
- }
-
- TIME_TRACER_ITEM_BEGIN("(sim)msisdn", 0);
- ret = sim_get_subscriber_number(&msisdn);
- TIME_TRACER_ITEM_END("(sim)msisdn", 0);
- if (ret == SIM_ERROR_NONE) {
- if (msisdn) {
- SIM->msisdn = msisdn;
- LogDebug("msisdn : " << SIM->msisdn);
- free(msisdn);
- }
- }
-
- TIME_TRACER_ITEM_BEGIN("(sim)iccId", 0);
- ret = sim_get_icc_id(&iccId);
- TIME_TRACER_ITEM_END("(sim)iccId", 0);
- if (ret == SIM_ERROR_NONE) {
- if (iccId) {
- SIM->iccid = iccId;
- LogDebug("iccid : " << SIM->iccid);
- free(iccId);
- }
- }
-
- TIME_TRACER_ITEM_BEGIN("(sim)mcc", 0);
- ret = sim_get_mcc(&mcc);
- TIME_TRACER_ITEM_END("(sim)mcc", 0);
- if (ret == SIM_ERROR_NONE) {
- if (mcc) {
- SIM->mcc = atoi(mcc);
- LogDebug("mcc : " << SIM->mcc);
- free(mcc);
- }
- }
-
- TIME_TRACER_ITEM_BEGIN("(sim)mnc", 0);
- ret = sim_get_mnc(&mnc);
- TIME_TRACER_ITEM_END("(sim)mnc", 0);
- if (ret == SIM_ERROR_NONE) {
- if (mnc) {
- SIM->mnc = atoi(mnc);
- LogDebug("mnc : " << SIM->mnc);
- free(mnc);
- }
- }
-
- TIME_TRACER_ITEM_BEGIN("(sim)msin", 0);
- ret = sim_get_msin(&msin);
- TIME_TRACER_ITEM_END("(sim)msin", 0);
- if (ret == SIM_ERROR_NONE) {
- if (msin) {
- SIM->msin = msin;
- LogDebug("msin : " << SIM->msin);
- free(msin);
- }
- }
-
- TIME_TRACER_ITEM_END("(sim)spn", 0);
- ret = sim_get_spn(&spn);
- TIME_TRACER_ITEM_END("(sim)spn", 0);
- if (ret == SIM_ERROR_NONE) {
- if (spn) {
- SIM->spn = spn;
- LogDebug("spn : " << SIM->spn);
- free(spn);
- }
- }
-
return JSSIMInfo::createJSObject(context, SIM);
}
#include <sensor.h>
#include <sensors.h>
#include <net_connection.h>
-#include <sim.h>
-#include <telephony_network.h>
#include <system_info.h>
#include <runtime_info.h>
#include <JavaScriptCore/JavaScript.h>
#include "SysteminfoListenerManager.h"
#include "JSSysteminfo.h"
+namespace DeviceAPI {
+namespace Systeminfo {
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "systeminfo", (js_class_template_getter)DeviceAPI::Systeminfo::JSSysteminfo::getClassRef, NULL)
PLUGIN_CLASS_MAP_END
+} // Systeminfo
+} // DeviceAPI
+
#include "JSTZDate.h"
#include "JSTimeDuration.h"
+namespace DeviceAPI {
+namespace Time {
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
(js_class_template_getter)DeviceAPI::Time::JSTimeDuration::getClassRef,
NULL)
PLUGIN_CLASS_MAP_END
+
+} // Time
+} // DeviceAPI
}
+namespace DeviceAPI {
+namespace Tizen {
+
using namespace WrtDeviceApis;
using namespace WrtDeviceApis::Commons;
PLUGIN_CLASS_MAP_END
#undef OBJECT_TIZEN
+
+} // Tizen
+} // DeviceAPI