Added lap counter module stub 37/190937/3
authorKrzysztof Wieclaw <k.wieclaw@samsung.com>
Tue, 9 Oct 2018 12:30:38 +0000 (14:30 +0200)
committerKrzysztof Wieclaw <k.wieclaw@samsung.com>
Tue, 23 Oct 2018 12:13:14 +0000 (14:13 +0200)
Change-Id: I692981cd4caa08fdd196433358caa52919bea6a2
Signed-off-by: Krzysztof Wieclaw <k.wieclaw@samsung.com>
inc/lap_counter/lap_counter.h [new file with mode: 0644]
src/lap_counter/lap_counter.c [new file with mode: 0644]

diff --git a/inc/lap_counter/lap_counter.h b/inc/lap_counter/lap_counter.h
new file mode 100644 (file)
index 0000000..6a4f1a2
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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 LAP_COUNTER_H_
+#define LAP_COUNTER_H_
+
+int lap_counter_init();
+int lap_counter_set_user_name(const char *user_name);
+int lap_counter_shutdown();
+
+#endif //LAP_COUNTER_H_
diff --git a/src/lap_counter/lap_counter.c b/src/lap_counter/lap_counter.c
new file mode 100644 (file)
index 0000000..800e193
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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 "lap_counter/lap_counter.h"
+#include <stdlib.h>
+#include <string.h>
+#include "log.h"
+
+typedef struct lap_counter_data {
+       const char *user_name;
+} lap_counter_data_t;
+
+static lap_counter_data_t s_info = {0, };
+
+int lap_counter_init()
+{
+       s_info.user_name = NULL;
+       return 0;
+}
+
+int lap_counter_set_user_name(const char *user_name)
+{
+       free((void*)s_info.user_name);
+       s_info.user_name = strdup(user_name);
+       if(!s_info.user_name) {
+               return -1;
+       }
+       _D("User name set to %s", s_info.user_name);
+       return 0;
+}
+
+int lap_counter_shutdown()
+{
+       free((void*)s_info.user_name);
+       return 0;
+}