2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #include <dpl/assert.h>
19 #include <Commons/Exception.h>
20 #include "SyncNetworkStatus.h"
24 const char* DBUS_INTERFACE_NETWORK_STATUS = "User.Email.NetworkStatus";
25 const int DBUS_MESSAGE_PARAMETERS_NUMBER = 5;
31 SyncNetworkStatus::SyncNetworkStatus(const DBus::MessagePtr& message)
33 LoggerD("enter : " << message->getInterface());
34 Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS);
38 int SyncNetworkStatus::getStatus() const
43 int SyncNetworkStatus::getHandle() const
48 std::string SyncNetworkStatus::getSource() const
53 int SyncNetworkStatus::getMailId() const
58 int SyncNetworkStatus::getErrorCode() const
63 void SyncNetworkStatus::initialize(const DBus::MessagePtr& message)
65 DBus::Message::ReadIterator it = message->getReadIterator();
66 for (int i = 0; i < DBUS_MESSAGE_PARAMETERS_NUMBER; it->next(), ++i) {
68 ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Missing some properties.");
72 case 0: m_status = it->getInt();
73 LoggerD("status :" << m_status);
75 case 1: m_mailId = it->getInt();
76 LoggerD("mail ID :" << m_mailId);
78 case 2: m_source = it->getString();
79 LoggerD("source :" << m_source);
81 case 3: m_handle = it->getInt();
82 LoggerD("handle :" << m_handle);
84 case 4: m_errorCode = it->getInt();
85 LoggerD("error Code :" << m_errorCode);