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 #include <watch-application.h>
27 #include <abort-handler.h>
39 * The Framework class is used to register callbacks with the TIZEN platform so that
40 * we know when any of the application lifecycle events occur. This includes events
41 * like when our application is to be initialised, terminated, paused, resumed etc.
48 NORMAL, ///< normal appFramework
49 WATCH ///< watch appFramework
53 * Observer class for the framework.
60 * Invoked when the application is to be initialised.
62 virtual void OnInit() {}
65 * Invoked when the application is to be terminated.
67 virtual void OnTerminate() {}
70 * Invoked when the application is to be paused.
72 virtual void OnPause() {}
75 * Invoked when the application is to be resumed.
77 virtual void OnResume() {}
80 * Invoked when the application is to be reset.
82 virtual void OnReset() {}
85 * Invoked when the AppControl message is received.
86 * @param[in] The bundle data of AppControl message.
88 virtual void OnAppControl(void *) {}
91 * Invoked at every second
93 virtual void OnTimeTick(WatchTime&) {}
96 * Invoked at every second in ambient mode
98 virtual void OnAmbientTick(WatchTime&) {}
101 * Invoked when the device enters or exits ambient mode
103 virtual void OnAmbientChanged(bool ambient) {}
106 * Invoked when the language of the device is changed.
108 virtual void OnLanguageChanged() {}
111 * Invoked when the region is changed.
113 virtual void OnRegionChanged() {}
116 * Invoked when the battery level of the device is low.
118 virtual void OnBatteryLow() {}
121 * Invoked when the memory level of the device is low.
123 virtual void OnMemoryLow() {}
130 * @param[in] observer The observer of the Framework.
131 * @param[in] argc A pointer to the number of arguments.
132 * @param[in] argv A pointer the the argument list.
133 * @param[in] type The type of application
135 Framework( Observer& observer, int* argc, char ***argv, Type type = NORMAL );
145 * Runs the main loop of framework
150 * Quits the main loop
155 * Checks whether the main loop of the framework is running.
156 * @return true, if the main loop is running, false otherwise.
158 bool IsMainLoopRunning();
161 * If the main loop aborts unexpectedly, then the connected callback function is called.
162 * @param[in] callBack The function to call.
163 * @note Only one callback can be registered. The last callback to be set will be called on abort.
164 * @note The ownership of callback is passed onto this class.
166 void AddAbortCallback( CallbackBase* callback );
169 * Gets bundle name which was passed in app_reset callback.
171 std::string GetBundleName() const;
174 * Gets bundle id which was passed in app_reset callback.
176 std::string GetBundleId() const;
181 Framework(const Framework&);
182 Framework& operator=(Framework&);
187 * Called when the application is created.
192 * Called by the App framework when an application lifecycle event occurs.
193 * @param[in] type The type of event occurred.
194 * @param[in] bundleData The bundle data of event occurred.
196 bool AppStatusHandler(int type, void *bundleData);
199 * Called app_reset callback was called with bundle.
201 void SetBundleName(const std::string& name);
204 * Called app_reset callback was called with bundle.
206 void SetBundleId(const std::string& id);
209 * Called if the application is aborted.
211 void AbortCallback();
214 * Called for initializing on specified backend. (X11 or Wayland)
224 std::string mBundleName;
225 std::string mBundleId;
226 AbortHandler mAbortHandler;
228 private: // impl members
234 } // namespace Adaptor
236 } // namespace Internal
240 #endif // __DALI_INTERNAL_FRAMEWORK_H__