Added binding for Keyboard RepeatInfo APIs 22/181322/7
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 12 Jun 2018 06:19:15 +0000 (15:19 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Fri, 27 Jul 2018 04:24:58 +0000 (13:24 +0900)
- Added binding SetRepeatInfo and GetRepeatInfo

Change-Id: Iad7db5714a0956ada38cbd0850a22c90370e6e2b
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
dali-csharp-binder/file.list
dali-csharp-binder/src/keyboard.cpp [new file with mode: 0755]

index d68e3d9..9c2be26 100755 (executable)
@@ -40,6 +40,7 @@ dali_csharp_binder_common_src_files = \
 # module: csharp-binder, backend: mobile,tv,ivi,watch
 dali_csharp_binder_tizen_src_files = \
   ${dali_csharp_binder_dir}/src/key-grab.cpp \
+  ${dali_csharp_binder_dir}/src/keyboard.cpp \
   ${dali_csharp_binder_dir}/src/widget_view.cpp \
   ${dali_csharp_binder_dir}/src/widget_view_manager.cpp \
   ${dali_csharp_binder_dir}/src/font-client.cpp \
diff --git a/dali-csharp-binder/src/keyboard.cpp b/dali-csharp-binder/src/keyboard.cpp
new file mode 100755 (executable)
index 0000000..c88516f
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2018 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 "common.h"
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/integration-api/debug.h>
+#include <dali/devel-api/adaptor-framework/keyboard.h>
+
+#include <stdexcept>
+#include <exception>
+
+
+#ifdef TIZEN_BUILD
+#ifdef ECORE_WL2
+#include <Ecore_Wl2.h>
+#else
+#include <Ecore_Wayland.h>
+#endif
+#endif
+
+#undef LOG
+//#define LOG DALI_LOG_ERROR
+#define LOG(a...)
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Keyboard_SetRepeatInfo(float rate, float delay)
+{
+  bool ret;
+
+  LOG("CSharp_Dali_Keyboard_SetRepeatInfo() [DP1] rate=%f, delay=%f", rate, delay);
+
+  {
+    try {
+      ret = Dali::Keyboard::SetRepeatInfo(rate, delay);
+    } catch (std::out_of_range& e) {
+    {
+      SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (std::exception& e) {
+    {
+      SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (Dali::DaliException e) {
+      {
+        SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
+      };
+    } catch (...) {
+      {
+        SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
+      };
+    }
+  }
+
+
+  LOG("CSharp_Dali_Keyboard_SetRepeatInfo() [DP2] ret=%d", ret);
+
+  return ret;
+}
+
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Keyboard_GetRepeatInfo(float& rate, float& delay)
+{
+  bool ret;
+
+  LOG("CSharp_Dali_Keyboard_GetRepeatInfo() [DP1] rate=%f, delay=%f", rate, delay);
+
+  {
+    try {
+      ret = Dali::Keyboard::GetRepeatInfo(rate, delay);
+    } catch (std::out_of_range& e) {
+    {
+      SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (std::exception& e) {
+    {
+      SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return false;
+    };
+    } catch (Dali::DaliException e) {
+      {
+        SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
+      };
+    } catch (...) {
+      {
+        SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
+      };
+    }
+  }
+
+
+  LOG("CSharp_Dali_Keyboard_GetRepeatInfo() [DP2] ret=%d", ret);
+
+  return ret;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+