|
1 /* |
|
2 * Copyright (c) 2006-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 running an echo test. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CORE_SUB_OPERATION_ECHO_TEST_H |
|
20 #define CORE_SUB_OPERATION_ECHO_TEST_H |
|
21 |
|
22 #include "core_operation_base.h" |
|
23 #include "abs_core_frame_handler.h" |
|
24 #include "core_ap_data.h" |
|
25 |
|
26 /** |
|
27 * Statemachine for running an echo test. |
|
28 * |
|
29 * @lib wlmserversrv.lib |
|
30 * @since S60 v3.2 |
|
31 */ |
|
32 NONSHARABLE_CLASS( core_sub_operation_echo_test_c ) : |
|
33 public core_operation_base_c, |
|
34 public abs_core_frame_handler_c |
|
35 { |
|
36 |
|
37 public: |
|
38 |
|
39 /** |
|
40 * The possible states of the operation. |
|
41 */ |
|
42 enum core_state_e |
|
43 { |
|
44 core_state_init = core_base_state_next, |
|
45 core_state_echo_frame_broadcast_timeout, |
|
46 core_state_echo_frame_unicast_timeout, |
|
47 core_state_echo_frame_broadcast, |
|
48 core_state_echo_frame_unicast, |
|
49 core_state_MAX |
|
50 }; |
|
51 |
|
52 /** |
|
53 * Constructor. |
|
54 * |
|
55 * @since S60 v3.2 |
|
56 * @param request_id An unique identification for the request. |
|
57 * @param server Handle to core server. |
|
58 * @param drivers Handle to low-level management functionality. |
|
59 * @param adaptation Handle upper-level management functionality. |
|
60 * @param ap_data The access point being tested. |
|
61 * @param max_retry_count Maximum times an echo test frame can be re-sent. |
|
62 * @param timeout The amount of microseconds to wait for response. |
|
63 * @param test_mode Indicates the current test mode which is unicast or broadcast. |
|
64 */ |
|
65 core_sub_operation_echo_test_c( |
|
66 u32_t request_id, |
|
67 core_server_c* server, |
|
68 abs_core_driverif_c* drivers, |
|
69 abs_core_server_callback_c* adaptation, |
|
70 const core_ap_data_c& ap_data, |
|
71 u8_t max_retry_count, |
|
72 u32_t timeout, |
|
73 bool_t test_mode ); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 virtual ~core_sub_operation_echo_test_c(); |
|
79 |
|
80 protected: |
|
81 |
|
82 /** |
|
83 * From core_operation_base_c This method is called when a pending request has been completed |
|
84 * and no sub-operations are pending. |
|
85 * |
|
86 * @since S60 v3.2 |
|
87 * @return status of the operation: |
|
88 * core_error_request_pending if the operation is not finished, |
|
89 * otherwise the status code of the finished operation |
|
90 */ |
|
91 core_error_e next_state(); |
|
92 |
|
93 /** |
|
94 * From abs_core_frame_handler_c Called by the core server when an echo test frame has been received. |
|
95 * |
|
96 * @since S60 v3.2 |
|
97 * @param frame Pointer to an echo test frame parser. |
|
98 * @param rcpi RCPI value of the frame. |
|
99 * @return true_t if the frame was handled, false_t otherwise. |
|
100 */ |
|
101 bool_t receive_test_frame( |
|
102 const core_frame_echo_test_c* frame, |
|
103 u8_t rcpi ); |
|
104 |
|
105 private: // data |
|
106 |
|
107 /** |
|
108 * The access point being tested. |
|
109 */ |
|
110 const core_ap_data_c& current_ap_m; |
|
111 |
|
112 /** |
|
113 * Maximum times an echo test frame can be re-sent. |
|
114 */ |
|
115 const u8_t max_retry_count_m; |
|
116 |
|
117 /** |
|
118 * Number of times the echo test frame has been sent. |
|
119 */ |
|
120 u8_t retry_count_m; |
|
121 |
|
122 /** |
|
123 * The amount of microseconds to wait for response. |
|
124 */ |
|
125 u32_t timeout_m; |
|
126 |
|
127 /** |
|
128 * The token used in the sent echo test frame. |
|
129 */ |
|
130 u16_t token_m; |
|
131 |
|
132 /** |
|
133 * Status of the operation. |
|
134 * |
|
135 * core_error_timeout if no response was received from the AP. |
|
136 * core_error_ok if response was successfully received, |
|
137 * an error otherwise. |
|
138 */ |
|
139 core_error_e return_status_m; |
|
140 |
|
141 /** |
|
142 * Illustrates the state if unicast test mode is on. |
|
143 */ |
|
144 bool_t is_unicast_mode_m; |
|
145 |
|
146 }; |
|
147 |
|
148 #endif // CORE_SUB_OPERATION_ECHO_TEST_H |