-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file global_model.cpp
- * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- */
-#include "global_model.h"
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-
-using namespace WrtDB;
-
-GlobalModel::GlobalModel() :
- HomeNetworkAccess(this,
- & GlobalModel::HomeNetworkAccessReadProperty),
- RoamingNetworkAccess(this,
- & GlobalModel::RoamingNetworkAccessReadProperty),
- DeveloperMode(this,
- static_cast<DPL::Event::Property<bool,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
- (& GlobalModel::ReadDeveloperMode))
-{
-}
-
-GlobalModel::NetworkAccessMode GlobalModel::HomeNetworkAccessReadProperty(
- DPL::Event::Model* /*model*/)
-{
- switch (GlobalDAOReadOnly::GetHomeNetworkDataUsage()) {
- case GlobalDAOReadOnly::NEVER_CONNECT:
- return GlobalModel::NEVER_CONNECT;
- case GlobalDAOReadOnly::ALWAYS_ASK:
- return GlobalModel::ALWAYS_ASK;
- case GlobalDAOReadOnly::CONNECT_AUTOMATICALLY:
- return GlobalModel::CONNECT_AUTOMATICALLY;
- default:
- break;
- }
- LogWarning("using default value");
- return GlobalModel::ALWAYS_ASK;
-}
-
-GlobalModel::NetworkAccessMode GlobalModel::RoamingNetworkAccessReadProperty(
- DPL::Event::Model* /*model*/)
-{
- switch (GlobalDAOReadOnly::GetRoamingDataUsage()) {
- case GlobalDAOReadOnly::NEVER_CONNECT:
- return GlobalModel::NEVER_CONNECT;
- case GlobalDAOReadOnly::ALWAYS_ASK:
- return GlobalModel::ALWAYS_ASK;
- case GlobalDAOReadOnly::CONNECT_AUTOMATICALLY:
- return GlobalModel::CONNECT_AUTOMATICALLY;
- default:
- break;
- }
- LogWarning("using default value");
- return GlobalModel::ALWAYS_ASK;
-}
-
-bool GlobalModel::ReadDeveloperMode(DPL::Event::Model */*model*/)
-{
- return GlobalDAOReadOnly::GetDeveloperMode();
-}