|
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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MUSMANAGERIMPL_H |
|
20 #define MUSMANAGERIMPL_H |
|
21 |
|
22 #include "musunittesting.h" |
|
23 #include "musmanagerclientsession.h" |
|
24 |
|
25 #include <e32base.h> |
|
26 |
|
27 |
|
28 enum TServerStart |
|
29 { |
|
30 EServerAlreadyRunning, |
|
31 EServer |
|
32 |
|
33 }; |
|
34 |
|
35 /** |
|
36 * ?one_line_short_description |
|
37 * |
|
38 * ?more_complete_description |
|
39 * |
|
40 * @lib musmanagerclient.dll |
|
41 * @since S60 v3.2 |
|
42 */ |
|
43 |
|
44 class MMusAvailabilityObserver; |
|
45 |
|
46 class CMusManagerImpl : public CBase |
|
47 { |
|
48 |
|
49 MUS_UNITTEST( UT_CMusManagerImpl ) |
|
50 |
|
51 public: // first phase constructors |
|
52 |
|
53 static CMusManagerImpl* NewL(); |
|
54 |
|
55 static CMusManagerImpl* NewLC(); |
|
56 |
|
57 static CMusManagerImpl* NewL( MMusAvailabilityObserver* aObserver ); |
|
58 |
|
59 static CMusManagerImpl* NewLC( MMusAvailabilityObserver* aObserver ); |
|
60 |
|
61 virtual ~CMusManagerImpl(); |
|
62 |
|
63 public: // new functions |
|
64 |
|
65 void ExamineAvailabilityL(); |
|
66 |
|
67 MultimediaSharing::TMusAvailabilityStatus AvailabilityL(); |
|
68 |
|
69 /** |
|
70 * This function allows clients to request coomand's to be executed by |
|
71 * the MUS manager server. |
|
72 * |
|
73 * In erroneous cases, this function will leave |
|
74 * with an error code that describes the error. Positive leave codes |
|
75 * are defined in MultimediaSharing::TMusAvailabilityStatus. |
|
76 * |
|
77 * @param aRequest Defines the coomand type. |
|
78 * |
|
79 */ |
|
80 void HandleCommandL( MultimediaSharing::TCommandType aCommandType ); |
|
81 |
|
82 void HandleSipRequestL( TInt aChannelId ); |
|
83 |
|
84 void StartApplicationL( MultimediaSharing::TMusUseCase aUseCase ); |
|
85 |
|
86 void StopApplicationL(); |
|
87 |
|
88 private: // second phase constructors |
|
89 |
|
90 CMusManagerImpl(); |
|
91 |
|
92 CMusManagerImpl( MMusAvailabilityObserver* aObserver ); |
|
93 |
|
94 void ConstructL(); |
|
95 |
|
96 private: // private helper functions |
|
97 |
|
98 void StartServer(); |
|
99 |
|
100 TBool ServerStarted(); |
|
101 |
|
102 void ConnectL(); |
|
103 |
|
104 void InitSessionL(); |
|
105 |
|
106 private: // private new functions |
|
107 |
|
108 MultimediaSharing::TMusAvailabilityStatus QueryAvailabilityL(); |
|
109 |
|
110 void MonitorAvailabilityL( TRequestStatus& aRequestStatus ); |
|
111 |
|
112 void CancelMonitoring(); |
|
113 |
|
114 private: // data |
|
115 |
|
116 RMusManagerClientSession iSession; |
|
117 |
|
118 TBool iConnected; |
|
119 |
|
120 TIpcArgs iPcArgs; |
|
121 |
|
122 TPckgBuf<MultimediaSharing::TMusAvailabilityStatus> iPckg; |
|
123 |
|
124 MMusAvailabilityObserver* iAvailabilityObserver; |
|
125 |
|
126 private: // class |
|
127 |
|
128 /** |
|
129 * Active object class listening for |
|
130 * availability status changes |
|
131 */ |
|
132 class CMusManagerImplListener : public CActive |
|
133 { |
|
134 |
|
135 public: |
|
136 |
|
137 static CMusManagerImplListener* NewL( CMusManagerImpl* aMusManagerImpl ); |
|
138 |
|
139 virtual ~CMusManagerImplListener(); |
|
140 |
|
141 void ListenL(); |
|
142 |
|
143 private: // from CActive |
|
144 |
|
145 void RunL(); |
|
146 |
|
147 void DoCancel(); |
|
148 |
|
149 TInt RunError( TInt aError ); |
|
150 |
|
151 private: |
|
152 |
|
153 CMusManagerImplListener( CMusManagerImpl* aMusManagerImpl ); |
|
154 |
|
155 void ConstructL(); |
|
156 |
|
157 private: |
|
158 |
|
159 CMusManagerImpl* iMusManagerImpl; |
|
160 |
|
161 }; |
|
162 |
|
163 private: // data |
|
164 |
|
165 CMusManagerImplListener* iListener; |
|
166 }; |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 #endif // MUSMANAGERIMPL_H |