--- /dev/null
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#ifndef AppControlHandle_h_
+#define AppControlHandle_h_
+
+#include "AppControlUtils.h"
+
+namespace Msg {
+
+ class AppControlLauncher;
+
+ class AppControlHandle {
+
+ friend class AppControlLauncher;
+
+ public:
+ AppControlHandle(app_control_launch_mode_e launchMode = APP_CONTROL_LAUNCH_MODE_GROUP);
+ virtual ~AppControlHandle();
+
+ /**
+ *@brief Terminate launch request related with this handle.
+ */
+ void terminate();
+
+ /**
+ *@brief Sends the launch request.
+ *@return bool is launch success, false otherwise
+ */
+ bool launch();
+
+ /**
+ *@brief Returns internal handle to app_control_h
+ */
+ operator app_control_h();
+
+ void setOperation(const char *operation);
+ void setUri(const char *uri);
+ void setLaunchMode(app_control_launch_mode_e mode);
+
+ protected:
+ virtual void onReply(app_control_h request, app_control_h reply, app_control_result_e result) {};
+
+ AppControlHandle(const AppControlHandle&) = delete;
+ AppControlHandle& operator=(AppControlHandle) = delete;
+
+ protected:
+ app_control_h m_Handle;
+ };
+}
+
+#endif /* AppControlHandle_h_ */
#ifndef AppControlLauncher_h_
#define AppControlLauncher_h_
-#include "AppControlUtils.h"
+#include "AppControlHandle.h"
#include <Ecore.h>
namespace Msg {
- class AppControlLauncher;
- class AppControlHandle {
- friend class AppControlLauncher;
-
- public:
- AppControlHandle(app_control_launch_mode_e launchMode = APP_CONTROL_LAUNCH_MODE_GROUP);
- virtual ~AppControlHandle();
-
- /**
- *@brief Terminate launch request related with this handle.
- */
- void terminate();
-
- /**
- *@brief Returns internal handle to app_control_h
- */
- operator app_control_h();
-
- protected:
- virtual void onReply(app_control_h request, app_control_h reply, app_control_result_e result) {};
-
- AppControlHandle(const AppControlHandle&) = delete;
- AppControlHandle& operator=(AppControlHandle) = delete;
-
- protected:
- app_control_h m_Handle;
- };
-
class AppControlLauncher {
+
friend class AppControlHandle;
public:
InputSelector();
virtual ~InputSelector();
- bool launch();
-
protected:
virtual void onKeyboardReply(const std::string &text) {};
virtual void onVoiceReply(const std::string &text, const std::string &filePath) {};
--- /dev/null
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "AppControlHandle.h"
+#include "AppControlLauncher.h"
+
+using namespace Msg;
+
+AppControlHandle::AppControlHandle(app_control_launch_mode_e launchMode)
+ : m_Handle()
+{
+ app_control_create(&m_Handle);
+ if (m_Handle)
+ setLaunchMode(launchMode);
+}
+
+AppControlHandle::~AppControlHandle()
+{
+ if (m_Handle) {
+ terminate();
+ app_control_destroy(m_Handle);
+ }
+}
+
+AppControlHandle::operator app_control_h()
+{
+ return m_Handle;
+}
+
+bool AppControlHandle::launch()
+{
+ return AppControlLauncher::getInst().launch(*this);
+}
+
+void AppControlHandle::terminate()
+{
+ if (m_Handle && AppControlLauncher::getInst().m_pHandle == this)
+ AppControlLauncher::getInst().terminate();
+}
+
+void AppControlHandle::setOperation(const char *operation)
+{
+ app_control_set_operation(m_Handle, operation);
+}
+
+void AppControlHandle::setUri(const char *uri)
+{
+ app_control_set_uri(m_Handle, uri);
+}
+
+void AppControlHandle::setLaunchMode(app_control_launch_mode_e mode)
+{
+ app_control_set_launch_mode(m_Handle, mode);
+}
using namespace Msg;
-AppControlHandle::AppControlHandle(app_control_launch_mode_e launchMode)
- : m_Handle()
-{
- app_control_create(&m_Handle);
- if (m_Handle)
- app_control_set_launch_mode(m_Handle, launchMode);
-}
-
-AppControlHandle::~AppControlHandle()
-{
- if (m_Handle) {
- terminate();
- app_control_destroy(m_Handle);
- }
-}
-
-AppControlHandle::operator app_control_h()
-{
- return m_Handle;
-}
-
-void AppControlHandle::terminate()
-{
- if (m_Handle && AppControlLauncher::getInst().m_pHandle == this)
- AppControlLauncher::getInst().terminate();
-}
-
AppControlLauncher::AppControlLauncher()
: m_LaunchInProgress(false)
, m_pTimer(nullptr)
InputSelector::InputSelector()
{
- app_control_set_operation(m_Handle, APP_CONTROL_OPERATION_GET_INPUT);
+ setOperation(APP_CONTROL_OPERATION_GET_INPUT);
}
InputSelector::~InputSelector()
{
}
-bool InputSelector::launch()
-{
- return AppControlLauncher::getInst().launch(*this);
-}
-
void InputSelector::onReply(app_control_h request, app_control_h reply, app_control_result_e result)
{
MSG_LOG("result = ", result);
}
}
-
-