int stc_plugin_appstatus_init(void);
int stc_plugin_appstatus_deinit(void);
-int stc_plugin_appstatus_send_message(const char *content, const char *type,
- const char *app_id, const char *iftype,
- const char *limit);
-
int stc_plugin_appstatus_register_state_changed_cb(stc_s *stc,
stc_plugin_app_state_changed_cb cb, void *data);
int stc_plugin_appstatus_deregister_state_changed_cb(stc_s *stc);
--- /dev/null
+/*
+ * Copyright (c) 2016 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.
+ */
+
+#ifndef __STC_MANAGER_PLUGIN_POPUP_H__
+#define __STC_MANAGER_PLUGIN_POPUP_H__
+
+#define STC_PLUGIN_POPUP_FILEPATH "/usr/lib/stc-plugin-popup.so"
+
+#include "stc-plugin-popup.h"
+
+int stc_plugin_popup_init(void);
+int stc_plugin_popup_deinit(void);
+
+int stc_plugin_popup_show(const char *content, const char *type,
+ const char *app_id, const char *iftype,
+ const char *limit);
+
+#endif /* __STC_MANAGER_PLUGIN_POPUP_H__ */
Name: stc-manager
Summary: STC(Smart Traffic Control) manager
-Version: 0.0.46
+Version: 0.0.47
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
%package plugin-appstatus
Summary: STC manager application status plugin
-BuildRequires: pkgconfig(bundle)
-BuildRequires: pkgconfig(syspopup-caller)
%description plugin-appstatus
A smart traffic control manager extension for application status plugin
%description plugin-procfs
A smart traffic control manager extension for proc file system plugin
+%package plugin-net-popup
+Summary: STC manager net popup notification plugin
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(syspopup-caller)
+BuildRequires: pkgconfig(capi-appfw-application)
+
+%description plugin-net-popup
+A smart traffic control manager extension for net popup notification plugin
+
+%package plugin-wearable-popup
+Summary: STC manager popup notification plugin for wearable
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(efl-extension)
+BuildRequires: pkgconfig(capi-system-system-settings)
+
+%description plugin-wearable-popup
+A smart traffic control manager extension for popup notification plugin wearable
+
%prep
%setup -q
chmod 644 %{SOURCE0}
mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
cp resources/dbus/stc-manager.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/stc-manager.conf
+%post plugin-net-popup
+mv -f %{_libdir}/stc-plugin-net-popup.so %{_libdir}/stc-plugin-popup.so
+
+%post plugin-wearable-popup
+mv -f %{_libdir}/stc-plugin-wearable-popup.so %{_libdir}/stc-plugin-popup.so
+
%files
%manifest %{name}.manifest
%license LICENSE
%files plugin-appstatus
%manifest %{name}.manifest
-%attr(644, -,-) %{_datadir}/icons/*.png
%attr(500,root,root) %{_libdir}/stc-plugin-appstatus.so
%files plugin-exception
%files plugin-procfs
%manifest %{name}.manifest
%attr(500,root,root) %{_libdir}/stc-plugin-procfs.so
+
+%files plugin-net-popup
+%manifest %{name}.manifest
+%attr(644, -,-) %{_datadir}/icons/*.png
+%attr(500,root,root) %{_libdir}/stc-plugin-net-popup.so
+
+%files plugin-wearable-popup
+%manifest %{name}.manifest
+%attr(500,root,root) %{_libdir}/stc-plugin-wearable-popup.so
+%attr(755,root,root) %{_bindir}/stc-wearable-popup
SET(HELPER_SOURCE_DIR ${SOURCE_DIR}/helper)
SET(DATABASE_SOURCE_DIR ${SOURCE_DIR}/database)
SET(MONITOR_SOURCE_DIR ${SOURCE_DIR}/monitor)
+SET(PLUGIN_DIR ${CMAKE_SOURCE_DIR}/plugin)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/interfaces)
INCLUDE_DIRECTORIES(${MONITOR_SOURCE_DIR})
INCLUDE_DIRECTORIES(${MONITOR_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${PLUGIN_DIR}/include)
+
ADD_SUBDIRECTORY(appstatus)
ADD_SUBDIRECTORY(exception)
ADD_SUBDIRECTORY(procfs)
+ADD_SUBDIRECTORY(net-popup)
+ADD_SUBDIRECTORY(wearable-popup)
gio-2.0
gio-unix-2.0
glib-2.0
- bundle
- syspopup-caller
)
FOREACH(flag ${appstatus_plugin_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
-
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Werror -fvisibility=hidden")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
# install
INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${LIBDIR})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/stc_noti_datausage.png DESTINATION /usr/share/icons)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <syspopup_caller.h>
-#include <bundle.h>
-#include <bundle_internal.h>
#include <dlog.h>
#include <gio/gio.h>
return 0;
}
-int stc_plugin_popup_send_message(const char *content, const char *type,
- const char *app_id, const char *iftype,
- const char *limit)
-{
- int ret = 0;
- bundle *b = bundle_create();
-
- bundle_add(b, "_SYSPOPUP_CONTENT_", content);
- bundle_add(b, "_SYSPOPUP_TYPE_", type);
- bundle_add(b, "_APP_ID_", app_id);
- bundle_add(b, "_IF_TYPE_", iftype);
-
- if (g_strcmp0(type, "warning_noti") == 0) {
- STC_LOGD("Warn message : content[%s] type[%s] app_id[%s] limit[%s]",
- content, type, app_id, limit);
-
- bundle_add(b, "_WARN_LIMIT_", limit);
- } else {
- STC_LOGD("Restriction message : content[%s] type[%s] app_id[%s] limit[%s]",
- content, type, app_id, limit);
-
- bundle_add(b, "_RESTRICTION_LIMIT_", limit);
- }
-
- ret = syspopup_launch("net-popup", b);
-
- bundle_free(b);
-
- return ret;
-}
-
API stc_plugin_appstatus_s stc_plugin_appstatus = {
- .send_message_to_net_popup =
- stc_plugin_popup_send_message,
.register_state_changed_cb =
stc_plugin_appstatus_register_changed_cb,
.deregister_state_changed_cb =
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
-
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Werror -fvisibility=hidden")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
stc_app_type_e app_type);
typedef struct {
- /* popup */
- int (*send_message_to_net_popup) (const char *, const char *,
- const char *, const char *,
- const char *);
/* app status */
int (*register_state_changed_cb) (stc_s *stc,
stc_plugin_app_state_changed_cb cb, void *data);
int (*deregister_state_changed_cb) (stc_s *stc);
} stc_plugin_appstatus_s;
-int stc_plugin_popup_send_message(const char *content, const char *type,
- const char *app_id, const char *iftype,
- const char *limit);
int stc_plugin_appstatus_register_changed_cb(stc_s *stc,
stc_plugin_app_state_changed_cb cb, void *data);
int stc_plugin_appstatus_deregister_changed_cb(stc_s *stc);
--- /dev/null
+/*
+ * Copyright (c) 2016 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.
+ */
+
+#ifndef __STC_PLUGIN_POPUP_H__
+#define __STC_PLUGIN_POPUP_H__
+
+typedef struct {
+ int (*initialize_plugin) (void);
+ int (*deinitialize_plugin) (void);
+
+ int (*show_popup) (const char *, const char *,
+ const char *, const char *,
+ const char *);
+} stc_plugin_popup_s;
+
+int stc_plugin_popup_initialize(void);
+int stc_plugin_popup_deinitialize(void);
+int stc_plugin_popup_show(const char *content, const char *type,
+ const char *app_id, const char *iftype,
+ const char *limit);
+
+#endif /* __STC_PLUGIN_POPUP_H__ */
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(stc-plugin-net-popup C)
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(net_popup_plugin REQUIRED
+ dlog
+ gio-2.0
+ gio-unix-2.0
+ glib-2.0
+ bundle
+ syspopup-caller
+ )
+
+FOREACH(flag ${net_popup_plugin_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Werror -fvisibility=hidden")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+ADD_DEFINITIONS("-DUSE_DLOG")
+
+SET(SRCS_PLUGIN
+ stc-plugin-net-popup.c
+ )
+
+# library build
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS_PLUGIN})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${net_popup_plugin_LDFLAGS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "" OUTPUT_NAME ${PROJECT_NAME})
+
+# install
+INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${LIBDIR})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/stc_noti_datausage.png DESTINATION /usr/share/icons)
--- /dev/null
+/*
+ * Copyright (c) 2016 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 <syspopup_caller.h>
+#include <bundle.h>
+#include <bundle_internal.h>
+
+#include "stc-plugin-popup.h"
+#include "stc-error.h"
+#include "stc-manager-util.h"
+
+int stc_plugin_popup_initialize(void)
+{
+ return STC_ERROR_NONE;
+}
+
+int stc_plugin_popup_deinitialize(void)
+{
+ return STC_ERROR_NONE;
+}
+
+int stc_plugin_popup_show(const char *content, const char *type,
+ const char *app_id, const char *iftype,
+ const char *limit)
+{
+ int ret = 0;
+ bundle *b = bundle_create();
+
+ bundle_add(b, "_SYSPOPUP_CONTENT_", content);
+ bundle_add(b, "_SYSPOPUP_TYPE_", type);
+ bundle_add(b, "_APP_ID_", app_id);
+ bundle_add(b, "_IF_TYPE_", iftype);
+
+ if (g_strcmp0(type, "warning_noti") == 0) {
+ STC_LOGD("Warn message : content[%s] type[%s] app_id[%s] limit[%s]",
+ content, type, app_id, limit);
+
+ bundle_add(b, "_WARN_LIMIT_", limit);
+ } else {
+ STC_LOGD("Restriction message : content[%s] type[%s] app_id[%s] limit[%s]",
+ content, type, app_id, limit);
+
+ bundle_add(b, "_RESTRICTION_LIMIT_", limit);
+ }
+
+ ret = syspopup_launch("net-popup", b);
+
+ bundle_free(b);
+
+ return ret;
+}
+
+API stc_plugin_popup_s stc_plugin_popup = {
+ .initialize_plugin =
+ stc_plugin_popup_initialize,
+ .deinitialize_plugin =
+ stc_plugin_popup_deinitialize,
+ .show_popup = stc_plugin_popup_show
+};
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
-
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Werror -fvisibility=hidden")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(stc-plugin-wearable-popup C)
+
+ADD_SUBDIRECTORY(stc-plugin)
+ADD_SUBDIRECTORY(stc-popup)
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(stc-plugin-wearable-popup C)
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(wearable_popup_plugin REQUIRED
+ dlog
+ gio-2.0
+ gio-unix-2.0
+ glib-2.0
+ )
+
+FOREACH(flag ${wearable_popup_plugin_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Werror -fvisibility=hidden")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+ADD_DEFINITIONS("-DUSE_DLOG")
+
+SET(SRCS_PLUGIN
+ stc-plugin-wearable-popup.c
+ )
+
+# library build
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS_PLUGIN})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${wearable_popup_plugin_LDFLAGS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "" OUTPUT_NAME ${PROJECT_NAME})
+
+# install
+INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${LIBDIR})
--- /dev/null
+/*
+ * Copyright (c) 2016 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 "stc-plugin-popup.h"
+#include "stc-error.h"
+#include "stc-manager-util.h"
+
+int stc_plugin_popup_initialize(void)
+{
+ return STC_ERROR_NONE;
+}
+
+int stc_plugin_popup_deinitialize(void)
+{
+ return STC_ERROR_NONE;
+}
+
+int stc_plugin_popup_show(const char *content, const char *type,
+ const char *app_id, const char *iftype,
+ const char *limit)
+{
+ return STC_ERROR_NONE;
+}
+
+API stc_plugin_popup_s stc_plugin_popup = {
+ .initialize_plugin =
+ stc_plugin_popup_initialize,
+ .deinitialize_plugin =
+ stc_plugin_popup_deinitialize,
+ .show_popup = stc_plugin_popup_show
+};
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(stc-wearable-popup C)
+SET(PACKAGE ${PROJECT_NAME})
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(wearable_popup REQUIRED
+ dlog
+ glib-2.0
+ elementary
+ capi-appfw-application
+ efl-extension
+ capi-system-system-settings
+ )
+
+FOREACH(flag ${wearable_popup_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Werror -fvisibility=hidden")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+ADD_DEFINITIONS("-DUSE_DLOG")
+
+INCLUDE_DIRECTORIES(inc)
+AUX_SOURCE_DIRECTORY(./src stc_wearable_srcs)
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${stc_wearable_srcs})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${wearable_popup_LDFLAGS} -ldl)
+
+# install
+INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${BIN_DIR})
--- /dev/null
+#ifndef __stc_wearable_popup_H__
+#define __stc_wearable_popup_H__
+
+#include <app.h>
+#include <Elementary.h>
+#include <system_settings.h>
+#include <efl_extension.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "stc-wearable-popup"
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.tizen.stc-wearable-popup"
+#endif
+
+#endif /* __stc_wearable_popup_H__ */
--- /dev/null
+#include "stc-wearable-popup.h"
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *label;
+} appdata_s;
+
+static void
+win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ui_app_exit();
+}
+
+static void
+win_back_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ appdata_s *ad = data;
+ /* Let window go to hide state. */
+ elm_win_lower(ad->win);
+}
+
+static void
+create_base_gui(appdata_s *ad)
+{
+ /* Window */
+ /* Create and initialize elm_win.
+ elm_win is mandatory to manipulate window. */
+ ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
+ elm_win_autodel_set(ad->win, EINA_TRUE);
+
+ if (elm_win_wm_rotation_supported_get(ad->win)) {
+ int rots[4] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
+ }
+
+ evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
+ eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);
+
+ /* Conformant */
+ /* Create and initialize elm_conformant.
+ elm_conformant is mandatory for base gui to have proper size
+ when indicator or virtual keypad is visible. */
+ ad->conform = elm_conformant_add(ad->win);
+ elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
+ elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
+ evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(ad->win, ad->conform);
+ evas_object_show(ad->conform);
+
+ /* Label */
+ /* Create an actual view of the base gui.
+ Modify this part to change the view. */
+ ad->label = elm_label_add(ad->conform);
+ elm_object_text_set(ad->label, "<align=center>Hello Tizen</align>");
+ evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_content_set(ad->conform, ad->label);
+
+ /* Show window after base gui is set up */
+ evas_object_show(ad->win);
+}
+
+static bool
+app_create(void *data)
+{
+ /* Hook to take necessary actions before main event loop starts
+ Initialize UI resources and application's data
+ If this function returns true, the main loop of application starts
+ If this function returns false, the application is terminated */
+ appdata_s *ad = data;
+
+ create_base_gui(ad);
+
+ return true;
+}
+
+static void
+app_control(app_control_h app_control, void *data)
+{
+ /* Handle the launch request. */
+}
+
+static void
+app_pause(void *data)
+{
+ /* Take necessary actions when application becomes invisible. */
+}
+
+static void
+app_resume(void *data)
+{
+ /* Take necessary actions when application becomes visible. */
+}
+
+static void
+app_terminate(void *data)
+{
+ /* Release all resources. */
+}
+
+static void
+ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LANGUAGE_CHANGED*/
+ char *locale = NULL;
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+ elm_language_set(locale);
+ free(locale);
+ return;
+}
+
+static void
+ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+ return;
+}
+
+static void
+ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_REGION_FORMAT_CHANGED*/
+}
+
+static void
+ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_BATTERY*/
+}
+
+static void
+ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_MEMORY*/
+}
+
+int
+main(int argc, char *argv[])
+{
+ appdata_s ad = {0,};
+ int ret = 0;
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ app_event_handler_h handlers[5] = {NULL, };
+
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.pause = app_pause;
+ event_callback.resume = app_resume;
+ event_callback.app_control = app_control;
+
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
+
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
+ }
+
+ return ret;
+}
SET(CONFIGURE_SOURCE_DIR ${SOURCE_DIR}/configure)
SET(LIMITATION_SOURCE_DIR ${SOURCE_DIR}/limitation)
SET(PLUGIN_DIR ${CMAKE_SOURCE_DIR}/plugin)
-SET(APPSTATUS_SOURCE_DIR ${PLUGIN_DIR}/appstatus)
-SET(EXCEPTION_SOURCE_DIR ${PLUGIN_DIR}/exception)
-SET(PROCFS_SOURCE_DIR ${PLUGIN_DIR}/procfs)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/interfaces)
INCLUDE_DIRECTORIES(${LIMITATION_SOURCE_DIR})
INCLUDE_DIRECTORIES(${LIMITATION_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${APPSTATUS_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${EXCEPTION_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${PROCFS_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${PLUGIN_DIR}/include)
FILE(GLOB SOURCE_SRCS ${SOURCE_DIR}/*.c)
FILE(GLOB HELPER_SRCS ${HELPER_SOURCE_DIR}/*.c)
#include "stc-monitor.h"
#include "stc-manager-plugin-appstatus.h"
#include "stc-manager-plugin-exception.h"
+#include "stc-manager-plugin-popup.h"
#include "stc-time.h"
#define MAX_INT_LENGTH 128
snprintf(iftype, MAX_INT_LENGTH, "%d", rstn_key->iftype);
snprintf(byte, MAX_INT_LENGTH, "%lld", rstn_value->limit[limit_type]);
- stc_plugin_appstatus_send_message(net_popup_content, net_popup_type,
- rstn_key->app_id, iftype, byte);
+
+ stc_plugin_popup_show(net_popup_content, net_popup_type,
+ rstn_key->app_id, iftype, byte);
}
static gboolean __rstn_counter_update(stc_rstn_key_s *rstn_key,
return STC_ERROR_NONE;
}
-int stc_plugin_appstatus_send_message(const char *content, const char *type,
- const char *app_id, const char *iftype,
- const char *limit)
-{
- __STC_LOG_FUNC_ENTER__;
-
- if (!stc_plugin_enabled) {
- STC_LOGE("Plugin wasn't enabled");
- __STC_LOG_FUNC_EXIT__;
- return STC_ERROR_UNINITIALIZED;
- }
-
- if (!stc_plugin) {
- STC_LOGE("Plugin wasn't loaded");
- __STC_LOG_FUNC_EXIT__;
- return STC_ERROR_UNINITIALIZED;
- }
-
- __STC_LOG_FUNC_EXIT__;
- return stc_plugin->send_message_to_net_popup(content, type, app_id,
- iftype, limit);
-}
-
int stc_plugin_appstatus_register_state_changed_cb(stc_s *stc,
stc_plugin_app_state_changed_cb cb, void *data)
{
--- /dev/null
+/*
+ * Copyright (c) 2016 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 <dlfcn.h>
+
+#include "stc-manager.h"
+#include "stc-manager-plugin-popup.h"
+
+static gboolean stc_plugin_enabled = FALSE;
+static void *handle_plugin;
+static stc_plugin_popup_s *stc_plugin;
+
+//LCOV_EXCL_START
+int stc_plugin_popup_init(void)
+{
+ __STC_LOG_FUNC_ENTER__;
+
+ handle_plugin = dlopen(STC_PLUGIN_POPUP_FILEPATH, RTLD_NOW);
+ if (!handle_plugin) {
+ STC_LOGE("Can't load %s: %s", STC_PLUGIN_POPUP_FILEPATH, dlerror());
+ __STC_LOG_FUNC_EXIT__;
+ return STC_ERROR_UNINITIALIZED;
+ }
+
+ stc_plugin = dlsym(handle_plugin, "stc_plugin_popup");
+ if (!stc_plugin) {
+ STC_LOGE("Can't load symbol: %s", dlerror());
+ dlclose(handle_plugin);
+ __STC_LOG_FUNC_EXIT__;
+ return STC_ERROR_UNINITIALIZED;
+ }
+
+ stc_plugin->initialize_plugin();
+ stc_plugin_enabled = TRUE;
+
+ __STC_LOG_FUNC_EXIT__;
+ return STC_ERROR_NONE;
+}
+
+int stc_plugin_popup_deinit(void)
+{
+ __STC_LOG_FUNC_ENTER__;
+
+ if (!stc_plugin_enabled) {
+ __STC_LOG_FUNC_EXIT__;
+ return STC_ERROR_UNINITIALIZED;
+ }
+
+ stc_plugin->deinitialize_plugin();
+ stc_plugin_enabled = FALSE;
+ dlclose(handle_plugin);
+
+ __STC_LOG_FUNC_EXIT__;
+ return STC_ERROR_NONE;
+}
+
+int stc_plugin_popup_show(const char *content, const char *type,
+ const char *app_id, const char *iftype,
+ const char *limit)
+{
+ __STC_LOG_FUNC_ENTER__;
+
+ if (!stc_plugin_enabled) {
+ STC_LOGE("Plugin wasn't enabled");
+ __STC_LOG_FUNC_EXIT__;
+ return STC_ERROR_UNINITIALIZED;
+ }
+
+ if (!stc_plugin) {
+ STC_LOGE("Plugin wasn't loaded");
+ __STC_LOG_FUNC_EXIT__;
+ return STC_ERROR_UNINITIALIZED;
+ }
+
+ __STC_LOG_FUNC_EXIT__;
+ return stc_plugin->show_popup(content, type, app_id, iftype, limit);
+}
+//LCOV_EXCL_STOP
#include "stc-manager-plugin-appstatus.h"
#include "stc-manager-plugin-exception.h"
#include "stc-manager-plugin-procfs.h"
+#include "stc-manager-plugin-popup.h"
static stc_s *g_stc = NULL;
stc_manager_gdbus_deinit((gpointer)g_stc);
- stc_plugin_appstatus_deinit();
- stc_plugin_exception_deinit();
stc_plugin_procfs_deinit();
+ stc_plugin_exception_deinit();
+ stc_plugin_appstatus_deinit();
+ stc_plugin_popup_deinit();
STC_LOGI("stc manager deinitialized");
FREE(g_stc);
EXEC(STC_ERROR_NONE, stc_db_initialize());
+ stc_plugin_popup_init();
stc_plugin_appstatus_init();
stc_plugin_exception_init();
stc_plugin_procfs_init();
} else if (!g_strcmp0(key, "month_start_date")) {
rule->month_start_date = g_variant_get_int64(value);
- STC_LOGD("month_start_date: [%lld]", rule->month_start_date);
+ STC_LOGD("month_start_date: [%d]", rule->month_start_date);
} else if (!g_strcmp0(key, "monthly_limit")) {
rule->monthly_limit = g_variant_get_int64(value);