|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: profile observer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CSImpleSipProfileObserver_H |
|
22 #define CSImpleSipProfileObserver_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <sipprofileregistryobserver.h> |
|
27 |
|
28 #include "simplesipconnectionobserver.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CSIPProfileRegistry; |
|
32 class CSIPProfile; |
|
33 |
|
34 // CLASS DECLARATIONS |
|
35 |
|
36 class CSimpleSipProfileObserver: public CBase, public MSIPProfileRegistryObserver |
|
37 { |
|
38 |
|
39 public: |
|
40 |
|
41 ~CSimpleSipProfileObserver(); |
|
42 |
|
43 /** |
|
44 * Two phase constructor |
|
45 * @param aSIP SIP core connection |
|
46 * @param aObs SIP connection observer for callbacks |
|
47 */ |
|
48 static CSimpleSipProfileObserver* NewL( CSIP* aSIP, CSimpleSipConnectionObserver& aObs ); |
|
49 |
|
50 /** |
|
51 * Register default profile |
|
52 * This start the registering and later the GiveConnectionL can be |
|
53 * used to get the ready connection. |
|
54 */ |
|
55 void RegisterDefaultProfileL(); |
|
56 |
|
57 /** |
|
58 * Register specified profile |
|
59 * This start the registering and later the GiveConnectionL can be |
|
60 * used to get the ready connection. |
|
61 * @param aId SIP Profile ID |
|
62 */ |
|
63 void RegisterGivenProfileL( TUint32 aID ); |
|
64 |
|
65 /** |
|
66 * Give the registered connection. |
|
67 * Leaves with KErrNotReady if not ready. |
|
68 * MSimpleSipConnCallback::ConnectionStateChange() is called when |
|
69 * the registeration is ready. |
|
70 * @return SIP connection, ownership is changed |
|
71 */ |
|
72 CSIPConnection* GiveConnectionL(); |
|
73 |
|
74 /** |
|
75 * Is the SIP Profile active |
|
76 * @return ETrue if active. |
|
77 */ |
|
78 TBool IsProfileActive(); |
|
79 |
|
80 /** |
|
81 * Give current registered user's AOR. |
|
82 * Leaves with KErrNotReady if profile is not registered. |
|
83 * @return AOR URI |
|
84 */ |
|
85 TPtrC8 GiveUserAorL(); |
|
86 |
|
87 /** |
|
88 * Current profile accessor |
|
89 */ |
|
90 MSIPRegistrationContext* ProfileContext(); |
|
91 |
|
92 public://functions from MSIPProfileObserver |
|
93 /** |
|
94 * An event related to SIP Profile has accorred |
|
95 * @param aProfileId a profile Id |
|
96 * @param aEvent an occurred event |
|
97 **/ |
|
98 void ProfileRegistryEventOccurred(TUint32 aProfileId, TEvent aEvent); |
|
99 |
|
100 /** |
|
101 * An asynchronous error has occurred related to SIP profile |
|
102 * Event is send to those observers, who have the |
|
103 * corresponding profile instantiated. |
|
104 * @param aProfileId the id of failed profile |
|
105 * @param aError an occurred error |
|
106 */ |
|
107 void ProfileRegistryErrorOccurred(TUint32 aProfileId, TInt aError); |
|
108 |
|
109 protected: |
|
110 |
|
111 /** |
|
112 * Second-phase constructor. |
|
113 */ |
|
114 void ConstructL( CSIP* aSIP ); |
|
115 |
|
116 CSimpleSipProfileObserver( CSimpleSipConnectionObserver& aObs ); |
|
117 |
|
118 private: // data |
|
119 |
|
120 /** |
|
121 * Next observer class where to send the events. |
|
122 */ |
|
123 CSimpleSipConnectionObserver& iObs; |
|
124 |
|
125 /** |
|
126 * Own. SIP profile registry. |
|
127 */ |
|
128 CSIPProfileRegistry* iRegistry; |
|
129 |
|
130 /** |
|
131 * Own. SIP profile |
|
132 */ |
|
133 CSIPProfile* iProfile; |
|
134 |
|
135 #ifdef _DEBUG |
|
136 friend class T_CSimpleSipConnection; |
|
137 #endif |
|
138 }; |
|
139 |
|
140 #endif |