/wrt/src/global_logic/global_model.cpp
https://review.tizen.org/git/ · C++ · 109 lines · 81 code · 9 blank · 19 comment · 2 complexity · 1a2bb37d64a2b4b4ffab9c2ee1e11ab9 MD5 · raw file
- /*
- * 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)),
- SecureByDefault(this,
- static_cast<DPL::Event::Property<bool,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
- (& GlobalModel::ReadSecureByDefault)),
- ComplianceMode(this,
- static_cast<DPL::Event::Property<bool,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
- (& GlobalModel::readComplianceMode)),
- ComplianceFakeImei(this,
- & GlobalModel::readComplianceFakeImei),
- ComplianceFakeMeid(this,
- & GlobalModel::readComplianceFakeMeid)
- {
- }
- 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();
- }
- bool GlobalModel::ReadSecureByDefault(DPL::Event::Model */*model*/)
- {
- return GlobalDAOReadOnly::GetSecureByDefault();
- }
- bool GlobalModel::readComplianceMode(DPL::Event::Model * /* model */)
- {
- return GlobalDAOReadOnly::getComplianceMode();
- }
- std::string GlobalModel::readComplianceFakeImei(DPL::Event::Model * /* model */)
- {
- return GlobalDAOReadOnly::getComplianceFakeImei();
- }
- std::string GlobalModel::readComplianceFakeMeid(DPL::Event::Model * /* model */)
- {
- return GlobalDAOReadOnly::getComplianceFakeMeid();
- }