From 5d388de3738ea92a079f3c9fd70c085e48a50a6f Mon Sep 17 00:00:00 2001 From: Dongjin Choi Date: Fri, 14 Jun 2013 18:37:00 +0900 Subject: [PATCH] Update change log and spec for wrt-plugins-tizen_0.4.42 [model] REDWOOD [binary_type] PDA [customer] OPEN [Issue] N/A [Problem] remove build warning [Cause] remove build warning [Solution] remove build warning [Bluetooth] Do not check whether bluetooth is supported or not. tizen.bluetooth returns undefined if bluetooth is not supported. [Systeminfo] add exception code about inputKeyMenu&inputKeyBack attribute [Issue#] N/A [Problem] prevent issue [Cause] dereference without checking null [Solution] add routine [Issue] orange CQ H0100189518 [Problem] does not check mode when resolving 'ringtones' [Cause] unexpected platform path change. [Solution] path modification. [Issue] N/A [Problem] message conversation bug fix for to and from [Cause] message conversation bug fix for to and from [Solution] message conversation bug fix for to and from [Issue] DCM 1886. [Problem] sync api performance issue. [Cause] using dlp event. [Solution] remove dpl event. [Systeminfo] Change get imei, sim value code [NBS] Move code about privilege check [Issue] N/A [Problem] email conversation listener update bug fix [Cause] email conversation listener update bug fix [Solution] email conversation listener update bug fix [Issue] N/A [Problem] remove build warning [Cause] remove build warning [Solution] remove build warning [Issue#] N/A [Problem] Returned 'undefined' if it has no priv obj [Cause] Check tightly [Solution] Return value if static value requested [team] WebAPI [request] N/A [horizontal_expansion] N/A --- packaging/wrt-plugins-tizen.spec | 2 +- src/Bluetooth/BluetoothAdapter.cpp | 11 -- src/Bluetooth/BluetoothAdapter.h | 1 - src/Bluetooth/JSBluetoothAdapter.cpp | 50 ------ src/Bluetooth/JSBluetoothClass.cpp | 5 - src/Bluetooth/JSBluetoothDevice.cpp | 5 - src/Bluetooth/JSBluetoothManager.cpp | 4 - src/Bluetooth/JSBluetoothServiceHandler.cpp | 5 - src/Bluetooth/JSBluetoothSocket.cpp | 15 -- src/Common/JSWebAPIError.cpp | 102 +---------- src/Common/JSWebAPIError.h | 11 +- src/Common/JSWebAPIException.cpp | 106 ++++++++++- src/Common/JSWebAPIException.h | 14 +- src/Contact/ContactsSvcChangeListenerManager.cpp | 6 +- src/Content/ContentManager.cpp | 1 - src/DataControl/DataControlAsyncCallbackManager.h | 2 +- src/DataControl/DataControlListener.h | 4 - src/DataControl/EventGetIndexedRow.h | 54 ------ src/DataControl/ISelectDataObject.cpp | 4 +- src/DataControl/ISelectDataObject.h | 8 +- src/DataControl/JSSelectObjectArrayValues.cpp | 91 +--------- src/DataControl/RowData.h | 2 - src/DataControl/SelectDataObject.cpp | 196 ++++++++++----------- src/DataControl/SelectDataObject.h | 3 +- src/Filesystem/JSFilesystemManager.cpp | 2 +- src/Messaging/Conversation.cpp | 180 +++++++++++-------- src/Messaging/Email.cpp | 4 +- src/Messaging/Messaging.cpp | 4 + src/Messaging/Mms.cpp | 3 +- .../JSNetworkBearerSelection.cpp | 13 +- src/Systeminfo/JSCellularNetworkInfo.cpp | 22 --- src/Systeminfo/JSDeviceCapabilitiesInfo.cpp | 7 + src/Systeminfo/JSSIMInfo.cpp | 83 --------- src/Systeminfo/Systeminfo.cpp | 113 ++++++++++++ src/Systeminfo/SysteminfoPropertyInfo.h | 4 +- 35 files changed, 470 insertions(+), 667 deletions(-) delete mode 100644 src/DataControl/EventGetIndexedRow.h diff --git a/packaging/wrt-plugins-tizen.spec b/packaging/wrt-plugins-tizen.spec index 3f7e876..c258687 100755 --- a/packaging/wrt-plugins-tizen.spec +++ b/packaging/wrt-plugins-tizen.spec @@ -1,6 +1,6 @@ Name: wrt-plugins-tizen Summary: JavaScript plugins for WebRuntime -Version: 0.4.41 +Version: 0.4.42 Release: 0 Group: Development/Libraries License: Apache License, Version 2.0 diff --git a/src/Bluetooth/BluetoothAdapter.cpp b/src/Bluetooth/BluetoothAdapter.cpp index 27f742b..8ea4789 100644 --- a/src/Bluetooth/BluetoothAdapter.cpp +++ b/src/Bluetooth/BluetoothAdapter.cpp @@ -706,17 +706,6 @@ BluetoothAdapter* BluetoothAdapter::getInstance() return &instance; } -bool BluetoothAdapter::isBluetoothSupported() -{ - bool isSupported = false; - - if(system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &isSupported) != SYSTEM_INFO_ERROR_NONE) { - LoggerE("Can't know whether Bluetooth is supported or not"); - } - - return isSupported; -} - bool BluetoothAdapter::isValidAddress(std::string &address) { pcrecpp::RE re("(([0-9a-zA-Z]+):)+([0-9a-zA-Z]+)"); diff --git a/src/Bluetooth/BluetoothAdapter.h b/src/Bluetooth/BluetoothAdapter.h index 841ced6..604ced4 100644 --- a/src/Bluetooth/BluetoothAdapter.h +++ b/src/Bluetooth/BluetoothAdapter.h @@ -87,7 +87,6 @@ public: void removeConnReq(std::string &remoteAddress); static BluetoothAdapter* getInstance(); - static bool isBluetoothSupported(); static bool isValidAddress(std::string &address); static bool isValidUUID(std::string &uuid); void unloadFrame(JSContextRef context); diff --git a/src/Bluetooth/JSBluetoothAdapter.cpp b/src/Bluetooth/JSBluetoothAdapter.cpp index 4f06056..221d792 100644 --- a/src/Bluetooth/JSBluetoothAdapter.cpp +++ b/src/Bluetooth/JSBluetoothAdapter.cpp @@ -148,11 +148,6 @@ JSValueRef JSBluetoothAdapter::setName(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - ArgumentValidator validator(context, argumentCount, arguments); std::string name = validator.toString(0); // name JSObjectRef successCallback = validator.toFunction(1, true); // successCallback @@ -195,11 +190,6 @@ JSValueRef JSBluetoothAdapter::setPowered(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Validate arguments ArgumentValidator validator(context, argumentCount, arguments); bool state = validator.toBool(0); // state @@ -243,11 +233,6 @@ JSValueRef JSBluetoothAdapter::setVisible(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Validate arguments ArgumentValidator validator(context, argumentCount, arguments); bool mode = validator.toBool(0); // mode @@ -294,11 +279,6 @@ JSValueRef JSBluetoothAdapter::discoverDevices(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Validate arguments ArgumentValidator validator(context, argumentCount, arguments); @@ -372,11 +352,6 @@ JSValueRef JSBluetoothAdapter::stopDiscovery(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Validate arguments ArgumentValidator validator(context, argumentCount, arguments); JSObjectRef successCallback = validator.toFunction(0, true); // successCallback @@ -419,11 +394,6 @@ JSValueRef JSBluetoothAdapter::getKnownDevices(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Validate arguments ArgumentValidator validator(context, argumentCount, arguments); JSObjectRef successCallback = validator.toFunction(0); // successCallback @@ -466,11 +436,6 @@ JSValueRef JSBluetoothAdapter::getDevice(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Validate arguments ArgumentValidator validator(context, argumentCount, arguments); std::string address = validator.toString(0); // address @@ -514,11 +479,6 @@ JSValueRef JSBluetoothAdapter::createBonding(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Validate arguments ArgumentValidator validator(context, argumentCount, arguments); std::string address = validator.toString(0); // address @@ -562,11 +522,6 @@ JSValueRef JSBluetoothAdapter::destroyBonding(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Validate arguments ArgumentValidator validator(context, argumentCount, arguments); std::string address = validator.toString(0); // address @@ -610,11 +565,6 @@ JSValueRef JSBluetoothAdapter::registerRFCOMMServiceByUUID(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Validate arguments ArgumentValidator validator(context, argumentCount, arguments); std::string uuid = validator.toString(0); // uuid diff --git a/src/Bluetooth/JSBluetoothClass.cpp b/src/Bluetooth/JSBluetoothClass.cpp index 1debbcd..2f1e97b 100644 --- a/src/Bluetooth/JSBluetoothClass.cpp +++ b/src/Bluetooth/JSBluetoothClass.cpp @@ -144,11 +144,6 @@ JSValueRef JSBluetoothClass::hasService(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Private Object BluetoothClassHolderPtr priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { diff --git a/src/Bluetooth/JSBluetoothDevice.cpp b/src/Bluetooth/JSBluetoothDevice.cpp index e7da4d3..4283313 100644 --- a/src/Bluetooth/JSBluetoothDevice.cpp +++ b/src/Bluetooth/JSBluetoothDevice.cpp @@ -161,11 +161,6 @@ JSValueRef JSBluetoothDevice::connectToServiceByUUID(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Private Object BluetoothDeviceHolderPtr priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { diff --git a/src/Bluetooth/JSBluetoothManager.cpp b/src/Bluetooth/JSBluetoothManager.cpp index 2f4c3c5..2c6db3c 100644 --- a/src/Bluetooth/JSBluetoothManager.cpp +++ b/src/Bluetooth/JSBluetoothManager.cpp @@ -153,10 +153,6 @@ JSValueRef JSBluetoothManager::getDefaultAdapter(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSBluetoothAdapter::createJSObject(context); diff --git a/src/Bluetooth/JSBluetoothServiceHandler.cpp b/src/Bluetooth/JSBluetoothServiceHandler.cpp index e0c5afc..0398771 100644 --- a/src/Bluetooth/JSBluetoothServiceHandler.cpp +++ b/src/Bluetooth/JSBluetoothServiceHandler.cpp @@ -189,11 +189,6 @@ JSValueRef JSBluetoothServiceHandler::unregister(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Private Object BluetoothServiceHandlerPtr priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { diff --git a/src/Bluetooth/JSBluetoothSocket.cpp b/src/Bluetooth/JSBluetoothSocket.cpp index cfa0607..577b281 100644 --- a/src/Bluetooth/JSBluetoothSocket.cpp +++ b/src/Bluetooth/JSBluetoothSocket.cpp @@ -256,11 +256,6 @@ JSValueRef JSBluetoothSocket::writeData(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Private Object BluetoothSocketPtr priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { @@ -301,11 +296,6 @@ JSValueRef JSBluetoothSocket::readData(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Private Object BluetoothSocketPtr priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { @@ -338,11 +328,6 @@ JSValueRef JSBluetoothSocket::close(JSContextRef context, TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); try { - // Check whether Bluetooth is supported or not - if(!BluetoothAdapter::isBluetoothSupported()) { - throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported"); - } - // Private Object BluetoothSocketPtr priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { diff --git a/src/Common/JSWebAPIError.cpp b/src/Common/JSWebAPIError.cpp index 79a944d..c600aa8 100644 --- a/src/Common/JSWebAPIError.cpp +++ b/src/Common/JSWebAPIError.cpp @@ -31,62 +31,6 @@ namespace Common { #define PROPERTY_TYPE "type" #define PROPERTY_MESSAGE "message" -#define PROPERTY_INDEX_SIZE_ERR "INDEX_SIZE_ERR" -#define PROPERTY_DOMSTRING_SIZE_ERR "DOMSTRING_SIZE_ERR" -#define PROPERTY_HIERARCHY_REQUEST_ERR "HIERARCHY_REQUEST_ERR" -#define PROPERTY_WRONG_DOCUMENT_ERR "WRONG_DOCUMENT_ERR" -#define PROPERTY_INVALID_CHARACTER_ERR "INVALID_CHARACTER_ERR" -#define PROPERTY_NO_DATA_ALLOWED_ERR "NO_DATA_ALLOWED_ERR" -#define PROPERTY_NO_MODIFICATION_ALLOWED_ERR "NO_MODIFICATION_ALLOWED_ERR" -#define PROPERTY_NOT_FOUND_ERR "NOT_FOUND_ERR" -#define PROPERTY_NOT_SUPPORTED_ERR "NOT_SUPPORTED_ERR" -#define PROPERTY_INUSE_ATTRIBUTE_ERR "INUSE_ATTRIBUTE_ERR" -#define PROPERTY_INVALID_STATE_ERR "INVALID_STATE_ERR" -#define PROPERTY_SYNTAX_ERR "SYNTAX_ERR" -#define PROPERTY_INVALID_MODIFICATION_ERR "INVALID_MODIFICATION_ERR" -#define PROPERTY_NAMESPACE_ERR "NAMESPACE_ERR" -#define PROPERTY_INVALID_ACCESS_ERR "INVALID_ACCESS_ERR" -#define PROPERTY_VALIDATION_ERR "VALIDATION_ERR" -#define PROPERTY_TYPE_MISMATCH_ERR "TYPE_MISMATCH_ERR" -#define PROPERTY_SECURITY_ERR "SECURITY_ERR" -#define PROPERTY_NETWORK_ERR "NETWORK_ERR" -#define PROPERTY_ABORT_ERR "ABORT_ERR" -#define PROPERTY_URL_MISMATCH_ERR "URL_MISMATCH_ERR" -#define PROPERTY_QUOTA_EXCEEDED_ERR "QUOTA_EXCEEDED_ERR" -#define PROPERTY_TIMEOUT_ERR "TIMEOUT_ERR" -#define PROPERTY_INVALID_NODE_TYPE_ERR "INVALID_NODE_TYPE_ERR" -#define PROPERTY_DATA_CLONE_ERR "DATA_CLONE_ERR" - -typedef std::map DeviceAPIErrorCodeMap; - -static DeviceAPIErrorCodeMap errorCodes = { - { PROPERTY_INDEX_SIZE_ERR, 1 }, - { PROPERTY_DOMSTRING_SIZE_ERR, 2 }, - { PROPERTY_HIERARCHY_REQUEST_ERR, 3 }, - { PROPERTY_WRONG_DOCUMENT_ERR, 4 }, - { PROPERTY_INVALID_CHARACTER_ERR, 5 }, - { PROPERTY_NO_DATA_ALLOWED_ERR, 6 }, - { PROPERTY_NO_MODIFICATION_ALLOWED_ERR, 7 }, - { PROPERTY_NOT_FOUND_ERR, 8 }, - { PROPERTY_NOT_SUPPORTED_ERR, 9 }, - { PROPERTY_INUSE_ATTRIBUTE_ERR, 10 }, - { PROPERTY_INVALID_STATE_ERR, 11 }, - { PROPERTY_SYNTAX_ERR, 12 }, - { PROPERTY_INVALID_MODIFICATION_ERR, 13 }, - { PROPERTY_NAMESPACE_ERR, 14 }, - { PROPERTY_INVALID_ACCESS_ERR, 15 }, - { PROPERTY_VALIDATION_ERR, 16 }, - { PROPERTY_TYPE_MISMATCH_ERR, 17 }, - { PROPERTY_SECURITY_ERR, 18 }, - { PROPERTY_NETWORK_ERR, 19 }, - { PROPERTY_ABORT_ERR, 20 }, - { PROPERTY_URL_MISMATCH_ERR, 21 }, - { PROPERTY_QUOTA_EXCEEDED_ERR, 22 }, - { PROPERTY_TIMEOUT_ERR, 23 }, - { PROPERTY_INVALID_NODE_TYPE_ERR, 24 }, - { PROPERTY_DATA_CLONE_ERR, 25 } -}; - JSClassRef JSWebAPIError::m_classRef = NULL; JSClassDefinition JSWebAPIError::m_classInfo = @@ -117,36 +61,10 @@ JSStaticFunction JSWebAPIError::m_function[] = }; JSStaticValue JSWebAPIError::m_properties[] = { - { PROPERTY_CODE, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_NAME, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_TYPE, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_MESSAGE, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - - { PROPERTY_INDEX_SIZE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_DOMSTRING_SIZE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_HIERARCHY_REQUEST_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_WRONG_DOCUMENT_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_INVALID_CHARACTER_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_NO_DATA_ALLOWED_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_NO_MODIFICATION_ALLOWED_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_NOT_FOUND_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_NOT_SUPPORTED_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_INUSE_ATTRIBUTE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_INVALID_STATE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_SYNTAX_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_INVALID_MODIFICATION_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_NAMESPACE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_INVALID_ACCESS_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_VALIDATION_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_TYPE_MISMATCH_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_SECURITY_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_NETWORK_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_ABORT_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_URL_MISMATCH_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_QUOTA_EXCEEDED_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_TIMEOUT_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_INVALID_NODE_TYPE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, - { PROPERTY_DATA_CLONE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_CODE, getProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_NAME, getProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_TYPE, getProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_MESSAGE, getProperty, NULL, kJSPropertyAttributeReadOnly }, { 0, 0, 0, 0 } }; @@ -201,7 +119,7 @@ void JSWebAPIError::finalize(JSObjectRef object) } } -JSValueRef JSWebAPIError::getStaticProperty(JSContextRef context, +JSValueRef JSWebAPIError::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* /*exception*/) @@ -233,12 +151,6 @@ JSValueRef JSWebAPIError::getStaticProperty(JSContextRef context, { return JSUtil::toJSValueRef(context, webapiErrObj->getMessage()); } - else // Error codes - { - DeviceAPIErrorCodeMap::iterator iter = errorCodes.find(propertyNameStr); - if(iter != errorCodes.end()) - return JSUtil::toJSValueRef(context, static_cast(iter->second)); - } } catch(const BasePlatformException & err) { @@ -271,11 +183,11 @@ JSValueRef JSWebAPIError::toString(JSContextRef context, } bool JSWebAPIError::hasInstance(JSContextRef context, - JSObjectRef /*constructor*/, + JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* /*exception*/) { - return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); + return JSValueIsObjectOfClass(context, constructor, getClassRef()); } } // Common diff --git a/src/Common/JSWebAPIError.h b/src/Common/JSWebAPIError.h index 86813cf..c39a588 100644 --- a/src/Common/JSWebAPIError.h +++ b/src/Common/JSWebAPIError.h @@ -15,11 +15,8 @@ // limitations under the License. // -// TODO This object will replace JSWebAPIError. -// The numeric suffix ('2') will be removed after replacing JSWebAPIError. - -#ifndef _JS_WEBAPI_ERROR2_H_ -#define _JS_WEBAPI_ERROR2_H_ +#ifndef _JS_WEBAPI_ERROR_H_ +#define _JS_WEBAPI_ERROR_H_ #include #include "JSWebAPIErrorFactory.h" @@ -49,7 +46,7 @@ private: static void finalize(JSObjectRef object); - static JSValueRef getStaticProperty(JSContextRef context, + static JSValueRef getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); @@ -80,4 +77,4 @@ private: } // Common } // DeviceAPI -#endif // _JS_WEBAPI_ERROR2_H_ +#endif // _JS_WEBAPI_ERROR_H_ diff --git a/src/Common/JSWebAPIException.cpp b/src/Common/JSWebAPIException.cpp index 8df738f..d2600eb 100644 --- a/src/Common/JSWebAPIException.cpp +++ b/src/Common/JSWebAPIException.cpp @@ -27,6 +27,62 @@ namespace Common { #define CLASS_NAME "WebAPIException" +#define PROPERTY_INDEX_SIZE_ERR "INDEX_SIZE_ERR" +#define PROPERTY_DOMSTRING_SIZE_ERR "DOMSTRING_SIZE_ERR" +#define PROPERTY_HIERARCHY_REQUEST_ERR "HIERARCHY_REQUEST_ERR" +#define PROPERTY_WRONG_DOCUMENT_ERR "WRONG_DOCUMENT_ERR" +#define PROPERTY_INVALID_CHARACTER_ERR "INVALID_CHARACTER_ERR" +#define PROPERTY_NO_DATA_ALLOWED_ERR "NO_DATA_ALLOWED_ERR" +#define PROPERTY_NO_MODIFICATION_ALLOWED_ERR "NO_MODIFICATION_ALLOWED_ERR" +#define PROPERTY_NOT_FOUND_ERR "NOT_FOUND_ERR" +#define PROPERTY_NOT_SUPPORTED_ERR "NOT_SUPPORTED_ERR" +#define PROPERTY_INUSE_ATTRIBUTE_ERR "INUSE_ATTRIBUTE_ERR" +#define PROPERTY_INVALID_STATE_ERR "INVALID_STATE_ERR" +#define PROPERTY_SYNTAX_ERR "SYNTAX_ERR" +#define PROPERTY_INVALID_MODIFICATION_ERR "INVALID_MODIFICATION_ERR" +#define PROPERTY_NAMESPACE_ERR "NAMESPACE_ERR" +#define PROPERTY_INVALID_ACCESS_ERR "INVALID_ACCESS_ERR" +#define PROPERTY_VALIDATION_ERR "VALIDATION_ERR" +#define PROPERTY_TYPE_MISMATCH_ERR "TYPE_MISMATCH_ERR" +#define PROPERTY_SECURITY_ERR "SECURITY_ERR" +#define PROPERTY_NETWORK_ERR "NETWORK_ERR" +#define PROPERTY_ABORT_ERR "ABORT_ERR" +#define PROPERTY_URL_MISMATCH_ERR "URL_MISMATCH_ERR" +#define PROPERTY_QUOTA_EXCEEDED_ERR "QUOTA_EXCEEDED_ERR" +#define PROPERTY_TIMEOUT_ERR "TIMEOUT_ERR" +#define PROPERTY_INVALID_NODE_TYPE_ERR "INVALID_NODE_TYPE_ERR" +#define PROPERTY_DATA_CLONE_ERR "DATA_CLONE_ERR" + +typedef std::map DeviceAPIErrorCodeMap; + +static DeviceAPIErrorCodeMap errorCodes = { + { PROPERTY_INDEX_SIZE_ERR, 1 }, + { PROPERTY_DOMSTRING_SIZE_ERR, 2 }, + { PROPERTY_HIERARCHY_REQUEST_ERR, 3 }, + { PROPERTY_WRONG_DOCUMENT_ERR, 4 }, + { PROPERTY_INVALID_CHARACTER_ERR, 5 }, + { PROPERTY_NO_DATA_ALLOWED_ERR, 6 }, + { PROPERTY_NO_MODIFICATION_ALLOWED_ERR, 7 }, + { PROPERTY_NOT_FOUND_ERR, 8 }, + { PROPERTY_NOT_SUPPORTED_ERR, 9 }, + { PROPERTY_INUSE_ATTRIBUTE_ERR, 10 }, + { PROPERTY_INVALID_STATE_ERR, 11 }, + { PROPERTY_SYNTAX_ERR, 12 }, + { PROPERTY_INVALID_MODIFICATION_ERR, 13 }, + { PROPERTY_NAMESPACE_ERR, 14 }, + { PROPERTY_INVALID_ACCESS_ERR, 15 }, + { PROPERTY_VALIDATION_ERR, 16 }, + { PROPERTY_TYPE_MISMATCH_ERR, 17 }, + { PROPERTY_SECURITY_ERR, 18 }, + { PROPERTY_NETWORK_ERR, 19 }, + { PROPERTY_ABORT_ERR, 20 }, + { PROPERTY_URL_MISMATCH_ERR, 21 }, + { PROPERTY_QUOTA_EXCEEDED_ERR, 22 }, + { PROPERTY_TIMEOUT_ERR, 23 }, + { PROPERTY_INVALID_NODE_TYPE_ERR, 24 }, + { PROPERTY_DATA_CLONE_ERR, 25 } +}; + JSClassRef JSWebAPIException::m_classRef = NULL; JSClassDefinition JSWebAPIException::m_classInfo = @@ -57,6 +113,31 @@ JSStaticFunction JSWebAPIException::m_function[] = }; JSStaticValue JSWebAPIException::m_properties[] = { + { PROPERTY_INDEX_SIZE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_DOMSTRING_SIZE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_HIERARCHY_REQUEST_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_WRONG_DOCUMENT_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_INVALID_CHARACTER_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_NO_DATA_ALLOWED_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_NO_MODIFICATION_ALLOWED_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_NOT_FOUND_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_NOT_SUPPORTED_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_INUSE_ATTRIBUTE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_INVALID_STATE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_SYNTAX_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_INVALID_MODIFICATION_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_NAMESPACE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_INVALID_ACCESS_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_VALIDATION_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_TYPE_MISMATCH_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_SECURITY_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_NETWORK_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_ABORT_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_URL_MISMATCH_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_QUOTA_EXCEEDED_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_TIMEOUT_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_INVALID_NODE_TYPE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, + { PROPERTY_DATA_CLONE_ERR, getStaticProperty, NULL, kJSPropertyAttributeReadOnly }, { 0, 0, 0, 0 } }; @@ -105,6 +186,27 @@ void JSWebAPIException::finalize(JSObjectRef /*object*/) { } +JSValueRef JSWebAPIException::getStaticProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* /*exception*/) +{ + try + { + std::string propertyNameStr = JSUtil::JSStringToString(context, propertyName); + + DeviceAPIErrorCodeMap::iterator iter = errorCodes.find(propertyNameStr); + if(iter != errorCodes.end()) + return JSUtil::toJSValueRef(context, static_cast(iter->second)); + } + catch(const BasePlatformException & err) + { + LoggerE("Exception: " << err.getMessage()); + } + + return JSValueMakeUndefined(context); +} + JSValueRef JSWebAPIException::toString(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, @@ -128,11 +230,11 @@ JSValueRef JSWebAPIException::toString(JSContextRef context, } bool JSWebAPIException::hasInstance(JSContextRef context, - JSObjectRef /*constructor*/, + JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* /*exception*/) { - return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); + return JSValueIsObjectOfClass(context, constructor, getClassRef()); } } // Common diff --git a/src/Common/JSWebAPIException.h b/src/Common/JSWebAPIException.h index f4b2d4f..25b884e 100644 --- a/src/Common/JSWebAPIException.h +++ b/src/Common/JSWebAPIException.h @@ -15,11 +15,8 @@ // limitations under the License. // -// TODO This object will replace JSWebAPIError. -// The numeric suffix ('2') will be removed after replacing JSWebAPIError. - -#ifndef _JS_WEBAPI_EXCEPTION2_H_ -#define _JS_WEBAPI_EXCEPTION2_H_ +#ifndef _JS_WEBAPI_EXCEPTION_H_ +#define _JS_WEBAPI_EXCEPTION_H_ #include #include "JSWebAPIErrorFactory.h" @@ -49,6 +46,11 @@ private: static void finalize(JSObjectRef object); + static JSValueRef getStaticProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, @@ -75,4 +77,4 @@ private: } // Common } // DeviceAPI -#endif // _JS_WEBAPI_EXCEPTION2_H_ +#endif // _JS_WEBAPI_EXCEPTION_H_ diff --git a/src/Contact/ContactsSvcChangeListenerManager.cpp b/src/Contact/ContactsSvcChangeListenerManager.cpp index 8c5f127..654a797 100755 --- a/src/Contact/ContactsSvcChangeListenerManager.cpp +++ b/src/Contact/ContactsSvcChangeListenerManager.cpp @@ -218,8 +218,6 @@ void ContactsSvcChangeListenerManager::contactsDbChangedCallback(const char* vie void ContactsSvcChangeListenerManager::personsDbChangedCallback(const char* view_uri, char* changes, void* user_data) { - LoggerD("entered : " << changes); - if(changes == NULL) { LoggerW("changes is NULL"); @@ -231,6 +229,7 @@ void ContactsSvcChangeListenerManager::personsDbChangedCallback(const char* view } } + LoggerD("entered : " << changes); if(user_data == NULL) { LoggerW("contacts-service listener passed NULL user_data"); @@ -540,6 +539,9 @@ void ContactsSvcChangeListenerManager::personsChangedCallback(char* changes) { tmpUpdatedType = atoi((const char*)sub_ptr); sub_ptr = strtok(NULL, " ,:"); + if(sub_ptr == NULL) + break; + if(validate("^[0-9]+$", sub_ptr, VALIDATE_MATCH_CASELESS)) { tmpUpdatedContactId = atoi((const char*)sub_ptr); diff --git a/src/Content/ContentManager.cpp b/src/Content/ContentManager.cpp index 1dcf289..43013b8 100755 --- a/src/Content/ContentManager.cpp +++ b/src/Content/ContentManager.cpp @@ -750,7 +750,6 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse { MediaSearchVisitorPtr visitor(new MediaSearchVisitor()); visitor->setQueryType(MediaSearchVisitor::QUERY_MEDIA); - int ret = MEDIA_CONTENT_ERROR_NONE; try { diff --git a/src/DataControl/DataControlAsyncCallbackManager.h b/src/DataControl/DataControlAsyncCallbackManager.h index 29cec97..3ffba37 100755 --- a/src/DataControl/DataControlAsyncCallbackManager.h +++ b/src/DataControl/DataControlAsyncCallbackManager.h @@ -53,7 +53,7 @@ public: { LoggerD(address); - if (m_mappedDataControlGCMap.find(address) == m_sqlDataControlGCMap.end()) + if (m_mappedDataControlGCMap.find(address) == m_mappedDataControlGCMap.end()) { return true; } diff --git a/src/DataControl/DataControlListener.h b/src/DataControl/DataControlListener.h index 04a2ebb..0b97c96 100755 --- a/src/DataControl/DataControlListener.h +++ b/src/DataControl/DataControlListener.h @@ -37,8 +37,6 @@ typedef WrtDeviceApis::Commons::EventAnswerReceiver EventSelectAnswerReceiver; typedef WrtDeviceApis::Commons::EventAnswerReceiver EventUpdateAnswerReceiver; -/*typedef WrtDeviceApis::Commons::EventAnswerReceiver - EventGetIndexedRowAnswerReceiver; */ typedef WrtDeviceApis::Commons::EventAnswerReceiver EventAddValueAnswerReceiver; typedef WrtDeviceApis::Commons::EventAnswerReceiver @@ -57,8 +55,6 @@ class DataControlListener : public EventRemoveValueAnswerReceiver, public EventGetValueAnswerReceiver, public EventUpdateValueAnswerReceiver - //, - //public EventGetIndexedRowAnswerReceiver { private: diff --git a/src/DataControl/EventGetIndexedRow.h b/src/DataControl/EventGetIndexedRow.h deleted file mode 100644 index 0f011e5..0000000 --- a/src/DataControl/EventGetIndexedRow.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// Tizen Web Device API -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// -// 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 TIZENAPIS_API_EVENT_GET_INDEXED_ROW_H_ -#define TIZENAPIS_API_EVENT_GET_INDEXED_ROW_H_ - -#include -#include -#include "RowData.h" -#include - -namespace DeviceAPI { -namespace DataControl { - -class EventGetIndexedRow: public WrtDeviceApis::Commons::IEvent -{ -public: - - EventGetIndexedRow() { LoggerD("entered"); } - ~EventGetIndexedRow() { } - void setIndex(const int& index) { m_index = index;} - int getIndex() { return m_index;} - - RowDataPtr getRowData() { return m_rowData;} - void setRowData(RowDataPtr data) { m_rowData = data;} -private: - int m_index; - RowDataPtr m_rowData; - - - -}; - -typedef DPL::SharedPtr EventGetIndexedRowPtr; - -} -} - -#endif diff --git a/src/DataControl/ISelectDataObject.cpp b/src/DataControl/ISelectDataObject.cpp index bb015f5..1007308 100755 --- a/src/DataControl/ISelectDataObject.cpp +++ b/src/DataControl/ISelectDataObject.cpp @@ -23,9 +23,7 @@ namespace DeviceAPI { namespace DataControl { using namespace WrtDeviceApis::Commons; -ISelectDataObject::ISelectDataObject() : - EventRequestReceiver(ThreadEnum::BLUETOOTH_THREAD) - +ISelectDataObject::ISelectDataObject() { } diff --git a/src/DataControl/ISelectDataObject.h b/src/DataControl/ISelectDataObject.h index f2cfeff..07b5750 100755 --- a/src/DataControl/ISelectDataObject.h +++ b/src/DataControl/ISelectDataObject.h @@ -21,25 +21,23 @@ #include #include -#include "EventGetIndexedRow.h" +#include "RowData.h" namespace DeviceAPI { namespace DataControl { -class ISelectDataObject : - public WrtDeviceApis::Commons::EventRequestReceiver +class ISelectDataObject { public: virtual ~ISelectDataObject(); - virtual void getIndexedRow(const EventGetIndexedRowPtr& event) = 0; + virtual RowDataPtr getIndexedRow(const int fetchIndex) = 0; virtual int getRowNumber() = 0; virtual void setResultSetPath(const std::string& path) = 0; virtual void openResultPath(const std::string& filepath) = 0; protected: ISelectDataObject(); - virtual void OnRequestReceived(const EventGetIndexedRowPtr& event) = 0; }; typedef DPL::SharedPtr ISelectDataObjectPtr; diff --git a/src/DataControl/JSSelectObjectArrayValues.cpp b/src/DataControl/JSSelectObjectArrayValues.cpp index a0e7e65..33ba3a3 100644 --- a/src/DataControl/JSSelectObjectArrayValues.cpp +++ b/src/DataControl/JSSelectObjectArrayValues.cpp @@ -112,7 +112,6 @@ JSValueRef JSSelectObjectArrayValues::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LoggerE("invalid property"); } return JSValueMakeUndefined(context); @@ -157,7 +156,6 @@ bool JSSelectObjectArrayValues::hasProperty(JSContextRef context, { Try { - LoggerD("Enter"); JSSelectObjectArrayValuesPriv* priv = static_cast(JSObjectGetPrivate(object)); if (!priv) @@ -168,7 +166,6 @@ bool JSSelectObjectArrayValues::hasProperty(JSContextRef context, DataControlConverter converter(priv->getContext()); int index = converter.toSizeT(propertyName); - LoggerD(index); ISelectDataObjectPtr SelectDataOjbect = priv->getObject(); if (index < SelectDataOjbect->getRowNumber()) @@ -178,7 +175,6 @@ bool JSSelectObjectArrayValues::hasProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LoggerE("invalid property"); } return false; } @@ -190,7 +186,6 @@ JSValueRef JSSelectObjectArrayValues::getProperty(JSContextRef context, { Try { - LoggerD("Eneter"); JSSelectObjectArrayValuesPriv* priv = static_cast(JSObjectGetPrivate(object)); if (!priv) @@ -201,36 +196,18 @@ JSValueRef JSSelectObjectArrayValues::getProperty(JSContextRef context, DataControlConverter converter(priv->getContext()); int index = converter.toSizeT(propertyName); - LoggerD(index); ISelectDataObjectPtr SelectDataOjbect = priv->getObject(); if (index >= SelectDataOjbect->getRowNumber()) { Throw(WrtDeviceApis::Commons::OutOfRangeException); } - - EventGetIndexedRowPtr event(new EventGetIndexedRow); - event->setIndex(index); - - if (event->setForSynchronousCall()) - { - - SelectDataOjbect->getIndexedRow(event); - - if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) - { - RowDataPtr data = event->getRowData(); - return converter.toJSRowData(data); - } - else - { - JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch"); - } - } + RowDataPtr data = SelectDataOjbect->getIndexedRow(index); + return converter.toJSRowData(data); } Catch(WrtDeviceApis::Commons::Exception) { - LoggerE("invalid property"); + JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch"); } return JSValueMakeUndefined(context); @@ -240,8 +217,6 @@ JSObjectRef JSSelectObjectArrayValues::createJSObject(JSContextRef context, cons { ISelectDataObjectPtr SelectDataObject(DataControlFactory::getInstance().getSelectDataObject()); SelectDataObject->openResultPath(filepath); -// SelectDataObject->loadHeader(); -// SelectDataObject->printHeader(); JSSelectObjectArrayValuesPriv * priv = new JSSelectObjectArrayValuesPriv( context, SelectDataObject); return JSObjectMake(context, getClassRef(), priv); } @@ -253,36 +228,6 @@ bool JSSelectObjectArrayValues::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - -/* ContactConverterFactory::ConverterType converter = - ContactConverterFactory::getConverter(context); - Try - { - size_t index = converter->toSizeT(propertyName); - AddressBookPtr addressBook(NULL); - if (!JSValueIsUndefined(context, value)) { - addressBook = converter->toAddressBook(value); - } - JSSelectObjectArrayValuesPriv* priv = - static_cast(JSObjectGetPrivate(object)); - if (!priv) { - Throw(WrtDeviceApis::Commons::NullPointerException); - } - AddressBookArrayPtr addressBooks = priv->getObject(); - if (!addressBooks) { - Throw(WrtDeviceApis::Commons::NullPointerException); - } - if (addressBooks->size() <= index) { - addressBooks->resize(index + 1); - } - (*addressBooks)[index] = addressBook; - return true; - } - Catch(WrtDeviceApis::Commons::Exception) - { - LoggerE("error occured"); - JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch"); - }*/ return false; } @@ -291,31 +236,6 @@ bool JSSelectObjectArrayValues::deleteProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { -/* ContactConverterFactory::ConverterType converter = - ContactConverterFactory::getConverter(context); - Try - { - size_t index = converter->toSizeT(propertyName); - AddressBookPtr addressBook(NULL); - JSSelectObjectArrayValuesPriv* priv = - static_cast(JSObjectGetPrivate(object)); - if (!priv) { - Throw(WrtDeviceApis::Commons::NullPointerException); - } - AddressBookArrayPtr addressBooks = priv->getObject(); - if (!addressBooks) { - Throw(WrtDeviceApis::Commons::NullPointerException); - } - if (addressBooks->size() > index) { - (*addressBooks)[index] = addressBook; - } - return true; - } - Catch(WrtDeviceApis::Commons::Exception) - { - LoggerE("error occured"); - JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch"); - }*/ return false; } @@ -325,7 +245,6 @@ void JSSelectObjectArrayValues::getPropertyNames(JSContextRef context, { Try { - LoggerD("Eneter"); JSSelectObjectArrayValuesPriv* priv = static_cast(JSObjectGetPrivate(object)); if (!priv) @@ -469,5 +388,5 @@ JSValueRef JSSelectObjectArrayValues::valueOf(JSContextRef context, return JSValueMakeUndefined(context); } -} // Contact -} // TizenApis +} +} diff --git a/src/DataControl/RowData.h b/src/DataControl/RowData.h index ac700b8..33ee4c9 100644 --- a/src/DataControl/RowData.h +++ b/src/DataControl/RowData.h @@ -38,8 +38,6 @@ public: RowData(std::vector& keys, std::vector& values) { - LoggerD("entered"); - if (keys.size() == 0) { ThrowMsg(WrtDeviceApis::Commons::ConversionException, "size 0 attribute"); diff --git a/src/DataControl/SelectDataObject.cpp b/src/DataControl/SelectDataObject.cpp index f7e711b..e294777 100644 --- a/src/DataControl/SelectDataObject.cpp +++ b/src/DataControl/SelectDataObject.cpp @@ -71,139 +71,123 @@ void SelectDataObject::openResultPath(const std::string& filepath) } } - -void SelectDataObject::getIndexedRow(const EventGetIndexedRowPtr& event) -{ - WrtDeviceApis::Commons::EventRequestReceiver::PostRequest(event); -} - -void SelectDataObject::OnRequestReceived(const EventGetIndexedRowPtr& event) +RowDataPtr SelectDataObject::getIndexedRow(const int fetchIndex) { - LoggerD("Enter"); char *buf = NULL; - try + size_t dataStart = sizeof(int) * 3 + m_colTotalSize + sizeof(int) * m_headerInfo.size(); + + int memorizedSize = 255; + int size = 0; + int type = 0; + int rowIndex = fetchIndex; + // move stream to current index + int index = 0; + + std::vector keys, values; + std::string data; + std::stringstream ssdata; + int ospIntData = 0; + long long ospBigIntData = 0; + double ospDoubleData = 0; + + + if (rowIndex >= m_rowCount) { + ThrowMsg(WrtDeviceApis::Commons::OutOfRangeException, "The requested index bigger than result row count"); + } - size_t dataStart = sizeof(int) * 3 + m_colTotalSize + sizeof(int) * m_headerInfo.size(); + m_istream.seekg(dataStart, std::ios::beg); + + for (index = 0; index < (int)m_headerInfo.size(); index++) + { + keys.push_back(m_headerInfo[index].m_name); + } + - int memorizedSize = 255; - int size = 0; - int type = 0; - int rowIndex = event->getIndex(); - // move stream to current index - int index = 0; - - std::vector keys, values; - std::string data; - std::stringstream ssdata; - int ospIntData = 0; - long long ospBigIntData = 0; - double ospDoubleData = 0; + for (index = 0; index < rowIndex; index++) + { + moveOneRow(); + } + buf = new char[memorizedSize + 1]; - if (rowIndex >= m_rowCount) - { - ThrowMsg(WrtDeviceApis::Commons::OutOfRangeException, "The requested index bigger than result row count"); - } + if (buf == NULL) + { + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Out of memory"); + } - m_istream.seekg(dataStart, std::ios::beg); - - for (index = 0; index < (int)m_headerInfo.size(); index++) - { - keys.push_back(m_headerInfo[index].m_name); - } + for (index = 0; index < m_colCount; index++) + { + size = 0; + m_istream.read((char*)&type, sizeof(type)); // skip type + m_istream.read((char*)&size, sizeof(int)); // read size +// LoggerD(type << " - " << size << " "); - for (index = 0; index < rowIndex; index++) + if (memorizedSize < size) { - moveOneRow(); - } + memorizedSize = size; - buf = new char[memorizedSize + 1]; + if (buf) + { + delete[] buf; + } + + buf = new char[memorizedSize + 1]; + } if (buf == NULL) { ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Out of memory"); } + + memset(buf, 0, memorizedSize + 1); - for (index = 0; index < m_colCount; index++) + switch (type) { - size = 0; - - m_istream.read((char*)&type, sizeof(type)); // skip type - m_istream.read((char*)&size, sizeof(int)); // read size -// LoggerD(type << " - " << size << " "); - - if (memorizedSize < size) - { - memorizedSize = size; - - if (buf) - { - delete[] buf; - } - - buf = new char[memorizedSize + 1]; - } - - if (buf == NULL) - { - ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Out of memory"); - } - - memset(buf, 0, memorizedSize + 1); - - switch (type) - { - case DB_COLUMNTYPE_TEXT: - case DB_COLUMNTYPE_BLOB: - m_istream.read((char*)buf, size); - data = buf; - break; - case DB_COLUMNTYPE_INT: - ssdata.str(""); - ospIntData = 0; - m_istream.read((char*)&ospIntData, size); - ssdata << ospIntData; - data = ssdata.str(); - break; - case DB_COLUMNTYPE_INT64: - ssdata.str(""); - m_istream.read((char*)&ospBigIntData, size); - ssdata << ospBigIntData; - data = ssdata.str(); - break; - case DB_COLUMNTYPE_DOUBLE: - ssdata.flush(); - m_istream.read((char*)&ospDoubleData, size); - ssdata << ospDoubleData; - data = ssdata.str(); - break; - case DB_COLUMNTYPE_NULL: - case DB_COLUMNTYPE_UNDEFINED: - data = ""; - break; - default: - ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Not support type"); - break; - } - values.push_back(data); + case DB_COLUMNTYPE_TEXT: + case DB_COLUMNTYPE_BLOB: + m_istream.read((char*)buf, size); + data = buf; + break; + case DB_COLUMNTYPE_INT: + ssdata.str(""); + ospIntData = 0; + m_istream.read((char*)&ospIntData, size); + ssdata << ospIntData; + data = ssdata.str(); + break; + case DB_COLUMNTYPE_INT64: + ssdata.str(""); + m_istream.read((char*)&ospBigIntData, size); + ssdata << ospBigIntData; + data = ssdata.str(); + break; + case DB_COLUMNTYPE_DOUBLE: + ssdata.flush(); + m_istream.read((char*)&ospDoubleData, size); + ssdata << ospDoubleData; + data = ssdata.str(); + break; + case DB_COLUMNTYPE_NULL: + case DB_COLUMNTYPE_UNDEFINED: + data = ""; + break; + default: + ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Not support type"); + break; } - RowDataPtr rowData(new RowData(keys, values)); - event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::None); - event->setRowData(rowData); + values.push_back(data); } - catch (const WrtDeviceApis::Commons::Exception& ex) - { - LoggerE("Exception: " << ex.GetMessage()); - event->setExceptionCode(ex.getCode()); - } if (buf) { delete[] buf; } + + RowDataPtr rowData(new RowData(keys, values)); + return rowData; } diff --git a/src/DataControl/SelectDataObject.h b/src/DataControl/SelectDataObject.h index 9f81bb7..b154bfc 100755 --- a/src/DataControl/SelectDataObject.h +++ b/src/DataControl/SelectDataObject.h @@ -44,11 +44,10 @@ public: virtual int getRowNumber(); virtual void setResultSetPath(const std::string& path); - virtual void getIndexedRow(const EventGetIndexedRowPtr& event); + virtual RowDataPtr getIndexedRow(const int fetchIndex); virtual void openResultPath(const std::string& filepath); protected: SelectDataObject(); - void OnRequestReceived(const EventGetIndexedRowPtr& event); private: void loadHeader(); void printHeader(); diff --git a/src/Filesystem/JSFilesystemManager.cpp b/src/Filesystem/JSFilesystemManager.cpp index 47d6182..2e98386 100644 --- a/src/Filesystem/JSFilesystemManager.cpp +++ b/src/Filesystem/JSFilesystemManager.cpp @@ -556,7 +556,7 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context, } } - if (permissions & PERM_WRITE && virtualPath == "wgt-package") { + if (permissions & PERM_WRITE && ((virtualPath == "wgt-package" ) || (virtualPath == "ringtones" ))) { return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "permission denied"); } diff --git a/src/Messaging/Conversation.cpp b/src/Messaging/Conversation.cpp index bc9e3db..b6181d9 100644 --- a/src/Messaging/Conversation.cpp +++ b/src/Messaging/Conversation.cpp @@ -96,48 +96,25 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) msg_struct_t msgInfo = NULL; msg_struct_t sendOpt = NULL; - msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); - sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT); - msg_error_t err = MSG_SUCCESS; unsigned int lastMsgIndex = 0; char *tempString = NULL; - int addressCount = 0; - int index = 0; int tempInt; bool tempBool; char msgData[128] = {0,}; m_result = true; int nToCnt; + int statusMO = 0; + int statusMT = 0; + int smsTypeCheck = 0; + int mmsTypeCheck = 0; try { // get thread Id msg_get_int_value(msg_thread, MSG_THREAD_ID_INT, &tempInt); m_Id = tempInt; - - // get thread type - msg_get_int_value(msg_thread, MSG_THREAD_MSG_TYPE_INT, &tempInt); - switch(tempInt) - { - case MSG_TYPE_SMS: - case MSG_TYPE_SMS_CB: - case MSG_TYPE_SMS_JAVACB: - case MSG_TYPE_SMS_WAPPUSH: - case MSG_TYPE_SMS_MWI: - case MSG_TYPE_SMS_SYNCML: - case MSG_TYPE_SMS_REJECT: - m_type = SMS; - LoggerD("Type:SMS"); - break; - case MSG_TYPE_MMS: - case MSG_TYPE_MMS_JAVA: - case MSG_TYPE_MMS_NOTI: - m_type = MMS;; - LoggerD("Type:MMS"); - break; - } - + // get thread time msg_get_int_value(msg_thread, MSG_THREAD_MSG_TIME_INT, &tempInt); m_time = tempInt; @@ -175,74 +152,127 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_ID_INT, &tempInt); m_lastMessageId = tempInt; - // get thread from - if (msg_get_message(handle, m_lastMessageId, msgInfo, sendOpt) != MSG_SUCCESS) + for(int convIndex=0; convIndex < (int)m_messageCount; convIndex++) { - ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get message fail"); - } + int tempMsgId; - msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_DIRECTION_INT, &tempInt); - int type = tempInt; + msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); + sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT); - msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); + msg_get_int_value(convViewList.msg_struct_info[convIndex], MSG_CONV_MSG_ID_INT, &tempMsgId); - nToCnt = addr_list->nCount; + LoggerD("tempMsgId " << tempMsgId); - if (type == MSG_DIRECTION_TYPE_MT) - { + if (msg_get_message(handle, tempMsgId, msgInfo, sendOpt) != MSG_SUCCESS) + { + ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get message fail"); + } - if (nToCnt > 0 && nToCnt < MAX_TO_ADDRESS_CNT ) + msg_get_int_value(msgInfo, MSG_MESSAGE_DIRECTION_INT, &tempInt); + + LoggerD("tempInt " << tempInt); + + if((tempInt == MSG_DIRECTION_TYPE_MO) && (statusMO==0)) // get TO { - char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; - msg_get_str_value(addr_list->msg_struct_info[m_lastMessageId], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); - - if (strNumber[0] != '\0') + msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); + nToCnt = addr_list->nCount; + + LoggerD("nToCnt " << nToCnt); + + if (nToCnt > 0 && nToCnt < MAX_TO_ADDRESS_CNT ) { - m_from = strNumber; // convert char to string + for(int toCount=0; toCount < nToCnt; toCount++) + { + char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; + msg_get_str_value(addr_list->msg_struct_info[toCount], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + + if (strNumber != NULL) + { + m_to.push_back(strNumber); + } + } + statusMO = 1; } - else + } + else if((tempInt == MSG_DIRECTION_TYPE_MT) && (statusMT==0)) // get From + { + msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); + nToCnt = addr_list->nCount; + + LoggerD("nToCnt " << nToCnt); + + if (nToCnt > 0 && nToCnt < MAX_TO_ADDRESS_CNT ) { - LoggerD("address is null "); + char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; + msg_get_str_value(addr_list->msg_struct_info[nToCnt-1], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + + if (strNumber[0] != '\0') + { + m_from = strNumber; // convert char to string + statusMT = 1; + } + else + { + LoggerD("address is null "); + } } } - else + + // get thread type + msg_get_int_value(msgInfo, MSG_MESSAGE_TYPE_INT, &tempInt); + switch(tempInt) { - LoggerD("address count index fail"); + case MSG_TYPE_SMS: + case MSG_TYPE_SMS_CB: + case MSG_TYPE_SMS_JAVACB: + case MSG_TYPE_SMS_WAPPUSH: + case MSG_TYPE_SMS_MWI: + case MSG_TYPE_SMS_SYNCML: + case MSG_TYPE_SMS_REJECT: + smsTypeCheck = 1; + break; + case MSG_TYPE_MMS: + case MSG_TYPE_MMS_JAVA: + case MSG_TYPE_MMS_NOTI: + mmsTypeCheck = 1; + break; } - - } - else - { - LoggerD("Msg direction: MO, from will be omitted"); - } - // get thread subject - char strTemp[MAX_SUBJECT_LEN] = {0}; - msg_get_str_value(msgInfo, MSG_MESSAGE_SUBJECT_STR, strTemp, MAX_SUBJECT_LEN); - tempString = strTemp; - if (tempString != NULL) - { - m_subject = tempString; // convert char to string - } - - // get thread to - if (nToCnt > 0 && nToCnt < MAX_TO_ADDRESS_CNT ) - { - for (index = 0; index < nToCnt; index++) + if(tempMsgId == m_lastMessageId) { - char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; - msg_get_str_value(addr_list->msg_struct_info[index], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); - tempString = strNumber; + // get thread subject + char strTemp[MAX_SUBJECT_LEN] = {0}; + msg_get_str_value(msgInfo, MSG_MESSAGE_SUBJECT_STR, strTemp, MAX_SUBJECT_LEN); + tempString = strTemp; if (tempString != NULL) { - m_to.push_back(tempString); + m_subject = tempString; // convert char to string + } + + // get thread type + if(mmsTypeCheck) + { + m_type = MMS; + LoggerD("Type:MMS"); + } + else + { + m_type = SMS; + LoggerD("Type:SMS"); } } + + if(msgInfo != NULL) + { + msg_release_struct(&msgInfo); + } + if(sendOpt != NULL) + { + msg_release_struct(&sendOpt); + } + } - else - { - LoggerD("address fetch fail" << addressCount); - } + } catch (const WrtDeviceApis::Commons::Exception& ex) { diff --git a/src/Messaging/Email.cpp b/src/Messaging/Email.cpp index e6c0a11..f2f38e7 100644 --- a/src/Messaging/Email.cpp +++ b/src/Messaging/Email.cpp @@ -861,7 +861,7 @@ void Email::updateMessage() error = email_get_meeting_request(m_mail->mail_id, &meeting_req); if (EMAIL_ERROR_NONE != error) { - LoggerW("email_get_meeting_request() failed [%d]\n" << error); + LoggerW("email_get_meeting_request() failed [" << error <<"]"); } error = email_update_mail( m_mail.Get(), attachment, attachmentCount, meeting_req, 0); @@ -885,7 +885,6 @@ void Email::updateMessage() if(result->body_download_status != 1) { LoggerD("result->body_download_status " << result->body_download_status); - int mail_id_count = 1; int mail_id_array[1]; email_mail_attribute_type attribute_type; email_mail_attribute_value_t attribute_value; @@ -1100,7 +1099,6 @@ void Email::loadDraftMessage() if(result->body_download_status != 1) { LoggerD("result->body_download_status " << result->body_download_status); - int mail_id_count = 1; int mail_id_array[1]; email_mail_attribute_type attribute_type; email_mail_attribute_value_t attribute_value; diff --git a/src/Messaging/Messaging.cpp b/src/Messaging/Messaging.cpp index e4f41b7..8b636cc 100644 --- a/src/Messaging/Messaging.cpp +++ b/src/Messaging/Messaging.cpp @@ -1345,6 +1345,10 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) } if(m_onConversationReceived.size() > 0){ + if(mail_id != thread_id) + { + jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED); + } m_onConversationReceived.emit(jsEvent); } } diff --git a/src/Messaging/Mms.cpp b/src/Messaging/Mms.cpp index 5bc0838..9b229ef 100644 --- a/src/Messaging/Mms.cpp +++ b/src/Messaging/Mms.cpp @@ -534,13 +534,12 @@ void Mms::readBodyAndAttachments(msg_struct_t& messageData) void Mms::readBody(msg_struct_t& messageData) { - int pageLen, mediaLen, attachLen, tempInt, ret; + int pageLen, mediaLen, tempInt, ret; msg_struct_t mms_struct = NULL; msg_list_handle_t page_list = NULL; msg_list_handle_t media_list = NULL; - msg_list_handle_t attach_list = NULL; msg_struct_t page = NULL; msg_struct_t media = NULL; diff --git a/src/NetworkBearerSelection/JSNetworkBearerSelection.cpp b/src/NetworkBearerSelection/JSNetworkBearerSelection.cpp index 605b48b..4245f6b 100755 --- a/src/NetworkBearerSelection/JSNetworkBearerSelection.cpp +++ b/src/NetworkBearerSelection/JSNetworkBearerSelection.cpp @@ -117,10 +117,14 @@ JSValueRef JSNetworkBearerSelection::requestRouteToHost(JSContextRef context, JS Converter converter(context); Validator check(context, exception); + AceSecurityStatus status = NETWORKBEARERSELECTION_CHECK_ACCESS(NETWORKBEARERSELECTION_FUNCTION_API_REQUEST_ROUTE_TO_HOST); + TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + if (!priv) { LoggerE("private object is null"); return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Wrong Object"); } + if (argumentCount < 3) { return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error"); } @@ -132,9 +136,6 @@ JSValueRef JSNetworkBearerSelection::requestRouteToHost(JSContextRef context, JS } } - AceSecurityStatus status = NETWORKBEARERSELECTION_CHECK_ACCESS(NETWORKBEARERSELECTION_FUNCTION_API_REQUEST_ROUTE_TO_HOST); - TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - JSValueRef onsuccess = NULL; JSValueRef onpaused = NULL; JSValueRef onresumed = NULL; @@ -230,6 +231,9 @@ JSValueRef JSNetworkBearerSelection::releaseRouteToHost(JSContextRef context, JS Converter converter(context); Validator check(context, exception); + AceSecurityStatus status = NETWORKBEARERSELECTION_CHECK_ACCESS(NETWORKBEARERSELECTION_FUNCTION_API_RELEASE_ROUTE_TO_HOST); + TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + if (!priv) { LoggerE("private object is null"); return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Wrong Object"); @@ -241,9 +245,6 @@ JSValueRef JSNetworkBearerSelection::releaseRouteToHost(JSContextRef context, JS return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error"); } - AceSecurityStatus status = NETWORKBEARERSELECTION_CHECK_ACCESS(NETWORKBEARERSELECTION_FUNCTION_API_RELEASE_ROUTE_TO_HOST); - TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - std::string networkType = converter.toString(arguments[0]); std::string domainName = converter.toString(arguments[1]); if (strcmp(networkType.c_str(), "CELLULAR") != 0) { diff --git a/src/Systeminfo/JSCellularNetworkInfo.cpp b/src/Systeminfo/JSCellularNetworkInfo.cpp index 3423737..0c84d4d 100755 --- a/src/Systeminfo/JSCellularNetworkInfo.cpp +++ b/src/Systeminfo/JSCellularNetworkInfo.cpp @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include "JSCellularNetworkInfo.h" #include "plugin_config.h" #include @@ -157,26 +155,6 @@ JSValueRef JSCellularNetworkInfo::getProperty(JSContextRef context, JSObjectRef AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_PARTNER_VALUE); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - TapiHandle *handle = NULL; - char* imei = NULL; - - handle = tel_init(0); - - if (handle == NULL) { - return convert.toJSValueRef(cellularNetworkInfo->imei); - } - - imei = tel_get_misc_me_imei_sync(handle); - - if (imei == NULL) { - tel_deinit(handle); - return convert.toJSValueRef(cellularNetworkInfo->imei); - } - - cellularNetworkInfo->imei = imei; - free(imei); - tel_deinit(handle); - return convert.toJSValueRef(cellularNetworkInfo->imei); } } diff --git a/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp b/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp index 4b324e9..839ae61 100755 --- a/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp +++ b/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp @@ -787,12 +787,18 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR bool inputKeyBack = false; if(system_info_get_platform_bool("tizen.org/feature/input.keys.back", &inputKeyBack) == SYSTEM_INFO_ERROR_NONE) { deviceCapabilitiesInfo->inputKeyBack = inputKeyBack; + } else { + LoggerE("fail get value"); + Throw(WrtDeviceApis::Commons::Exception); } return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyBack); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_INPUT_KEY_OPTION)) { bool inputKeyMenu = false; if(system_info_get_platform_bool("tizen.org/feature/input.keys.menu", &inputKeyMenu) == SYSTEM_INFO_ERROR_NONE) { deviceCapabilitiesInfo->inputKeyMenu = inputKeyMenu; + } else { + LoggerE("fail get value"); + Throw(WrtDeviceApis::Commons::Exception); } return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyMenu); } @@ -800,6 +806,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR Catch(Exception) { LoggerE("Exception: " << _rethrown_exception.GetMessage()); + JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSSIMInfo.cpp b/src/Systeminfo/JSSIMInfo.cpp index 2ddac9c..1613e3f 100755 --- a/src/Systeminfo/JSSIMInfo.cpp +++ b/src/Systeminfo/JSSIMInfo.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include "JSSIMInfo.h" #include "plugin_config.h" #include @@ -116,7 +115,6 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt { LoggerD("Enter"); JSSIMPriv *priv = static_cast(JSObjectGetPrivate(object)); - int ret = SIM_ERROR_NONE; if (NULL == priv) { LoggerE("Private object not set."); return JSValueMakeUndefined(context); @@ -129,115 +127,34 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt if (JSStringIsEqualToUTF8CString(propertyName, SIM_STATE_PROPERTY)) { AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - sim_state_e state; - ret = sim_get_state(&state); - if (ret == SIM_ERROR_NONE) { - if (state == SIM_STATE_UNAVAILABLE) { - SIMInfo->state = "ABSENT"; - } else if (state == SIM_STATE_LOCKED) { - SIMInfo->state = "PIN_REQUIRED"; - } else if (state == SIM_STATE_AVAILABLE) { - SIMInfo->state = "READY"; - } else if (state == SIM_STATE_UNKNOWN) { - SIMInfo->state = "INITIALIZING"; - } - } return convert.toJSValueRef(SIMInfo->state); } else 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; - LoggerD("operatorName : " << SIMInfo->operatorName); - free(fullName); - } else if (shortName) { - SIMInfo->operatorName = shortName; - LoggerD("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); - char* msisdn = NULL; - ret = sim_get_subscriber_number(&msisdn); - if (ret == SIM_ERROR_NONE) { - if (msisdn) { - SIMInfo->msisdn = msisdn; - LoggerD("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); - char* iccId = NULL; - ret = sim_get_icc_id(&iccId); - if (ret == SIM_ERROR_NONE) { - if (iccId) { - SIMInfo->iccid = iccId; - LoggerD("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); - char* mcc = NULL; - ret = sim_get_mcc(&mcc); - if (ret == SIM_ERROR_NONE) { - if (mcc) { - SIMInfo->mcc = atoi(mcc); - LoggerD("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); - char* mnc = NULL; - ret = sim_get_mnc(&mnc); - if (ret == SIM_ERROR_NONE) { - if (mnc) { - SIMInfo->mnc = atoi(mnc); - LoggerD("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); - char* msin = NULL; - ret = sim_get_msin(&msin); - if (ret == SIM_ERROR_NONE) { - if (msin) { - SIMInfo->msin = msin; - LoggerD("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); - char* spn = NULL; - ret = sim_get_spn(&spn); - if (ret == SIM_ERROR_NONE) { - if (spn) { - SIMInfo->spn = spn; - LoggerD("spn : " << SIMInfo->spn); - free(spn); - } - } return convert.toJSValueRef(SIMInfo->spn); } } diff --git a/src/Systeminfo/Systeminfo.cpp b/src/Systeminfo/Systeminfo.cpp index f3657b8..d13c0d3 100755 --- a/src/Systeminfo/Systeminfo.cpp +++ b/src/Systeminfo/Systeminfo.cpp @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include #include "Systeminfo.h" #include @@ -1245,7 +1248,9 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(CellularNetwork) { connection_address_family_e addressFamily = CONNECTION_ADDRESS_FAMILY_IPV4; char* ipAddr = NULL; char* apn = NULL; + char* imei = NULL; int plmn = 0, cellId = 0, lac = 0, isRoaming = 0, isFlightMode = 0; + TapiHandle *tapiHandle = NULL; TIME_TRACER_ITEM_BEGIN("(cellular)mcc", 0); if (vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &plmn) == 0) { @@ -1321,12 +1326,120 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(CellularNetwork) { } } + tapiHandle = tel_init(0); + + if (tapiHandle != NULL) { + imei = tel_get_misc_me_imei_sync(tapiHandle); + + if (imei == NULL) { + tel_deinit(tapiHandle); + return JSCellularNetworkInfo::createJSObject(context, cellularNetwork); + } + + cellularNetwork->imei = imei; + free(imei); + tel_deinit(tapiHandle); + } + return JSCellularNetworkInfo::createJSObject(context, cellularNetwork); } PROPERTY_GET_SYSTEMINFO_DEFINITION(SIM) { Converter converter(context); SIMPropertiesPtr SIM(new SIMProperties()); + + sim_state_e state; + 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; + + ret = sim_get_state(&state); + if (ret == SIM_ERROR_NONE) { + if (state == SIM_STATE_UNAVAILABLE) { + SIM->state = "ABSENT"; + } else if (state == SIM_STATE_LOCKED) { + SIM->state = "PIN_REQUIRED"; + } else if (state == SIM_STATE_AVAILABLE) { + SIM->state = "READY"; + } else if (state == SIM_STATE_UNKNOWN) { + SIM->state = "INITIALIZING"; + } + } + + ret = sim_get_cphs_operator_name(&fullName, &shortName); + if (ret == SIM_ERROR_NONE) { + if (fullName) { + SIM->operatorName = fullName; + LoggerD("operatorName : " << SIM->operatorName); + free(fullName); + } else if (shortName) { + SIM->operatorName = shortName; + LoggerD("operatorName : " << SIM->operatorName); + free(shortName); + } + } + + + ret = sim_get_subscriber_number(&msisdn); + if (ret == SIM_ERROR_NONE) { + if (msisdn) { + SIM->msisdn = msisdn; + LoggerD("msisdn : " << SIM->msisdn); + free(msisdn); + } + } + + ret = sim_get_icc_id(&iccId); + if (ret == SIM_ERROR_NONE) { + if (iccId) { + SIM->iccid = iccId; + LoggerD("iccid : " << SIM->iccid); + free(iccId); + } + } + + ret = sim_get_mcc(&mcc); + if (ret == SIM_ERROR_NONE) { + if (mcc) { + SIM->mcc = atoi(mcc); + LoggerD("mcc : " << SIM->mcc); + free(mcc); + } + } + + ret = sim_get_mnc(&mnc); + if (ret == SIM_ERROR_NONE) { + if (mnc) { + SIM->mnc = atoi(mnc); + LoggerD("mnc : " << SIM->mnc); + free(mnc); + } + } + + ret = sim_get_msin(&msin); + if (ret == SIM_ERROR_NONE) { + if (msin) { + SIM->msin = msin; + LoggerD("msin : " << SIM->msin); + free(msin); + } + } + + ret = sim_get_spn(&spn); + if (ret == SIM_ERROR_NONE) { + if (spn) { + SIM->spn = spn; + LoggerD("spn : " << SIM->spn); + free(spn); + } + } + return JSSIMInfo::createJSObject(context, SIM); } diff --git a/src/Systeminfo/SysteminfoPropertyInfo.h b/src/Systeminfo/SysteminfoPropertyInfo.h index a91613e..f08aea6 100755 --- a/src/Systeminfo/SysteminfoPropertyInfo.h +++ b/src/Systeminfo/SysteminfoPropertyInfo.h @@ -175,8 +175,8 @@ struct DeviceCapabilitiesProperties visionFaceRecognition(false), secureElement(false), nativeOspCompatible(false), - inputKeyBack(true), - inputKeyMenu(true) + inputKeyBack(false), + inputKeyMenu(false) { } }; -- 2.7.4