Tizen 2.0 Release
[apps/osp/Phone.git] / inc / PhnSettingsManager.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                PhnSettingsManager.h
19  * @brief               This is the header file for the %SettingsManager class.
20  *
21  * This header file contains the declarations for %SettingsManager class.
22  */
23 #ifndef _PHN_SETTINGS_MANAGER_H_
24 #define _PHN_SETTINGS_MANAGER_H_
25
26 #include <FBase.h>
27 #include <FIo.h>
28 #include <FSocial.h>
29 #include <FSysSettingInfo.h>
30 #include "ITapiCall.h"
31 #include "ITapiSs.h"
32 #include "tapi_common.h"
33 #include "TapiUtility.h"
34 #include "TelCall.h"
35 #include "TelSs.h"
36 #include "vconf.h"
37 #include "PhnCallRejectInfo.h"
38 #include "PhnISettingsEventListener.h"
39 #include "PhnSettingsConstants.h"
40 #include "PhnCallSettingDataService.h"
41
42 /**
43  * @class SettingsManager
44  * @brief This class provides functionality to set and fetch settings related to voice call, e.g. Call barring,
45  * call forwarding, etc.
46  */
47 class SettingsManager
48 : public Tizen::System::ISettingEventListener
49 {
50 public:
51         //create a singleton instance
52         static SettingsManager* GetInstance(void);
53
54 private:
55         //constructor
56         SettingsManager(void);
57         SettingsManager(SettingsManager& manager);
58         SettingsManager& operator =(const SettingsManager& manager);
59
60         result Construct(void);
61         static void CreateInstance(void);
62         static void DestroyInstance(void);
63
64 public:
65         // Add the observer for setting events
66         void AddSettingEventListener(ISettingsEventListener* pSettingsEventListener);
67         //remove the observer for setting events
68         void RemoveSettingEventListener(ISettingsEventListener* pSettingsEventListener);
69         // Set the call Forwarding status
70         int SetCallForwardStatus(const Tizen::Base::String& phoneNumber, CallForwardCondition callFwdCondition, bool activateFwding, int noReplyTime = TAPI_SS_CF_NO_REPLY_TIME_30_SECS);
71         // Get the call Forwarding status
72         int GetCallForwardStatus(CallForwardCondition callFwdCondition);
73         // callback function to handle response for set call forward request
74         static void HandleSetForwardResponse(TapiHandle* pHandle, int result, void* pData, void* pUserData);
75         // callback function to handle response for get call forward request
76         static void HandleGetForwardResponse(TapiHandle* pHandle, int result, void* pData, void* pUserData);
77         // Set the call barring status
78         int SetCallBarringStatus(const Tizen::Base::String& password, CallBarringType callBarringType, bool activateBarring);
79         // callback function to handle response for set call barring request
80         static void HandleSetBarringResponse(TapiHandle* pHandle, int result, void* pData, void* pUserData);
81         // Get the call barring status
82         int GetCallBarringStatus(CallBarringType callBarringType);
83         // callback function to handle response for set call barring request
84         static void HandleGetBarringResponse(TapiHandle* pHandle, int result, void* pData, void* pUserData);
85         // Set the call waiting status
86         int SetCallWaitingStatus(bool activateWaiting);
87         // callback function to handle response for set call waiting request
88         static void HandleSetWaitingResponse(TapiHandle* pHandle, int result, void* pData, void* pUserData);
89         // Get the call waiting status
90         int GetCallWaitingStatus(void);
91         // callback function to handle response for set call waiting request
92         static void HandleGetWaitingResponse(TapiHandle* pHandle, int result, void* pData, void* pUserData);
93         // Get the reject message list
94         Tizen::Base::Collection::IMapT<int,Tizen::Base::String>* GetRejectMessageListN(void);
95         // Add/edit the message list at the given index
96         result SetRejectMessage(int messageIndex, const Tizen::Base::String& rejectMessage);
97         // delete the message from the list
98         result RemoveRejectMessage(const Tizen::Base::Collection::IListT<int>& deleteKeyList);
99         // get the prefix dialing list
100         Tizen::Base::Collection::IList* GetPrefixDialListN(void);
101         // Set the number to the prefix dial list
102         result SetPrefixDialNumber(int phoneNumberIndex, const Tizen::Base::String& phoneNumber);
103         // Get the number set at 'phoneNumberIndex'.
104         result GetPrefixDialNumberAtIndex(int phoneNumberIndex, Tizen::Base::String& phoneNumber);
105         // delete the number from the list
106         result RemovePrefixDialNumber(int phoneNumberIndex);
107         // Set the prefix dial status
108         result SetPrefixDialingStatus(bool enablePrefixDialing);
109         // Set the active prefix dial to be used
110         result SetActivePrefixDialingValue(int prefixDialIndex);
111         // Get the active prefix dial to be used
112         result GetActivePrefixDialingValue(int& prefixDialIndex);
113         // Get the prefix dialing status
114         bool GetPrefixDialingStatus(void);
115         // Set the video call image path
116         result SetVideoCallImagePath(const Tizen::Base::String& imagePath);
117         // Get the video call image path
118         result GetVideoCallImagePath(Tizen::Base::String& imagePath);
119         // Set the call line identity
120         result SetCallLineIdentity(CallLineIdentity identity);
121         // Get the call line identity
122         result GetCallLineIdentity(CallLineIdentity& identity);
123         // Add the number to the call reject list
124         result AddToCallRejectList(const Tizen::Base::String& phoneNumber, CallRejectMatchCondition rejectCondition);
125         // Get the call reject list
126         Tizen::Base::Collection::IListT<CallRejectInfo>* GetCallRejectList(void);
127         // Update the call reject number already present
128         result UpdateCallRejectRow(int rowId, const Tizen::Base::String& phoneNumber, bool activate, CallRejectMatchCondition rejectCondition);
129         // Remove the call reject item
130         result RemoveCallRejectRow(int rowId);
131         // Set the reject "unknown" status
132         result SetUnknownRejectStatus(bool activate);
133         // Get the reject "unknown" status
134         bool GetUnknownRejectStatus(void);
135         // checks if the call is to be rejected
136         bool IsCallToBeRejected(Tizen::Base::String& phoneNumber);
137         // Set the call alert status
138         result SetCallAlertStatus(CallAlertStatus callAlertStatus);
139         // Get the call alert status
140         result GetCallAlertStatus(CallAlertStatus& callAlertStatus);
141         // Set the call connect tone status
142         result SetCallConnectToneStatus(bool activate);
143         // Get the call connect tone status
144         bool GetCallConnectToneStatus(void);
145         // Set the minute minder tone status
146         result SetMinuteMinderToneStatus(bool activate);
147         // Get the minute minder tone status
148         bool GetMinuteMinderToneStatus(void);
149         // Set the call End tone status
150         result SetCallEndToneStatus(bool activate);
151         // Get the call End tone status
152         bool GetCallEndToneStatus(void);
153         //Set the speed dial mapping
154         result SetSpeedDialMapping(const Tizen::Base::String& contactId, int numberToMap);
155         // Get the speed dial mapping list
156         Tizen::Base::Collection::IMapT<int,SpeedDialInfo>* GetSpeedDialMappingN(void);
157         //Remove the speed dial mapping
158         result RemoveSpeedDialMapping(int rowId);
159         //Change the speed dial mapped
160         result UpdateSpeedDialMapping(int rowId, const Tizen::Base::String& contactId, int numberToMap);
161         //fetch the mapped speed dial contact no.
162         Tizen::Base::String* GetMappedSpeedDialNumberN(int aIndex);
163         //Fetch Contacts details by contact id
164         Tizen::Social::Contact* FetchContactDetailsN(const Tizen::Base::String& contactId);
165         //Sets the Call State
166         result SetCallState(CallState callState);
167         void AddSystemEventListener(void);
168         void RemoveSystemEventListener(void);
169         virtual void OnSettingChanged(Tizen::Base::String& key);
170         bool GetFlightModeStatus(void);
171
172 private:
173
174         enum ForwardResponseType
175         {
176                 SET_CALLFORWARD_RESPONSE,
177                 GET_CALLFORWARD_RESPONSE,
178         };
179         enum BarringResponseType
180         {
181                 SET_CALLBARRING_RESPONSE,
182                 GET_CALLBARRING_RESPONSE,
183         };
184         enum WaitingResponseType
185         {
186                 SET_CALLWAITING_RESPONSE,
187                 GET_CALLWAITING_RESPONSE,
188         };
189 private:
190         virtual ~SettingsManager(void);
191         //notify event listeners for Setting or Getting Call Forwarding status events.
192         void NotifyForwardingEventListeners(ForwardResponseType responseType, bool isCallSuccessful, CallForwardCondition callFwdCondition, const Tizen::Base::String& callFwdNumber, bool isCallForwardActivated, int noReplyWaitTime);
193         //notify event listeners for Setting or Getting Call Barring status events.
194         void NotifyBarringEventListeners(BarringResponseType responseType, bool isCallSuccessful, CallBarringType callBarringType, bool isBarringActivated);
195         //notify event listeners for Setting or Getting Call Waiting status events.
196         void NotifyWaitingEventListeners(WaitingResponseType responseType, bool isCallSuccessful, bool isCallWaitingActivated);
197
198 private:
199         static SettingsManager* __pInstance;
200         //handle to Telephony API
201         TapiHandle* __pTapiHandle;
202         Tizen::Base::Collection::ArrayListT<ISettingsEventListener*>* __pSettingsEventListener;
203         CallSettingDataService* __pCallSettingDataService;
204 };
205
206 #endif // _PHN_SETTINGS_MANAGER_H_