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