aul_comp_info.h
aul_comp_context.h
aul_comp_info_internal.h
+ aul_watch_control.h
)
# Install headers, other files
--- /dev/null
+/*
+ * Copyright (c) 2019 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.
+ */
+
+#ifndef __AUL_WATCH_CONTROL_H__
+#define __AUL_WATCH_CONTROL_H__
+
+#include <bundle.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The watch control handle.
+ * @since_tizen 5.5
+ */
+typedef void *aul_watch_control_h;
+
+/**
+ * @brief Called when another application sends a launch request to the application.
+ * @details Before calling app_control_cb() function, this callback function is called.
+ * @since_tizen 5.5
+ *
+ * @param[in] b The bundle object
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see aul_watch_control_add_handler()
+ *
+ * @remarks This is only for App Framework internally.
+ */
+typedef void (*aul_watch_control_cb)(bundle *b, void *user_data);
+
+/**
+ * @brief Adds the watch control handle.
+ * @since_tizen 5.5
+ *
+ * @param[in] callback The callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] handle The watch control handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @see aul_watch_control_remove_handler()
+ * @see aul_watch_control_cb()
+ *
+ * @remarks This is only for App Framework internally.
+ */
+int aul_watch_control_add_handler(aul_watch_control_cb callback,
+ void *user_data, aul_watch_control_h *handle);
+
+/**
+ * @brief Removes registered watch control handle.
+ * @since_tizen 5.5
+ *
+ * @param[in] handle The watch control handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @see aul_watch_control_add_handler()
+ *
+ * @remarks This is only for App Framework internally.
+ */
+int aul_watch_control_remove_handler(aul_watch_control_h handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AUL_WATCH_CONTROL_H__ */
#include "aul_sock.h"
#include "launch.h"
#include "key.h"
+#include "aul_watch_control_internal.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
{
const char *str;
+ aul_watch_control_invoke(req->b);
__invoke_aul_handler(AUL_START, req->b);
str = bundle_get_val(req->b, AUL_K_DATA_CONTROL_TYPE);
if (str && !strcmp(str, "CORE")) {
--- /dev/null
+/*
+ * Copyright (c) 2019 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.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include "aul.h"
+#include "aul_api.h"
+#include "aul_util.h"
+#include "aul_watch_control.h"
+#include "aul_watch_control_internal.h"
+
+struct aul_watch_control_s {
+ aul_watch_control_cb callback;
+ void *user_data;
+};
+
+static GList *__controls;
+
+API int aul_watch_control_add_handler(aul_watch_control_cb callback,
+ void *user_data, aul_watch_control_h *handle)
+{
+ struct aul_watch_control_s *control;
+
+ if (!callback || !handle) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ control = calloc(1, sizeof(struct aul_watch_control_s));
+ if (!control) {
+ _E("Out of memory");
+ return AUL_R_ENOMEM;
+ }
+
+ control->callback = callback;
+ control->user_data = user_data;
+
+ __controls = g_list_append(__controls, control);
+
+ *handle = control;
+
+ return AUL_R_OK;
+}
+
+API int aul_watch_control_remove_handler(aul_watch_control_h handle)
+{
+ if (!handle || !g_list_find(__controls, handle)) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ __controls = g_list_remove(__controls, handle);
+ free(handle);
+
+ return AUL_R_OK;
+}
+
+static void __foreach_control_cb(gpointer data, gpointer user_data)
+{
+ struct aul_watch_control_s *control;
+ bundle *b = (bundle *)user_data;
+
+ control = (struct aul_watch_control_s *)data;
+ control->callback(b, control->user_data);
+}
+
+void aul_watch_control_invoke(bundle *b)
+{
+ if (!__controls)
+ return;
+
+ g_list_foreach(__controls, __foreach_control_cb, b);
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 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.
+ */
+
+#ifndef __AUL_WATCH_CONTROL_INTENRAL_H__
+#define __AUL_WATCH_CONTROL_INTERNAL_H__
+
+#include <bundle.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void aul_watch_control_invoke(bundle *b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AUL_WATCH_CONTROL_INTERNAL_H__ */