2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file StorageChangeMessage.cpp
18 * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
21 #include <Commons/Exception.h>
22 #include "StorageChangeMessage.h"
25 const char* DBUS_INTERFACE_STORAGE_CHANGE = "User.Email.StorageChange";
26 const int DBUS_MESSAGE_PARAMETERS_NUMBER = 5;
29 namespace WrtDeviceApis {
32 StorageChangeMessage::StorageChangeMessage()
38 StorageChangeMessage StorageChangeMessage::parse(const DBus::MessagePtr& message)
40 Assert(message.Get() != NULL && "Empty message.");
41 Assert(message->getInterface() == DBUS_INTERFACE_STORAGE_CHANGE);
43 StorageChangeMessage result;
45 DBus::Message::ReadIterator it = message->getReadIterator();
46 for (int i = 0; i < DBUS_MESSAGE_PARAMETERS_NUMBER; it->next(), ++i)
50 ThrowMsg(Commons::PlatformException, "Missing some properties.");
56 result.m_type = it->getInt();
59 result.m_accountId = it->getInt();
62 result.m_mailId = it->getInt();
65 result.m_folderName = it->getString();
68 result.m_extra = it->getInt();
76 int StorageChangeMessage::getType() const
81 int StorageChangeMessage::getAccountId() const
86 int StorageChangeMessage::getMailId() const
91 std::string StorageChangeMessage::getFolderName() const
96 int StorageChangeMessage::getExtra() const