set(WRT_DAO_RW_SOURCES
dao/feature_dao.cpp
- dao/global_dao.cpp
dao/plugin_dao.cpp
dao/property_dao.cpp
dao/widget_dao.cpp
INSTALL(FILES
include/dpl/wrt-dao-rw/feature_dao.h
- include/dpl/wrt-dao-rw/global_dao.h
include/dpl/wrt-dao-rw/plugin_dao.h
include/dpl/wrt-dao-rw/property_dao.h
include/dpl/wrt-dao-rw/widget_dao.h
+++ /dev/null
-/*
- * 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_dao.cpp
- * @author Pawel Sikorski (p.sikorski@samsung.com)
- * @version 1.0
- * @brief This file contains the definition of global dao class.
- */
-#include <stddef.h>
-#include <dpl/wrt-dao-rw/global_dao.h>
-#include <dpl/log/log.h>
-#include <dpl/string.h>
-#include <dpl/db/orm.h>
-#include <orm_generator_wrt.h>
-#include <dpl/wrt-dao-ro/webruntime_database.h>
-#include <dpl/wrt-dao-ro/WrtDatabase.h>
-
-namespace WrtDB {
-void GlobalDAO::SetRoamingDataUsage(GlobalDAO::NetworkAccessMode newMode)
-{
- LogDebug("updating roaming network data usage to:" << newMode);
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- GlobalProperties::Row row;
- row.Set_roaming_data_usage(static_cast<int>(newMode));
-
- WRT_DB_UPDATE(update, GlobalProperties, &WrtDatabase::interface())
- update->Values(row);
- update->Execute();
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAO::Exception::DatabaseError,
- "Failed to update roaming network data usage");
- }
-}
-
-} // namespace WrtDB
#include <dpl/wrt-dao-ro/common_dao_types.h>
namespace WrtDB {
-GlobalDAOReadOnly::NetworkAccessMode GlobalDAOReadOnly::GetRoamingDataUsage()
-{
- LogDebug("Getting roaming network data usage");
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- WRT_DB_SELECT(select, GlobalProperties, &WrtDatabase::interface())
- return static_cast<GlobalDAOReadOnly::NetworkAccessMode>(
- select->GetSingleValue<GlobalProperties::roaming_data_usage>());
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAOReadOnly::Exception::DatabaseError,
- "Failed to get roaming network data usage");
- }
-}
-
DeviceCapabilitySet GlobalDAOReadOnly::GetDeviceCapability(
const DPL::String &apifeature)
{
};
public:
-
-
-
- enum NetworkAccessMode
- {
- NEVER_CONNECT,
- ALWAYS_ASK,
- CONNECT_AUTOMATICALLY
- };
-
- /**
- * This method returns network access mode while roaming is enabled.
- *
- * @return Access mode for home network.
- */
- static NetworkAccessMode GetRoamingDataUsage() DPL_DEPRECATED;
-
/**
* This method returns set of device capabilities used by apifeature.
*/
+++ /dev/null
-/*
- * 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_dao.h
- * @author Pawel Sikorski (p.sikorski@samsung.com)
- * @version 1.0
- * @brief This file contains the declaration of global dao
- */
-
-#ifndef WRT_SRC_CONFIGURATION_GLOBAL_DAO_H_
-#define WRT_SRC_CONFIGURATION_GLOBAL_DAO_H_
-
-#include <dpl/availability.h>
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-
-namespace WrtDB {
-class GlobalDAO : public GlobalDAOReadOnly
-{
- public:
- /**
- * This method changes network access mode while roaming is enabled.
- *
- */
- static void SetRoamingDataUsage(NetworkAccessMode newMode) DPL_DEPRECATED;
-
- private:
- DPL_DEPRECATED GlobalDAO()
- {}
-};
-} // namespace WrtDB
-
-#endif /* WRT_SRC_CONFIGURATION_GLOBAL_DAO_H_ */
PRAGMA foreign_keys = ON;
BEGIN TRANSACTION;
)
-CREATE_TABLE(GlobalProperties)
- COLUMN_NOT_NULL(roaming_data_usage, TINYINT, DEFAULT 1)
-CREATE_TABLE_END()
-
-SQL(
- INSERT INTO GlobalProperties DEFAULT VALUES;
-)
CREATE_TABLE(WidgetInfo)
COLUMN_NOT_NULL(app_id, INTEGER, PRIMARY KEY AUTOINCREMENT)
+++ /dev/null
-/*
- * 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 TestCases_GlobalDAO.cpp
- * @author Pawel Sikorski (p.sikorski@samsung.com)
- * @version 1.0
- * @brief This file contains tests for global dao class.
- */
-
-#include <list>
-#include <vector>
-#include <set>
-#include <dpl/test/test_runner.h>
-#include <dpl/foreach.h>
-#include <dpl/exception.h>
-#include <dpl/string.h>
-#include <dpl/wrt-dao-rw/global_dao.h>
-#include <dpl/wrt-dao-ro/wrt_db_types.h>
-
-using namespace WrtDB;
-
-namespace {
-const DPL::String widgetPackage5(L"widgetpackage5");
-} // namespace
-
-RUNNER_TEST_GROUP_INIT(DAO)
-
-/*
- * Name: roaming_data_usage
- * Description: tests if RoamingDataUsage is correctly set and get
- * Expected: received developer shoudl match the one was set
- */
-RUNNER_TEST(roaming_data_usage)
-{
- GlobalDAO::NetworkAccessMode original =
- GlobalDAO::GetRoamingDataUsage();
-
- GlobalDAO::SetRoamingDataUsage(GlobalDAO::CONNECT_AUTOMATICALLY);
- RUNNER_ASSERT_MSG(GlobalDAO::CONNECT_AUTOMATICALLY ==
- GlobalDAO::GetRoamingDataUsage(), "Value not updated");
-
- GlobalDAO::SetRoamingDataUsage(GlobalDAO::ALWAYS_ASK);
- RUNNER_ASSERT_MSG(GlobalDAO::ALWAYS_ASK ==
- GlobalDAO::GetRoamingDataUsage(), "Value not updated");
-
- GlobalDAO::SetRoamingDataUsage(GlobalDAO::NEVER_CONNECT);
- RUNNER_ASSERT_MSG(GlobalDAO::NEVER_CONNECT ==
- GlobalDAO::GetRoamingDataUsage(), "Value not updated");
-
- GlobalDAO::SetRoamingDataUsage(original);
- RUNNER_ASSERT_MSG(original == GlobalDAO::GetRoamingDataUsage(),
- "Value not updated");
-}