summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorJeonghoon Park <jh1979.park@samsung.com>2018-06-26 16:39:20 +0900
committerJeonghoon Park <jh1979.park@samsung.com>2018-06-26 16:39:20 +0900
commit5526607945d3e7f843b90093ad4de5edf8b1da31 (patch)
tree17e2c615df5baa6b7abd21e8e2b9e0b4198f8c62 /daemon
parentacb8b197d26c2efef2f6d8f99f20f4037b46753c (diff)
downloadtizen-things-daemon-5526607945d3e7f843b90093ad4de5edf8b1da31.tar.gz
tizen-things-daemon-5526607945d3e7f843b90093ad4de5edf8b1da31.tar.bz2
tizen-things-daemon-5526607945d3e7f843b90093ad4de5edf8b1da31.zip
add url for log
Change-Id: I125aad8044876e878be1ffa3261dda59ea23647e
Diffstat (limited to 'daemon')
-rw-r--r--daemon/include/ttd-url.h1
-rw-r--r--daemon/res/ttd.conf1
-rw-r--r--daemon/src/ttd-url.c29
3 files changed, 31 insertions, 0 deletions
diff --git a/daemon/include/ttd-url.h b/daemon/include/ttd-url.h
index 1b8b8bd..859495b 100644
--- a/daemon/include/ttd-url.h
+++ b/daemon/include/ttd-url.h
@@ -21,6 +21,7 @@ typedef enum {
TTD_URL_CMD = 0,
TTD_URL_REPORT,
TTD_URL_DATA,
+ TTD_URL_LOG,
TTD_URL_TYPE_NUM
} ttd_url_type_e;
diff --git a/daemon/res/ttd.conf b/daemon/res/ttd.conf
index 0e9c8de..0b4a80c 100644
--- a/daemon/res/ttd.conf
+++ b/daemon/res/ttd.conf
@@ -3,6 +3,7 @@ server=https://test.showiot.xyz
api_cmd=/api/cmd
api_report=/api/report/cmd
api_data=/api/data
+api_log=/api/log
[worker]
appid=
[setting]
diff --git a/daemon/src/ttd-url.c b/daemon/src/ttd-url.c
index 21a2508..6a8ebe2 100644
--- a/daemon/src/ttd-url.c
+++ b/daemon/src/ttd-url.c
@@ -24,6 +24,7 @@
#define CONF_URL_KEY_CMD "api_cmd"
#define CONF_URL_KEY_REPORT "api_report"
#define CONF_URL_KEY_DATA "api_data"
+#define CONF_URL_KEY_LOG "api_log"
#define QUERY_KEY_DEVICE_ID "deviceId="
#define QUERY_KEY_STATE "state="
@@ -59,6 +60,31 @@ static char *__ttd_url_get_by_key(const char *key)
return url;
}
+static char *_ttd_url_get_log(void)
+{
+ char *log_api = NULL;
+ char *device_id = NULL;
+ char *log_url = NULL;
+
+ device_id = __ttd_url_get_device_id();
+ retv_if(!device_id, NULL);
+
+ log_api = __ttd_url_get_by_key(CONF_URL_KEY_LOG);
+ goto_if(!log_api, DONE_N_FREE);
+
+ log_url = g_strdup_printf("%s?&%s%s", log_api,
+ QUERY_KEY_DEVICE_ID, device_id);
+
+ if (!log_url)
+ _E("failed to create log_url");
+
+DONE_N_FREE:
+ g_free(device_id);
+ g_free(log_api);
+
+ return log_url;
+}
+
static char *_ttd_url_get_cmd(void)
{
char *cmd_api = NULL;
@@ -114,6 +140,9 @@ char *ttd_url_get_by_type(ttd_url_type_e type)
case TTD_URL_DATA:
url_postfix = _ttd_url_get_data();
break;
+ case TTD_URL_LOG:
+ url_postfix = _ttd_url_get_log();
+ break;
case TTD_URL_TYPE_NUM:
default:
_E("not supported type : %d", type);