Fix for N_SE-47477
[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         , public Tizen::Base::Runtime::ITimerEventListener
36 {
37 public:
38         /**
39          * [Test] UiApp must have a factory method that creates an instance of itself.
40          */
41         static Tizen::App::UiApp* CreateInstance(void);
42
43 public:
44         CallApp(void);
45         virtual~CallApp(void);
46
47 public:
48         // Called when the UiApp is initializing.
49         virtual bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
50
51         // Called when the UiApp initializing is finished. 
52         virtual bool OnAppInitialized(void); 
53
54         // Called when the UiApp is requested to terminate. 
55         virtual bool OnAppWillTerminate(void); 
56
57         // Called when the UiApp is terminating.
58         virtual bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
59
60         // Called when the UiApp's frame moves to the top of the screen.
61         virtual void OnForeground(void);
62
63         // Called when this UiApp's frame is moved from top of the screen to the background.
64         virtual void OnBackground(void);
65
66         // Called when the system memory is not sufficient to run the UiApp any further.
67         virtual void OnLowMemory(void);
68
69         // Called when the battery level changes.
70         virtual void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
71
72         // Called when the screen turns on.
73         virtual void OnScreenOn(void);
74
75         // Called when the screen turns off.
76         virtual void OnScreenOff(void);
77
78         //Called when application becomes active
79         virtual void OnActiveAppChanged(const Tizen::Base::String& appId);
80
81         virtual Tizen::Ui::Scenes::SceneId GetInitialScene(void);
82
83         //Used to get launch arguments at application launch
84         Tizen::Base::Collection::IList* GetAppLaunchArguments(void);
85
86         void AddAppStateChangeListener(const IAppStateChangeListener& listener);
87
88         void RemoveAppStateChangeListener(const IAppStateChangeListener& listener);
89
90         // Called when the application control request is received from the caller application.
91         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);
92         //Called when incoming call has to be handled
93         void SetTopMostWindow(bool bTopMost);
94         //Gets the time duration since appplication has been launched
95         long long GetCallAppTicks(void);
96
97 private:
98         //internal function to process AppControl request.
99         void ProcessAppControlRequest(RequestId reqId, const Tizen::Base::String& operationId,const Tizen::Base::Collection::IMap* pArgsMap,const Tizen::Base::String* pUriData =null);
100         //internal function to process AppControl request.
101         void ProcessWebAppControlRequest(RequestId reqId, const Tizen::Base::String& operationId,const Tizen::Base::String* pUriData);
102
103         //internal function to handle AppControl Request for Incoming call.
104         void HandleIncomingCallAppControlRequest(RequestId reqId,const Tizen::Base::Collection::IMap* pArgsMap);
105         //internal function to handle AppControl Request for dial call.
106         void HandleDialCallAppControlRequest(RequestId reqId,const Tizen::Base::Collection::IMap* pArgsMap,const Tizen::Base::String* pUriData);
107         //Checks if the number is valid
108         bool CheckNumberIsValid(Tizen::Base::String phoneNumber);
109
110         void ShowAutoRejectPopup(Tizen::Base::String contactNumber);
111         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer &timer);
112
113
114
115 private:
116         Tizen::Ui::Scenes::SceneId __initialSceneId;
117         Tizen::Base::Collection::ArrayList* __pLaunchArgs;
118         Tizen::Base::Collection::ArrayList __listenerList;
119         Tizen::Ui::Controls::Popup* __pCallRejectedIonPopup;
120         Tizen::Base::Runtime::Timer __callRejectedIontimer;
121         long long __callTicks;
122         Tizen::Base::Runtime::Timer* __pCallAppTimer;
123 };
124
125 #endif // _CALLAPP_H_