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.
18 * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
21 #include <dpl/assert.h>
22 #include <Commons/Exception.h>
23 #include "NetworkStatus.h"
26 const char* DBUS_INTERFACE_NETWORK_STATUS = "User.Email.NetworkStatus";
27 const int DBUS_MESSAGE_PARAMETERS_NUMBER = 5;
34 NetworkStatus::NetworkStatus(const DBus::MessagePtr& message)
36 Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS);
40 int NetworkStatus::getStatus() const
45 int NetworkStatus::getAccountId() const
50 std::string NetworkStatus::getSource() const
55 int NetworkStatus::getMailId() const
60 int NetworkStatus::getErrorCode() const
65 void NetworkStatus::initialize(const DBus::MessagePtr& message)
67 DBus::Message::ReadIterator it = message->getReadIterator();
68 for (int i = 0; i < DBUS_MESSAGE_PARAMETERS_NUMBER; it->next(), ++i) {
70 ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Missing some properties.");
74 case 0: m_status = it->getInt();
76 case 1: m_accountId = it->getInt();
78 case 2: m_source = it->getString();
80 case 3: m_mailId = it->getInt();
82 case 4: m_errorCode = it->getInt();