common: interface draft
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 26 Jul 2016 09:10:10 +0000 (11:10 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 26 Jul 2016 09:59:04 +0000 (11:59 +0200)
common/inc/Model/Alarm.h [new file with mode: 0644]
common/inc/Model/AlarmProvider.h [new file with mode: 0644]
common/inc/Model/Location.h [new file with mode: 0644]
common/inc/Model/StopWatch.h [new file with mode: 0644]
common/inc/Model/StopWatchLap.h [new file with mode: 0644]
common/inc/Model/Timer.h [new file with mode: 0644]
common/inc/Model/WeekFlags.h [new file with mode: 0644]
common/inc/Model/WordlClock.h [new file with mode: 0644]
common/inc/UI/View.h [new file with mode: 0644]
common/inc/Utils/Log.h [new file with mode: 0644]

diff --git a/common/inc/Model/Alarm.h b/common/inc/Model/Alarm.h
new file mode 100644 (file)
index 0000000..9b50825
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef _CLOCK_ALARM_H_
+#define _CLOCK_ALARM_H_
+
+#include <string>
+
+#include "WeekFlags.h"
+
+namespace clock {
+       namespace model {
+               class Alarm {
+                       public:
+                               Alarm();
+                               ~Alarm();
+                               void Activate();
+                               void Deactivate();
+                               void Snooze();
+                               std::string GetName();
+                               void SetName(std::string name);
+                               time_t GetTime();
+                               void SetTime(time_t time);
+                               std::string GetMelody();
+                               void SetMelody(std::string path);
+                               std::string GetVibration();
+                               void SetVibration(std::string pattern);
+                               WeekFlags GetWeekFlags();
+                               void SetWeekFlags(WeekFlags flags);
+                       private:
+                               int alarm_id;
+                               std::string name;
+                               std::string melody;
+                               std::string vibration;
+                               WeekFlags flags;
+                               bool activated;
+               };
+       } /* model */
+} /* clock */
+
+#endif
diff --git a/common/inc/Model/AlarmProvider.h b/common/inc/Model/AlarmProvider.h
new file mode 100644 (file)
index 0000000..2c43f02
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef _CLOCK_ALARM_PROVIDER_H
+#define _CLOCK_ALARM_PROVIDER_H
+
+#include "Model/Alarm.h"
+
+#include <vector.h>
+#include <functional.h>
+
+namespace clock {
+       namespace model {
+               class AlarmProvider {
+                       public:
+                               static AlarmProvider& GetInstance();
+
+                               void std::vector<std::reference_wrapper<Alarm>> GetAlarms();
+
+                               void Sync(Alarm& alarm);
+                               void SyncAll();
+                               void Add(Alarm& alarm);
+                               void Remove(Alarm& alarm);
+
+                       private:
+                               std::vector<Alarm> alarms;
+               };
+       } /* model */
+} /* clock */
+
+#endif
diff --git a/common/inc/Model/Location.h b/common/inc/Model/Location.h
new file mode 100644 (file)
index 0000000..2f5a973
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _CLOCK_LOCATION_H_
+#define _CLOCK_LOCATION_H_
+
+namespace clock {
+       namespace model {
+               struct Location {
+                       std::string Name;
+                       std::string Country;
+                       std::string Timezone;
+                       std::string TzPath;
+               };
+       } /* model */
+} /* clock */
+#endif
diff --git a/common/inc/Model/StopWatch.h b/common/inc/Model/StopWatch.h
new file mode 100644 (file)
index 0000000..3c25532
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef _CLOCK_STOPWATCH_H_
+#define _CLOCK_STOPWATCH_H_
+
+namespace clock {
+       namespace model {
+               class StopWatch {
+                       public:
+                               void Start();
+                               void Stop();
+                               void EndLap();
+                               void Reset();
+                               time_t ElapsedTime();
+                               std::vector<StopWatchLap> GetLaps();
+                       private:
+                               time_t start_time;
+                               std::vector<StopWatchLap> laps;
+               };
+       } /* model */
+} /* clock */
+
+#endif
diff --git a/common/inc/Model/StopWatchLap.h b/common/inc/Model/StopWatchLap.h
new file mode 100644 (file)
index 0000000..3d21b6f
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef _CLOCK_STOPWATCH_LAP_H_
+#define _CLOCK_STOPWATCH_LA_H_
+
+namespace clock {
+       namespace model {
+               class StopWatchLap {
+                       public:
+                               StopWatchLap(time_t start, time_t duration);
+                               ~StopWatchLap();
+                               time_t LapDuration();
+                               time_t LapStartTime();
+               };
+       } /* model */
+} /* clock */
+
+#endif
diff --git a/common/inc/Model/Timer.h b/common/inc/Model/Timer.h
new file mode 100644 (file)
index 0000000..945f521
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _CLOCK_TIMER_H_
+#define _CLOCK_TIMER_H_
+
+namespace clock {
+       namespace model {
+               class Timer {
+                       public:
+                               Start(time_t delay);
+                               time_t StartTime();
+                               time_t RemainingTime();
+               };
+       } /* model */
+} /* clock */
+
+#endif
diff --git a/common/inc/Model/WeekFlags.h b/common/inc/Model/WeekFlags.h
new file mode 100644 (file)
index 0000000..8712580
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef _CLOCK_ALARM_WEEK_FLAGS_H
+#define _CLOCK_ALARM_WEEK_FLAGS_H
+
+namespace clock {
+       namespace model {
+               enum WeekFlag {
+                       MONDAY   = (1 << 0),
+                       TUESDAY  = (1 << 1),
+                       WENSDAY  = (1 << 2),
+                       THURSDAY = (1 << 3),
+                       FRIDAY   = (1 << 4),
+                       SATURDAY = (1 << 5),
+                       SUNDAY   = (1 << 6),
+               };
+               class WeekFlags {
+                       public:
+                               WeekFlags();
+                               AddDay(WeekFlag day);
+                               RemoveDay(WeekFlag day);
+                               bool IsOn(WeekFlag day);
+                       private:
+                               int raw_flags;
+               };
+       } /* model */
+} /* clock */
+
+#endif
diff --git a/common/inc/Model/WordlClock.h b/common/inc/Model/WordlClock.h
new file mode 100644 (file)
index 0000000..21b5ef8
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef _CLOCK_WORLDCLOCK_H_
+#define _CLOCK_WORLDCLOCK_H_
+
+#include <vector>
+
+namespace clock {
+       namespace model {
+               class WorldClock {
+                       public:
+                               const std::vector<Location> Locations;
+                               const std::vector<Location> UserLocations;
+
+                               void AddUserLocation(Location loc);
+                               void RemoveUserLocation(Location loc);
+               };
+       } /* model */
+} /* clock */
+#endif
diff --git a/common/inc/UI/View.h b/common/inc/UI/View.h
new file mode 100644 (file)
index 0000000..857af53
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _CLOCK_UI_VIEW_H_
+#define _CLOCK_UI_VIEW_H_
+
+#include <Elementary.h>
+
+namespace clock {
+namespace ui {
+       class IView {
+               public:
+                       virtual Evas_Object *GetEvasObject() = 0;
+       };
+};
+};
+
+#endif
diff --git a/common/inc/Utils/Log.h b/common/inc/Utils/Log.h
new file mode 100644 (file)
index 0000000..7809d98
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef _CLOCK_LOC
+#define _CLOCK_LOC
+
+namespace clock {
+       namespace utils {
+               class Log {
+               };
+       } /* utils */
+} /* clock */
+#endif