Fix for Call sate not set properly when there is 1 waiting and 1 active call and...
[apps/osp/Call.git] / inc / CallInfo.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
17 /**
18  * @file                CallInfo.h
19  * @brief               This is the header file for the %CallInfo class.
20  *
21  * This header file contains the declarations for %CallInfo class.
22  */
23 #ifndef _PHN_CALL_INFO_H_
24 #define _PHN_CALL_INFO_H_
25
26 #include <FBase.h>
27 #include <FSocial.h>
28 #include <FSclTypes.h>
29 #include "CallTypes.h"
30
31 /**
32  * @class CallInfo
33  * @brief This class holds information about currently active Single party,
34  * mutli-party or conference calls.
35  *
36  */
37 class AppCallInfo
38         : public Tizen::Base::Object
39 {
40 public:
41         enum CallType
42         {
43                 VOICE_CALL,
44                 VIDEO_CALL, // Currently not supported
45         };
46
47 public:
48         // Default Constructor.
49         AppCallInfo(void);
50         virtual ~AppCallInfo(void);
51
52         //returns if a call is conference call or not
53         bool IsConferenceCall(void);
54         //Sets the conferenceflag for a call
55         void SetConference(bool isConferenceCall);
56         //returns if a call is emergency call or not
57         bool IsEmergency(void);
58         //Sets if a call is emergency call
59         void SetEmergency(bool isEmergency);
60         //get the call Handle
61         Tizen::Base::Long* GetCallHandle(void);
62         //Set the call handle
63         void SetCallHandle(unsigned int handle);
64         //Get for Contact Number for the call
65         Tizen::Base::String& GetContactNumber(void);
66         //Set the contact number for the call
67         void SetContactNumber(Tizen::Base::String& contactNumber);
68         void ResetContactNumber(Tizen::Base::String* contactNumber);
69         void ResetContactInfo(const Tizen::Social::Contact* contact);
70         //Sets the contact info for the call
71         void SetContactInfo(const Tizen::Social::Contact& contact);
72         //returns contact info if present in contacts db
73         const Tizen::Social::Contact* GetContactInfo(void);
74         //returns if a call is held call or not
75         bool IsOnHold(void);
76         //Sets the held call for the call
77         void SetOnHold(bool onHold);
78         //get the connected time for the call
79         long long GetCallConnectTime(void);
80         //Sets the connected time when call started
81         void SetCallConnectTime(long long connectTime);
82         //Set the duration time wrt to call app time
83         void SetDurationTime(long long durationTime);
84         //get the notified / dialed time when call started
85         long long GetCallNotificationTime(void);
86         //Gets the duration wrt to callapp time
87         long long GetDurationTime(void);
88         //Sets the notified / dialed time when call started
89         void SetCallNotificationTime(long long callNotificationTime);
90         //gets the end call cause
91         Tizen::Base::String& GetEndCallCause(void);
92         //Sets the end call cause
93         void SetEndCallCause(Tizen::Base::String& pEndCause);
94         //gets the caller list for a conference call
95         Tizen::Base::Collection::IListT<AppCallInfo>* GetCallerList(void);
96         //Adds a call to conference call list
97         result AddCallToCallerList(AppCallInfo& callInfo);
98         //removes a call from the conference call list
99         result RemoveCallFromCallerList(int index);
100         //returns the number of calls in conference
101         int GetCallerListCount(void);
102         //sets the type of the call for the logs application
103         void SetCalllogType(CallLogType callLogType);
104         //returns the type of the call log
105         CallLogType GetCalllogType(void);
106         /**
107          * This is the equality operator for this CallInfo.
108          * returns true, if both have same value for call handle.
109          *
110          * @param[in]   rhs     A reference to the %CallInfo instance
111          */
112         bool operator ==(const AppCallInfo& rhs) const;
113
114         /**
115          * This is the InEquality operator for this CallInfo.
116          * returns true, if value for call handle is different.
117          *
118          * @param[in]   rhs     A reference to the %CallInfo instance
119          */
120         bool operator !=(const AppCallInfo& rhs) const;
121
122         /**
123          * This is the assignment operator for this class.
124          * @param[in]   rhs     A reference to the %CallInfo instance
125          */
126         AppCallInfo& operator =(const AppCallInfo& rhs);
127
128         // this funtion fetches the contact person's name.
129         Tizen::Base::String* FetchCallerNameN(void);
130         //Returns the latest Caller Name for a Number from address book
131         Tizen::Base::String* FetchLatestCallerNameN(const Tizen::Base::String& phoneNumber);
132         // this funtion fetches the contact person's photo id, if present.
133         Tizen::Graphics::Bitmap* FetchCallerPhotoN(void);
134         //Returns the latest Caller Photo for a Number from address book
135         Tizen::Graphics::Bitmap* FetchLatestCallerPhotoN(const Tizen::Base::String& phoneNumber);
136         //Returns the Contact Matched for the PhoneNumber from address book
137         Tizen::Social::Contact* FetchContactN(const Tizen::Base::String& phoneNumber);
138
139
140
141 private:
142         bool __isConfCall;
143         CallType __callType;
144
145         ///Calllog type information like outgoing, incoming, missed call
146         CallLogType __calllogType;
147
148         //To uniquely identify both Single / Conf. Call.
149         Tizen::Base::Long* __pCallHandle;
150
151         bool __isEmergency;
152
153         //applicable only for Single Call
154         Tizen::Base::String __contactNumber;
155
156         //call is held
157         bool __isOnHold;
158
159         //system time when call connected
160         long long __callConnectTime;
161
162         long long __durationTime;
163
164         //system time when the call was notified / dialed
165         long long __callNotificationTime;
166
167         //end call cause
168         Tizen::Base::String* __pEndCallCause;
169
170         //callHandles for individual callers in conf. calls
171         Tizen::Base::Collection::ArrayListT<AppCallInfo>* __pParticipantCallHandles;
172
173         //used to store previously fetched contact.
174         Tizen::Social::Contact* __pContact;
175         // having the address book here
176         Tizen::Social::Addressbook* __pAddressBook;
177 };
178
179 #endif // _PHN_CALL_INFO_H_