|
1 /* |
|
2 * Copyright (c) 2004 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: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "CTcSIPContext.h" |
|
19 #include "SIPConstants.h" |
|
20 #include "CTcSIPConnectionContainer.h" |
|
21 #include "TCmdGetProfileStatus.h" |
|
22 #include "CTcSIPProfileContainer.h" |
|
23 |
|
24 #include <sipmanagedprofile.h> |
|
25 #include <sipmanagedprofileregistry.h> |
|
26 #include <sipprofile.h> |
|
27 #include <sipprofiletypeinfo.h> |
|
28 |
|
29 /** |
|
30 * INPUT: |
|
31 * Headers: - |
|
32 * Parameters: Timeout* |
|
33 * IDs: RegistryId |
|
34 * |
|
35 * OUTPUT: |
|
36 * Parameters: ProfileErrorCode, ProfileState |
|
37 * IDs: ProfileId |
|
38 */ |
|
39 void TCmdGetProfileStatus::ExecuteL() |
|
40 { |
|
41 // -- Setup --------------------------------------------------------------- |
|
42 // Get selected registry |
|
43 CTcSIPProfileContainer& container = SelectProfileL(); |
|
44 |
|
45 // Get an item off the receive queue (waits until timeout if none is present) |
|
46 TInt timeout = ExtractIntegerL( KParamTimeout, KDefaultReceiveTimeout, EFalse ); |
|
47 TTcProfileReceived item = container.ReceivedProfileItemL( timeout ); |
|
48 |
|
49 // -- Execution ----------------------------------------------------------- |
|
50 |
|
51 |
|
52 // -- Response creation --------------------------------------------------- |
|
53 |
|
54 AddIntegerResponseL( KParamProfileId, item.iProfileId ); |
|
55 AddIntegerResponseL( KParamProfileErrorCode, item.iError ); |
|
56 |
|
57 TPtrC8 state; |
|
58 switch( item.iEvent ) |
|
59 { |
|
60 case ETcProfileCreated: |
|
61 { |
|
62 state.Set( KProfileCreated ); |
|
63 break; |
|
64 } |
|
65 case ETcProfileUpdated: |
|
66 { |
|
67 state.Set( KProfileUpdated ); |
|
68 break; |
|
69 } |
|
70 case ETcProfileRegistrationStatusChanged: |
|
71 { |
|
72 state.Set( KProfileRegistrationStatusChanged ); |
|
73 break; |
|
74 } |
|
75 case ETcProfileDestroyed: |
|
76 { |
|
77 state.Set( KProfileDestroyed ); |
|
78 break; |
|
79 } |
|
80 case ETcProfileRegistryErrorOccurred: |
|
81 { |
|
82 state.Set( KProfileRegistryErrorOccurred ); |
|
83 break; |
|
84 } |
|
85 default: |
|
86 { |
|
87 state.Set( KUnknown ); |
|
88 break; |
|
89 } |
|
90 } |
|
91 AddTextResponseL( KParamProfileState, state ); |
|
92 |
|
93 TPtrC8 regStatus; |
|
94 switch( item.iRegStatus ) |
|
95 { |
|
96 case ETcStatusUnregistered: |
|
97 { |
|
98 regStatus.Set( KProfileUnregistered ); |
|
99 break; |
|
100 } |
|
101 case ETcStatusRegistered: |
|
102 { |
|
103 regStatus.Set( KProfileRegistered ); |
|
104 break; |
|
105 } |
|
106 default: |
|
107 { |
|
108 regStatus.Set( KUnknown ); |
|
109 break; |
|
110 } |
|
111 } |
|
112 AddTextResponseL( KParamProfileRegStatus, regStatus ); |
|
113 } |
|
114 |
|
115 |
|
116 TBool TCmdGetProfileStatus::Match( const TTcIdentifier& aId ) |
|
117 { |
|
118 return TTcSIPCommandBase::Match( aId, _L8("GetProfileStatus") ); |
|
119 } |
|
120 |
|
121 TTcCommandBase* TCmdGetProfileStatus::CreateL( MTcTestContext& aContext ) |
|
122 { |
|
123 return new( ELeave ) TCmdGetProfileStatus( aContext ); |
|
124 } |
|
125 |