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
58 * Observer class for the framework.
65 * Invoked when the application is to be initialised.
67 virtual void OnInit() {}
70 * Invoked when the application is to be terminated.
72 virtual void OnTerminate() {}
75 * Invoked when the application is to be paused.
77 virtual void OnPause() {}
80 * Invoked when the application is to be resumed.
82 virtual void OnResume() {}
85 * Invoked when the application is to be reset.
87 virtual void OnReset() {}
90 * Invoked when the AppControl message is received.
91 * @param[in] The bundle data of AppControl message.
93 virtual void OnAppControl(void *) {}
95 #ifdef APPCORE_WATCH_AVAILABLE
97 * Invoked at every second
99 virtual void OnTimeTick(WatchTime&) {}
102 * Invoked at every second in ambient mode
104 virtual void OnAmbientTick(WatchTime&) {}
107 * Invoked when the device enters or exits ambient mode
109 virtual void OnAmbientChanged(bool ambient) {}
113 * Invoked when the language of the device is changed.
115 virtual void OnLanguageChanged() {}
118 * Invoked when the region is changed.
120 virtual void OnRegionChanged() {}
123 * Invoked when the battery level of the device is low.
125 virtual void OnBatteryLow() {}
128 * Invoked when the memory level of the device is low.
130 virtual void OnMemoryLow() {}
137 * @param[in] observer The observer of the Framework.
138 * @param[in] argc A pointer to the number of arguments.
139 * @param[in] argv A pointer the the argument list.
140 * @param[in] type The type of application
142 Framework( Observer& observer, int* argc, char ***argv, Type type = NORMAL );
152 * Runs the main loop of framework
157 * Quits the main loop
162 * Checks whether the main loop of the framework is running.
163 * @return true, if the main loop is running, false otherwise.
165 bool IsMainLoopRunning();
168 * If the main loop aborts unexpectedly, then the connected callback function is called.
169 * @param[in] callBack The function to call.
170 * @note Only one callback can be registered. The last callback to be set will be called on abort.
171 * @note The ownership of callback is passed onto this class.
173 void AddAbortCallback( CallbackBase* callback );
176 * Gets bundle name which was passed in app_reset callback.
178 std::string GetBundleName() const;
181 * Gets bundle id which was passed in app_reset callback.
183 std::string GetBundleId() const;
186 * Gets the path at which application resources are stored.
188 static std::string GetResourcePath();
193 Framework(const Framework&);
194 Framework& operator=(Framework&);
199 * Called when the application is created.
204 * Called by the App framework when an application lifecycle event occurs.
205 * @param[in] type The type of event occurred.
206 * @param[in] bundleData The bundle data of event occurred.
208 bool AppStatusHandler(int type, void *bundleData);
211 * Called app_reset callback was called with bundle.
213 void SetBundleName(const std::string& name);
216 * Called app_reset callback was called with bundle.
218 void SetBundleId(const std::string& id);
221 * Called if the application is aborted.
223 void AbortCallback();
226 * Called for initializing on specified backend. (X11 or Wayland)
236 std::string mBundleName;
237 std::string mBundleId;
238 AbortHandler mAbortHandler;
240 private: // impl members
246 } // namespace Adaptor
248 } // namespace Internal
252 #endif // __DALI_INTERNAL_FRAMEWORK_H__