diff options
Diffstat (limited to 'mobile_src/DataSync/plugin_config.cpp')
-rwxr-xr-x | mobile_src/DataSync/plugin_config.cpp | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/mobile_src/DataSync/plugin_config.cpp b/mobile_src/DataSync/plugin_config.cpp new file mode 100755 index 0000000..e17acb3 --- /dev/null +++ b/mobile_src/DataSync/plugin_config.cpp @@ -0,0 +1,184 @@ +// +// Tizen Web Device API +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// 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. +// + + +#include <Commons/FunctionDefinition.h> +#include <Commons/FunctionDeclaration.h> +#include <Commons/Exception.h> +#include <dpl/exception.h> +#include <map> + +#include "plugin_config.h" + +#define DATASYNC_FEATURE_API "http://tizen.org/privilege/datasync" + +#define DATASYNC_DEVICE_CAP "datasync" + +using namespace WrtDeviceApis::Commons; + +namespace DeviceAPI { +namespace DataSync { + +static FunctionMapping createDataSyncFunctions(); + +static FunctionMapping DataSyncFunctions = createDataSyncFunctions(); + +#pragma GCC visibility push(default) + +DEFINE_FUNCTION_GETTER(DataSync, DataSyncFunctions); + +#pragma GCC visibility pop + +static FunctionMapping createDataSyncFunctions() +{ + /** + * Device capabilities + */ + ACE_CREATE_DEVICE_CAP(DEVICE_CAP_DATASYNC, DATASYNC_DEVICE_CAP); + + ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_DATASYNC); + ACE_ADD_DEVICE_CAP(DEVICE_LIST_DATASYNC, DEVICE_CAP_DATASYNC); + + /** + * Api Features + */ + ACE_CREATE_FEATURE(FEATURE_DATASYNC, DATASYNC_FEATURE_API); + + ACE_CREATE_FEATURE_LIST(DATASYNC_FEATURES); + ACE_ADD_API_FEATURE(DATASYNC_FEATURES, FEATURE_DATASYNC); + + /** + * Functions + */ + FunctionMapping dataSyncMapping; + + // add + AceFunction addFunc = ACE_CREATE_FUNCTION( + FUNCTION_ADD, + DATASYNC_FUNCTION_API_ADD, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_ADD, + addFunc)); + + // update + AceFunction updateFunc = ACE_CREATE_FUNCTION( + FUNCTION_UPDATE, + DATASYNC_FUNCTION_API_UPDATE, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_UPDATE, + updateFunc)); + + // remove + AceFunction removeFunc = ACE_CREATE_FUNCTION( + FUNCTION_REMOVE, + DATASYNC_FUNCTION_API_REMOVE, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_REMOVE, + removeFunc)); + + // getMaxProfilesNum + AceFunction getMaxProfilesNumFunc = ACE_CREATE_FUNCTION( + FUNCTION_GET_MAX_PROFILES_NUM, + DATASYNC_FUNCTION_API_GET_MAX_PROFILES_NUM, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_GET_MAX_PROFILES_NUM, + getMaxProfilesNumFunc)); + + // getProfilesNum + AceFunction getProfilesNumFunc = ACE_CREATE_FUNCTION( + FUNCTION_GET_PROFILES_NUM, + DATASYNC_FUNCTION_API_GET_PROFILES_NUM, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_GET_PROFILES_NUM, + getMaxProfilesNumFunc)); + + // get + AceFunction getFunc = ACE_CREATE_FUNCTION( + FUNCTION_GET, + DATASYNC_FUNCTION_API_GET, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_GET, + getFunc)); + + // getAll + AceFunction getAllFunc = ACE_CREATE_FUNCTION( + FUNCTION_GET_ALL, + DATASYNC_FUNCTION_API_GET_ALL, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_GET_ALL, + getAllFunc)); + + // startSync + AceFunction startSyncFunc = ACE_CREATE_FUNCTION( + FUNCTION_START_SYNC, + DATASYNC_FUNCTION_API_START_SYNC, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_START_SYNC, + startSyncFunc)); + + // stopSync + AceFunction stopSyncFunc = ACE_CREATE_FUNCTION( + FUNCTION_STOP_SYNC, + DATASYNC_FUNCTION_API_STOP_SYNC, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_STOP_SYNC, + stopSyncFunc)); + + + // getLastSyncStatistics + AceFunction getLastSyncStatisticsFunc = ACE_CREATE_FUNCTION( + FUNCTION_GET_LAST_SYNC_STATISTICS, + DATASYNC_FUNCTION_API_GET_LAST_SYNC_STATISTICS, + DATASYNC_FEATURES, + DEVICE_LIST_DATASYNC); + + dataSyncMapping.insert(std::make_pair( + DATASYNC_FUNCTION_API_GET_LAST_SYNC_STATISTICS, + getLastSyncStatisticsFunc)); + + return dataSyncMapping; +} + +} +} |