1 #ifndef DALI_INTERNAL_WATCH_APPLICATION_H
2 #define DALI_INTERNAL_WATCH_APPLICATION_H
5 * Copyright (c) 2023 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.
22 #include <dali/internal/adaptor/common/application-impl.h>
23 #include <dali/public-api/watch/watch-application.h>
33 class WatchApplication;
34 typedef IntrusivePtr<WatchApplication> WatchApplicationPtr;
36 enum WatchApplicationState
41 RESUMED = INITIALIZED,
46 * Implementation of the WatchApplication class.
48 class WatchApplication : public Application
51 typedef Dali::WatchApplication::WatchTimeSignal WatchTimeSignal;
52 typedef Dali::WatchApplication::WatchBoolSignal WatchBoolSignal;
56 * @param[in] argc A pointer to the number of arguments
57 * @param[in] argv A pointer to the argument list
58 * @param[in] stylesheet The path to user defined theme file
59 * @param[in] windowData The window data
61 static WatchApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, WindowData& windowData);
65 * @param[in] argc A pointer to the number of arguments
66 * @param[in] argv A pointer to the argument list
67 * @param[in] stylesheet The path to user defined theme file
68 * @param[in] windowData The window data
70 WatchApplication(int* argc, char** argv[], const std::string& stylesheet, WindowData& windowData);
75 virtual ~WatchApplication();
78 * Called when the framework is initialised.
80 void OnInit() override;
83 * Called when the framework is terminated.
85 void OnTerminate() override;
88 * Called when the framework is paused.
90 void OnPause() override;
93 * Called when the framework resumes from a paused state.
95 void OnResume() override;
100 void OnTimeTick(WatchTime& time);
103 * Called every second in ambient mode
105 void OnAmbientTick(WatchTime& time);
108 * Called when the device enters or exits ambient mode
110 void OnAmbientChanged(bool ambient);
113 // @brief Undefined copy constructor.
114 WatchApplication(const WatchApplication&);
116 // @brief Undefined assignment operator.
117 WatchApplication& operator=(const WatchApplication&);
121 WatchTimeSignal mTickSignal;
122 WatchTimeSignal mAmbientTickSignal;
123 WatchBoolSignal mAmbientChangeSignal;
126 WatchApplicationState mState;
129 inline WatchApplication& GetImplementation(Dali::WatchApplication& watch)
131 DALI_ASSERT_ALWAYS(watch && "watch handle is empty");
133 BaseObject& handle = watch.GetBaseObject();
135 return static_cast<Internal::Adaptor::WatchApplication&>(handle);
138 inline const WatchApplication& GetImplementation(const Dali::WatchApplication& watch)
140 DALI_ASSERT_ALWAYS(watch && "Time handle is empty");
142 const BaseObject& handle = watch.GetBaseObject();
144 return static_cast<const Internal::Adaptor::WatchApplication&>(handle);
147 } // namespace Adaptor
149 } // namespace Internal
153 #endif // DALI_INTERNAL_WATCH_APPLICATION_H