app-provider: API design 52/182252/3
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 21 Jun 2018 14:59:00 +0000 (16:59 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 22 Jun 2018 12:53:05 +0000 (14:53 +0200)
Change-Id: I70750d272eb9cc75c4bf211ac0695346d95d2e02

src/CMakeLists.txt
src/appinfo-provider.c
src/appinfo-provider.h

index 224d930..89167e0 100644 (file)
@@ -23,6 +23,7 @@ SET(SRCS
        task.c
        scheduler.c
        config-deserializer.c
+       appinfo-provider.c
 )
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 
index e69de29..0f41eb9 100644 (file)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2018 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 "appinfo-provider.h"
+
+void app_info_provider_app_descriptor_free(struct app_info_descriptor *descr)
+{
+}
+
+struct app_info_descriptor *app_info_provider_app_descriptor_copy(const struct app_info_descriptor *descr)
+{
+       return NULL;
+}
+
+void app_info_provider_free_app_info_descriptor_list(struct app_info_descriptor *descriptors)
+{
+}
+
+struct app_info_descriptor *app_info_provider_get_running_applications()
+{
+       return NULL;
+}
+
+int app_info_provider_find_main_pid(const char *appid)
+{
+       return -1;
+}
+
+char *app_info_provider_find_appid(int pid)
+{
+       return NULL;
+}
+
+int app_provider_init()
+{
+       return -1;
+}
+
+void app_provider_shutdown()
+{
+}
+
index 7da097e..50b8419 100644 (file)
 
 #include "report.h"
 
-char **app_info_provider_get_running_applications();
+struct app_info_descriptor {
+       int pid;
+       char *app_id;
+};
+
+/**
+ * @brief Frees descriptors list returned by app_info_provider_get_running_applications
+ */
+void app_info_provider_free_app_info_descriptor_list(struct app_info_descriptor *descriptors);
+
+/**
+ * @brief Returns list of running Tizen applications.
+ *
+ * @return array of app_desciptor (NULL-terminated), NULL on error
+ *
+ * @remark function is thread safe
+ * @remark returned value should be released with
+ * @app_info_provider_free_app_info_descriptor_list
+ */
+struct app_info_descriptor *app_info_provider_get_running_applications();
+
+/**
+ * @brief Searches Tizen applications main process id.
+ *
+ * @return pid (>0) on success, -1 if app_id was not found
+ *
+ * @remark function is thread safe
+ * @remark app_provide_init should be called beforehead
+ */
+int app_info_provider_find_main_pid(const char *app_id);
+
+/**
+ * @brief Searches for Tizen application app_id with given pid.
+ *
+ * @return app_id, NULL on if pid was not found or not owned by any Tizen application
+ *
+ * @remark function is thread safe
+ * @remark app_provide_init should be called beforehead
+ * @remark the returned value should be released with @free
+ */
+char *app_info_provider_find_app_id(int pid);
+
+/**
+ * @brief Initializes app provider internals
+ *
+ * @return 0 on success, other value on error.
+ */
+int app_provider_init();
+
+/**
+ * @brief Shutdowns app provider internals
+ */
+void app_provider_shutdown();
 
 #endif