|
1 /* |
|
2 * Copyright (c) 2005-2009 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 the License "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: Statemachine for connecting to a network |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CORE_OPERATION_CONNECT_H |
|
20 #define CORE_OPERATION_CONNECT_H |
|
21 |
|
22 #include "core_operation_base.h" |
|
23 #include "core_type_list.h" |
|
24 #include "core_ap_data.h" |
|
25 |
|
26 class abs_core_timer_c; |
|
27 |
|
28 /** |
|
29 * Statemachine for connecting to a network. |
|
30 * |
|
31 * @lib wlmserversrv.lib |
|
32 * @since S60 v3.1 |
|
33 */ |
|
34 NONSHARABLE_CLASS( core_operation_connect_c ) : public core_operation_base_c |
|
35 { |
|
36 |
|
37 public: |
|
38 |
|
39 /** The possible states of the state machine. */ |
|
40 enum core_state_e |
|
41 { |
|
42 core_state_init = core_base_state_next, |
|
43 core_state_power_mode, |
|
44 core_state_secondary_ssid_scan_start, |
|
45 core_state_secondary_ssid_scan, |
|
46 core_state_scan_start, |
|
47 core_state_scan_complete, |
|
48 core_state_connect_failure, |
|
49 core_state_connect_secondary_ssid_failure, |
|
50 core_state_connect_total_failure, |
|
51 core_state_connect_disconnect, |
|
52 core_state_connect_success, |
|
53 core_state_set_rcpi_trigger, |
|
54 core_state_MAX |
|
55 }; |
|
56 |
|
57 /** |
|
58 * Constructor. |
|
59 * |
|
60 * @since S60 v3.1 |
|
61 * @param request_id to corresponding service request |
|
62 * @param server core server |
|
63 * @param drivers pointer to lower adaptation |
|
64 * @param adaptation pointer to upper adaptation |
|
65 * @param settings The settings used for establishing the connection. |
|
66 * @param ssid_list List of possible secondary SSIDs. |
|
67 * @param connect_status contains the error code of connection attempt |
|
68 * on completion. |
|
69 */ |
|
70 core_operation_connect_c( |
|
71 u32_t request_id, |
|
72 core_server_c* server, |
|
73 abs_core_driverif_c* drivers, |
|
74 abs_core_server_callback_c* adaptation, |
|
75 const core_iap_data_s& settings, |
|
76 core_type_list_c<core_ssid_entry_s>* ssid_list, |
|
77 core_connect_status_e& connect_status ); |
|
78 |
|
79 /** |
|
80 * Destructor. |
|
81 */ |
|
82 virtual ~core_operation_connect_c(); |
|
83 |
|
84 protected: |
|
85 |
|
86 /** |
|
87 * This method is called when a pending request has been completed |
|
88 * and so sub-operations are pending. |
|
89 * |
|
90 * @since S60 v3.1 |
|
91 * @return status of the operation: |
|
92 * core_error_request_pending if the operation is not finished, |
|
93 * otherwise the status code of the finished operation |
|
94 */ |
|
95 core_error_e next_state(); |
|
96 |
|
97 /** |
|
98 * This method is called when the operation needs to be canceled. |
|
99 * |
|
100 * @since S60 v3.1 |
|
101 * @return status of the operation: |
|
102 * core_error_request_pending if the operation is not finished, |
|
103 * otherwise the status code of the finished operation |
|
104 */ |
|
105 core_error_e cancel(); |
|
106 |
|
107 /** |
|
108 * This method is called when user want the operation to be canceled. |
|
109 * |
|
110 * @since S60 v3.2 |
|
111 * @param do_graceful_cancel Whether cancel should be graceful or forced. |
|
112 */ |
|
113 void user_cancel( |
|
114 bool_t do_graceful_cancel ); |
|
115 |
|
116 private: // data |
|
117 |
|
118 /** |
|
119 * The settings used for establishing the connection. |
|
120 */ |
|
121 const core_iap_data_s settings_m; |
|
122 |
|
123 /** Connect status that will be returned to adaptation */ |
|
124 core_connect_status_e& connect_status_m; |
|
125 |
|
126 /** |
|
127 * The number of times roaming has failed. |
|
128 */ |
|
129 u32_t failure_count_m; |
|
130 |
|
131 /** |
|
132 * Whether we are still connected to an AP. |
|
133 */ |
|
134 bool_t is_connected_m; |
|
135 |
|
136 /** |
|
137 * SSID to connect to. |
|
138 */ |
|
139 core_ssid_s ssid_m; |
|
140 |
|
141 /** |
|
142 * List of secondary SSIDs. NULL if none. Not owned by this pointer. |
|
143 */ |
|
144 core_type_list_c<core_ssid_entry_s>* ssid_list_m; |
|
145 |
|
146 /** |
|
147 * Reason the connection is released. |
|
148 */ |
|
149 core_release_reason_e release_reason_m; |
|
150 |
|
151 }; |
|
152 |
|
153 #endif // CORE_OPERATION_CONNECT_H |