|
1 /* |
|
2 * Copyright (c) 2008 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: Utility class for matching network related enumerations to |
|
15 * descriptor. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef GSNETWORKDEBUGHELPER_H_ |
|
21 #define GSNETWORKDEBUGHELPER_H_ |
|
22 |
|
23 #include "GsNetworkPlugin.hrh" |
|
24 #include <e32base.h> |
|
25 #include <e32def.h> |
|
26 #include <NWHandlingEngine.h> |
|
27 #include <MPsetNetworkModeObs.h> |
|
28 #include <MPsetNetworkInfoObs.h> |
|
29 |
|
30 /** |
|
31 * Static helper class for transfering network enumerations into descriptors. |
|
32 * Pretty handy in printing debug traces from network events... |
|
33 * |
|
34 * Example (do not print in release mode!): |
|
35 * #ifdef _DEBUG |
|
36 * TBuf<KGSNetworkModeDebugStrLen> myBuf; |
|
37 * GSNetworkDebugHelper::XXXToDes( myEnum, aModeCaps ); |
|
38 * __GSLOGSTRING2( "%S", &aModeCaps, &myEnum ); |
|
39 * #endif //_DEBUG |
|
40 */ |
|
41 class GSNetworkDebugHelper |
|
42 { |
|
43 public: |
|
44 |
|
45 /** |
|
46 * Prints enum name into descriptor. |
|
47 * |
|
48 * @param aMode Enumeration whose name should be used. |
|
49 * @param buf Descriptor indicating the enumeration name. Use |
|
50 * KGSNetworkModeDebugStrLen as length. |
|
51 */ |
|
52 static void NwToDes( TGSNetworkModeItems aMode, TDes& buf ); |
|
53 |
|
54 /** |
|
55 * Prints enum name into descriptor. |
|
56 * From: |
|
57 * enum RMmCustomAPI::TNetworkModeCaps |
|
58 * { |
|
59 * KCapsNetworkModeGsm = 0x01, |
|
60 * KCapsNetworkModeUmts = 0x02, |
|
61 * KCapsNetworkModeDual = 0x04 |
|
62 * }; |
|
63 * AND KGSNetworkModeCapsNotUpdated |
|
64 * |
|
65 * Can be used for debugging purposes. |
|
66 * |
|
67 * @param aModeCaps Enumeration whose name should be used. |
|
68 * @param buf Descriptor indicating the enumeration name. Use |
|
69 * KGSNetworkModeDebugStrLen as length. |
|
70 */ |
|
71 static void NwCapsToDes( |
|
72 TUint32 aModeCaps, |
|
73 TDes& buf ); |
|
74 |
|
75 /** |
|
76 * Prints enum name into descriptor. |
|
77 * |
|
78 * Example: |
|
79 * TBuf<KGSNetworkModeDebugStrLen> myBuf; |
|
80 * GSNetworkDebugHelper::NwCapsToDes( myEnum, aModeCaps ); |
|
81 * __GSLOGSTRING2( "%S", &aModeCaps, &myEnum ); |
|
82 * |
|
83 * @param aNetworkStatus Enumeration whose name should be used. |
|
84 * @param buf Descriptor indicating the enumeration name. Use |
|
85 * KGSNetworkModeDebugStrLen as length. |
|
86 * |
|
87 */ |
|
88 static void NetworkStatusToDes( |
|
89 TNWRegistrationStatus aNetworkStatus, |
|
90 TDes& aDes ); |
|
91 |
|
92 /** |
|
93 * Prints enum name into descriptor. |
|
94 * |
|
95 * @param aNetworkMessage Enumeration whose name should be used. |
|
96 * @param buf Descriptor indicating the enumeration name. Use |
|
97 * KGSNetworkModeDebugStrLen as length. |
|
98 */ |
|
99 static void NetworkMessageToDes( |
|
100 MNWMessageObserver::TNWMessages aNetworkMessage, |
|
101 TDes& aDes ); |
|
102 |
|
103 /** |
|
104 * Prints enum name into descriptor. |
|
105 * |
|
106 * @param aNetworkOperation Enumeration whose name should be used. |
|
107 * @param buf Descriptor indicating the enumeration name. Use |
|
108 * KGSNetworkModeDebugStrLen as length. |
|
109 */ |
|
110 static void NetworkOperationToDes( |
|
111 MNWMessageObserver::TNWOperation aNetworkOperation, |
|
112 TDes& aDes ); |
|
113 |
|
114 /** |
|
115 * Prints enum name into descriptor. |
|
116 * |
|
117 * @param aRequest Enumeration whose name should be used. |
|
118 * @param buf Descriptor indicating the enumeration name. Use |
|
119 * KGSNetworkModeDebugStrLen as length. |
|
120 */ |
|
121 static void NetworkModeRequestToDes( |
|
122 MPsetNetworkModeObserver::TServiceRequest aRequest, |
|
123 TDes& aDes ); |
|
124 |
|
125 /** |
|
126 * Prints enum name into descriptor. |
|
127 * |
|
128 * @param aRequest Enumeration whose name should be used. |
|
129 * @param buf Descriptor indicating the enumeration name. Use |
|
130 * KGSNetworkModeDebugStrLen as length. |
|
131 */ |
|
132 static void NetworkInfoRequestToDes( |
|
133 MPsetNetworkInfoObserver::TServiceRequest aRequest, |
|
134 TDes& aDes ); |
|
135 |
|
136 }; |
|
137 |
|
138 #endif /*GSNETWORKDEBUGHELPER_H_*/ |
|
139 |
|
140 |
|
141 //End of File |