Set current time to default WatchTime constructor 64/85464/6
authorsuhyung Eom <suhyung.eom@samsung.com>
Thu, 25 Aug 2016 08:04:09 +0000 (17:04 +0900)
committersu hyung Eom <suhyung.eom@samsung.com>
Thu, 1 Sep 2016 08:18:35 +0000 (01:18 -0700)
Signed-off-by: suhyung Eom <suhyung.eom@samsung.com>
Change-Id: Ie79c69b679ab74a70bb21866d631de896fdeecf9

adaptors/wearable/watch/watch-application.h
adaptors/wearable/watch/watch-time.cpp

index c5b940c..f83355f 100644 (file)
@@ -165,13 +165,15 @@ public:
   WatchTimeSignal& TimeTickSignal();
 
   /**
-   * @brief This signal is emitted at every second in ambient mode
+   * @brief This signal is emitted at each minute in ambient mode
    * A callback of the following type may be connected:
    * @code
    *   void YourCallbackName(Application& application, WatchTimeSignal &time);
    * @endcode
    * time(watch time handle) will not be available after returning this callback. It will be freed by the framework.
    * @SINCE_1_1.37
+   * @remarks http://tizen.org/privilege/alarm.set privilege is needed to receive ambient ticks at each minute.
+   * The AmbientTickSignal() will be ignored if your app doesn't have the privilege
    */
   WatchTimeSignal& AmbientTickSignal();
 
index 34c4089..73890c2 100644 (file)
@@ -36,11 +36,6 @@ struct WatchTime::Impl
   void *mTimeHandle;
 };
 
-WatchTime::WatchTime()
-  :mImpl(NULL)
-{
-}
-
 WatchTime::WatchTime(void *time_handle)
 {
   mImpl = new Impl(time_handle);
@@ -57,6 +52,14 @@ WatchTime::~WatchTime()
 
 #ifdef APPCORE_WATCH_AVAILABLE
 
+WatchTime::WatchTime()
+{
+  watch_time_h watch_time = {0,};
+
+  watch_time_get_current_time(&watch_time);
+  mImpl = new Impl(watch_time);
+}
+
 int WatchTime::GetHour() const
 {
   int hour;
@@ -91,6 +94,11 @@ int WatchTime::GetSecond() const
 
 #else
 
+WatchTime::WatchTime()
+  :mImpl(NULL)
+{
+}
+
 int WatchTime::GetHour() const
 {
   return 0;
@@ -111,6 +119,6 @@ int WatchTime::GetSecond() const
   return 0;
 }
 
-#endif
+#endif  // APPCORE_WATCH_AVAILABLE
 
 } // namespace Dali