summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeonghoon Park <jh1979.park@samsung.com>2018-04-10 15:15:46 +0900
committerJeonghoon Park <jh1979.park@samsung.com>2018-04-10 15:15:46 +0900
commit14beef3d22a2700bd48b42aaece5dda2a1ae493c (patch)
treec71a59c0df9ccbe6ecf5ac7370971507193b541c
parent4e20a933bfe892d519e9c71ac1fb1f7b45b2d0ce (diff)
downloadttsd-worker-package-14beef3d22a2700bd48b42aaece5dda2a1ae493c.tar.gz
ttsd-worker-package-14beef3d22a2700bd48b42aaece5dda2a1ae493c.tar.bz2
ttsd-worker-package-14beef3d22a2700bd48b42aaece5dda2a1ae493c.zip
adds report module
-rw-r--r--inc/pm_report.h22
-rw-r--r--src/pm_report.c40
2 files changed, 62 insertions, 0 deletions
diff --git a/inc/pm_report.h b/inc/pm_report.h
new file mode 100644
index 0000000..405c03c
--- /dev/null
+++ b/inc/pm_report.h
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+#ifndef __PM_REPORT_H__
+#define __PM_REPORT_H__
+
+void pm_worker_report_result(const char *report);
+
+#endif /* __PM_REPORT_H__ */
diff --git a/src/pm_report.c b/src/pm_report.c
new file mode 100644
index 0000000..f7d3344
--- /dev/null
+++ b/src/pm_report.c
@@ -0,0 +1,40 @@
+/*
+ * 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 <stdio.h>
+#include "log.h"
+
+#define TEMP_REPORT_FILE "/tmp/pmw-report.json"
+
+static void __temp_report_result_internal(const char *report)
+{
+ FILE *fp = NULL;
+ ret_if(!report);
+
+ fp = fopen(TEMP_REPORT_FILE, "w");
+ if (!fp) {
+ _E("Failed to open file: %s", TEMP_REPORT_FILE);
+ return;
+ }
+ fprintf(fp, "%s\n", report);
+ fclose(fp);
+}
+
+void pm_worker_report_result(const char *report)
+{
+ __temp_report_result_internal(report);
+ /* TODO : report result to daemon, and notify it */
+} \ No newline at end of file