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 "SyncNetworkStatus.h"
24 #include <dpl/log/log.h>
27 const char* DBUS_INTERFACE_NETWORK_STATUS = "User.Email.NetworkStatus";
28 const int DBUS_MESSAGE_PARAMETERS_NUMBER = 5;
35 SyncNetworkStatus::SyncNetworkStatus(const DBus::MessagePtr& message)
37 Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS);
41 int SyncNetworkStatus::getStatus() const
46 int SyncNetworkStatus::getHandle() const
51 std::string SyncNetworkStatus::getSource() const
56 int SyncNetworkStatus::getMailId() const
61 int SyncNetworkStatus::getErrorCode() const
66 void SyncNetworkStatus::initialize(const DBus::MessagePtr& message)
68 DBus::Message::ReadIterator it = message->getReadIterator();
69 for (int i = 0; i < DBUS_MESSAGE_PARAMETERS_NUMBER; it->next(), ++i) {
71 ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Missing some properties.");
75 case 0: m_status = it->getInt();
76 LogDebug("status :" << m_status);
78 case 1: m_mailId = it->getInt();
79 LogDebug("mail ID :" << m_mailId);
81 case 2: m_source = it->getString();
82 LogDebug("source :" << m_source);
84 case 3: m_handle = it->getInt();
85 LogDebug("handle :" << m_handle);
87 case 4: m_errorCode = it->getInt();
88 LogDebug("error Code :" << m_errorCode);