/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

  1. /*
  2. * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
  3. *
  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
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  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.
  15. */
  16. /*
  17. * @file global_model.cpp
  18. * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
  19. */
  20. #include "global_model.h"
  21. #include <dpl/wrt-dao-ro/global_dao_read_only.h>
  22. using namespace WrtDB;
  23. GlobalModel::GlobalModel() :
  24. HomeNetworkAccess(this,
  25. & GlobalModel::HomeNetworkAccessReadProperty),
  26. RoamingNetworkAccess(this,
  27. & GlobalModel::RoamingNetworkAccessReadProperty),
  28. DeveloperMode(this,
  29. static_cast<DPL::Event::Property<bool,
  30. DPL::Event::PropertyReadOnly,
  31. DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
  32. (& GlobalModel::ReadDeveloperMode)),
  33. SecureByDefault(this,
  34. static_cast<DPL::Event::Property<bool,
  35. DPL::Event::PropertyReadOnly,
  36. DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
  37. (& GlobalModel::ReadSecureByDefault)),
  38. ComplianceMode(this,
  39. static_cast<DPL::Event::Property<bool,
  40. DPL::Event::PropertyReadOnly,
  41. DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
  42. (& GlobalModel::readComplianceMode)),
  43. ComplianceFakeImei(this,
  44. & GlobalModel::readComplianceFakeImei),
  45. ComplianceFakeMeid(this,
  46. & GlobalModel::readComplianceFakeMeid)
  47. {
  48. }
  49. GlobalModel::NetworkAccessMode GlobalModel::HomeNetworkAccessReadProperty(
  50. DPL::Event::Model* /*model*/)
  51. {
  52. switch (GlobalDAOReadOnly::GetHomeNetworkDataUsage()) {
  53. case GlobalDAOReadOnly::NEVER_CONNECT:
  54. return GlobalModel::NEVER_CONNECT;
  55. case GlobalDAOReadOnly::ALWAYS_ASK:
  56. return GlobalModel::ALWAYS_ASK;
  57. case GlobalDAOReadOnly::CONNECT_AUTOMATICALLY:
  58. return GlobalModel::CONNECT_AUTOMATICALLY;
  59. default:
  60. break;
  61. }
  62. LogWarning("using default value");
  63. return GlobalModel::ALWAYS_ASK;
  64. }
  65. GlobalModel::NetworkAccessMode GlobalModel::RoamingNetworkAccessReadProperty(
  66. DPL::Event::Model* /*model*/)
  67. {
  68. switch (GlobalDAOReadOnly::GetRoamingDataUsage()) {
  69. case GlobalDAOReadOnly::NEVER_CONNECT:
  70. return GlobalModel::NEVER_CONNECT;
  71. case GlobalDAOReadOnly::ALWAYS_ASK:
  72. return GlobalModel::ALWAYS_ASK;
  73. case GlobalDAOReadOnly::CONNECT_AUTOMATICALLY:
  74. return GlobalModel::CONNECT_AUTOMATICALLY;
  75. default:
  76. break;
  77. }
  78. LogWarning("using default value");
  79. return GlobalModel::ALWAYS_ASK;
  80. }
  81. bool GlobalModel::ReadDeveloperMode(DPL::Event::Model */*model*/)
  82. {
  83. return GlobalDAOReadOnly::GetDeveloperMode();
  84. }
  85. bool GlobalModel::ReadSecureByDefault(DPL::Event::Model */*model*/)
  86. {
  87. return GlobalDAOReadOnly::GetSecureByDefault();
  88. }
  89. bool GlobalModel::readComplianceMode(DPL::Event::Model * /* model */)
  90. {
  91. return GlobalDAOReadOnly::getComplianceMode();
  92. }
  93. std::string GlobalModel::readComplianceFakeImei(DPL::Event::Model * /* model */)
  94. {
  95. return GlobalDAOReadOnly::getComplianceFakeImei();
  96. }
  97. std::string GlobalModel::readComplianceFakeMeid(DPL::Event::Model * /* model */)
  98. {
  99. return GlobalDAOReadOnly::getComplianceFakeMeid();
  100. }