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 used to register callbacks with the TIZEN platform so that
42 * we know when any of the application lifecycle events occur. This includes events
43 * like when our application is to be initialised, terminated, paused, resumed etc.
50 NORMAL, ///< normal appFramework
51 WATCH ///< watch appFramework
55 * Observer class for the framework.
62 * Invoked when the application is to be initialised.
64 virtual void OnInit() {}
67 * Invoked when the application is to be terminated.
69 virtual void OnTerminate() {}
72 * Invoked when the application is to be paused.
74 virtual void OnPause() {}
77 * Invoked when the application is to be resumed.
79 virtual void OnResume() {}
82 * Invoked when the application is to be reset.
84 virtual void OnReset() {}
87 * Invoked when the AppControl message is received.
88 * @param[in] The bundle data of AppControl message.
90 virtual void OnAppControl(void *) {}
92 #ifdef APPCORE_WATCH_AVAILABLE
94 * Invoked at every second
96 virtual void OnTimeTick(WatchTime&) {}
99 * Invoked at every second in ambient mode
101 virtual void OnAmbientTick(WatchTime&) {}
104 * Invoked when the device enters or exits ambient mode
106 virtual void OnAmbientChanged(bool ambient) {}
110 * Invoked when the language of the device is changed.
112 virtual void OnLanguageChanged() {}
115 * Invoked when the region is changed.
117 virtual void OnRegionChanged() {}
120 * Invoked when the battery level of the device is low.
122 virtual void OnBatteryLow() {}
125 * Invoked when the memory level of the device is low.
127 virtual void OnMemoryLow() {}
134 * @param[in] observer The observer of the Framework.
135 * @param[in] argc A pointer to the number of arguments.
136 * @param[in] argv A pointer the the argument list.
137 * @param[in] type The type of application
139 Framework( Observer& observer, int* argc, char ***argv, Type type = NORMAL );
149 * Runs the main loop of framework
154 * Quits the main loop
159 * Checks whether the main loop of the framework is running.
160 * @return true, if the main loop is running, false otherwise.
162 bool IsMainLoopRunning();
165 * If the main loop aborts unexpectedly, then the connected callback function is called.
166 * @param[in] callBack The function to call.
167 * @note Only one callback can be registered. The last callback to be set will be called on abort.
168 * @note The ownership of callback is passed onto this class.
170 void AddAbortCallback( CallbackBase* callback );
173 * Gets bundle name which was passed in app_reset callback.
175 std::string GetBundleName() const;
178 * Gets bundle id which was passed in app_reset callback.
180 std::string GetBundleId() const;
185 Framework(const Framework&);
186 Framework& operator=(Framework&);
191 * Called when the application is created.
196 * Called by the App framework when an application lifecycle event occurs.
197 * @param[in] type The type of event occurred.
198 * @param[in] bundleData The bundle data of event occurred.
200 bool AppStatusHandler(int type, void *bundleData);
203 * Called app_reset callback was called with bundle.
205 void SetBundleName(const std::string& name);
208 * Called app_reset callback was called with bundle.
210 void SetBundleId(const std::string& id);
213 * Called if the application is aborted.
215 void AbortCallback();
218 * Called for initializing on specified backend. (X11 or Wayland)
228 std::string mBundleName;
229 std::string mBundleId;
230 AbortHandler mAbortHandler;
232 private: // impl members
238 } // namespace Adaptor
240 } // namespace Internal
244 #endif // __DALI_INTERNAL_FRAMEWORK_H__