Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.54
+Version: 0.4.55
Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
bool previousState = object->mEnabled;
object->mEnabled = (adapterState == BT_ADAPTER_ENABLED) ? true : false;
+ if(object->mEnabled == true) {
+ object->mVisible = object->getVisible();
+ }
// call onstatechanged in ChangeListener
if(previousState != object->mEnabled && result == BT_ERROR_NONE && object->mChangeListener != NULL) {
bool BluetoothAdapter::getVisible() const
{
-/*
bt_adapter_visibility_mode_e mode;
if (bt_adapter_get_visibility(&mode, NULL) == BT_ERROR_NONE) {
}
return false;
-*/
- return mVisible;
}
void BluetoothAdapter::setVisible(bool visible, unsigned int timeout, MultiCallbackUserDataPtr userData)
};
JSStaticFunction JSBluetoothHealthApplication::m_function[] = {
- { BLUETOOTH_HEALTH_APPLICATION_API_UNREGISTER, unregister, kJSPropertyAttributeNone },
+ { "unregister", unregister, kJSPropertyAttributeNone },
{ 0, 0, 0 }
};
JSStaticFunction JSBluetoothHealthChannel::m_function[] = {
{ BLUETOOTH_HEALTH_CHANNEL_API_SEND_DATA, sendData, kJSPropertyAttributeNone },
- { BLUETOOTH_HEALTH_CHANNEL_API_CLOSE, close, kJSPropertyAttributeNone },
+ { "close", close, kJSPropertyAttributeNone },
{ BLUETOOTH_HEALTH_CHANNEL_API_SET_LISTENER, setListener, kJSPropertyAttributeNone },
{ BLUETOOTH_HEALTH_CHANNEL_API_UNSET_LISTENER, unsetListener, kJSPropertyAttributeNone },
{ 0, 0, 0 }
#define BLUETOOTH_CLASS_API_HAS_SERVICE "hasService"
#define BLUETOOTH_SERVICE_HANDLER_API_UNREGISTER "unregister"
#define BLUETOOTH_HEALTH_PROFILE_HANDLER_API_REGISTER_SINK_APPLICATION "registerSinkApplication"
-#define BLUETOOTH_HEALTH_APPLICATION_API_UNREGISTER "unregister"
+#define BLUETOOTH_HEALTH_APPLICATION_API_UNREGISTER "healthUnregister"
#define BLUETOOTH_HEALTH_PROFILE_HANDLER_API_CONNECT_TO_SOURCE "connectToSource"
#define BLUETOOTH_HEALTH_CHANNEL_API_SEND_DATA "sendData"
#define BLUETOOTH_HEALTH_CHANNEL_API_SET_LISTENER "setListener"
#define BLUETOOTH_HEALTH_CHANNEL_API_UNSET_LISTENER "unsetListener"
-#define BLUETOOTH_HEALTH_CHANNEL_API_CLOSE "close"
+#define BLUETOOTH_HEALTH_CHANNEL_API_CLOSE "healthClose"
DECLARE_FUNCTION_GETTER(Bluetooth);
EventAlarm::EventAlarm()
{
- m_absoluteDate = UNDEFINED_TIME;
- m_timeZone = DEFAULT_TIMEZONE;
+ m_absoluteDate = UNDEFINED_TIME;
+ m_duration.length = UNDEFINED_TIME;
+ m_timeZone = DEFAULT_TIMEZONE;
m_method = SOUND_ALARM;
}
EventAlarm::~EventAlarm()
return timeConverter.toJSValueRefTZDate((double)(alarm->getAbsoluteDate()*1000.0), alarm->getTimeZone());
}
} else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_CALENDAR_ALARM_BEFORE)) {
- return JSTimeDuration::createJSObject(context, alarm->getDuration());
+ if (UNDEFINED_TIME==alarm->getDuration().length) {
+ return JSValueMakeNull(context);
+ } else {
+ return JSTimeDuration::createJSObject(context, alarm->getDuration());
+ }
} else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_CALENDAR_ALARM_DESCRIPTION)) {
return converter.toJSValueRef(alarm->getDescription());
} else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_CALENDAR_ALARM_METHOD)) {
if(m_filteredContactIds != NULL)
m_isFilterSet = true;
-}
+ }
void ContactSearchEngine::setSortMode(SortModePtr attr)
{
{
ContactIdSetPtr idSet = ContactIdSetPtr(new ContactIdSet());
- bool initialValueIsSet = false;
- bool endValueIsSet = false;
+ bool initialValueIsSet = true;
+ bool endValueIsSet = true;
- if(initialValue != NULL || initialValue->isNullOrUndefined())
+ if(initialValue == NULL || initialValue->isNullOrUndefined())
initialValueIsSet = false;
- if(endValue != NULL || endValue->isNullOrUndefined())
+ if(endValue == NULL || endValue->isNullOrUndefined())
endValueIsSet = false;
if(!initialValueIsSet && !endValueIsSet)
initialValueInt = ContactUtility::toDateDbInt(*initialValue->getDateTm());
}
if(endValueIsSet){
- endValueInt = ContactUtility::toDateDbInt(*initialValue->getDateTm());
+ endValueInt = ContactUtility::toDateDbInt(*endValue->getDateTm());
}
}
else
endValueInt = endValue->getLong();
}
- queryAttributeRangeInt(properties, idSet, initialValueIsSet, initialValueInt, endValueIsSet, endValueInt);
+ if(attrName == "birthday" || attrName == "anniversaries.date"){
+ queryAttributeRangeDate(attrName, properties, idSet, initialValueIsSet, initialValueInt, endValueIsSet, endValueInt);
+ }else{
+ queryAttributeRangeInt(properties, idSet, initialValueIsSet, initialValueInt, endValueIsSet, endValueInt);
+ }
}
if(depth == 0)
if(errorCode != CONTACTS_ERROR_NONE)
ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
- LoggerD("attrName" << attrName);
-
if(attrName == "birthday"){
errorCode = contacts_filter_add_operator( filter, CONTACTS_FILTER_OPERATOR_AND);
if(errorCode != CONTACTS_ERROR_NONE)
_CONTACTS_SVC_QUERY_FUNC_SUFFIX(query, filter, list, property_contact_id, result);
}
+void ContactSearchEngine::queryAttributeRangeDate(string& attrName, AttributeProperties& attributeProperties, ContactIdSetPtr& result,
+ bool initial_value_is_set, int initial_value, bool end_value_is_set, int end_value)
+{
+ const char* view_uri = attributeProperties.viewUri;
+ unsigned int property_contact_id = attributeProperties.propertyContactId;
+ unsigned int property_id = attributeProperties.propertyId;
+
+ int errorCode = 0;
+ contacts_query_h query = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_list_h list = NULL;
+
+ _CONTACTS_SVC_QUERY_FUNC_PREFIX(view_uri, query, filter);
+
+ if(initial_value_is_set && end_value_is_set)
+ {
+ errorCode = contacts_filter_add_int(filter, property_id, CONTACTS_MATCH_GREATER_THAN_OR_EQUAL, initial_value);
+ contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND);
+ errorCode = contacts_filter_add_int(filter, property_id, CONTACTS_MATCH_LESS_THAN_OR_EQUAL, end_value);
+ }
+ else if(initial_value_is_set)
+ {
+ errorCode = contacts_filter_add_int(filter, property_id, CONTACTS_MATCH_GREATER_THAN_OR_EQUAL, initial_value);
+ }
+ else if(end_value_is_set)
+ {
+ errorCode = contacts_filter_add_int(filter, property_id, CONTACTS_MATCH_LESS_THAN_OR_EQUAL, end_value);
+ }
+
+ if(attrName == "birthday"){
+ errorCode = contacts_filter_add_operator( filter, CONTACTS_FILTER_OPERATOR_AND);
+ if(errorCode != CONTACTS_ERROR_NONE)
+ ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
+
+ errorCode = contacts_filter_add_int(filter, _contacts_event.type, CONTACTS_MATCH_EQUAL, CONTACTS_EVENT_TYPE_BIRTH);
+ if(errorCode != CONTACTS_ERROR_NONE)
+ ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
+ }else if(attrName == "anniversaries.date"){
+ errorCode = contacts_filter_add_operator( filter, CONTACTS_FILTER_OPERATOR_AND);
+ if(errorCode != CONTACTS_ERROR_NONE)
+ ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
+
+ errorCode = contacts_filter_add_int(filter, _contacts_event.type, CONTACTS_MATCH_EQUAL, CONTACTS_EVENT_TYPE_ANNIVERSARY);
+ if(errorCode != CONTACTS_ERROR_NONE)
+ ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
+ }
+
+ _CONTACTS_SVC_QUERY_FUNC_SUFFIX(query, filter, list, property_contact_id, result);
+}
+
void ContactSearchEngine::queryAttributeRangeInt(AttributeProperties& attributeProperties, ContactIdSetPtr& result,
bool initial_value_is_set, int initial_value, bool end_value_is_set, int end_value)
{
contacts_match_str_flag_e match, const char* match_value);
void queryAttributeRangeBool(AttributeProperties& attributeProperties, ContactIdSetPtr& result,
bool initial_value_is_set, bool initial_value, bool end_value_is_set, bool end_value);
+ void queryAttributeRangeDate(std::string& attrName, AttributeProperties& attributeProperties, ContactIdSetPtr& result,
+ bool initial_value_is_set, int initial_value, bool end_value_is_set, int end_value);
void queryAttributeRangeInt(AttributeProperties& attributeProperties, ContactIdSetPtr& result,
bool initial_value_is_set, int initial_value, bool end_value_is_set, int end_value);
void queryAttributeRangeString(AttributeProperties& attributeProperties, ContactIdSetPtr& result,
#include "JSAudio.h"
#include "JSFolder.h"
#include "JSAudioLyrics.h"
+#include "ContentUtility.h"
#include <Logger.h>
using namespace DeviceAPI::Common;
}
if(JSValueIsObjectOfClass(m_context, element, JSImage::getClassRef())){
- JSValueRef geoValRef = JSUtil::getProperty(m_context , JSUtil::JSValueToObject(m_context, element), "geolocation");
- JSObjectRef geoObjRef = JSUtil::JSValueToObject(m_context, geoValRef);
- double latitude = JSUtil::JSValueToDouble(m_context, JSUtil::getProperty(m_context, geoObjRef, "latitude"));
- double longitude = JSUtil::JSValueToDouble(m_context,JSUtil::getProperty(m_context, geoObjRef, "longitude"));
MediacontentImagePtr imgPtr = JSImage::getImageObject(arg);
- imgPtr->setImageLatitude(latitude);
- imgPtr->setImageLongitude(longitude);
+ JSValueRef geoValRef = JSUtil::getProperty(m_context , JSUtil::JSValueToObject(m_context, element), "geolocation");
+ if(!(JSValueIsNull(m_context, geoValRef) || JSValueIsUndefined(m_context, geoValRef))){
+ JSObjectRef geoObjRef = JSUtil::JSValueToObject(m_context, geoValRef);
+ double latitude = JSUtil::JSValueToDouble(m_context, JSUtil::getProperty(m_context, geoObjRef, "latitude"));
+ double longitude = JSUtil::JSValueToDouble(m_context,JSUtil::getProperty(m_context, geoObjRef, "longitude"));
+ if(ContentUtility::checkLocation(latitude, latitude)){
+ imgPtr->setImageLatitude(latitude);
+ imgPtr->setImageLongitude(longitude);
+ }
+ else{
+ ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "geolocation value is not valid.");
+ }
+ }
+ else
+ {
+ imgPtr->setImageLatitude(DEFAULT_GEOLOCATION);
+ imgPtr->setImageLongitude(DEFAULT_GEOLOCATION);
+ }
}
if(JSValueIsObjectOfClass(m_context, element, JSVideo::getClassRef())){
- JSValueRef geoValRef = JSUtil::getProperty(m_context , JSUtil::JSValueToObject(m_context, element), "geolocation");
- JSObjectRef geoObjRef = JSUtil::JSValueToObject(m_context, geoValRef);
- double latitude = JSUtil::JSValueToDouble(m_context, JSUtil::getProperty(m_context, geoObjRef, "latitude"));
- double longitude = JSUtil::JSValueToDouble(m_context,JSUtil::getProperty(m_context, geoObjRef, "longitude"));
MediacontentVideoPtr vedioPtr = JSVideo::getVideoObject(arg);
- vedioPtr->setVideoLatitude(latitude);
- vedioPtr->setVideoLongitude(longitude);
+ JSValueRef geoValRef = JSUtil::getProperty(m_context , JSUtil::JSValueToObject(m_context, element), "geolocation");
+ if(!(JSValueIsNull(m_context, geoValRef) || JSValueIsUndefined(m_context, geoValRef))){
+ JSObjectRef geoObjRef = JSUtil::JSValueToObject(m_context, geoValRef);
+ double latitude = JSUtil::JSValueToDouble(m_context, JSUtil::getProperty(m_context, geoObjRef, "latitude"));
+ double longitude = JSUtil::JSValueToDouble(m_context,JSUtil::getProperty(m_context, geoObjRef, "longitude"));
+ if(ContentUtility::checkLocation(latitude, latitude)){
+ vedioPtr->setVideoLatitude(latitude);
+ vedioPtr->setVideoLongitude(longitude);
+ }
+ else{
+ ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "geolocation value is not valid.");
+ }
+ }
+ else
+ {
+ vedioPtr->setVideoLatitude(DEFAULT_GEOLOCATION);
+ vedioPtr->setVideoLongitude(DEFAULT_GEOLOCATION);
+ }
}
resultVector.push_back(JSMedia::getMediaObject(arg));
}
#include "ContentImage.h"
#include <Logger.h>
+
namespace DeviceAPI {
namespace Content {
{
m_editableAttrList.push_back("geolocation");
m_editableAttrList.push_back("orientation");
+ m_imageLongitude = DEFAULT_GEOLOCATION;
+ m_imageLatitude = DEFAULT_GEOLOCATION;
}
MediacontentImage::~MediacontentImage()
double MediacontentImage::getImageLongitude() const
{
- return m_imageLongitude;
-
+ return m_imageLongitude;
}
void MediacontentImage::setImageLatitude(const double &value, bool isChanged)
if ( MEDIA_CONTENT_ERROR_NONE == media_filter_create(&filter))
{
string condition="(FOLDER_STORAGE_TYPE = 0 OR FOLDER_STORAGE_TYPE = 1)";
- LoggerI("condition:" + condition);
+
media_filter_set_condition(filter, condition.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT ); //set condition
if ( MEDIA_CONTENT_ERROR_NONE !=
media_folder_foreach_folder_from_db (filter, mediaFolderCallback, eFolder.Get()))
condition += visitor->getResult();
}
- LoggerI("condition:" + condition);
+ //LoggerI("condition:" << condition);
+
media_filter_set_condition(filter, condition.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT ); //set condition
if(eBrowse->getSortModesIsSet())
namespace DeviceAPI {
namespace Content {
+const double DEFAULT_GEOLOCATION = -200;
+
typedef enum
{
MEDIA_TYPE_IMAGE = 1,
MEDIA_TYPE_UNKOWN = 4,
}media_type;
-
typedef vector<std::string> EditableAttributeList;
typedef DPL::SharedPtr<EditableAttributeList> EditableAttributeListPtr;
const string STR_EQUAL ("=");
const string STR_S_QUOTATION ("'");
const string STR_PERCENT ("%");
+const string STR_MIN_LATITUDE("-90");
+const string STR_MAX_LATITUDE("90");
+const string STR_MIN_LONGITUDE("-180");
+const string STR_MAX_LONGITUDE("180");
+
+
typedef enum
{
string operatorStr;
string conditionStr;
- condition_e cond;
string matchValueStr;
if(attrName.compare("MEDIA_TYPE")==0)
{
matchValueStr = ContentUtility::convertUriToPath(matchValue->getString());
}
+ else if(attrName.compare("MEDIA_LATITUDE")==0){
+ if(matchValue->getDouble() < MIN_LATITUDE ||
+ matchValue->getDouble() > MAX_LATITUDE)
+ {
+ ThrowMsg(PlatformException, "latitude range is -90 ~ 90");
+ }
+ else
+ {
+ matchValueStr = matchValue->toString();
+ }
+ }
+ else if(attrName.compare("MEDIA_LONGITUDE")==0){
+ if(matchValue->getDouble() < MIN_LONGITUDE||
+ matchValue->getDouble() > MAX_LONGITUDE)
+ {
+ ThrowMsg(PlatformException, "longitude range is -180 ~ 180");
+ }
+ else
+ {
+ matchValueStr = matchValue->toString();
+ }
+ }
else
{
matchValueStr = matchValue->toString();
{
valueStr = toDateDbStr(date);
}
- cond = EQUAL;
+ m_operationKey = EQUAL;
}
else
{
ostringstream os;
- if(matchFlag == MATCH_STARTSWITH)
- {
- cond = LIKE;
- os << STR_S_QUOTATION << matchValueStr << STR_PERCENT << STR_S_QUOTATION;
- }
- else if( matchFlag == MATCH_ENDSWITH )
- {
- cond = LIKE;
- os << STR_S_QUOTATION << STR_PERCENT << matchValueStr << STR_S_QUOTATION;
- }
- else if( matchFlag == MATCH_CONTAINS )
- {
- cond = LIKE;
- os << STR_S_QUOTATION << STR_PERCENT << matchValueStr << STR_PERCENT << STR_S_QUOTATION;
- }
- else
- {
- cond = EQUAL;
- os << STR_S_QUOTATION << matchValueStr << STR_S_QUOTATION;
- }
-
+ switch (matchFlag) {
+
+ case MATCH_CONTAINS:
+ m_operationKey = LIKE;
+ os << STR_S_QUOTATION << STR_PERCENT << matchValueStr << STR_PERCENT << STR_S_QUOTATION;
+ break;
+ case MATCH_STARTSWITH:
+ m_operationKey = LIKE;
+ os << STR_S_QUOTATION << matchValueStr << STR_PERCENT << STR_S_QUOTATION;
+ break;
+ case MATCH_ENDSWITH:
+ m_operationKey = LIKE;
+ os << STR_S_QUOTATION << STR_PERCENT << matchValueStr << STR_S_QUOTATION;
+ break;
+ case MATCH_FULLSTRING:
+ m_operationKey = FULLSTRING;
+ os << STR_S_QUOTATION << matchValueStr << STR_S_QUOTATION << " COLLATE NOCASE ";
+ break;
+ case MATCH_EXISTS:
+ m_operationKey = EXISTS;
+ break;
+ case MATCH_EXACTLY:
+ default:
+ m_operationKey = EQUAL;
+ os << STR_S_QUOTATION << matchValueStr << STR_S_QUOTATION;
+ }
+
valueStr = os.str();
}
- operatorStr = operatorKey[cond];
- conditionStr = STR_LEFT_BRACKET + attrName + operatorStr + valueStr + STR_RIGHT_BRACKET;
+
+ operatorStr = operatorKey[m_operationKey];
+
+ if( m_operationKey != EXISTS)
+ {
+ conditionStr = STR_LEFT_BRACKET + attrName + operatorStr + valueStr + STR_RIGHT_BRACKET;
+ }
+ else
+ {
+ conditionStr = STR_LEFT_BRACKET + attrName + operatorStr + STR_RIGHT_BRACKET;
+ }
return conditionStr;
}
+condition_e MediaSearchVisitor::getOperationKey()
+{
+ return m_operationKey;
+}
+
void MediaSearchVisitor::visitAttributeRange(string& attrName,AnyPtr& initialValue,AnyPtr& endValue,int depth)
{
if(initialValue->isType(PrimitiveType_Time))
{
tm date = *initialValue->getDateTm();
- if(attrName.compare("MEDIA_DATETAKEN")==0)
+ if(attrPlatform.compare("MEDIA_DATETAKEN")==0)
{
char buf[512];
strftime(buf, sizeof(buf), "'%Y:%m:%d %H:%M:%S'", &date);
}
else
{
- initialValueStr = initialValue->toString();
+ initialValueStr = initialValue->toString();
}
}
if(endValue->isType(PrimitiveType_Time))
{
tm date = *endValue->getDateTm();
- if(attrName.compare("MEDIA_DATETAKEN")==0)
+ if(attrPlatform.compare("MEDIA_DATETAKEN")==0)
{
char buf[512];
strftime(buf, sizeof(buf), "'%Y:%m:%d %H:%M:%S'", &date);
if (!initialValue->isNullOrUndefined() && endValue->isNullOrUndefined())
{
+ initialValueStr = initialValue->toString();
+ if(attrPlatform.compare("MEDIA_LATITUDE")==0)
+ {
+ if(initialValue->getDouble() < MIN_LATITUDE)
+ {
+ initialValueStr = STR_MIN_LATITUDE;
+ }
+ }
+ else if(attrPlatform.compare("MEDIA_LONGITUDE")==0)
+ {
+ if(initialValue->getDouble() < MIN_LONGITUDE)
+ {
+ initialValueStr = STR_MIN_LONGITUDE;
+ }
+ }
str = STR_LEFT_BRACKET + attrPlatform + STR_GREATER_THAN + STR_EQUAL +
STR_S_QUOTATION + initialValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET;
}
else if(initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined())
{
- str = STR_LEFT_BRACKET + attrPlatform + STR_LESS_THAN + STR_S_QUOTATION +
- endValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET;
+ if(attrPlatform.compare("MEDIA_LATITUDE")==0)
+ {
+ initialValueStr = STR_MIN_LATITUDE;
+ str = STR_LEFT_BRACKET + attrPlatform + STR_GREATER_THAN + STR_EQUAL + STR_S_QUOTATION +
+ initialValueStr + STR_S_QUOTATION + STR_AND + attrPlatform + STR_LESS_THAN + STR_S_QUOTATION +
+ endValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET;
+ }
+ else if(attrPlatform.compare("MEDIA_LONGITUDE")==0)
+ {
+ initialValueStr = STR_MIN_LONGITUDE;
+ str = STR_LEFT_BRACKET + attrPlatform + STR_GREATER_THAN + STR_EQUAL + STR_S_QUOTATION +
+ initialValueStr + STR_S_QUOTATION + STR_AND + attrPlatform + STR_LESS_THAN + STR_S_QUOTATION +
+ endValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET;
+ }
+ else
+ {
+ str = STR_LEFT_BRACKET + attrPlatform + STR_LESS_THAN + STR_S_QUOTATION +
+ endValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET;
+ }
}
else if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined())
{
- str = STR_LEFT_BRACKET + attrPlatform + STR_GREATER_THAN + STR_EQUAL + STR_S_QUOTATION +
- initialValueStr + STR_S_QUOTATION + STR_AND + attrPlatform + STR_LESS_THAN + STR_S_QUOTATION +
- endValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET;
+ if(attrPlatform.compare("MEDIA_LATITUDE")==0)
+ {
+ if(initialValue->getDouble() < MIN_LATITUDE)
+ {
+ initialValueStr = STR_MIN_LATITUDE;
+ }
+ }
+ else if(attrPlatform.compare("MEDIA_LONGITUDE")==0)
+ {
+ if(initialValue->getDouble() < MIN_LONGITUDE)
+ {
+ initialValueStr = STR_MIN_LONGITUDE;
+ }
+ }
+ str = STR_LEFT_BRACKET + attrPlatform + STR_GREATER_THAN + STR_EQUAL + STR_S_QUOTATION +
+ initialValueStr + STR_S_QUOTATION + STR_AND + attrPlatform + STR_LESS_THAN + STR_S_QUOTATION +
+ endValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET;
}
m_query.append(str);
typedef enum
{
- EQUAL,
- NOT_EQUAL,
- GREATER_THAN,
- LESS_THAN,
- GREATER_THAN_OR_EQUAL,
- LESS_THAN_OR_EQUAL,
- LIKE,
- EXISTS,
- CONDITION_MAX
+ EQUAL,
+ NOT_EQUAL,
+ GREATER_THAN,
+ LESS_THAN,
+ GREATER_THAN_OR_EQUAL,
+ LESS_THAN_OR_EQUAL,
+ LIKE,
+ FULLSTRING,
+ EXISTS,
+ CONDITION_MAX
}condition_e;
static string operatorKey[] =
{
- " = ",
- " NOT IN ", //!=
- " > ",
- " < ",
- " >= ",
- " <= ",
- " LIKE " // like
+ " = ", //EQUAL
+ " NOT IN ", //NOT_EQUAL
+ " > ", //GREATER_THAN
+ " < ", //LESS_THAN
+ " >= ", //GREATER_THAN_OR_EQUAL
+ " <= ", //LESS_THAN_OR_EQUAL
+ " LIKE ", // like
+ " = ", //fullstring
+ " is not null " //EXISTS
};
class MediaSearchVisitor : public DeviceAPI::Tizen::IFilterVisitor
{
public:
- typedef enum _QueryType { QUERY_FOLDER, QUERY_MEDIA } QueryType;
+ typedef enum _QueryType { QUERY_FOLDER, QUERY_MEDIA } QueryType;
-
- MediaSearchVisitor();
- virtual ~MediaSearchVisitor();
- virtual void visitPreComposite(FilterType& type, int depth);
- virtual void visitInComposite(FilterType& type, int depth);
- virtual void visitPostComposite(FilterType& type, int depth);
- virtual void visitAttribute(string& attrName, MatchFlag& matchFlag, AnyPtr& matchValue, int depth);
- virtual void visitAttributeRange(string& attrName,AnyPtr& initialValue,AnyPtr& endValue,int depth);
+ MediaSearchVisitor();
+ virtual ~MediaSearchVisitor();
+
+ virtual void visitPreComposite(FilterType& type, int depth);
+ virtual void visitInComposite(FilterType& type, int depth);
+ virtual void visitPostComposite(FilterType& type, int depth);
+ virtual void visitAttribute(string& attrName, MatchFlag& matchFlag, AnyPtr& matchValue, int depth);
+ virtual void visitAttributeRange(string& attrName,AnyPtr& initialValue,AnyPtr& endValue,int depth);
- string getPlatformAttr(string attrName);
- string getResult() const;
+ string getPlatformAttr(string attrName);
+ string getResult() const;
+ condition_e getOperationKey();
- void setQueryType(QueryType value);
+ void setQueryType(QueryType value);
private:
- string toDateDbStr(tm &date) const;
- string convertAttribute(string &attrname, AnyPtr& matchValue, MatchFlag& matchFlag);
+ string toDateDbStr(tm &date) const;
+ string convertAttribute(string &attrname, AnyPtr& matchValue, MatchFlag& matchFlag);
private:
- QueryType queryType;
- string m_query;
- static map<string, string> attrFolderEnumMap;
- static map<string, string> attrMediaEnumMap;
+ condition_e m_operationKey;
+ QueryType queryType;
+ string m_query;
+ static map<string, string> attrFolderEnumMap;
+ static map<string, string> attrMediaEnumMap;
- vector<string> m_condition;
+ vector<string> m_condition;
};
#include "ContentUtility.h"
#include <Commons/Regex.h>
+
namespace DeviceAPI {
namespace Content {
return str;
}
+bool ContentUtility::checkLocation(double lati, double longi)
+{
+ bool ret = true;
+ if(lati < MIN_LATITUDE || lati > MAX_LATITUDE ||
+ longi < MIN_LONGITUDE || longi > MAX_LONGITUDE){
+ ret = false;
+ }
+ return ret;
+}
+
} // Content
} // DeviceAPI
#include <string>
+const double MAX_LATITUDE = 90;
+const double MIN_LATITUDE = -90;
+const double MAX_LONGITUDE = 180;
+const double MIN_LONGITUDE = -180;
+
namespace DeviceAPI {
namespace Content {
static std::string convertUriToPath(const std::string str);
static std::string convertPathToUri(const std::string str);
-
+ static bool checkLocation(double lati, double longi);
private:
static std::string ltrim(const std::string s);
MediacontentVideo::MediacontentVideo()
{
m_editableAttrList.push_back("geolocation");
-
+ m_videoLongitude = DEFAULT_GEOLOCATION;
+ m_videoLatitude = DEFAULT_GEOLOCATION;
}
MediacontentVideo::~MediacontentVideo()
virtual vector<std::string> getEditableAttr() const;
private:
- double m_videoLongitude;
+ double m_videoLongitude;
double m_videoLatitude;
string m_videoAlbum;
vector<std::string> m_videoArtist;
}
-bool JSMedia::setPropertyDisplayName(
+bool JSMedia::setPropertyDisplayName(
JSContextRef context,
JSObjectRef object,
JSStringRef propertyName,
MediacontentMediaPtr objMedia = getMediaObject(object);
string displayName = converter.toString(value);
- if ((objMedia->getDescription()).compare(displayName) != 0)
+ if ((objMedia->getDisplayName()).compare(displayName) != 0)
{
objMedia->setDisplayName(displayName, true);
}
return false;
}
-bool JSMedia::setPropertyDescription(
+bool JSMedia::setPropertyDescription(
JSContextRef context,
JSObjectRef object,
JSStringRef propertyName,
IEventUpdateMediaPtr dplEvent(new IEventUpdateMedia());
if(JSValueIsObjectOfClass(context, arguments[0], JSImage::getClassRef())){
- JSValueRef geoValRef = JSUtil::getProperty(context , JSUtil::JSValueToObject(context, arguments[0]), "geolocation");
- JSObjectRef geoObjRef = JSUtil::JSValueToObject(context, geoValRef);
- double latitude = JSUtil::JSValueToDouble(context, JSUtil::getProperty(context, geoObjRef, "latitude"));
- double longitude = JSUtil::JSValueToDouble(context, JSUtil::getProperty(context, geoObjRef, "longitude"));
-
MediacontentImagePtr imgPtr = JSImage::getImageObject(arg);
- imgPtr->setImageLatitude(latitude);
- imgPtr->setImageLongitude(longitude);
+ JSValueRef geoValRef = JSUtil::getProperty(context , JSUtil::JSValueToObject(context, arguments[0]), "geolocation");
+ if(!(JSValueIsNull(context, geoValRef) || JSValueIsUndefined(context, geoValRef))){
+ JSObjectRef geoObjRef = JSUtil::JSValueToObject(context, geoValRef);
+ double latitude = JSUtil::JSValueToDouble(context, JSUtil::getProperty(context, geoObjRef, "latitude"));
+ double longitude = JSUtil::JSValueToDouble(context, JSUtil::getProperty(context, geoObjRef, "longitude"));
+ if(ContentUtility::checkLocation(latitude, latitude)){
+ imgPtr->setImageLatitude(latitude);
+ imgPtr->setImageLongitude(longitude);
+ }
+ else{
+ ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "geolocation value is not valid.");
+ }
+ }
+ else
+ {
+ imgPtr->setImageLatitude(DEFAULT_GEOLOCATION);
+ imgPtr->setImageLongitude(DEFAULT_GEOLOCATION);
+ }
}
else if(JSValueIsObjectOfClass(context, arguments[0], JSVideo::getClassRef())){
- JSValueRef geoValRef = JSUtil::getProperty(context , JSUtil::JSValueToObject(context, arguments[0]), "geolocation");
- JSObjectRef geoObjRef = JSUtil::JSValueToObject(context, geoValRef);
-
- double latitude = JSUtil::JSValueToDouble(context, JSUtil::getProperty(context, geoObjRef, "latitude"));
-
- double longitude = JSUtil::JSValueToDouble(context, JSUtil::getProperty(context, geoObjRef, "longitude"));
-
MediacontentVideoPtr vedioPtr = JSVideo::getVideoObject(arg);
- vedioPtr->setVideoLatitude(latitude);
- vedioPtr->setVideoLongitude(longitude);
+ JSValueRef geoValRef = JSUtil::getProperty(context , JSUtil::JSValueToObject(context, arguments[0]), "geolocation");
+ if(!(JSValueIsNull(context, geoValRef) || JSValueIsUndefined(context, geoValRef))){
+ JSObjectRef geoObjRef = JSUtil::JSValueToObject(context, geoValRef);
+ double latitude = JSUtil::JSValueToDouble(context, JSUtil::getProperty(context, geoObjRef, "latitude"));
+ double longitude = JSUtil::JSValueToDouble(context, JSUtil::getProperty(context, geoObjRef, "longitude"));
+ if(ContentUtility::checkLocation(latitude, latitude)){
+ vedioPtr->setVideoLatitude(latitude);
+ vedioPtr->setVideoLongitude(longitude);
+ }
+ else{
+ ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "geolocation value is not valid.");
+ }
+ }
+ else
+ {
+ vedioPtr->setVideoLatitude(DEFAULT_GEOLOCATION);
+ vedioPtr->setVideoLongitude(DEFAULT_GEOLOCATION);
+ }
}
event = JSMedia::getMediaObject(arg);
}
else {
MediacontentImagePtr image = getImageObject(object);
- DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(image->getImageLatitude(),image->getImageLongitude()));
- JSUtil::setProperty(context, object, TIZEN_CONTENT_IMAGE_GEOLOCATION,
- JSSimpleCoordinates::createJSObject(context,geoPtr),
- kJSPropertyAttributeNone);
+ if(image->getImageLatitude() != DEFAULT_GEOLOCATION &&
+ image->getImageLongitude() != DEFAULT_GEOLOCATION){
+ DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(image->getImageLatitude(),image->getImageLongitude()));
+ JSUtil::setProperty(context, object, TIZEN_CONTENT_IMAGE_GEOLOCATION,
+ JSSimpleCoordinates::createJSObject(context,geoPtr),
+ kJSPropertyAttributeNone);
+ }
+ else
+ {
+ JSUtil::setProperty(context, object, TIZEN_CONTENT_IMAGE_GEOLOCATION,
+ JSValueMakeNull(context),kJSPropertyAttributeNone);
+ }
}
}
{
Converter converter(context);
MediacontentImagePtr image = getImageObject(object);
- DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(image->getImageLatitude(),image->getImageLongitude()));
- return JSSimpleCoordinates::createJSObject(context,geoPtr);
-
+ if(image->getImageLatitude() != DEFAULT_GEOLOCATION &&
+ image->getImageLongitude() != DEFAULT_GEOLOCATION){
+ DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(image->getImageLatitude(),image->getImageLongitude()));
+ return JSSimpleCoordinates::createJSObject(context,geoPtr);
+ }
}
Catch(Exception)
{
}
else {
LoggerD("private object already exists");
- MediacontentVideoPtr video = getVideoObject(object);
- DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(video->getVideoLatitude(),video->getVideoLongitude()));
- JSUtil::setProperty(context, object, TIZEN_CONTENT_VIDEO_GEOLOCATION,
- JSSimpleCoordinates::createJSObject(context,geoPtr),
- kJSPropertyAttributeNone);
+ MediacontentVideoPtr video = getVideoObject(object);
+ if(video->getVideoLatitude() != DEFAULT_GEOLOCATION &&
+ video->getVideoLongitude() != DEFAULT_GEOLOCATION){
+ DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(video->getVideoLatitude(),video->getVideoLongitude()));
+ JSUtil::setProperty(context, object, TIZEN_CONTENT_VIDEO_GEOLOCATION,
+ JSSimpleCoordinates::createJSObject(context,geoPtr),
+ kJSPropertyAttributeNone);
+ }
+ else
+ {
+ JSUtil::setProperty(context, object, TIZEN_CONTENT_VIDEO_GEOLOCATION,
+ JSValueMakeNull(context),kJSPropertyAttributeNone);
+ }
}
}
{
Converter converter(context);
MediacontentVideoPtr video = getVideoObject(object);
- SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(video->getVideoLatitude(),video->getVideoLongitude()));
- return JSSimpleCoordinates::createJSObject(context,geoPtr);
+ if(video->getVideoLatitude() != DEFAULT_GEOLOCATION &&
+ video->getVideoLongitude() != DEFAULT_GEOLOCATION){
+ SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(video->getVideoLatitude(),video->getVideoLongitude()));
+ return JSSimpleCoordinates::createJSObject(context,geoPtr);
+ }
}
Catch(Exception)
{
ret = msg_get_message(handle, tempMsgId, msgInfo, sendOpt);
+ if(ret == MSG_ERR_STORAGE_ERROR)
+ {
+ int retryCount = 0;
+ while (retryCount < 2 && ret != MSG_SUCCESS) {
+ LoggerD("retry msg_get_message for MSG_ERR_STORAGE_ERROR");
+ usleep(300 * 1000);
+ ret = msg_get_message(handle, tempMsgId, msgInfo, sendOpt);
+ retryCount++;
+ }
+ }
+
if (ret != MSG_SUCCESS)
{
LoggerD("ret " << ret);
- ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get message fail");
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "get message fail");
}
msg_get_int_value(msgInfo, MSG_MESSAGE_DIRECTION_INT, &tempInt);
}
}
+ catch (const WrtDeviceApis::Commons::PlatformException& ex)
+ {
+ LoggerE("Exception: " << ex.GetMessage());
+ msg_release_list_struct(&convViewList);
+ if(msgInfo != NULL)
+ {
+ msg_release_struct(&msgInfo);
+ }
+ if(sendOpt != NULL)
+ {
+ msg_release_struct(&sendOpt);
+ }
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "make conversation error");
+ }
catch (const WrtDeviceApis::Commons::Exception& ex)
{
m_result = false;
std::vector<IConversationPtr> Messaging::createVectorFromeThreadViewList(const msg_struct_list_s& threadViewList){
vector<IConversationPtr> recVec;
- if (threadViewList.nCount <= 0) {
+ if (threadViewList.nCount <= 0) {
LoggerD("Empty...");
- } else {
- for (int i = 0; i < threadViewList.nCount; i++) {
-// IConversationPtr convPtr(new Conversation(i));
- IConversationPtr convPtr(new Conversation(threadViewList.msg_struct_info[i]));
-
- recVec.push_back(convPtr);
+ }
+ else {
+ for (int i = 0; i < threadViewList.nCount; i++)
+ {
+ try
+ {
+ IConversationPtr convPtr(new Conversation(threadViewList.msg_struct_info[i]));
+ recVec.push_back(convPtr);
+ }
+ catch (const WrtDeviceApis::Commons::Exception& ex)
+ {
+ LoggerD("make conversation error for element " << i);
+ continue;
+ }
}
}
msg_struct_t Mms::createNewCopyOfPLatformMsgWithAddressList(const msg_struct_t src) const
{
- int tempInt, nCount;
+ int tempInt, nCount, ret;
bool tempBool;
msg_struct_list_s *addr_list;
msg_struct_list_s *new_addr_list;
- int pageLen, mediaLen, attachLen, ret;
-
msg_struct_t mms_struct = NULL;
msg_struct_t mms_struct_dummy = 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;
- msg_struct_t attach = NULL;
-
- char szFilePath[MSG_FILEPATH_LEN_MAX] = {0,};
- char szFileName[MSG_FILENAME_LEN_MAX] = {0,};
-
msg_struct_t msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
msg_set_int_value(msg, MSG_MESSAGE_TYPE_INT, MSG_TYPE_MMS);
// copy mms body and attachment
mms_struct = msg_create_struct(MSG_STRUCT_MMS);
mms_struct_dummy = msg_create_struct(MSG_STRUCT_MMS);
- msg_get_mms_struct(src, mms_struct);
+ ret = msg_get_mms_struct(src, mms_struct);
+ if (ret != MSG_SUCCESS)
+ {
+ LoggerE("cannot get mms struct");
+ ThrowMsg(WrtDeviceApis::Commons::PlatformException, "cannot get mms struct");
+ }
msg_set_mms_struct(src, mms_struct_dummy);
msg_set_mms_struct(msg, mms_struct);
- msg_release_struct(&mms_struct);
msg_get_int_value(src, MSG_MESSAGE_DISPLAY_TIME_INT, &tempInt);
msg_set_int_value(msg, MSG_MESSAGE_DISPLAY_TIME_INT, tempInt);
msg_set_int_value(new_addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, tempInt);
}
+ msg_release_struct(&mms_struct_dummy);
+ msg_release_struct(&mms_struct);
+
return msg;
}
EventGetSysteminfoPtr event = pendingEvent->getEvent();
if (access_rt == TAPI_SIM_ACCESS_SUCCESS) {
- if (cphsInfo->full_name) {
- systeminfo->setSimValue(SIM_CPHS_VALUE, (char *)cphsInfo->full_name, event);
- } else if (cphsInfo->short_name) {
+ if(strlen((const char*)cphsInfo->full_name) == 0) {
+ systeminfo->setSimValue(SIM_CPHS_VALUE, (char *)cphsInfo->full_name, event);
+ } else if (strlen((const char*)cphsInfo->short_name) == 0) {
systeminfo->setSimValue(SIM_CPHS_VALUE, (char *)cphsInfo->short_name, event);
} else {
systeminfo->setSimValue(SIM_CPHS_VALUE, NULL, event);
simState = strdup("UNKNOWN");
break;
}
- LoggerD("simState : " << simState);
event->setSimState(simState);
if(strcmp(simState, "READY") == 0) {
if (tel_get_sim_imsi(m_tapiHandle, &imsi) == TAPI_API_SUCCESS) {
event->makeSimObject();
EventRequestReceiver<EventGetSysteminfo>::ManualAnswer(event);
}
- if (simState)
+ if (simState) {
+ LoggerD("simState : " << simState);
free(simState);
+ }
} else {
LoggerE("get fail sim state");
event->makeSimObject();