21 #define C_MUSSIPPROFILEMODEL_H |
22 #define C_MUSSIPPROFILEMODEL_H |
22 |
23 |
23 |
24 |
24 #include "mmussipprofilehandler.h" |
25 #include "mmussipprofilehandler.h" |
25 #include <e32base.h> |
26 #include <e32base.h> |
26 #include <sipmanagedprofile.h> |
|
27 #include <gsplugininterface.h> |
|
28 #include <sipprofileregistryobserver.h> |
27 #include <sipprofileregistryobserver.h> |
29 |
28 #include <sipobserver.h> |
|
29 #include <sipconnectionobserver.h> |
30 |
30 |
31 class CSIPManagedProfileRegistry; |
31 class CSIPManagedProfileRegistry; |
32 |
32 class CMusSettingsModel; |
33 |
33 |
34 /** |
34 /** |
35 * CMusSIPProfileModel model class. |
35 * CMusSIPProfileModel model class. |
36 * Model class implementing SIP profile model. |
36 * Model class implementing SIP profile model. |
37 * |
|
38 * @since S60 v3.2 |
|
39 */ |
37 */ |
40 class CMusSIPProfileModel |
38 class CMusSIPProfileModel : public CBase, |
41 :public CBase, |
39 public MSIPProfileRegistryObserver, |
42 public MSIPProfileRegistryObserver, |
40 public MMusSIPProfileHandler |
43 public MMusSIPProfileHandler |
41 { |
44 { |
|
45 public: |
42 public: |
46 |
43 |
47 static CMusSIPProfileModel* NewL(); |
44 static CMusSIPProfileModel* NewL(); |
48 |
45 |
49 /** |
46 /** |
55 |
52 |
56 /** |
53 /** |
57 * From MMusSIPProfileHandler. |
54 * From MMusSIPProfileHandler. |
58 * Returns the index of the default SIP profile. |
55 * Returns the index of the default SIP profile. |
59 * @return KErrNotFound, if one does not exist, otherwise index of the |
56 * @return KErrNotFound, if one does not exist, otherwise index of the |
60 * default SIP profile. |
57 * default SIP profile. |
61 */ |
58 */ |
62 virtual TInt DefaultProfileIndex(); |
59 TInt DefaultProfileIndex(); |
63 |
60 |
64 /** |
61 /** |
65 * From MMusSIPProfileHandler. |
62 * From MMusSIPProfileHandler. |
66 * Returns the id of the default SIP profile. |
63 * Returns the id of the default SIP profile. |
67 * @return KErrNotFound, if one does not exist, otherwise id of the |
64 * @return KErrNotFound, if one does not exist, otherwise id of the |
68 * default SIP profile. |
65 * default SIP profile. |
69 */ |
66 */ |
70 virtual TUint32 DefaultProfileId(); |
67 TUint32 DefaultProfileId(); |
|
68 |
|
69 /* |
|
70 * Disables MUS profile |
|
71 */ |
|
72 void DisableProfileL(); |
|
73 |
|
74 /* |
|
75 * Enables MUS profile |
|
76 */ |
|
77 void EnableProfileL(); |
|
78 |
|
79 /* |
|
80 * Checks, if MUS profile is enabled |
|
81 */ |
|
82 TBool ProfileEnabledL(); |
71 |
83 |
72 /** |
84 /** |
73 * From MMusSIPProfileHandler. |
85 * From MMusSIPProfileHandler. |
74 * Returns SIP profile index on locally cached array based on id. |
86 * Returns SIP profile index on locally cached array based on id. |
75 * @param aId Profile id |
87 * @param aId Profile id |
76 * @return Profile index or KErrNotFound if no matching profile is found. |
88 * @return Profile index or KErrNotFound if no matching profile is found. |
77 */ |
89 */ |
78 virtual TInt ProfileIndexByIdL( TUint32 aId ); |
90 TInt ProfileIndexByIdL( TUint32 aId ); |
79 |
91 |
80 /** |
92 /** |
81 * From MMusSIPProfileHandler. |
93 * From MMusSIPProfileHandler. |
82 * Returns profile id based on index. |
94 * Returns profile id based on index. |
83 * @param aIndex Profile index |
95 * @param aIndex Profile index |
84 * @return Profile id or KUnknownProfileId if no matching profile is found. |
96 * @return Profile id or KUnknownProfileId if no matching profile is found. |
85 */ |
97 */ |
86 virtual TUint32 ProfileIdByIndex( TUint aIndex ); |
98 TUint32 ProfileIdByIndex( TUint aIndex ); |
87 |
99 |
88 /** |
100 /** |
89 * From MMusSIPProfileHandler. |
101 * From MMusSIPProfileHandler. |
90 * Returns pointer to the SIP profile array, does not change ownership. |
102 * Returns a reference to the SIP profile array. |
91 * Note that previously returned value goes out of scope after a new |
103 * Note that previously returned value goes out of scope after a new |
92 * call to ProfileArrayL. So it is not advised to store return value |
104 * call to ProfileArrayL. So it is not advised to store return value |
93 * in long persistent variable, but rather to be used like stack |
105 * in long persistent variable, but rather to be used like stack |
94 * variables for safety. |
106 * variables for safety. |
95 * |
107 * |
96 * @return Pointer to internally cached SIP profile array. |
108 * @return Reference to internally cached SIP profile array. |
97 */ |
109 */ |
98 virtual CArrayPtr<CSIPManagedProfile>* ProfileArrayL(); |
110 RPointerArray<CSIPProfile>& ProfileArrayL(); |
99 |
111 |
100 public: // From base class MSIPProfileRegistryObserver. |
112 public: // From base class MSIPProfileRegistryObserver. |
101 |
113 |
102 /** |
114 /** |
103 * From MSIPProfileRegistryObserver. |
115 * From MSIPProfileRegistryObserver. |
104 * SIP profile information event. |
116 * SIP profile information event. |
105 * @param aProfileId Id of SIP profile in question. |
117 * @param aProfileId Id of SIP profile in question. |
106 * @param aEvent Type of information event. |
118 * @param aEvent Type of information event. |
107 */ |
119 */ |
108 virtual void ProfileRegistryEventOccurred( |
120 void ProfileRegistryEventOccurred( |
109 TUint32 aSIPProfileId, |
121 TUint32 aSIPProfileId, |
110 TEvent aEvent ); |
122 TEvent aEvent ); |
111 |
123 |
112 /** |
124 /** |
113 * From MSIPProfileRegistryObserver. |
125 * From MSIPProfileRegistryObserver. |
114 * An asynchronous error has occurred related to SIP profile. |
126 * An asynchronous error has occurred related to SIP profile. |
115 * @param aSIPProfileId Id of the failed profile. |
127 * @param aSIPProfileId Id of the failed profile. |
116 * @param aError An error code. |
128 * @param aError An error code. |
117 */ |
129 */ |
118 virtual void ProfileRegistryErrorOccurred( |
130 void ProfileRegistryErrorOccurred( |
119 TUint32 aSIPProfileId, |
131 TUint32 aSIPProfileId, |
120 TInt aError ); |
132 TInt aError ); |
|
133 |
|
134 |
|
135 public: |
|
136 |
|
137 /** |
|
138 * Set CMusSettingsModel to handle ProfileRegistry Event. |
|
139 * @param aCMusSettingsModel the CMusSettingsModel to handle ProfileRegistry Event |
|
140 */ |
|
141 void SetCMusSettingsModel(CMusSettingsModel* aCMusSettingsModel); |
121 |
142 |
122 protected: |
143 protected: |
123 |
|
124 /** |
|
125 * Reads the profile array from SIP Profile Client. |
|
126 */ |
|
127 void ReadArrayFromEngineL(); |
|
128 |
144 |
129 /** |
145 /** |
130 * Sorts internal array of SIP profiles by id. |
146 * Sorts internal array of SIP profiles by id. |
131 */ |
147 */ |
132 void SortProfilesL(); |
148 void SortProfilesL(); |
133 |
149 |
134 /** |
|
135 * Deletes internally cached profiles. |
|
136 */ |
|
137 void DeleteProfiles(); |
|
138 |
|
139 /** |
|
140 * Reads profile list from the engine; if reading fails, |
|
141 * keeps the old list safe. |
|
142 */ |
|
143 void ReadProfileListFromEngineSafeL(); |
|
144 |
150 |
145 private: |
151 private: |
146 |
152 |
147 CMusSIPProfileModel(); |
153 CMusSIPProfileModel(); |
148 |
154 |
149 void ConstructL(); |
155 void ConstructL(); |
150 |
156 |
151 /** |
|
152 * For deleting RPointerArray in case of leave. |
|
153 */ |
|
154 static void ResetAndDestroy( TAny* aPointerArray ); |
|
155 |
157 |
156 private: // data |
158 private: // data |
157 |
159 |
158 /** |
160 /** |
159 * Instance of the SIP profile registry engine for managing SIP profiles. |
161 * Instance of the SIP profile registry engine for managing SIP profiles. |
160 * Own. |
162 * Own. |
161 */ |
163 */ |
162 CSIPManagedProfileRegistry* iEngine; |
164 CSIPManagedProfileRegistry* iEngine; |
163 |
165 |
164 /** |
166 /** |
165 * Locally cached array of SIP profiles. |
167 * Locally cached array of SIP profiles. |
166 * Own. |
168 */ |
167 */ |
169 RPointerArray<CSIPProfile> iProfiles; |
168 CArrayPtrFlat<CSIPManagedProfile>* iProfiles; |
170 |
|
171 /** |
|
172 * CMusSettingsModel to handle ProfileRegistry |
|
173 * Event |
|
174 */ |
|
175 CMusSettingsModel* iCMusSettingsModel; |
|
176 |
|
177 |
169 |
178 |
170 }; |
179 }; |
171 |
180 |
172 #endif // C_MUSSIPPROFILEMODEL_H |
181 #endif // C_MUSSIPPROFILEMODEL_H |