Tizen 2.0 Release
[apps/osp/Phone.git] / inc / PhnPhoneApp.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file                PhnPhoneApp.h
19  * @brief               This is the header file for the %PhoneApp class.
20  *
21  * This header file contains the declarations for %PhoneApp class.
22  */
23 #ifndef _PHN_PHONE_APP_H_
24 #define _PHN_PHONE_APP_H_
25
26 #include <FApp.h>
27 #include <FBase.h>
28 #include <FSystem.h>
29 #include <FUi.h>
30
31 class IAppStateChangeListener;
32
33 /**
34  * @class PhoneApp
35  * @brief PhoneApp must inherit from UiApp class
36  * which provides basic features necessary to define an UiApp.
37  *
38  */
39 class PhoneApp
40         : public Tizen::App::UiApp
41         , public Tizen::System::IScreenEventListener
42         , public Tizen::App::IAppControlProviderEventListener
43 {
44 public:
45
46         static Tizen::App::UiApp* CreateInstance(void);
47
48 public:
49         PhoneApp(void);
50         virtual ~PhoneApp(void);
51
52 public:
53         bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
54         bool OnAppInitialized(void);
55         bool OnAppWillTerminate(void);
56         bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
57         void OnForeground(void);
58         void OnBackground(void);
59         void OnLowMemory(void);
60         void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
61         void OnScreenOn(void);
62         void OnScreenOff(void);
63
64         // Called when the application control request is received from the caller application.
65         virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData);
66
67         //Used to query whether application is initialized as AppControl.
68         bool IsOpenAsAppControl(void);
69         //Used to get the initial scene Id
70         Tizen::Ui::Scenes::SceneId GetInitialScene(void);
71         //Used to set initial scene id
72         void SetInitialScene(Tizen::Ui::Scenes::SceneId initialSceneId);
73         //Used to get launch arguments at application launch
74         Tizen::Base::Collection::IList* GetAppLaunchArguments(void);
75
76         void AddAppStateChangeListener(const IAppStateChangeListener& listener);
77         void RemoveAppStateChangeListener(const IAppStateChangeListener& listener);
78
79 private:
80         //internal function to process AppControl request.
81         void ProcessAppControlRequest(RequestId reqId, const Tizen::Base::String& operationId,const Tizen::Base::Collection::IMap* pArgsMap);
82         //internal function to handle AppControl Request for Incoming call.
83         void HandleIncomingCallAppControlRequest(RequestId reqId,const Tizen::Base::Collection::IMap* pArgsMap);
84         //internal function to handle AppControl Request for Dial.
85         void HandleDialerAppControlRequest(RequestId reqId,const Tizen::Base::Collection::IMap* pArgsMap);
86         //internal function to handle AppControl Request for dial call.
87         void HandleDialCallAppControlRequest(RequestId reqId,const Tizen::Base::Collection::IMap* pArgsMap);
88         //internal function to handle AppControl Request for call Settings.
89         void HandleSettingsAppControlRequest(RequestId reqId,const Tizen::Base::Collection::IMap* pArgsMap);
90
91 private:
92         //Used to implement AppControl Specific features.
93         bool __isOpenAsAppControl;
94         Tizen::Base::Collection::ArrayList* __pLaunchArgs;
95         //Used to store initial scene id
96         Tizen::Ui::Scenes::SceneId __initialSceneId;
97         Tizen::Base::Collection::ArrayList __listenerList;
98 };
99
100 #endif // _PHN_PHONE_APP_H_