|
1 /* |
|
2 * Copyright (c) 2005-2006 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 updating device settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "core_operation_update_device_settings.h" |
|
20 #include "core_operation_update_power_mode.h" |
|
21 #include "core_server.h" |
|
22 #include "am_debug.h" |
|
23 |
|
24 // ======== MEMBER FUNCTIONS ======== |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 core_operation_update_device_settings_c::core_operation_update_device_settings_c( |
|
30 u32_t request_id, |
|
31 core_server_c* server, |
|
32 abs_core_driverif_c* drivers, |
|
33 abs_core_server_callback_c* adaptation ) : |
|
34 core_operation_base_c( core_operation_update_device_settings, request_id, server, drivers, adaptation, |
|
35 core_base_flag_none ) |
|
36 { |
|
37 DEBUG( "core_operation_update_device_settings_c::core_operation_update_device_settings_c()" ); |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 core_operation_update_device_settings_c::~core_operation_update_device_settings_c() |
|
44 { |
|
45 DEBUG( "core_operation_update_device_settings_c::~core_operation_update_device_settings_c()" ); |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 core_error_e core_operation_update_device_settings_c::next_state() |
|
52 { |
|
53 DEBUG( "core_operation_update_device_settings_c::next_state()" ); |
|
54 |
|
55 switch( operation_state_m ) |
|
56 { |
|
57 case core_state_init: |
|
58 { |
|
59 operation_state_m = core_state_req_set_power_mode; |
|
60 |
|
61 /** |
|
62 * Currently power save mode is the only device setting that will cause |
|
63 * an immediate operation. |
|
64 * |
|
65 * However, we do not want to disturb DHCP negotiation. |
|
66 */ |
|
67 if( !server_m->is_dhcp_timer_active() ) |
|
68 { |
|
69 core_operation_base_c* operation = new core_operation_update_power_mode_c( |
|
70 request_id_m, |
|
71 server_m, |
|
72 drivers_m, |
|
73 adaptation_m ); |
|
74 |
|
75 return run_sub_operation( operation ); |
|
76 } |
|
77 |
|
78 return core_error_ok; |
|
79 } |
|
80 case core_state_req_set_power_mode: |
|
81 { |
|
82 DEBUG( "core_operation_update_device_settings_c::next_state() - device settings updated" ); |
|
83 |
|
84 return core_error_ok; |
|
85 } |
|
86 default: |
|
87 { |
|
88 ASSERT( false_t ); |
|
89 } |
|
90 } |
|
91 |
|
92 return core_error_request_pending; |
|
93 } |