2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef TIZEN_CPP_APP_CORE_UI_CPP_APP_CORE_TASK_BASE_HH_
18 #define TIZEN_CPP_APP_CORE_UI_CPP_APP_CORE_TASK_BASE_HH_
22 #include <app_core_base.hh>
23 #include <interface_app_core_ui_event.hh>
26 #define EXPORT_API __attribute__((visibility("default")))
30 class EXPORT_API AppCoreTaskBase : public AppCoreBase,
31 public IAppCoreUiEvent {
34 LOW_MEMORY_STATE_UNKNOWN,
35 LOW_MEMORY_STATE_NORMAL = 0x01,
36 LOW_MEMORY_STATE_SOFT_WARNING = 0x02,
37 LOW_MEMORY_STATE_HARD_WARNING = 0x04,
40 enum LowBatteryState {
41 LOW_BATTERY_STATE_UNKNOWN,
42 LOW_BATTERY_STATE_POWER_OFF = 1,
43 LOW_BATTERY_STATE_CRITICAL_LOW = 2,
46 enum DeviceOrientationState {
47 DEVICE_ORIENTATION_STATE_UNKNOWN = -1,
48 DEVICE_ORIENTATION_STATE_0 = 0,
49 DEVICE_ORIENTATION_STATE_90 = 90,
50 DEVICE_ORIENTATION_STATE_180 = 180,
51 DEVICE_ORIENTATION_STATE_270 = 270,
55 virtual ~AppCoreTaskBase();
57 int OnReceive(aul_type type, tizen_base::Bundle b) override;
58 int OnCreate() override;
59 int OnTerminate() override;
60 int OnControl(tizen_base::Bundle b) override;
62 int OnTrimMemory() override;
63 void OnLoopInit(int argc, char** argv) override;
64 void OnLoopRun() override;
65 void OnLoopExit() override;
66 void OnLoopFinish() override;
68 virtual void OnLowMemory(LowMemoryState state);
69 virtual void OnLowBattery(LowBatteryState state);
70 virtual void OnLangChanged(const std::string& lang);
71 virtual void OnDeviceOrientationChanged(DeviceOrientationState state);
72 virtual void OnRegionChanged(const std::string& region);
74 void Run(int argc, char** argv) override;
76 void OnUiEvent(UiState state) override;
77 void Post(UiState state) override;
81 std::unique_ptr<Impl> impl_;
84 } // namespace tizen_cpp
86 #endif // TIZEN_CPP_APP_CORE_UI_CPP_APP_CORE_TASK_BASE_HH_