Name: stc-manager
Summary: STC(Smart Traffic Control) manager
-Version: 0.0.16
+Version: 0.0.17
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(capi-system-info)
%if %{?enable_database} == YES
BuildRequires: pkgconfig(sqlite3)
gio-unix-2.0
dlog
vconf
+ capi-system-info
)
IF("${ENABLE_DATABASE}" STREQUAL "YES")
--- /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_EMULATOR_H__
+#define __STC_EMULATOR_H__
+
+#include <glib.h>
+
+gboolean stc_emulator_is_emulated(void);
+void stc_emulator_check_environment(void);
+
+#endif /* __STC_EMULATOR_H__ */
--- /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 <stdio.h>
+#include <system_info.h>
+
+#include "stc-emulator.h"
+#include "stc-manager-util.h"
+
+static gboolean stc_is_emulated = FALSE;
+
+static gboolean __stc_emulator_check_env(void)
+{
+ int ret;
+ char *model = NULL;
+
+ ret = system_info_get_platform_string("tizen.org/system/model_name", &model);
+ if (ret != SYSTEM_INFO_ERROR_NONE) {
+ STC_LOGE("Failed to get system information(%d)", ret);
+ return FALSE;
+ }
+
+ if (model && strncmp(model, "Emulator", strlen("Emulator")) == 0) {
+ g_free(model);
+ return TRUE;
+ }
+
+ g_free(model);
+ return FALSE;
+}
+
+gboolean stc_emulator_is_emulated(void)
+{
+ return stc_is_emulated;
+}
+
+void stc_emulator_check_environment(void)
+{
+ stc_is_emulated = __stc_emulator_check_env();
+
+ STC_LOGD("Emulation environment : %s",
+ stc_is_emulated ? "It's emulated" : "Not emulated");
+}
+
ret = read_netlink(sock,
&ans, sizeof(struct genl));
- STC_LOGD("Counter data received ret [%d]", ret);
+ /* STC_LOGD("Counter data received ret [%d]", ret); */
if (ret == 0)
goto out;
stc->carg->sock = stc_monitor_get_counter_socket();
}
- STC_LOGD("Get all counters");
+ /* STC_LOGD("Get all counters"); */
nfacct_send_get_all(stc->carg);
/* we need to continue the timer */
*/
#include "stc-manager.h"
+#include "stc-emulator.h"
#include "stc-statistics.h"
#include "stc-restriction.h"
#include "stc-manager-gdbus.h"
g_type_init();
#endif
- g_stc = __stc_manager_init();
- if (!g_stc)
- goto fail;
-
/* Crate the GLIB main loop */
main_loop = g_main_loop_new(NULL, FALSE);
- g_stc->main_loop = main_loop;
+
+ stc_emulator_check_environment();
+ if (stc_emulator_is_emulated() == FALSE) {
+ g_stc = __stc_manager_init();
+ if (!g_stc)
+ goto fail;
+ g_stc->main_loop = main_loop;
+ }
/* Run the main loop */
g_main_loop_run(main_loop);
ret = 0;
fail:
- __stc_manager_deinit();
+ if (stc_emulator_is_emulated() == FALSE)
+ __stc_manager_deinit();
if (main_loop)
g_main_loop_unref(main_loop);