1 #ifndef __DALI_INTERNAL_FRAMEWORK_H__
2 #define __DALI_INTERNAL_FRAMEWORK_H__
5 * Copyright (c) 2016 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/signals/callback.h>
24 #ifdef APPCORE_WATCH_AVAILABLE
25 #include "wearable/watch/watch-application.h"
29 #include <abort-handler.h>
41 * The Framework class is ideally placed to provide key API required by Applications.
43 * The class is also used to register callbacks with the TIZEN platform so that
44 * we know when any of the application lifecycle events occur. This includes events
45 * like when our application is to be initialised, terminated, paused, resumed etc.
53 NORMAL, ///< normal appFramework
54 WATCH, ///< watch appFramework
55 WIDGET ///< widget appFramework
59 * Observer class for the framework.
66 * Invoked when the application is to be initialised.
68 virtual void OnInit() {}
71 * Invoked when the application is to be terminated.
73 virtual void OnTerminate() {}
76 * Invoked when the application is to be paused.
78 virtual void OnPause() {}
81 * Invoked when the application is to be resumed.
83 virtual void OnResume() {}
86 * Invoked when the application is to be reset.
88 virtual void OnReset() {}
91 * Invoked when the AppControl message is received.
92 * @param[in] The bundle data of AppControl message.
94 virtual void OnAppControl(void *) {}
96 #ifdef APPCORE_WATCH_AVAILABLE
98 * Invoked at every second
100 virtual void OnTimeTick(WatchTime&) {}
103 * Invoked at every second in ambient mode
105 virtual void OnAmbientTick(WatchTime&) {}
108 * Invoked when the device enters or exits ambient mode
110 virtual void OnAmbientChanged(bool ambient) {}
114 * Invoked when the language of the device is changed.
116 virtual void OnLanguageChanged() {}
119 * Invoked when the region is changed.
121 virtual void OnRegionChanged() {}
124 * Invoked when the battery level of the device is low.
126 virtual void OnBatteryLow() {}
129 * Invoked when the memory level of the device is low.
131 virtual void OnMemoryLow() {}
138 * @param[in] observer The observer of the Framework.
139 * @param[in] argc A pointer to the number of arguments.
140 * @param[in] argv A pointer the the argument list.
141 * @param[in] type The type of application
143 Framework( Observer& observer, int* argc, char ***argv, Type type = NORMAL );
153 * Runs the main loop of framework
158 * Quits the main loop
163 * Checks whether the main loop of the framework is running.
164 * @return true, if the main loop is running, false otherwise.
166 bool IsMainLoopRunning();
169 * If the main loop aborts unexpectedly, then the connected callback function is called.
170 * @param[in] callBack The function to call.
171 * @note Only one callback can be registered. The last callback to be set will be called on abort.
172 * @note The ownership of callback is passed onto this class.
174 void AddAbortCallback( CallbackBase* callback );
177 * Gets bundle name which was passed in app_reset callback.
179 std::string GetBundleName() const;
182 * Gets bundle id which was passed in app_reset callback.
184 std::string GetBundleId() const;
187 * Gets the path at which application resources are stored.
189 static std::string GetResourcePath();
194 Framework(const Framework&);
195 Framework& operator=(Framework&);
200 * Called when the application is created.
205 * Called by the App framework when an application lifecycle event occurs.
206 * @param[in] type The type of event occurred.
207 * @param[in] bundleData The bundle data of event occurred.
209 bool AppStatusHandler(int type, void *bundleData);
212 * Called app_reset callback was called with bundle.
214 void SetBundleName(const std::string& name);
217 * Called app_reset callback was called with bundle.
219 void SetBundleId(const std::string& id);
222 * Called if the application is aborted.
224 void AbortCallback();
227 * Called for initializing on specified backend. (X11 or Wayland)
237 std::string mBundleName;
238 std::string mBundleId;
239 AbortHandler mAbortHandler;
241 private: // impl members
247 } // namespace Adaptor
249 } // namespace Internal
253 #endif // __DALI_INTERNAL_FRAMEWORK_H__