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
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]+)");
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);
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
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
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
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);
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
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
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
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
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
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
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<BluetoothClassHolderPtr>(JSObjectGetPrivate(thisObject));
if (!priv) {
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<BluetoothDeviceHolderPtr>(JSObjectGetPrivate(thisObject));
if (!priv) {
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);
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<BluetoothServiceHandlerPtr>(JSObjectGetPrivate(thisObject));
if (!priv) {
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<BluetoothSocketPtr>(JSObjectGetPrivate(thisObject));
if (!priv) {
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<BluetoothSocketPtr>(JSObjectGetPrivate(thisObject));
if (!priv) {
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<BluetoothSocketPtr>(JSObjectGetPrivate(thisObject));
if (!priv) {
#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<std::string, int> 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 =
};
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 }
};
}
}
-JSValueRef JSWebAPIError::getStaticProperty(JSContextRef context,
+JSValueRef JSWebAPIError::getProperty(JSContextRef context,
JSObjectRef object,
JSStringRef propertyName,
JSValueRef* /*exception*/)
{
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<long>(iter->second));
- }
}
catch(const BasePlatformException & err)
{
}
bool JSWebAPIError::hasInstance(JSContextRef context,
- JSObjectRef /*constructor*/,
+ JSObjectRef constructor,
JSValueRef possibleInstance,
JSValueRef* /*exception*/)
{
- return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
+ return JSValueIsObjectOfClass(context, constructor, getClassRef());
}
} // Common
// 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 <JavaScriptCore/JavaScript.h>
#include "JSWebAPIErrorFactory.h"
static void finalize(JSObjectRef object);
- static JSValueRef getStaticProperty(JSContextRef context,
+ static JSValueRef getProperty(JSContextRef context,
JSObjectRef object,
JSStringRef propertyName,
JSValueRef* exception);
} // Common
} // DeviceAPI
-#endif // _JS_WEBAPI_ERROR2_H_
+#endif // _JS_WEBAPI_ERROR_H_
#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<std::string, int> 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 =
};
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 }
};
{
}
+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<long>(iter->second));
+ }
+ catch(const BasePlatformException & err)
+ {
+ LoggerE("Exception: " << err.getMessage());
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
JSValueRef JSWebAPIException::toString(JSContextRef context,
JSObjectRef object,
JSObjectRef thisObject,
}
bool JSWebAPIException::hasInstance(JSContextRef context,
- JSObjectRef /*constructor*/,
+ JSObjectRef constructor,
JSValueRef possibleInstance,
JSValueRef* /*exception*/)
{
- return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
+ return JSValueIsObjectOfClass(context, constructor, getClassRef());
}
} // Common
// 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 <JavaScriptCore/JavaScript.h>
#include "JSWebAPIErrorFactory.h"
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,
} // Common
} // DeviceAPI
-#endif // _JS_WEBAPI_EXCEPTION2_H_
+#endif // _JS_WEBAPI_EXCEPTION_H_
void ContactsSvcChangeListenerManager::personsDbChangedCallback(const char* view_uri, char* changes, void* user_data)
{
- LoggerD("entered : " << changes);
-
if(changes == NULL)
{
LoggerW("changes is NULL");
}
}
+ LoggerD("entered : " << changes);
if(user_data == NULL)
{
LoggerW("contacts-service listener passed NULL user_data");
{
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);
{
MediaSearchVisitorPtr visitor(new MediaSearchVisitor());
visitor->setQueryType(MediaSearchVisitor::QUERY_MEDIA);
- int ret = MEDIA_CONTENT_ERROR_NONE;
try
{
{
LoggerD(address);
- if (m_mappedDataControlGCMap.find(address) == m_sqlDataControlGCMap.end())
+ if (m_mappedDataControlGCMap.find(address) == m_mappedDataControlGCMap.end())
{
return true;
}
EventSelectAnswerReceiver;
typedef WrtDeviceApis::Commons::EventAnswerReceiver<EventUpdate>
EventUpdateAnswerReceiver;
-/*typedef WrtDeviceApis::Commons::EventAnswerReceiver<EventGetIndexedRow>
- EventGetIndexedRowAnswerReceiver; */
typedef WrtDeviceApis::Commons::EventAnswerReceiver<EventAddValue>
EventAddValueAnswerReceiver;
typedef WrtDeviceApis::Commons::EventAnswerReceiver<EventRemoveValue>
public EventRemoveValueAnswerReceiver,
public EventGetValueAnswerReceiver,
public EventUpdateValueAnswerReceiver
- //,
- //public EventGetIndexedRowAnswerReceiver
{
private:
+++ /dev/null
-//
-// 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 <Commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-#include "RowData.h"
-#include <Logger.h>
-
-namespace DeviceAPI {
-namespace DataControl {
-
-class EventGetIndexedRow: public WrtDeviceApis::Commons::IEvent<EventGetIndexedRow>
-{
-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<EventGetIndexedRow> EventGetIndexedRowPtr;
-
-}
-}
-
-#endif
namespace DataControl {
using namespace WrtDeviceApis::Commons;
-ISelectDataObject::ISelectDataObject() :
- EventRequestReceiver<EventGetIndexedRow>(ThreadEnum::BLUETOOTH_THREAD)
-
+ISelectDataObject::ISelectDataObject()
{
}
#include <dpl/shared_ptr.h>
#include <fstream>
-#include "EventGetIndexedRow.h"
+#include "RowData.h"
namespace DeviceAPI {
namespace DataControl {
-class ISelectDataObject :
- public WrtDeviceApis::Commons::EventRequestReceiver<EventGetIndexedRow>
+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<ISelectDataObject> ISelectDataObjectPtr;
}
Catch(WrtDeviceApis::Commons::Exception)
{
- LoggerE("invalid property");
}
return JSValueMakeUndefined(context);
{
Try
{
- LoggerD("Enter");
JSSelectObjectArrayValuesPriv* priv = static_cast<JSSelectObjectArrayValuesPriv*>(JSObjectGetPrivate(object));
if (!priv)
DataControlConverter converter(priv->getContext());
int index = converter.toSizeT(propertyName);
- LoggerD(index);
ISelectDataObjectPtr SelectDataOjbect = priv->getObject();
if (index < SelectDataOjbect->getRowNumber())
}
Catch(WrtDeviceApis::Commons::Exception)
{
- LoggerE("invalid property");
}
return false;
}
{
Try
{
- LoggerD("Eneter");
JSSelectObjectArrayValuesPriv* priv = static_cast<JSSelectObjectArrayValuesPriv*>(JSObjectGetPrivate(object));
if (!priv)
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);
{
ISelectDataObjectPtr SelectDataObject(DataControlFactory::getInstance().getSelectDataObject());
SelectDataObject->openResultPath(filepath);
-// SelectDataObject->loadHeader();
-// SelectDataObject->printHeader();
JSSelectObjectArrayValuesPriv * priv = new JSSelectObjectArrayValuesPriv( context, SelectDataObject);
return JSObjectMake(context, getClassRef(), priv);
}
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<JSSelectObjectArrayValuesPriv*>(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;
}
JSStringRef propertyName,
JSValueRef* exception)
{
-/* ContactConverterFactory::ConverterType converter =
- ContactConverterFactory::getConverter(context);
- Try
- {
- size_t index = converter->toSizeT(propertyName);
- AddressBookPtr addressBook(NULL);
- JSSelectObjectArrayValuesPriv* priv =
- static_cast<JSSelectObjectArrayValuesPriv*>(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;
}
{
Try
{
- LoggerD("Eneter");
JSSelectObjectArrayValuesPriv* priv = static_cast<JSSelectObjectArrayValuesPriv*>(JSObjectGetPrivate(object));
if (!priv)
return JSValueMakeUndefined(context);
}
-} // Contact
-} // TizenApis
+}
+}
RowData(std::vector<std::string>& keys, std::vector<std::string>& values)
{
- LoggerD("entered");
-
if (keys.size() == 0)
{
ThrowMsg(WrtDeviceApis::Commons::ConversionException, "size 0 attribute");
}
}
-
-void SelectDataObject::getIndexedRow(const EventGetIndexedRowPtr& event)
-{
- WrtDeviceApis::Commons::EventRequestReceiver<EventGetIndexedRow>::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<std::string> 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<std::string> 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;
}
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();
}
}
- 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");
}
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;
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)
{
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);
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;
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;
}
if(m_onConversationReceived.size() > 0){
+ if(mail_id != thread_id)
+ {
+ jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+ }
m_onConversationReceived.emit(jsEvent);
}
}
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;
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");
}
}
}
- 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;
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");
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) {
#include <memory>
#include <JSWebAPIErrorFactory.h>
#include <SecurityExceptions.h>
-#include <tapi_common.h>
-#include <ITapiModem.h>
#include "JSCellularNetworkInfo.h"
#include "plugin_config.h"
#include <Logger.h>
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);
}
}
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);
}
Catch(Exception)
{
LoggerE("Exception: " << _rethrown_exception.GetMessage());
+ JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR);
}
return JSValueMakeUndefined(context);
}
#include <memory>
#include <JSWebAPIErrorFactory.h>
#include <SecurityExceptions.h>
-#include <sim.h>
#include "JSSIMInfo.h"
#include "plugin_config.h"
#include <Logger.h>
{
LoggerD("Enter");
JSSIMPriv *priv = static_cast<JSSIMPriv*>(JSObjectGetPrivate(object));
- int ret = SIM_ERROR_NONE;
if (NULL == priv) {
LoggerE("Private object not set.");
return JSValueMakeUndefined(context);
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);
}
}
#include <CommonsJavaScript/Converter.h>
#include <CommonsJavaScript/PrivateObject.h>
#include <TimeTracer.h>
+#include <tapi_common.h>
+#include <ITapiModem.h>
+#include <sim.h>
#include "Systeminfo.h"
#include <Logger.h>
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) {
}
}
+ 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);
}
visionFaceRecognition(false),
secureElement(false),
nativeOspCompatible(false),
- inputKeyBack(true),
- inputKeyMenu(true)
+ inputKeyBack(false),
+ inputKeyMenu(false)
{
}
};