tizen2.1 code merge
[apps/osp/Call.git] / inc / CallApp.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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 #ifndef _CALLAPP_H_
17 #define _CALLAPP_H_
18
19 #include <FApp.h>
20 #include <FBase.h>
21 #include <FSystem.h>
22 #include <FUi.h>
23
24 class IAppStateChangeListener;
25
26 /**
27  * [CallAppApp] UiApp must inherit from UiApp class
28  * which provides basic features necessary to define an UiApp.
29  */
30 class CallApp
31         : public Tizen::App::UiApp
32         , public Tizen::System::IScreenEventListener
33         , public Tizen::App::IAppControlProviderEventListener
34         , public Tizen::App::IActiveAppEventListener
35 {
36 public:
37         /**
38          * [Test] UiApp must have a factory method that creates an instance of itself.
39          */
40         static Tizen::App::UiApp* CreateInstance(void);
41
42 public:
43         CallApp(void);
44         virtual~CallApp(void);
45
46 public:
47         // Called when the UiApp is initializing.
48         virtual bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
49
50         // Called when the UiApp initializing is finished. 
51         virtual bool OnAppInitialized(void); 
52
53         // Called when the UiApp is requested to terminate. 
54         virtual bool OnAppWillTerminate(void); 
55
56         // Called when the UiApp is terminating.
57         virtual bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
58
59         // Called when the UiApp's frame moves to the top of the screen.
60         virtual void OnForeground(void);
61
62         // Called when this UiApp's frame is moved from top of the screen to the background.
63         virtual void OnBackground(void);
64
65         // Called when the system memory is not sufficient to run the UiApp any further.
66         virtual void OnLowMemory(void);
67
68         // Called when the battery level changes.
69         virtual void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
70
71         // Called when the screen turns on.
72         virtual void OnScreenOn(void);
73
74         // Called when the screen turns off.
75         virtual void OnScreenOff(void);
76
77         //Called when application becomes active
78         virtual void OnActiveAppChanged(const Tizen::Base::String& appId);
79
80         virtual Tizen::Ui::Scenes::SceneId GetInitialScene(void);
81
82         //Used to get launch arguments at application launch
83         Tizen::Base::Collection::IList* GetAppLaunchArguments(void);
84
85         void AddAppStateChangeListener(const IAppStateChangeListener& listener);
86
87         void RemoveAppStateChangeListener(const IAppStateChangeListener& listener);
88
89         // Called when the application control request is received from the caller application.
90         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);
91         //Called when incoming call has to be handled
92         void SetTopMostWindow(bool bTopMost);
93
94 private:
95         //internal function to process AppControl request.
96         void ProcessAppControlRequest(RequestId reqId, const Tizen::Base::String& operationId,const Tizen::Base::Collection::IMap* pArgsMap,const Tizen::Base::String* pUriData =null);
97         //internal function to process AppControl request.
98         void ProcessWebAppControlRequest(RequestId reqId, const Tizen::Base::String& operationId,const Tizen::Base::String* pUriData);
99
100         //internal function to handle AppControl Request for Incoming call.
101         void HandleIncomingCallAppControlRequest(RequestId reqId,const Tizen::Base::Collection::IMap* pArgsMap);
102         //internal function to handle AppControl Request for dial call.
103         void HandleDialCallAppControlRequest(RequestId reqId,const Tizen::Base::Collection::IMap* pArgsMap,const Tizen::Base::String* pUriData);
104         //Checks if the number is valid
105         bool CheckNumberIsValid(Tizen::Base::String phoneNumber);
106
107
108
109 private:
110         Tizen::Ui::Scenes::SceneId __initialSceneId;
111         Tizen::Base::Collection::ArrayList* __pLaunchArgs;
112         Tizen::Base::Collection::ArrayList __listenerList;
113 };
114
115 #endif // _CALLAPP_H_