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 * @file global_model.cpp
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 #include "global_model.h"
21 #include <dpl/wrt-dao-ro/global_dao_read_only.h>
23 using namespace WrtDB;
25 GlobalModel::GlobalModel() :
26 HomeNetworkAccess(this,
27 & GlobalModel::HomeNetworkAccessReadProperty),
28 RoamingNetworkAccess(this,
29 & GlobalModel::RoamingNetworkAccessReadProperty),
31 static_cast<DPL::Event::Property<bool,
32 DPL::Event::PropertyReadOnly,
33 DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
34 (& GlobalModel::ReadDeveloperMode))
38 GlobalModel::NetworkAccessMode GlobalModel::HomeNetworkAccessReadProperty(
39 DPL::Event::Model* /*model*/)
41 switch (GlobalDAOReadOnly::GetHomeNetworkDataUsage()) {
42 case GlobalDAOReadOnly::NEVER_CONNECT:
43 return GlobalModel::NEVER_CONNECT;
44 case GlobalDAOReadOnly::ALWAYS_ASK:
45 return GlobalModel::ALWAYS_ASK;
46 case GlobalDAOReadOnly::CONNECT_AUTOMATICALLY:
47 return GlobalModel::CONNECT_AUTOMATICALLY;
51 LogWarning("using default value");
52 return GlobalModel::ALWAYS_ASK;
55 GlobalModel::NetworkAccessMode GlobalModel::RoamingNetworkAccessReadProperty(
56 DPL::Event::Model* /*model*/)
58 switch (GlobalDAOReadOnly::GetRoamingDataUsage()) {
59 case GlobalDAOReadOnly::NEVER_CONNECT:
60 return GlobalModel::NEVER_CONNECT;
61 case GlobalDAOReadOnly::ALWAYS_ASK:
62 return GlobalModel::ALWAYS_ASK;
63 case GlobalDAOReadOnly::CONNECT_AUTOMATICALLY:
64 return GlobalModel::CONNECT_AUTOMATICALLY;
68 LogWarning("using default value");
69 return GlobalModel::ALWAYS_ASK;
72 bool GlobalModel::ReadDeveloperMode(DPL::Event::Model */*model*/)
74 return GlobalDAOReadOnly::GetDeveloperMode();