|
1 /* |
|
2 * Copyright (c) 2007 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: Always Online class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "AOActiveScheduler.h" |
|
21 #include "AlwaysOnlineManagerServer.h" |
|
22 #include "AlwaysOnlineManagerLogging.h" |
|
23 |
|
24 // CONSTANTS |
|
25 |
|
26 #ifdef _DEBUG |
|
27 _LIT(KAOActiveSchedulerPanic, "AOActiveScheduler"); |
|
28 const TInt KAOSchedulerPanicCode = -1; |
|
29 #endif |
|
30 |
|
31 //--------------------------------------------- |
|
32 // Constructor |
|
33 //--------------------------------------------- |
|
34 CAOActiveScheduler::CAOActiveScheduler() |
|
35 { |
|
36 } |
|
37 |
|
38 //--------------------------------------------- |
|
39 // Destructor |
|
40 //--------------------------------------------- |
|
41 CAOActiveScheduler::~CAOActiveScheduler() |
|
42 { |
|
43 // this not owned, just set null |
|
44 iAoServer = NULL; |
|
45 } |
|
46 |
|
47 //--------------------------------------------- |
|
48 // Destructor |
|
49 //--------------------------------------------- |
|
50 void CAOActiveScheduler::SetServerRef( CAlwaysOnlineManagerServer* aAoServer ) |
|
51 { |
|
52 iAoServer = aAoServer; |
|
53 } |
|
54 |
|
55 |
|
56 //--------------------------------------------- |
|
57 // CAOActiveScheduler::Error() |
|
58 //--------------------------------------------- |
|
59 void CAOActiveScheduler::Error( TInt anError ) const |
|
60 { |
|
61 |
|
62 KAOMANAGER_LOGGER_WRITE_FORMAT("CAOActiveScheduler::Error() ERROR IN AO ACTIVE SCHEDULER error code: ", anError ); |
|
63 |
|
64 TPckgBuf<TInt> errorBuffer( anError ); |
|
65 |
|
66 //check that error is short enough value for |
|
67 //descriptor |
|
68 |
|
69 TInt error = KErrNone; |
|
70 |
|
71 // make sure thet AoServer pointer is set |
|
72 if ( iAoServer ) |
|
73 { |
|
74 TRAP(error, iAoServer->HandleClientCommandL( |
|
75 EServerAPIBaseCommandAoSchedulerError , errorBuffer ); ); |
|
76 } |
|
77 else |
|
78 { |
|
79 error = KErrNotFound; |
|
80 } |
|
81 |
|
82 // panic in debug mode if there is error |
|
83 __ASSERT_DEBUG( error == KErrNone, |
|
84 User::Panic( KAOActiveSchedulerPanic, KAOSchedulerPanicCode ) ); |
|
85 |
|
86 KAOMANAGER_LOGGER_WRITE("CAOActiveScheduler::Error() ERROR is handled." ); |
|
87 } |