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 * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
20 #include <dpl/assert.h>
21 #include <Commons/Exception.h>
22 #include "NetworkStatus.h"
25 const char* DBUS_INTERFACE_NETWORK_STATUS = "User.Email.NetworkStatus";
26 const int DBUS_MESSAGE_PARAMETERS_NUMBER = 5;
29 namespace WrtDeviceApis {
31 NetworkStatus::NetworkStatus(const DBus::MessagePtr& message)
33 Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS);
37 int NetworkStatus::getStatus() const
42 int NetworkStatus::getAccountId() const
47 std::string NetworkStatus::getSource() const
52 int NetworkStatus::getMailId() const
57 int NetworkStatus::getErrorCode() const
62 void NetworkStatus::initialize(const DBus::MessagePtr& message)
64 DBus::Message::ReadIterator it = message->getReadIterator();
65 for (int i = 0; i < DBUS_MESSAGE_PARAMETERS_NUMBER; it->next(), ++i) {
67 ThrowMsg(Commons::PlatformException, "Missing some properties.");
71 case 0: m_status = it->getInt();
73 case 1: m_accountId = it->getInt();
75 case 2: m_source = it->getString();
77 case 3: m_mailId = it->getInt();
79 case 4: m_errorCode = it->getInt();