1 #ifndef __DALI_WATCH_APPLICATION_H__
2 #define __DALI_WATCH_APPLICATION_H__
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/signals/callback.h>
27 #include <dali/public-api/dali-adaptor-common.h>
28 #include <dali/public-api/adaptor-framework/application.h>
29 #include <dali/public-api/watch/watch-time.h>
34 * @addtogroup dali_adaptor_framework
37 namespace Internal DALI_INTERNAL
41 class WatchApplication;
46 * @brief A WatchApplication class object should be created by every watch application
47 * that wishes to use Dali.
49 * It provides a means for initialising the resources required by the Dali::Core.
50 * Like Application class, the WatchApplication class manages Tizen watch application life cycle.
52 * The WatchApplication class emits additional signals which are availalble only in the watch application
53 * (TimeTick, AmbientTick, AmbientChanged)
55 * This feature is supported in wearable applications only.
57 * WatchApplication should follow the example below:
60 * class ExampleController: public ConnectionTracker
63 * ExampleController( WatchApplication& application )
64 * : mApplication( application )
66 * mApplication.InitSignal().Connect( this, &ExampleController::Create );
69 * void Create( Application& application )
71 * // Create Dali components...
75 * WatchApplication& mApplication;
78 * int DALI_ADAPTOR_API main (int argc, char **argv)
80 * WatchApplication app = WatchApplication::New(&argc, &argv);
81 * ExampleController example( app );
86 * If required, you can also connect class member functions to a signal:
90 * app.ResumeSignal().Connect(&app, &MyApplication::Resume);
93 * When the above options are found, they are stripped from argv, and argc is updated appropriately.
97 class DALI_ADAPTOR_API WatchApplication : public Application
100 typedef Signal< void (Application&, const WatchTime&) > WatchTimeSignal; ///< Watch pointer signal callback type @SINCE_1_1.37
101 typedef Signal< void (Application&, bool) > WatchBoolSignal; ///< Watch bool signal callback type @SINCE_1_1.37
106 * @brief This is the constructor for applications without an argument list.
108 * @return A handle to the WatchApplication
110 static WatchApplication New();
113 * @brief This is the constructor for applications.
116 * @param[in,out] argc A pointer to the number of arguments
117 * @param[in,out] argv A pointer the the argument list
118 * @return A handle to the WatchApplication
120 static WatchApplication New( int* argc, char **argv[] );
123 * @brief This is the constructor for applications with a name
126 * @param[in,out] argc A pointer to the number of arguments
127 * @param[in,out] argv A pointer the the argument list
128 * @param[in] stylesheet The path to user defined theme file
129 * @return A handle to the WatchApplication
131 static WatchApplication New( int* argc, char **argv[], const std::string& stylesheet );
134 * @brief Construct an empty handle
140 * @brief Copy Constructor
142 * @param[in] implementation The WatchApplication implementation
144 WatchApplication( const WatchApplication& implementation );
147 * @brief Assignment operator
149 * @param[in] application Handle to an object
150 * @return A reference to this
152 WatchApplication& operator=( const WatchApplication& application );
157 * This is non-virtual since derived Handle types must not contain data or virtual methods.
164 * @brief This signal is emitted at every second
165 * A callback of the following type may be connected:
167 * void YourCallbackName(Application& application, const WatchTime& time);
169 * time(watch time handle) will not be available after returning this callback. It will be freed by the framework.
171 * @return The signal to connect to
173 WatchTimeSignal& TimeTickSignal();
176 * @brief This signal is emitted at each minute in ambient mode
177 * A callback of the following type may be connected:
179 * void YourCallbackName(Application& application, const WatchTime& time);
181 * time(watch time handle) will not be available after returning this callback. It will be freed by the framework.
183 * @remarks http://tizen.org/privilege/alarm.set privilege is needed to receive ambient ticks at each minute.
184 * The AmbientTickSignal() will be ignored if your app doesn't have the privilege
185 * @return The signal to connect to
187 WatchTimeSignal& AmbientTickSignal();
190 * @brief This signal is emitted when the device enters or exits ambient mode
191 * A callback of the following type may be connected:
193 * void YourCallbackName(Application& application, bool ambient);
195 * ambient_mode If true the device enters the ambient mode, otherwise false
197 * @return The signal to connect to
199 WatchBoolSignal& AmbientChangedSignal();
201 public: // Not intended for application developers
204 * @brief Internal constructor
207 explicit DALI_INTERNAL WatchApplication(Internal::Adaptor::WatchApplication* implementation);
216 #endif // __DALI_WATCH_APPLICATION_H__