|
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: See class definition below. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CTCAPPUI_H__ |
|
19 #define __CTCAPPUI_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <bldvariant.hrh> |
|
23 #ifdef __SERIES60_ |
|
24 #include <aknappui.h> |
|
25 #else |
|
26 #include <eikappui.h> |
|
27 #endif |
|
28 #include "MTcBearerObserver.h" |
|
29 #include "MTcTestObserver.h" |
|
30 #include "TTcSettings.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CErrorUI; |
|
34 class CTcBacklight; |
|
35 class CTcBearer; |
|
36 class CTcContainer; |
|
37 class CTcTestRunner; |
|
38 class CTcWatcher; |
|
39 |
|
40 // CLASS DEFINITION |
|
41 /** |
|
42 * CTcAppUi implements the AppUi class required by the Application Framework. |
|
43 * Its main task is to handle user originated events. It is also responsible |
|
44 * for owning the test case runner CTcTestRunner and launching the settings |
|
45 * dialog CTcSettingsDialog. |
|
46 */ |
|
47 class CTcAppUi |
|
48 #ifdef __SERIES60_ |
|
49 : public CAknAppUi, |
|
50 #else |
|
51 : public CEikAppUi, |
|
52 #endif |
|
53 public MTcBearerObserver, |
|
54 public MTcTestObserver |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 /// Default constructor |
|
59 CTcAppUi(); |
|
60 |
|
61 /// Destructor |
|
62 ~CTcAppUi(); |
|
63 |
|
64 /// 2nd phase constructor |
|
65 void ConstructL(); |
|
66 |
|
67 public: // From CEikAppUi |
|
68 |
|
69 void HandleCommandL( TInt aCommand ); |
|
70 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
71 |
|
72 public: // From MTcBearerObserver |
|
73 |
|
74 void BearerCompletion( MTcBearerObserver::TOperation aOp, |
|
75 TInt aStatus ); |
|
76 |
|
77 public: // From MTcTestObserver |
|
78 |
|
79 void NotifyDisconnect(); |
|
80 void NotifyStatusChange(); |
|
81 |
|
82 private: // New methods |
|
83 |
|
84 /** |
|
85 * Handles the ECmdConnect command. Creates and connects the chosen |
|
86 * Bearer (TCP / BT ) |
|
87 */ |
|
88 void CmdConnectL(); |
|
89 |
|
90 /** |
|
91 * Handles the ECmdDisconnect command. Deletes both Test Runner and |
|
92 * Bearer, closing any network connections. |
|
93 */ |
|
94 void CmdDisconnect(); |
|
95 |
|
96 /** |
|
97 * Handles the ECmdSettings command. Constructs and displays |
|
98 * the settings dialog CTcSettingsDialog. |
|
99 */ |
|
100 void CmdSettingsL(); |
|
101 |
|
102 /** |
|
103 * Handles the ECmdLocalAddress command. Displays |
|
104 * the local device address in a popup note. |
|
105 */ |
|
106 void CmdLocalAddressL(); |
|
107 |
|
108 /** |
|
109 * Change Status label text in the application main view. |
|
110 * |
|
111 * @param aText New text for the label |
|
112 */ |
|
113 void SetStatus( const TDesC8& aText ); |
|
114 |
|
115 /** |
|
116 * Reads text from resource array. |
|
117 * |
|
118 */ |
|
119 HBufC* ReadFromResourceArrayLC( TInt aResourceId, TInt aSettingIndex ); |
|
120 |
|
121 /** |
|
122 * Shows a global error note using CErrorUI if aStatus =! KErrNone |
|
123 * |
|
124 * @param aStatus System-wide error code, or KErrNone |
|
125 */ |
|
126 void ShowErrorNote( TInt aStatus ); |
|
127 |
|
128 private: // Data |
|
129 |
|
130 /// Application view control. Owned. |
|
131 CTcContainer* iContainer; |
|
132 |
|
133 /// Bearer implemenatation object. Owned. |
|
134 CTcBearer* iBearer; |
|
135 |
|
136 /// Settings container. Owned. |
|
137 TTcSettings iSettings; |
|
138 |
|
139 /// Test runner. Owned. |
|
140 CTcTestRunner* iRunner; |
|
141 |
|
142 #ifdef __SERIES60_ |
|
143 |
|
144 /// Nokia Error UI. Owned. |
|
145 CErrorUI* iErrorUi; |
|
146 #endif |
|
147 |
|
148 /// Watcher client wrapper. Owned. |
|
149 CTcWatcher* iWatcher; |
|
150 |
|
151 /// Backlight keep-alive object. Owned. |
|
152 CTcBacklight* iBacklight; |
|
153 |
|
154 }; |
|
155 |
|
156 #endif // __CTCAPPUI_H__ |