summaryrefslogtreecommitdiff
path: root/mobile_src/Content/plugin_config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mobile_src/Content/plugin_config.cpp')
-rwxr-xr-xmobile_src/Content/plugin_config.cpp170
1 files changed, 170 insertions, 0 deletions
diff --git a/mobile_src/Content/plugin_config.cpp b/mobile_src/Content/plugin_config.cpp
new file mode 100755
index 0000000..fd7c673
--- /dev/null
+++ b/mobile_src/Content/plugin_config.cpp
@@ -0,0 +1,170 @@
+//
+// 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 <iostream>
+#include <Commons/Exception.h>
+#include <dpl/exception.h>
+#include <map>
+
+#include "plugin_config.h"
+
+#define CONTENT_FEATURE_API_READ "http://tizen.org/privilege/content.read"
+#define CONTENT_FEATURE_API_WRITE "http://tizen.org/privilege/content.write"
+
+#define CONTENT_DEVICE_CAP_READ "content.read"
+#define CONTENT_DEVICE_CAP_WRITE "content.write"
+
+
+using namespace WrtDeviceApis::Commons;
+
+namespace DeviceAPI {
+namespace Content {
+
+static FunctionMapping createContentFunctions();
+
+static FunctionMapping ContentFunctions = createContentFunctions();
+
+#pragma GCC visibility push(default)
+
+DEFINE_FUNCTION_GETTER(Content, ContentFunctions);
+
+#pragma GCC visibility pop
+
+static FunctionMapping createContentFunctions()
+{
+ /**
+ * Device capabilities
+ */
+ ACE_CREATE_DEVICE_CAP(DEVICE_CAP_CONTENT_READ, CONTENT_DEVICE_CAP_READ);
+ ACE_CREATE_DEVICE_CAP(DEVICE_CAP_CONTENT_WRITE, CONTENT_DEVICE_CAP_WRITE);
+
+ ACE_CREATE_DEVICE_CAPS_LIST(EMPTY_DEVICE_LIST);
+ ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_CONTENT_READ);
+ ACE_ADD_DEVICE_CAP(DEVICE_LIST_CONTENT_READ, DEVICE_CAP_CONTENT_READ);
+
+ ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_CONTENT_WRITE);
+ ACE_ADD_DEVICE_CAP(DEVICE_LIST_CONTENT_WRITE, DEVICE_CAP_CONTENT_WRITE);
+
+ /**
+ * Api Features
+ */
+ ACE_CREATE_FEATURE(FEATURE_CONTENT_READ, CONTENT_FEATURE_API_READ);
+ ACE_CREATE_FEATURE(FEATURE_CONTENT_WRITE, CONTENT_FEATURE_API_WRITE);
+
+ ACE_CREATE_FEATURE_LIST(CONTENT_FEATURES_CONTENT_READ_WRITE);
+ ACE_ADD_API_FEATURE(CONTENT_FEATURES_CONTENT_READ_WRITE, FEATURE_CONTENT_READ);
+ ACE_ADD_API_FEATURE(CONTENT_FEATURES_CONTENT_READ_WRITE, FEATURE_CONTENT_WRITE);
+
+ ACE_CREATE_FEATURE_LIST(CONTENT_FEATURES_CONTENT_READ);
+ ACE_ADD_API_FEATURE(CONTENT_FEATURES_CONTENT_READ, FEATURE_CONTENT_READ);
+
+ ACE_CREATE_FEATURE_LIST(CONTENT_FEATURES_CONTENT_WRITE);
+ ACE_ADD_API_FEATURE(CONTENT_FEATURES_CONTENT_WRITE, FEATURE_CONTENT_WRITE);
+
+ /**
+ * Functions
+ */
+ FunctionMapping contentMapping;
+
+ //"getLocalMediaSource"
+ AceFunction getLocalMediaSourceFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_GET_LOCAL_MEDIA_SOURCE,
+ CONTENT_FUNCTION_API_GET_LOCAL_MEDIASOURCE,
+ CONTENT_FEATURES_CONTENT_READ_WRITE,
+ DEVICE_LIST_CONTENT_READ);
+
+ contentMapping.insert(std::make_pair(
+ CONTENT_FUNCTION_API_GET_LOCAL_MEDIASOURCE,
+ getLocalMediaSourceFunc));
+
+
+ //findItems
+ AceFunction findItemsFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_FIND_ITEMS,
+ CONTENT_FUNCTION_API_FIND_ITEMS,
+ CONTENT_FEATURES_CONTENT_READ,
+ DEVICE_LIST_CONTENT_READ);
+
+ contentMapping.insert(std::make_pair(
+ CONTENT_FUNCTION_API_FIND_ITEMS,
+ findItemsFunc));
+
+
+ //updateItem
+ AceFunction updateItemFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_UPDATE_ITEM,
+ CONTENT_FUNCTION_API_UPDATE_ITEM,
+ CONTENT_FEATURES_CONTENT_WRITE,
+ DEVICE_LIST_CONTENT_WRITE);
+
+ contentMapping.insert(std::make_pair(
+ CONTENT_FUNCTION_API_UPDATE_ITEM,
+ updateItemFunc));
+
+ //updateItemsBatch
+ AceFunction updateItemsBatchFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_UPDATE_ITEMS_BATCH,
+ CONTENT_FUNCTION_API_UPDATE_ITEMS_BATCH,
+ CONTENT_FEATURES_CONTENT_WRITE,
+ DEVICE_LIST_CONTENT_WRITE);
+
+ contentMapping.insert(std::make_pair(
+ CONTENT_FUNCTION_API_UPDATE_ITEMS_BATCH,
+ updateItemsBatchFunc));
+
+ //scanFile
+ AceFunction scanFileFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_SCAN_FILE,
+ CONTENT_FUNCTION_API_SCAN_FILE,
+ CONTENT_FEATURES_CONTENT_WRITE,
+ DEVICE_LIST_CONTENT_WRITE);
+
+ contentMapping.insert(std::make_pair(
+ CONTENT_FUNCTION_API_SCAN_FILE,
+ scanFileFunc));
+
+ //setChangeListener
+ AceFunction setListenerFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_SET_CHANGE_LISTENER,
+ CONTENT_FUNCTION_API_SET_CHANGE_LISTENER,
+ CONTENT_FEATURES_CONTENT_READ,
+ DEVICE_LIST_CONTENT_READ);
+
+ contentMapping.insert(std::make_pair(
+ CONTENT_FUNCTION_API_SET_CHANGE_LISTENER,
+ setListenerFunc));
+
+ //unsetChangeListener
+ AceFunction unsetListenerFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_UNSET_CHANGE_LISTENER,
+ CONTENT_FUNCTION_API_UNSET_CHANGE_LISTENER,
+ CONTENT_FEATURES_CONTENT_READ,
+ DEVICE_LIST_CONTENT_READ);
+
+ contentMapping.insert(std::make_pair(
+ CONTENT_FUNCTION_API_UNSET_CHANGE_LISTENER,
+ unsetListenerFunc));
+
+
+ return contentMapping;
+}
+
+}
+}