summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongjin Choi <milkelf.choi@samsung.com>2013-06-19 21:35:45 +0900
committerDongjin Choi <milkelf.choi@samsung.com>2013-06-19 21:35:45 +0900
commitb8c7c1cb164e3a6a9b165f3ef1f785fff789a34a (patch)
tree2db918545ec60dd483aee65602a0174db5d9b311
parent9a7fa665d243067965f911d2c623d66cde739960 (diff)
downloadwrt-plugins-tizen-b8c7c1cb164e3a6a9b165f3ef1f785fff789a34a.tar.gz
wrt-plugins-tizen-b8c7c1cb164e3a6a9b165f3ef1f785fff789a34a.tar.bz2
wrt-plugins-tizen-b8c7c1cb164e3a6a9b165f3ef1f785fff789a34a.zip
Update change log and spec for wrt-plugins-tizen_0.4.43
[model] REDWOOD [binary_type] PDA [customer] OPEN [Issue#] CID 56765 [Problem] There is dereferencing a pointer. [Solution] Fixed the dereferencing a pointer. [Systeminfo] Fix TCT issue(storage property) [Systeminfo] Chanage getDeviceCapabilities API code [NBS] Fix TCT issue(manual tc) [Issue#] N/A [Problem] A crash and wrong sync statistics after syncing with the funambol server. [Cause] Unexpected DS callback parameters and data from platform. [Solution] Add defense codes and revise sync statistics handling routine. [Issue] DCM 2017 [Problem] crash when callback is invoked. [Cause] Appcontrol launch is failed, but remote app is launched. [Solution] check event value. [Issue] CID-60382 [Problem] Array compared against 0 [Cause] Comparing an array to null is not useful [Solution] Check array is empty [Issue] N/A [Problem] Account Name and email sender address bug fix [Cause] Account Name and email sender address bug fix [Solution] Account Name and email sender address bug fix [Issue] N/A [Problem] remove assert function [Cause] remove assert function [Solution] remove assert function [team] WebAPI [request] N/A [horizontal_expansion] N/A
-rwxr-xr-xpackaging/wrt-plugins-tizen.spec4
-rwxr-xr-xsrc/Callhistory/CallHistory.cpp7
-rw-r--r--src/DataControl/SqlDataControlConsumer.cpp28
-rwxr-xr-xsrc/DataSync/DataSyncManager.cpp24
-rwxr-xr-xsrc/DataSync/SyncStatistics.cpp2
-rwxr-xr-xsrc/DataSync/SyncStatistics.h3
-rwxr-xr-xsrc/Filesystem/EventResolve.cpp11
-rwxr-xr-xsrc/Filesystem/EventResolve.h4
-rwxr-xr-xsrc/Filesystem/INode.h1
-rw-r--r--src/Filesystem/JSFilesystemManager.cpp10
-rw-r--r--src/Filesystem/Manager.cpp7
-rw-r--r--src/Filesystem/Node.cpp75
-rwxr-xr-xsrc/Filesystem/Node.h3
-rw-r--r--src/Filesystem/ResponseDispatcher.cpp6
-rw-r--r--src/Messaging/Conversation.cpp2
-rw-r--r--src/Messaging/ConverterMessage.cpp5
-rw-r--r--src/Messaging/Email.cpp29
-rw-r--r--src/Messaging/EmailService.cpp6
-rwxr-xr-xsrc/Messaging/EmailUtils.cpp15
-rw-r--r--src/Messaging/JSMessage.cpp1
-rw-r--r--src/Messaging/MailSender.cpp6
-rw-r--r--src/Messaging/MailSync.cpp11
-rw-r--r--src/Messaging/Messaging.cpp6
-rw-r--r--src/Messaging/MessagingController.cpp7
-rw-r--r--src/Messaging/MessagingListener.cpp56
-rw-r--r--src/Messaging/MessagingServiceManager.cpp4
-rwxr-xr-xsrc/Messaging/NetworkStatus.cpp7
-rw-r--r--src/Messaging/ReqReceiverMessage.cpp4
-rw-r--r--src/Messaging/SyncNetworkStatus.cpp7
-rwxr-xr-x[-rw-r--r--]src/NetworkBearerSelection/NetworkBearerSelection.cpp14
-rwxr-xr-xsrc/Systeminfo/CMakeLists.txt1
-rwxr-xr-xsrc/Systeminfo/EventWatchSysteminfo.cpp19
-rwxr-xr-xsrc/Systeminfo/EventWatchSysteminfo.h2
-rwxr-xr-xsrc/Systeminfo/JSDeviceCapabilitiesInfo.cpp6
-rwxr-xr-x[-rw-r--r--]src/Systeminfo/JSStorageInfo.cpp46
-rwxr-xr-xsrc/Systeminfo/JSStorageUnitInfo.cpp135
-rwxr-xr-xsrc/Systeminfo/JSStorageUnitInfo.h48
-rwxr-xr-xsrc/Systeminfo/Systeminfo.cpp65
-rwxr-xr-xsrc/Systeminfo/SysteminfoPropertyInfo.h17
39 files changed, 542 insertions, 162 deletions
diff --git a/packaging/wrt-plugins-tizen.spec b/packaging/wrt-plugins-tizen.spec
index 2de7855..89e6274 100755
--- a/packaging/wrt-plugins-tizen.spec
+++ b/packaging/wrt-plugins-tizen.spec
@@ -1,7 +1,7 @@
Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.42
-Release: 2
+Version: 0.4.43
+Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
Source0: %{name}-%{version}.tar.gz
diff --git a/src/Callhistory/CallHistory.cpp b/src/Callhistory/CallHistory.cpp
index 1f7a309..9b4350b 100755
--- a/src/Callhistory/CallHistory.cpp
+++ b/src/Callhistory/CallHistory.cpp
@@ -769,8 +769,11 @@ void CallHistory::Watcher::ListenerCB(char* changes)
while( tokenType != NULL )
{
tokenId = strtok( NULL, seps );
- changeType = atoi((const char*)tokenType);
- changeId = atoi((const char*)tokenId);
+
+ if(tokenType!=NULL)
+ changeType = atoi((const char*)tokenType);
+ if(tokenId != NULL)
+ changeId = atoi((const char*)tokenId);
contacts_query_h query = NULL;
diff --git a/src/DataControl/SqlDataControlConsumer.cpp b/src/DataControl/SqlDataControlConsumer.cpp
index fd22114..3a893e0 100644
--- a/src/DataControl/SqlDataControlConsumer.cpp
+++ b/src/DataControl/SqlDataControlConsumer.cpp
@@ -162,6 +162,13 @@ static void sqldataControlSelectCallback(bundle* b, int request_code, appsvc_res
catch (const WrtDeviceApis::Commons::Exception& ex)
{
LoggerE("Exception: " << ex.GetMessage());
+
+ if (event.Get() == NULL)
+ {
+ LoggerD("event removed, invalid cb");
+ return;
+ }
+
event->setExceptionCode(ex.getCode());
event->setErrorMsg(ex.GetMessage());
}
@@ -241,6 +248,13 @@ static void sqldataControlInsertCallback(bundle* b, int request_code, appsvc_res
catch (const WrtDeviceApis::Commons::Exception& ex)
{
LoggerE("Exception: " << ex.GetMessage());
+
+ if (event.Get() == NULL)
+ {
+ LoggerD("event removed, invalid cb");
+ return;
+ }
+
event->setExceptionCode(ex.getCode());
event->setErrorMsg(ex.GetMessage());
}
@@ -314,6 +328,13 @@ static void sqldataControlDeleteCallback(bundle* b, int request_code, appsvc_res
catch (const WrtDeviceApis::Commons::Exception& ex)
{
LoggerE("Exception: " << ex.GetMessage());
+
+ if (event.Get() == NULL)
+ {
+ LoggerD("event removed, invalid cb");
+ return;
+ }
+
event->setExceptionCode(ex.getCode());
event->setErrorMsg(ex.GetMessage());
}
@@ -385,6 +406,13 @@ static void sqldataControlUpdateCallback(bundle* b, int request_code, appsvc_res
catch (const WrtDeviceApis::Commons::Exception& ex)
{
LoggerE("Exception: " << ex.GetMessage());
+
+ if (event.Get() == NULL)
+ {
+ LoggerD("event removed, invalid cb");
+ return;
+ }
+
event->setExceptionCode(ex.getCode());
event->setErrorMsg(ex.GetMessage());
}
diff --git a/src/DataSync/DataSyncManager.cpp b/src/DataSync/DataSyncManager.cpp
index ff33873..86bcaf7 100755
--- a/src/DataSync/DataSyncManager.cpp
+++ b/src/DataSync/DataSyncManager.cpp
@@ -397,7 +397,7 @@ static SyncStatistics::SyncStatus convertToSyncStatus(char* status)
LoggerW("Error while converting a sync status.");
}
- return SyncStatistics::UNDEFINED_STATUS;
+ return SyncStatistics::NONE_STATUS;
}
void DataSyncManager::OnRequestReceived(const IEventAddProfilePtr &event)
@@ -1079,15 +1079,19 @@ void DataSyncManager::OnRequestReceived(const IEventGetLastSyncStatisticsPtr &ev
}
LoggerD("dbsynced: "<<statistics->dbsynced);
- statisticsPtr->setSyncStatus(convertToSyncStatus(statistics->dbsynced));
- statisticsPtr->setClientToServerTotal(statistics->client2server_total);
- statisticsPtr->setClientToServerAdded(statistics->client2server_nrofadd);
- statisticsPtr->setClientToServerUpdated(statistics->client2server_nrofreplace);
- statisticsPtr->setClientToServerRemoved(statistics->client2server_nrofdelete);
- statisticsPtr->setServerToClientTotal(statistics->server2client_total);
- statisticsPtr->setServerToClientAdded(statistics->server2client_nrofadd);
- statisticsPtr->setServerToClientUpdated(statistics->server2client_nrofreplace);
- statisticsPtr->setServerToClientRemoved(statistics->server2client_nrofdelete);
+ if (statistics->dbsynced) {
+ statisticsPtr->setSyncStatus(convertToSyncStatus(statistics->dbsynced));
+ statisticsPtr->setClientToServerTotal(statistics->client2server_total);
+ statisticsPtr->setClientToServerAdded(statistics->client2server_nrofadd);
+ statisticsPtr->setClientToServerUpdated(statistics->client2server_nrofreplace);
+ statisticsPtr->setClientToServerRemoved(statistics->client2server_nrofdelete);
+ statisticsPtr->setServerToClientTotal(statistics->server2client_total);
+ statisticsPtr->setServerToClientAdded(statistics->server2client_nrofadd);
+ statisticsPtr->setServerToClientUpdated(statistics->server2client_nrofreplace);
+ statisticsPtr->setServerToClientRemoved(statistics->server2client_nrofdelete);
+
+ statisticsPtr->setLastSyncTime((long long int) (statistics->last_session_time));
+ }
LoggerD("ClientToServerTotal: "<<statisticsPtr->getClientToServerTotal()<<", ServerToClientTotal: "<<statisticsPtr->getServerToClientTotal());
diff --git a/src/DataSync/SyncStatistics.cpp b/src/DataSync/SyncStatistics.cpp
index 62b0c2d..c8a183b 100755
--- a/src/DataSync/SyncStatistics.cpp
+++ b/src/DataSync/SyncStatistics.cpp
@@ -23,7 +23,7 @@ namespace DataSync {
SyncStatistics::SyncStatistics()
{
- m_syncStatus = UNDEFINED_STATUS;
+ m_syncStatus = NONE_STATUS;
m_serviceType = SyncServiceInfo::UNDEFINED_SERVICE_TYPE;
m_lastSyncTime = UNDEFILED_TIME;
m_serverToClientTotal = 0;
diff --git a/src/DataSync/SyncStatistics.h b/src/DataSync/SyncStatistics.h
index 1b54524..9dd5634 100755
--- a/src/DataSync/SyncStatistics.h
+++ b/src/DataSync/SyncStatistics.h
@@ -37,8 +37,7 @@ class SyncStatistics
SUCCESS_STATUS,
FAIL_STATUS,
STOP_STATUS,
- NONE_STATUS,
- UNDEFINED_STATUS
+ NONE_STATUS
} SyncStatus;
SyncStatistics();
diff --git a/src/Filesystem/EventResolve.cpp b/src/Filesystem/EventResolve.cpp
index 7750d8b..52572b1 100755
--- a/src/Filesystem/EventResolve.cpp
+++ b/src/Filesystem/EventResolve.cpp
@@ -22,6 +22,7 @@ namespace DeviceAPI {
namespace Filesystem {
EventResolve::EventResolve(const IPathPtr& path) : m_path(path)
{
+ m_mode = "rw";
}
IPathPtr EventResolve::getPath() const
@@ -38,5 +39,15 @@ void EventResolve::setResult(const INodePtr& node)
{
m_node = node;
}
+
+void EventResolve::setMode(const std::string &mode)
+{
+ m_mode = mode;
+}
+std::string EventResolve::getMode()
+{
+ return m_mode;
+}
+
} // Filesystem
} // TizenApis \ No newline at end of file
diff --git a/src/Filesystem/EventResolve.h b/src/Filesystem/EventResolve.h
index b73f151..0f61331 100755
--- a/src/Filesystem/EventResolve.h
+++ b/src/Filesystem/EventResolve.h
@@ -55,9 +55,13 @@ class EventResolve : public WrtDeviceApis::Commons::IEvent<EventResolve>
*/
void setResult(const INodePtr& node);
+ void setMode(const std::string &mode);
+ std::string getMode();
+
private:
IPathPtr m_path; ///< Path to the requested node.
INodePtr m_node; ///< Resolved node.
+ std::string m_mode;
};
typedef DPL::SharedPtr<EventResolve> EventResolvePtr;
diff --git a/src/Filesystem/INode.h b/src/Filesystem/INode.h
index 91ca0b0..e6b3611 100755
--- a/src/Filesystem/INode.h
+++ b/src/Filesystem/INode.h
@@ -176,6 +176,7 @@ class INode : public WrtDeviceApis::Commons::EventRequestReceiver<EventListNodes
virtual void read(const EventReadTextPtr& event) = 0;
virtual std::string toUri(int widgetId) const = 0;
+ virtual bool checkPermission(const IPathPtr& path, const std::string &mode, NodeType type) = 0;
protected:
INode();
diff --git a/src/Filesystem/JSFilesystemManager.cpp b/src/Filesystem/JSFilesystemManager.cpp
index 2e98386..fbaa582 100644
--- a/src/Filesystem/JSFilesystemManager.cpp
+++ b/src/Filesystem/JSFilesystemManager.cpp
@@ -543,15 +543,16 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
virtualPath = converter->toString(reserveArguments[0]);
LoggerD("virtualPath:[" << virtualPath << "]");
int permissions = PERM_READ | PERM_WRITE;
+ std::string perm = "rw";
if (argc > 3) {
- std::string perms = converter->toString(reserveArguments[3]);
- LoggerD("perms:[" << perms << "]");
- if (("r" != perms) && ("rw" != perms) && ("w" != perms) && ("a" != perms)) {
+ perm = converter->toString(reserveArguments[3]);
+ LoggerD("perms:[" << perm << "]");
+ if (("r" != perm) && ("rw" != perm) && ("w" != perm) && ("a" != perm)) {
return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Invalid permission");
- } else if ("r" == perms) {
+ } else if ("r" == perm) {
permissions = PERM_READ;
}
}
@@ -570,6 +571,7 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
EventGetNodeDataPtr data(new EventGetNodeData(permissions, cbm));
EventResolvePtr event(new EventResolve(path));
event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
+ event->setMode(perm);
event->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData > (data));
FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
diff --git a/src/Filesystem/Manager.cpp b/src/Filesystem/Manager.cpp
index 4fdf5f5..1518351 100644
--- a/src/Filesystem/Manager.cpp
+++ b/src/Filesystem/Manager.cpp
@@ -421,7 +421,12 @@ bool Manager::matchFilters(const std::string& name,
void Manager::OnRequestReceived(const EventResolvePtr& event)
{
try {
- event->setResult(Node::resolve(event->getPath()));
+ INodePtr node = Node::resolve(event->getPath());
+ if (node->checkPermission(event->getPath(), event->getMode(), node->getType()) == false)
+ {
+ ThrowMsg(Commons::SecurityException, "Permission Denied Error");
+ }
+ event->setResult(node);
}
catch (const Commons::Exception& ex)
{
diff --git a/src/Filesystem/Node.cpp b/src/Filesystem/Node.cpp
index 9e72030..30b07cd 100644
--- a/src/Filesystem/Node.cpp
+++ b/src/Filesystem/Node.cpp
@@ -44,6 +44,79 @@ namespace DeviceAPI {
namespace Filesystem {
#define MAX_NODE_LENGTH 256
+bool Node::checkPermission(const IPathPtr &path, const std::string &mode, NodeType type)
+{
+ switch (type)
+ {
+ case NT_DIRECTORY:
+ {
+ DIR* dir = opendir(path->getFullPath().c_str());
+
+ if (!dir)
+ ThrowMsg(Commons::SecurityException, "Node has been deleted from platform.");
+
+ if (closedir(dir) != 0)
+ ThrowMsg(Commons::SecurityException, "Could not close platform node.");
+
+ LoggerD("open/close dir ok");
+
+
+ if (mode == "r")
+ return true;
+
+ std::stringstream ss;
+ time_t now;
+ time(&now);
+ ss << now;
+ IPathPtr tempFilePath = IPath::create(path->getFullPath());
+ tempFilePath->append(ss.str());
+ try
+ {
+ createAsFileInternal(tempFilePath);
+ removeAsFile(tempFilePath);
+ }
+ catch (const Commons::Exception& ex)
+ {
+ LoggerE("Exception: " << ex.GetMessage());
+ return false;
+ }
+
+ if (mode == "rw" || mode == "w" || mode == "a")
+ return true;
+ ThrowMsg(Commons::InvalidArgumentException, "invalid mode");
+ }
+ break;
+ case NT_FILE:
+ {
+ std::fstream stream;
+ std::ios_base::openmode modeBit = std::fstream::binary;
+
+ if (mode == "r")
+ {
+ modeBit |= std::fstream::in;
+ }
+ else if (mode == "rw" || mode == "w" || mode == "a")
+ {
+ modeBit |= std::fstream::app;
+ }
+ else
+ {
+ ThrowMsg(Commons::InvalidArgumentException, "invalid mode");
+ }
+
+ stream.open(path->getFullPath().c_str(), modeBit);
+
+ if (stream.is_open())
+ {
+ stream.close();
+ return true;
+ }
+ return false;
+ }
+ break;
+ }
+ return false;
+}
INodePtr Node::resolve(const IPathPtr& path)
{
@@ -56,7 +129,7 @@ INodePtr Node::resolve(const IPathPtr& path)
switch (errno)
{
case EACCES:
- ThrowMsg(Commons::PlatformException, "Node access denied");
+ ThrowMsg(Commons::SecurityException, "Node access denied");
break;
case ENOENT:
ThrowMsg(Commons::NotFoundException, "Node does not exist");
diff --git a/src/Filesystem/Node.h b/src/Filesystem/Node.h
index 233d7b1..2a59ddf 100755
--- a/src/Filesystem/Node.h
+++ b/src/Filesystem/Node.h
@@ -41,7 +41,9 @@ class Node : public INode,
static INodePtr resolve(
const IPathPtr& path);
+
public:
+ bool checkPermission(const IPathPtr& path, const std::string &mode, NodeType type);
IPathPtr getPath() const;
NodeType getType() const;
int getPermissions() const;
@@ -100,6 +102,7 @@ class Node : public INode,
std::string toUri(int widgetId) const;
+
private:
IPathPtr m_path;
NodeType m_type;
diff --git a/src/Filesystem/ResponseDispatcher.cpp b/src/Filesystem/ResponseDispatcher.cpp
index 3eda79a..8c8673a 100644
--- a/src/Filesystem/ResponseDispatcher.cpp
+++ b/src/Filesystem/ResponseDispatcher.cpp
@@ -87,7 +87,11 @@ void ResponseDispatcher::OnAnswerReceived(const EventResolvePtr& event)
JSObjectRef jsException;
if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
jsException = JSWebAPIErrorFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError");
- } else {
+ }
+ else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
+ jsException = JSWebAPIErrorFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "PermissionDeniedError");
+ }
+ else {
jsException = JSWebAPIErrorFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown error");
}
data->getCallbackManager()->callOnError(jsException);
diff --git a/src/Messaging/Conversation.cpp b/src/Messaging/Conversation.cpp
index b6181d9..78fc87b 100644
--- a/src/Messaging/Conversation.cpp
+++ b/src/Messaging/Conversation.cpp
@@ -186,7 +186,7 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread)
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)
+ if (strNumber[0] != '\0')
{
m_to.push_back(strNumber);
}
diff --git a/src/Messaging/ConverterMessage.cpp b/src/Messaging/ConverterMessage.cpp
index 9a25644..bc742cf 100644
--- a/src/Messaging/ConverterMessage.cpp
+++ b/src/Messaging/ConverterMessage.cpp
@@ -15,7 +15,6 @@
// limitations under the License.
//
-#include <dpl/assert.h>
#include <Commons/Exception.h>
#include <CommonsJavaScript/PrivateObject.h>
#include <CommonsJavaScript/Validator.h>
@@ -599,8 +598,6 @@ DeviceAPI::Filesystem::INodePtr ConverterMessage::toFilesystemNode(JSValueRef ar
JSValueRef ConverterMessage::toFunctionOrNull(const JSValueRef& arg)
{
- Assert(arg && "Argument is NULL.");
-
if (Validator(m_context).isCallback(arg)) {
return arg;
} else if (!JSValueIsNull(m_context, arg) ) {
@@ -611,8 +608,6 @@ JSValueRef ConverterMessage::toFunctionOrNull(const JSValueRef& arg)
JSValueRef ConverterMessage::toFunction(const JSValueRef& arg)
{
- Assert(arg && "Argument is NULL.");
-
if (Validator(m_context).isCallback(arg)) {
return arg;
} else if (JSValueIsNull(m_context,
diff --git a/src/Messaging/Email.cpp b/src/Messaging/Email.cpp
index f2f38e7..1b666c2 100644
--- a/src/Messaging/Email.cpp
+++ b/src/Messaging/Email.cpp
@@ -22,7 +22,6 @@
#include <ctime>
#include <email-types.h>
#include <email-api.h>
-#include <dpl/assert.h>
#include <dpl/scoped_fclose.h>
#include <dpl/scoped_ptr.h>
#include <Commons/Exception.h>
@@ -437,7 +436,10 @@ void Email::readHeader()
{
LOG_ENTER
- Assert(m_mail && "Header is NULL.");
+ if (!m_mail) {
+ LoggerE("Header is NULL");
+ Throw(WrtDeviceApis::Commons::PlatformException);
+ }
if (m_mail->subject) {
setSubject(m_mail->subject);
@@ -528,7 +530,10 @@ void Email::readHeader()
void Email::readBody() {
LOG_ENTER
- Assert(m_mail && "Body is NULL.");
+ if (!m_mail) {
+ LoggerE("Body is NULL");
+ Throw(WrtDeviceApis::Commons::PlatformException);
+ }
if (m_mail->file_path_plain) {
LoggerD("m_mail->file_path_plain : " << m_mail->file_path_plain);
@@ -859,11 +864,17 @@ void Email::updateMessage()
LoggerW("email_get_attachment_data_list [" << error << "]");
}
- error = email_get_meeting_request(m_mail->mail_id, &meeting_req);
- if (EMAIL_ERROR_NONE != error) {
- LoggerW("email_get_meeting_request() failed [" << error <<"]");
- }
+ LoggerW("meeting_request_status " << m_mail->meeting_request_status);
+ if( m_mail->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_REQUEST
+ || m_mail->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_RESPONSE
+ || m_mail->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_ORIGINATINGREQUEST)
+ {
+ error = email_get_meeting_request(m_mail->mail_id, &meeting_req);
+ if (EMAIL_ERROR_NONE != error) {
+ LoggerW("email_get_meeting_request() failed [" << error <<"]");
+ }
+ }
error = email_update_mail( m_mail.Get(), attachment, attachmentCount, meeting_req, 0);
if (EMAIL_ERROR_NONE != error) {
LoggerW("Nothing to update or error. [" << error << "]");
@@ -873,7 +884,8 @@ void Email::updateMessage()
{
updateAttachments();
-
+
+/*
email_mail_data_t* result = NULL;
error = email_get_mail_data(m_mail->mail_id, &result);
@@ -907,6 +919,7 @@ void Email::updateMessage()
LoggerW("email_free_mail_data error. [" << error << "]");
}
}
+*/
}
if(meeting_req) {
diff --git a/src/Messaging/EmailService.cpp b/src/Messaging/EmailService.cpp
index adbf93c..8ded66b 100644
--- a/src/Messaging/EmailService.cpp
+++ b/src/Messaging/EmailService.cpp
@@ -18,7 +18,6 @@
#include <string>
#include <sstream>
-#include <dpl/assert.h>
#include <dpl/scoped_free.h>
#include <email-api.h>
@@ -134,7 +133,10 @@ email_mailbox_t* getMailboxByType(int accountId,
int addMail(email_mail_data_t* mail, email_attachment_data_t* attachment)
{
LOG_ENTER
- Assert(mail);
+ if (!mail) {
+ LoggerE("mail is NULL");
+ Throw(WrtDeviceApis::Commons::PlatformException);
+ }
int error = 0;
if (!mail->mailbox_id)
diff --git a/src/Messaging/EmailUtils.cpp b/src/Messaging/EmailUtils.cpp
index f13f911..0cacc8c 100755
--- a/src/Messaging/EmailUtils.cpp
+++ b/src/Messaging/EmailUtils.cpp
@@ -49,7 +49,7 @@ std::string formatAddress(const std::string& address,
std::stringstream ss;
if (!name.empty()) {
- ss << "\"" << name << "\" ";
+ ss << "\"" << name << "\"";
}
ss << "<" << address << ">";
@@ -59,8 +59,17 @@ std::string formatAddress(const std::string& address,
std::string formatAddressLine(const Recipients& recipients)
{
std::string result;
- for (size_t i = 0; i < recipients.getRecipientSize(); ++i) {
- result += formatAddress(recipients.getRecipient(i)) + ";";
+ size_t tempSize = recipients.getRecipientSize();
+
+ for (size_t i = 0; i < tempSize; ++i) {
+ if(i != tempSize-1)
+ {
+ result += formatAddress(recipients.getRecipient(i)) + ";";
+ }
+ else
+ {
+ result += formatAddress(recipients.getRecipient(i));
+ }
}
return result;
}
diff --git a/src/Messaging/JSMessage.cpp b/src/Messaging/JSMessage.cpp
index 0b4f9f1..be7c71a 100644
--- a/src/Messaging/JSMessage.cpp
+++ b/src/Messaging/JSMessage.cpp
@@ -15,7 +15,6 @@
// limitations under the License.
//
-#include <dpl/assert.h>
#include "MessageFactory.h"
#include "MessagePriority.h"
#include <CommonsJavaScript/JSCallbackManager.h>
diff --git a/src/Messaging/MailSender.cpp b/src/Messaging/MailSender.cpp
index dc41a55..59172e0 100644
--- a/src/Messaging/MailSender.cpp
+++ b/src/Messaging/MailSender.cpp
@@ -22,7 +22,6 @@
#include <email-api-init.h>
#include <email-api-account.h>
-#include <dpl/assert.h>
#include <Commons/Exception.h>
#include <Commons/ThreadPool.h>
#include "ReqReceiverMessage.h"
@@ -52,7 +51,10 @@ MailSender& MailSender::getInstance()
int MailSender::send(const IEmailPtr& mail)
{
- Assert(mail && "Mail must not be NULL.");
+ if (!mail) {
+ LoggerE("mail is NULL");
+ Throw(WrtDeviceApis::Commons::PlatformException);
+ }
int mailId = mail->convertId(mail->getIdRef());
LoggerD("send mailId = " << mailId);
diff --git a/src/Messaging/MailSync.cpp b/src/Messaging/MailSync.cpp
index 5852d86..b716596 100644
--- a/src/Messaging/MailSync.cpp
+++ b/src/Messaging/MailSync.cpp
@@ -22,7 +22,6 @@
#include <email-api-init.h>
#include <email-api-account.h>
-#include <dpl/assert.h>
#include <Commons/Exception.h>
#include <Commons/ThreadPool.h>
#include "ReqReceiverMessage.h"
@@ -154,8 +153,6 @@ int MailSync::downloadBody( const IEmailPtr& mail )
void MailSync::cancelDownloadBody(int handle)
{
- Assert(handle > -1);
-
SyncRequestIterator it = m_SyncRequests.find(handle);
if ( m_SyncRequests.end() != it)
{
@@ -173,7 +170,6 @@ void MailSync::cancelDownloadBody(int handle)
void MailSync::cancelDownloadAttachment(int handle)
{
- Assert(handle > -1);
SyncRequestIterator it = m_SyncRequests.find(handle);
if ( m_SyncRequests.end() != it)
@@ -304,7 +300,6 @@ int MailSync::syncAccountInternal( const IMessagingServicePtr& messagingService,
void MailSync::syncAccountCancel(const int handle)
{
LoggerD("sync cancel");
- Assert(handle > -1);
SyncRequestIterator it = m_SyncRequests.find(handle);
if ( m_SyncRequests.end() != it)
@@ -363,7 +358,6 @@ int MailSync::syncFolder(const IMessagingServicePtr& messagingService, const int
void MailSync::syncFolderCancel(const int handle)
{
LoggerD("sync Folder Cancel");
- Assert(handle > -1);
SyncRequestIterator it = m_SyncRequests.find(handle);
if ( m_SyncRequests.end() != it)
@@ -667,7 +661,10 @@ int MailSync::downloadBodyInternal( const IEmailPtr& mail, int account_id)
int MailSync::downloadAttachmentInternal(const IEmailPtr& mail, int account_id, const IAttachmentPtr& attachment)
{
LoggerD("downloadAttachmentInternal");
- Assert(mail);
+ if (!mail) {
+ LoggerE("mail is NULL");
+ Throw(WrtDeviceApis::Commons::PlatformException);
+ }
int err = 0;
int nth = 0;
diff --git a/src/Messaging/Messaging.cpp b/src/Messaging/Messaging.cpp
index 8b636cc..57d943e 100644
--- a/src/Messaging/Messaging.cpp
+++ b/src/Messaging/Messaging.cpp
@@ -854,13 +854,13 @@ vector<EmailAccountInfo> Messaging::getEmailAccounts() const
}
vector<EmailAccountInfo> result;
- for (int i = 0; i < count; ++i)
+ for (int i = 0; i < count; ++i)
{
- if(accounts[i].incoming_server_user_name != NULL)
+ if(accounts[i].user_display_name != NULL)
{
LoggerE("server user name is NULL");
EmailAccountInfo account(accounts[i].account_id,
- accounts[i].incoming_server_user_name,
+ accounts[i].user_display_name,
accounts[i].user_email_address);
result.push_back(account);
}
diff --git a/src/Messaging/MessagingController.cpp b/src/Messaging/MessagingController.cpp
index 4986daf..5ff0d81 100644
--- a/src/Messaging/MessagingController.cpp
+++ b/src/Messaging/MessagingController.cpp
@@ -281,7 +281,11 @@ void MessagingController::OnAnswerReceived(const EventSendMessagePtr& event)
JSValueRef error = NULL;
EventSendMessagePrivateDataPtr privateData =
DPL::StaticPointerCast<EventSendMessagePrivateData>(event->getPrivateData());
- Assert(NULL != privateData);
+ if(!privateData)
+ {
+ LoggerE("no privateData");
+ return;
+ }
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = privateData->getCallbackManager();
MessageAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager);
@@ -289,7 +293,6 @@ void MessagingController::OnAnswerReceived(const EventSendMessagePtr& event)
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr recipientCallbackManager = privateData->getRecipientCallbackManager();
JSContextRef context = callbackManager->getContext();
- Assert(NULL != context);
if (WrtDeviceApis::Commons::ExceptionCodes::None != event->getExceptionCode()) {
switch (event->getExceptionCode()) {
diff --git a/src/Messaging/MessagingListener.cpp b/src/Messaging/MessagingListener.cpp
index f37431b..fdf73df 100644
--- a/src/Messaging/MessagingListener.cpp
+++ b/src/Messaging/MessagingListener.cpp
@@ -16,7 +16,6 @@
//
#include <vector>
-#include <dpl/assert.h>
#include <CommonsJavaScript/JSCallbackManager.h>
#include <IFilter.h>
@@ -74,11 +73,14 @@ void MessagingListener::OnAnswerReceived(
{
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager =
DPL::StaticPointerCast<JSCallbackManager >(event->getPrivateData());
- Assert(NULL != callbackManager);
+ if(!callbackManager)
+ {
+ LoggerE("no callbackManager");
+ return;
+ }
LoggerD("thread=" << DPL::Thread::GetCurrentThread());
JSContextRef context = callbackManager->getContext();
- Assert(NULL != context);
MessageAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager);
@@ -130,11 +132,15 @@ void MessagingListener::OnAnswerReceived(
{
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager =
DPL::StaticPointerCast<JSCallbackManager >(event->getPrivateData());
- Assert(NULL != callbackManager);
+ if(!callbackManager)
+ {
+ LoggerE("no callbackManager");
+ return;
+ }
+
LoggerD("thread=" << DPL::Thread::GetCurrentThread());
JSContextRef context = callbackManager->getContext();
- Assert(NULL != context);
MessageAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager);
@@ -192,11 +198,14 @@ void MessagingListener::OnAnswerReceived(
{
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager =
DPL::StaticPointerCast<JSCallbackManager >(event->getPrivateData());
- Assert(NULL != callbackManager);
+ if(!callbackManager)
+ {
+ LoggerE("no callbackManager");
+ return;
+ }
LoggerD("thread=" << DPL::Thread::GetCurrentThread());
JSContextRef context = callbackManager->getContext();
- Assert(NULL != context);
MessageAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager);
@@ -242,11 +251,14 @@ void MessagingListener::OnAnswerReceived(
{
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager =
DPL::StaticPointerCast<JSCallbackManager >(event->getPrivateData());
- Assert(NULL != callbackManager);
+ if(!callbackManager)
+ {
+ LoggerE("no callbackManager");
+ return;
+ }
LoggerD("thread=" << DPL::Thread::GetCurrentThread());
JSContextRef context = callbackManager->getContext();
- Assert(NULL != context);
MessageAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager);
@@ -292,11 +304,14 @@ void MessagingListener::OnAnswerReceived(
{
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager =
DPL::StaticPointerCast<JSCallbackManager >(event->getPrivateData());
- Assert(NULL != callbackManager);
+ if(!callbackManager)
+ {
+ LoggerE("no callbackManager");
+ return;
+ }
LoggerD("thread=" << DPL::Thread::GetCurrentThread());
JSContextRef context = callbackManager->getContext();
- Assert(NULL != context);
Try
{
@@ -341,9 +356,12 @@ void MessagingListener::OnAnswerReceived(const EventQueryConversationsPtr& event
LoggerD("enter");
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast<JSCallbackManager >(event->getPrivateData());
-
+ if(!callbackManager)
+ {
+ LoggerE("no callbackManager");
+ return;
+ }
JSContextRef context = callbackManager->getContext();
- Assert(NULL != context);
MessageAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager);
@@ -404,9 +422,13 @@ void MessagingListener::OnAnswerReceived(const EventDeleteConversationsPtr& even
{
LoggerD("enter");
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast<JSCallbackManager >(event->getPrivateData());
+ if(!callbackManager)
+ {
+ LoggerE("no callbackManager");
+ return;
+ }
JSContextRef context = callbackManager->getContext();
- Assert(NULL != context);
MessageAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager);
@@ -455,9 +477,13 @@ void MessagingListener::OnAnswerReceived(const EventQueryFoldersPtr& event)
LoggerD("enter");
WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast<JSCallbackManager >(event->getPrivateData());
+ if(!callbackManager)
+ {
+ LoggerE("no callbackManager");
+ return;
+ }
JSContextRef context = callbackManager->getContext();
- Assert(NULL != context);
MessageAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager);
diff --git a/src/Messaging/MessagingServiceManager.cpp b/src/Messaging/MessagingServiceManager.cpp
index db34065..27fe93e 100644
--- a/src/Messaging/MessagingServiceManager.cpp
+++ b/src/Messaging/MessagingServiceManager.cpp
@@ -61,8 +61,8 @@ std::vector<EmailAccountInfo> MessagingServiceManager::getEmailAccounts()
{
std::stringstream stream;
for (int i = 0; i < count; ++i) {
- stream << "[" << accounts[i].account_name << "] " << accounts[i].incoming_server_user_name;
- LoggerD("account ID :" << accounts[i].account_id << "Name :" << accounts[i].incoming_server_user_name << "Addr :" << accounts[i].user_email_address );
+ stream << "[" << accounts[i].account_name << "] " << accounts[i].user_display_name;
+ LoggerD("account ID :" << accounts[i].account_id << "Name :" << accounts[i].user_display_name << "Addr :" << accounts[i].user_email_address );
EmailAccountInfo account(accounts[i].account_id, stream.str(), accounts[i].user_email_address );
result.push_back(account);
stream.str("");
diff --git a/src/Messaging/NetworkStatus.cpp b/src/Messaging/NetworkStatus.cpp
index f99853a..ba187b4 100755
--- a/src/Messaging/NetworkStatus.cpp
+++ b/src/Messaging/NetworkStatus.cpp
@@ -15,7 +15,7 @@
// limitations under the License.
//
-#include <dpl/assert.h>
+#include <Logger.h>
#include <Commons/Exception.h>
#include "NetworkStatus.h"
@@ -29,7 +29,10 @@ namespace Messaging {
NetworkStatus::NetworkStatus(const DBus::MessagePtr& message)
{
- Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS);
+ LoggerD("enter : " << message->getInterface());
+ if (message->getInterface() != DBUS_INTERFACE_NETWORK_STATUS) {
+ Throw(WrtDeviceApis::Commons::PlatformException);
+ }
initialize(message);
}
diff --git a/src/Messaging/ReqReceiverMessage.cpp b/src/Messaging/ReqReceiverMessage.cpp
index dcddea7..46181af 100644
--- a/src/Messaging/ReqReceiverMessage.cpp
+++ b/src/Messaging/ReqReceiverMessage.cpp
@@ -245,8 +245,8 @@ void ReqReceiverMessage::OnRequestReceived(const EventAddDraftMessagePtr& event)
{
int index = (int)event->getIndex();
EmailAccountInfo account(accounts[index-1].account_id,
- accounts[index-1].incoming_server_user_name,
- accounts[index-1].user_email_address );
+ accounts[index-1].user_display_name,
+ accounts[index-1].user_email_address );
email->setEmailAccount(account);
}
}
diff --git a/src/Messaging/SyncNetworkStatus.cpp b/src/Messaging/SyncNetworkStatus.cpp
index 0974ddc..27bf1d1 100644
--- a/src/Messaging/SyncNetworkStatus.cpp
+++ b/src/Messaging/SyncNetworkStatus.cpp
@@ -15,7 +15,6 @@
// limitations under the License.
//
-#include <dpl/assert.h>
#include <Commons/Exception.h>
#include "SyncNetworkStatus.h"
#include <Logger.h>
@@ -30,8 +29,10 @@ namespace Messaging {
SyncNetworkStatus::SyncNetworkStatus(const DBus::MessagePtr& message)
{
- LoggerD("enter : " << message->getInterface());
- Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS);
+ LoggerD("enter : " << message->getInterface());
+ if (message->getInterface() != DBUS_INTERFACE_NETWORK_STATUS) {
+ Throw(WrtDeviceApis::Commons::PlatformException);
+ }
initialize(message);
}
diff --git a/src/NetworkBearerSelection/NetworkBearerSelection.cpp b/src/NetworkBearerSelection/NetworkBearerSelection.cpp
index 39cdf2a..9d4fa1a 100644..100755
--- a/src/NetworkBearerSelection/NetworkBearerSelection.cpp
+++ b/src/NetworkBearerSelection/NetworkBearerSelection.cpp
@@ -36,6 +36,11 @@ static void connection_state_changed_callback(connection_profile_state_e state,
LoggerD("enter");
if(user_data != NULL) {
LoggerD("Callback registration Succeeded");
+ if (state == CONNECTION_PROFILE_STATE_ASSOCIATION) {
+ LoggerD("association state");
+ return;
+ }
+
NewtorkBearerSelectionPendingEvent *pendingEvent = (NewtorkBearerSelectionPendingEvent *)user_data;
NetworkBearerSelection *networkBearerSelection = (NetworkBearerSelection *)pendingEvent->getThisObject();
EventNetworkBearerSelectionPtr event = pendingEvent->getEvent();
@@ -46,8 +51,6 @@ static void connection_state_changed_callback(connection_profile_state_e state,
networkBearerSelection->makeCallback(event, CONNECTION_STATE_CONNECTED);
}
- delete pendingEvent;
- pendingEvent = NULL;
user_data = NULL;
}
}
@@ -297,9 +300,14 @@ void NetworkBearerSelection::registStateChangeListener(const EventNetworkBearerS
LoggerD("hostAddr : " << hostAddr);
NewtorkBearerSelectionPendingEvent *pendingEvent = new NewtorkBearerSelectionPendingEvent((void *)this, event);
- connection_profile_set_state_changed_cb(m_profileHandle, connection_state_changed_callback, pendingEvent);
+ if (connection_profile_set_state_changed_cb(m_profileHandle, connection_state_changed_callback, pendingEvent) != CONNECTION_ERROR_NONE) {
+ LoggerE("Callback register is failed.");
+ delete pendingEvent;
+ pendingEvent = NULL;
+ } else {
connection_add_route(m_connectionHandle, interfaceName, hostAddr);
}
+}
void NetworkBearerSelection::deregistStateChangeListener(const EventNetworkBearerReleasePtr &event)
{
diff --git a/src/Systeminfo/CMakeLists.txt b/src/Systeminfo/CMakeLists.txt
index e33d773..53f8287 100755
--- a/src/Systeminfo/CMakeLists.txt
+++ b/src/Systeminfo/CMakeLists.txt
@@ -33,6 +33,7 @@ SET(SRCS_IMPL
Systeminfo.cpp
JSDisplayInfo.cpp
JSStorageInfo.cpp
+ JSStorageUnitInfo.cpp
JSCpuInfo.cpp
JSWifiNetworkInfo.cpp
JSCellularNetworkInfo.cpp
diff --git a/src/Systeminfo/EventWatchSysteminfo.cpp b/src/Systeminfo/EventWatchSysteminfo.cpp
index c64e5b7..174f0c8 100755
--- a/src/Systeminfo/EventWatchSysteminfo.cpp
+++ b/src/Systeminfo/EventWatchSysteminfo.cpp
@@ -30,7 +30,6 @@ namespace {
static Eina_Bool timeout_timer_cb(void* data)
{
- LoggerD("enter");
EventWatchSysteminfo *event = static_cast<EventWatchSysteminfo *> (data);
event->timeoutWatch();
return ECORE_CALLBACK_RENEW;
@@ -38,7 +37,7 @@ static Eina_Bool timeout_timer_cb(void* data)
}
-#define MAX_STORAGE_CNT 3
+#define MAX_STORAGE_CNT 2
DPL::Atomic EventWatchSysteminfo::m_uniqId = 1;
EventWatchSysteminfo::EventWatchSysteminfo() : m_id(m_uniqId)
@@ -116,6 +115,7 @@ void EventWatchSysteminfo::processGetValue()
JSStringRef propertyName = NULL;
std::string key;
JSObjectRef object = NULL;
+ JSValueRef value = NULL;
double level = 0.0, brightness = 0.0, load = 0.0;
bool isCharging = false;
double capacity[MAX_STORAGE_CNT];
@@ -162,8 +162,14 @@ void EventWatchSysteminfo::processGetValue()
Throw(WrtDeviceApis::Commons::Exception);
}
+ key = "units";
+ object = JSValueToObject(context, lastValue, NULL);
+ propertyName = JSStringCreateWithUTF8CString(key.c_str());
+ value = JSObjectGetProperty(context, object, propertyName, NULL);
+
for (int i=0; i<m_tmpStorageCnt; i++) {
- lastValueList[i] = JSGetArrayElement(context, JSValueToObject(context, lastValue, NULL), i);
+
+ lastValueList[i] = JSGetArrayElement(context, JSValueToObject(context, value, NULL), i);
key = "capacity";
object = JSValueToObject(context, lastValueList[i], NULL);
@@ -249,8 +255,13 @@ void EventWatchSysteminfo::processGetValue()
Throw(Exception);
}
+ key = "units";
+ object = JSValueToObject(context, tmpValue, NULL);
+ propertyName = JSStringCreateWithUTF8CString(key.c_str());
+ value = JSObjectGetProperty(context, object, propertyName, NULL);
+
for (int i=0; i<m_tmpStorageCnt; i++) {
- tmpValueList[i] = JSGetArrayElement(context, JSValueToObject(context, tmpValue, NULL), i);
+ tmpValueList[i] = JSGetArrayElement(context, JSValueToObject(context, value, NULL), i);
key = "capacity";
object = JSValueToObject(context, tmpValueList[i], NULL);
propertyName = JSStringCreateWithUTF8CString(key.c_str());
diff --git a/src/Systeminfo/EventWatchSysteminfo.h b/src/Systeminfo/EventWatchSysteminfo.h
index 680de46..075e8ac 100755
--- a/src/Systeminfo/EventWatchSysteminfo.h
+++ b/src/Systeminfo/EventWatchSysteminfo.h
@@ -49,7 +49,7 @@ struct StoragePropertyValue {
struct PropertyValue {
BatteryPropertyValue batterInfo;
CpuPropertyValue cpuInfo;
- StoragePropertyValue storageInfo[3];
+ StoragePropertyValue storageInfo[2];
};
class EventWatchSysteminfo : public WrtDeviceApis::Commons::IEvent<EventWatchSysteminfo>
diff --git a/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp b/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp
index 839ae61..4c837d9 100755
--- a/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp
+++ b/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp
@@ -788,8 +788,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR
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 JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyBack);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_INPUT_KEY_OPTION)) {
@@ -797,8 +796,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR
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 JSValueMakeUndefined(context);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyMenu);
}
diff --git a/src/Systeminfo/JSStorageInfo.cpp b/src/Systeminfo/JSStorageInfo.cpp
index f75fcd5..029a084 100644..100755
--- a/src/Systeminfo/JSStorageInfo.cpp
+++ b/src/Systeminfo/JSStorageInfo.cpp
@@ -16,6 +16,7 @@
//
#include <memory>
+#include "JSStorageUnitInfo.h"
#include "JSStorageInfo.h"
#include <Logger.h>
@@ -25,11 +26,7 @@ using namespace WrtDeviceApis::CommonsJavaScript;
using namespace WrtDeviceApis::Commons;
namespace {
-const char* STORAGE_TYPE_PROPERTY = "type";
-const char* STORAGE_CAPACITY_PROPERTY = "capacity";
-const char* STORAGE_AVAILCAPA_PROPERTY = "availableCapacity";
-const char* STORAGE_REMOVEABLE_PROPERTY = "isRemoveable";
-const char* STORAGE_REMOVABLE_PROPERTY = "isRemovable";
+const char* STORAGE_UNITS_PROPERTY = "units";
}
JSClassRef JSStorageInfo::m_classRef = NULL;
@@ -55,11 +52,7 @@ JSClassDefinition JSStorageInfo::m_classInfo = {
};
JSStaticValue JSStorageInfo::m_properties[] = {
- { STORAGE_TYPE_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
- { STORAGE_CAPACITY_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
- { STORAGE_AVAILCAPA_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
- { STORAGE_REMOVEABLE_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
- { STORAGE_REMOVABLE_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
+ { STORAGE_UNITS_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
{ 0, 0, 0, 0 }
};
@@ -113,16 +106,29 @@ JSValueRef JSStorageInfo::getProperty(JSContextRef context, JSObjectRef object,
{
StoragePropertiesPtr storageInfo = priv->getObject();
Converter convert(context);
- if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_TYPE_PROPERTY)) {
- return convert.toJSValueRef(storageInfo->type);
- } else if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_CAPACITY_PROPERTY)) {
- return JSValueMakeNumber(context, storageInfo->capacity);
- } else if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_AVAILCAPA_PROPERTY)) {
- return JSValueMakeNumber(context, storageInfo->availableCapacity);
- } else if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_REMOVEABLE_PROPERTY)) {
- return convert.toJSValueRef(storageInfo->isRemoveable);
- } else if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_REMOVABLE_PROPERTY)) {
- return convert.toJSValueRef(storageInfo->isRemovable);
+ std::vector <JSObjectRef> storagelist;
+ StorageUnitPropertiesPtr internal(new StorageUnitProperties());
+ StorageUnitPropertiesPtr sdcard(new StorageUnitProperties());
+
+ if (storageInfo->cnt > 0) {
+ internal->type = storageInfo->units[0].type;
+ internal->capacity = storageInfo->units[0].capacity;
+ internal->availableCapacity = storageInfo->units[0].availableCapacity;
+ internal->isRemoveable = storageInfo->units[0].isRemoveable;
+ internal->isRemovable = storageInfo->units[0].isRemovable;
+ storagelist.push_back(JSStorageUnitInfo::createJSObject(context, internal));
+ }
+ if (storageInfo->cnt > 1) {
+ sdcard->type = storageInfo->units[1].type;
+ sdcard->capacity = storageInfo->units[1].capacity;
+ sdcard->availableCapacity = storageInfo->units[1].availableCapacity;
+ sdcard->isRemoveable = storageInfo->units[1].isRemoveable;
+ sdcard->isRemovable = storageInfo->units[1].isRemovable;
+ storagelist.push_back(JSStorageUnitInfo::createJSObject(context, sdcard));
+ }
+
+ if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_UNITS_PROPERTY)) {
+ return JSObjectMakeArray(context, storageInfo->cnt, storagelist.data(), NULL);
}
}
Catch(Exception)
diff --git a/src/Systeminfo/JSStorageUnitInfo.cpp b/src/Systeminfo/JSStorageUnitInfo.cpp
new file mode 100755
index 0000000..797d1b9
--- /dev/null
+++ b/src/Systeminfo/JSStorageUnitInfo.cpp
@@ -0,0 +1,135 @@
+//
+// 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.
+//
+
+#include <memory>
+#include "JSStorageUnitInfo.h"
+#include <Logger.h>
+
+namespace DeviceAPI {
+namespace Systeminfo {
+using namespace WrtDeviceApis::CommonsJavaScript;
+using namespace WrtDeviceApis::Commons;
+
+namespace {
+const char* STORAGE_UNIT_TYPE_PROPERTY = "type";
+const char* STORAGE_UNIT_CAPACITY_PROPERTY = "capacity";
+const char* STORAGE_UNIT_AVAILCAPA_PROPERTY = "availableCapacity";
+const char* STORAGE_UNIT_REMOVEABLE_PROPERTY = "isRemoveable";
+const char* STORAGE_UNIT_REMOVABLE_PROPERTY = "isRemovable";
+}
+
+JSClassRef JSStorageUnitInfo::m_classRef = NULL;
+
+JSClassDefinition JSStorageUnitInfo::m_classInfo = {
+ 0,
+ kJSClassAttributeNone,
+ "storageunitinfo",
+ 0,
+ m_properties,
+ NULL,
+ Initialize,
+ Finalize,
+ hasProperty,
+ getProperty,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+JSStaticValue JSStorageUnitInfo::m_properties[] = {
+ { STORAGE_UNIT_TYPE_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
+ { STORAGE_UNIT_CAPACITY_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
+ { STORAGE_UNIT_AVAILCAPA_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
+ { STORAGE_UNIT_REMOVEABLE_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
+ { STORAGE_UNIT_REMOVABLE_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly },
+ { 0, 0, 0, 0 }
+};
+
+const JSClassRef JSStorageUnitInfo::getClassRef()
+{
+ if (!m_classRef) {
+ m_classRef = JSClassCreate(&m_classInfo);
+ }
+ return m_classRef;
+}
+
+const JSClassDefinition* JSStorageUnitInfo::getClassInfo()
+{
+ return &m_classInfo;
+}
+
+void JSStorageUnitInfo::Initialize(JSContextRef context, JSObjectRef object)
+{
+}
+
+void JSStorageUnitInfo::Finalize(JSObjectRef object)
+{
+ LoggerD("Entered");
+ JSStorageUnitPriv* priv = static_cast<JSStorageUnitPriv*>(JSObjectGetPrivate(object));
+ JSObjectSetPrivate(object, NULL);
+ LoggerD("Deleting StorageUnitInfo object");
+ delete priv;
+}
+
+bool JSStorageUnitInfo::hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName)
+{
+ return JSUtils::hasProperty(m_properties, propertyName);
+}
+
+JSObjectRef JSStorageUnitInfo::createJSObject(JSContextRef context, const StorageUnitPropertiesPtr storageUnitInfo)
+{
+ JSStorageUnitPriv *priv = new JSStorageUnitPriv(context, storageUnitInfo);
+ return JSObjectMake(context, getClassRef(), priv);
+}
+
+JSValueRef JSStorageUnitInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ LoggerD("Enter");
+ JSStorageUnitPriv *priv = static_cast<JSStorageUnitPriv*>(JSObjectGetPrivate(object));
+ if (NULL == priv) {
+ LoggerE("Private object not set.");
+ return JSValueMakeUndefined(context);
+ }
+
+ Try
+ {
+ StorageUnitPropertiesPtr storageUnitInfo = priv->getObject();
+ Converter convert(context);
+ if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_UNIT_TYPE_PROPERTY)) {
+ return convert.toJSValueRef(storageUnitInfo->type);
+ } else if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_UNIT_CAPACITY_PROPERTY)) {
+ return JSValueMakeNumber(context, storageUnitInfo->capacity);
+ } else if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_UNIT_AVAILCAPA_PROPERTY)) {
+ return JSValueMakeNumber(context, storageUnitInfo->availableCapacity);
+ } else if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_UNIT_REMOVEABLE_PROPERTY)) {
+ return convert.toJSValueRef(storageUnitInfo->isRemoveable);
+ } else if (JSStringIsEqualToUTF8CString(propertyName, STORAGE_UNIT_REMOVABLE_PROPERTY)) {
+ return convert.toJSValueRef(storageUnitInfo->isRemovable);
+ }
+ }
+ Catch(Exception)
+ {
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
+ }
+ return JSValueMakeUndefined(context);
+}
+}
+}
diff --git a/src/Systeminfo/JSStorageUnitInfo.h b/src/Systeminfo/JSStorageUnitInfo.h
new file mode 100755
index 0000000..f435286
--- /dev/null
+++ b/src/Systeminfo/JSStorageUnitInfo.h
@@ -0,0 +1,48 @@
+//
+// 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 WRTPLUGINS_TIZEN1_0_STORAGE_UNIT_INFO_H_
+#define WRTPLUGINS_TIZEN1_0_STORAGE_UNIT_INFO_H_
+
+#include <JavaScriptCore/JavaScript.h>
+#include "SysteminfoPropertyInfo.h"
+
+namespace DeviceAPI {
+namespace Systeminfo {
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<StorageUnitPropertiesPtr>::Type JSStorageUnitPriv;
+
+class JSStorageUnitInfo
+{
+ public:
+ static const JSClassDefinition* getClassInfo();
+ static const JSClassRef getClassRef();
+ static JSObjectRef createJSObject(JSContextRef context, const StorageUnitPropertiesPtr storageUnitInfo);
+
+ private:
+ static void Initialize(JSContextRef context, JSObjectRef object);
+ static void Finalize(JSObjectRef object);
+ static bool hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName);
+ static JSValueRef getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
+
+ static JSStaticValue m_properties[];
+ static JSClassRef m_classRef;
+ static JSClassDefinition m_classInfo;
+};
+
+}
+}
+#endif
diff --git a/src/Systeminfo/Systeminfo.cpp b/src/Systeminfo/Systeminfo.cpp
index d13c0d3..eeb804f 100755
--- a/src/Systeminfo/Systeminfo.cpp
+++ b/src/Systeminfo/Systeminfo.cpp
@@ -387,17 +387,11 @@ void Systeminfo::getWatchValue(const int watchType)
for (EventStorageList::iterator it = eventList.begin(); it != eventList.end(); it++) {
int storageCnt = 1;
int sdcardState = 0;
- int usbhostState = 0;
if(vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sdcardState) == 0) {
if(sdcardState == VCONFKEY_SYSMAN_MMC_MOUNTED) {
storageCnt++;
}
}
- if(vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &usbhostState) == 0) {
- if(usbhostState == VCONFKEY_SYSMAN_USB_HOST_CONNECTED) {
- storageCnt++;
- }
- }
LoggerD("storage cnt : " << storageCnt);
(*it)->getWatchValue(storageCnt);
}
@@ -1065,57 +1059,36 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Cpu) {
PROPERTY_GET_SYSTEMINFO_DEFINITION(Storage) {
Converter converter(context);
int sdcardState=0;
- int usbhostState=0;
- int storageCnt=0;
struct statfs fs;
- StoragePropertiesPtr internal(new StorageProperties());
- StoragePropertiesPtr mmc(new StorageProperties());
- StoragePropertiesPtr usbhost(new StorageProperties());
- std::vector <JSObjectRef> storagelist;
if (statfs(STORAGE_INTERNAL_PATH, &fs) < 0) {
+ // make exception
return JSValueMakeNull(context);
}
-
- internal->type = "INTERNAL";
- internal->capacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_blocks;
- internal->availableCapacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_bavail;
- internal->isRemoveable = false;
- internal->isRemovable = false;
- storagelist.push_back(JSStorageInfo::createJSObject(context, internal));
- storageCnt++;
-
- if(vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sdcardState) == 0){
+ StoragePropertiesPtr storagePtr(new StorageProperties());
+ storagePtr->units[0].type = "INTERNAL";
+ storagePtr->units[0].capacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_blocks;
+ storagePtr->units[0].availableCapacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_bavail;
+ storagePtr->units[0].isRemoveable = false;
+ storagePtr->units[0].isRemovable = false;
+ storagePtr->cnt = 1;
+ LoggerD("type : " << storagePtr->units[0].type);
+ if(vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sdcardState) == 0) {
if(sdcardState == VCONFKEY_SYSMAN_MMC_MOUNTED){
- storageCnt++;
if (statfs(STORAGE_SDCARD_PATH, &fs) < 0) {
return JSValueMakeNull(context);
}
- mmc->type = "MMC";
- mmc->capacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_blocks;
- mmc->availableCapacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_bavail;
- mmc->isRemoveable = true;
- mmc->isRemovable = true;
- storagelist.push_back(JSStorageInfo::createJSObject(context, mmc));
+ storagePtr->units[1].type = "MMC";
+ storagePtr->units[1].capacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_blocks;
+ storagePtr->units[1].availableCapacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_bavail;
+ storagePtr->units[1].isRemoveable = false;
+ storagePtr->units[1].isRemovable = false;
+ storagePtr->cnt = 2;
+ LoggerD("type : " << storagePtr->units[1].type);
}
}
+ return JSStorageInfo::createJSObject(context, storagePtr);
- if(vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &usbhostState) == 0) {
- if(usbhostState == VCONFKEY_SYSMAN_USB_HOST_CONNECTED) {
- storageCnt++;
- if (statfs(STORAGE_USBHOST_PATH, &fs) < 0) {
- return JSValueMakeNull(context);
- }
- usbhost->type = "USB_HOST";
- usbhost->capacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_blocks;
- usbhost->availableCapacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_bavail;
- usbhost->isRemoveable = true;
- usbhost->isRemovable = true;
- storagelist.push_back(JSStorageInfo::createJSObject(context, usbhost));
- }
- }
-
- return JSObjectMakeArray(context, storageCnt, storagelist.data(), NULL);
}
PROPERTY_GET_SYSTEMINFO_DEFINITION(Display) {
@@ -1325,7 +1298,7 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(CellularNetwork) {
connection_profile_destroy(profileHandle);
}
}
-
+
tapiHandle = tel_init(0);
if (tapiHandle != NULL) {
diff --git a/src/Systeminfo/SysteminfoPropertyInfo.h b/src/Systeminfo/SysteminfoPropertyInfo.h
index f08aea6..6aeff39 100755
--- a/src/Systeminfo/SysteminfoPropertyInfo.h
+++ b/src/Systeminfo/SysteminfoPropertyInfo.h
@@ -203,7 +203,7 @@ struct CpuProperties
}
};
-struct StorageProperties
+struct StorageUnitProperties
{
std::string type;
unsigned long long capacity;
@@ -211,7 +211,7 @@ struct StorageProperties
bool isRemoveable;
bool isRemovable;
- StorageProperties():
+ StorageUnitProperties():
type("UNKNOWN"),
capacity(0),
availableCapacity(0),
@@ -221,6 +221,18 @@ struct StorageProperties
}
};
+struct StorageProperties
+{
+ StorageUnitProperties units[2];
+ unsigned long cnt;
+
+ StorageProperties():
+ cnt(0)
+ {
+ }
+};
+
+
struct DisplayProperties
{
unsigned long resolutionWidth;
@@ -374,6 +386,7 @@ struct PeripheralProperties
typedef DPL::SharedPtr<DeviceCapabilitiesProperties> DeviceCapabilitiesPropertiesPtr;
typedef DPL::SharedPtr<BatteryProperties> BatteryPropertiesPtr;
typedef DPL::SharedPtr<CpuProperties> CpuPropertiesPtr;
+typedef DPL::SharedPtr<StorageUnitProperties> StorageUnitPropertiesPtr;
typedef DPL::SharedPtr<StorageProperties> StoragePropertiesPtr;
typedef DPL::SharedPtr<DisplayProperties> DisplayPropertiesPtr;
typedef DPL::SharedPtr<WifiNetworkProperties> WifiNetworkPropertiesPtr;