|
1 /* |
|
2 * Copyright (c) 2005 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: The class implements the powerup/down, and scan and store |
|
15 * state machines. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #include <f32file.h> |
|
22 |
|
23 #include "fmradioengineradiostatehandler.h" |
|
24 #include "fmradioengine.h" |
|
25 #include "debug.h" |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ---------------------------------------------------- |
|
31 // CRadioStateHandler::CRadioStateHandler |
|
32 // c++ default constructor |
|
33 // ---------------------------------------------------- |
|
34 // |
|
35 CRadioStateHandler::CRadioStateHandler(CRadioEngine* aEngine) |
|
36 : CActive(EPriorityStandard), iEngine(aEngine) |
|
37 { |
|
38 CActiveScheduler::Add(this); |
|
39 } |
|
40 |
|
41 // ---------------------------------------------------- |
|
42 // CRadioStateHandler::ConstructL |
|
43 // 2nd phase constructor |
|
44 // ---------------------------------------------------- |
|
45 // |
|
46 void CRadioStateHandler::ConstructL() |
|
47 { |
|
48 } |
|
49 |
|
50 // ---------------------------------------------------- |
|
51 // CRadioStateHandler::NewL |
|
52 // Method for creating new instances of this class. |
|
53 // ---------------------------------------------------- |
|
54 // |
|
55 CRadioStateHandler* CRadioStateHandler::NewL( |
|
56 CRadioEngine* aEngine) //a pointer to CRadioEngine object |
|
57 { |
|
58 CRadioStateHandler *self = new(ELeave) CRadioStateHandler(aEngine); |
|
59 CleanupStack::PushL(self); |
|
60 self->ConstructL(); |
|
61 CleanupStack::Pop(); |
|
62 return self; |
|
63 } |
|
64 |
|
65 // Destructor |
|
66 CRadioStateHandler::~CRadioStateHandler() |
|
67 { |
|
68 Cancel(); |
|
69 } |
|
70 |
|
71 |
|
72 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
73 |
|
74 // ---------------------------------------------------- |
|
75 // CRadioStateHandler::Callback |
|
76 // Trigger the active object to call the client callback function |
|
77 // Returns: None |
|
78 // ---------------------------------------------------- |
|
79 // |
|
80 void CRadioStateHandler::Callback( |
|
81 MRadioEngineStateChangeCallback::TFMRadioNotifyEvent aEventCode, // a event code |
|
82 TInt aErrorCode ) // a error code |
|
83 { |
|
84 iCallbackEventCode = aEventCode; |
|
85 iCallbackErrorCode = aErrorCode; |
|
86 Cancel(); |
|
87 SetActive(); |
|
88 TRequestStatus* status=&iStatus; |
|
89 User::RequestComplete(status, KRadioStateEventCallback); |
|
90 } |
|
91 |
|
92 |
|
93 // ---------------------------------------------------- |
|
94 // CRadioStateHandler::DoCancel |
|
95 // Cancel the timeout timer. This generally means that a |
|
96 // response was received, so the timeout is no longer needed. |
|
97 // Returns: None |
|
98 // ---------------------------------------------------- |
|
99 // |
|
100 void CRadioStateHandler::DoCancel() |
|
101 { |
|
102 } |
|
103 |
|
104 // ---------------------------------------------------- |
|
105 // CRadioStateHandler::RunL |
|
106 // State Change Request/timeout handler |
|
107 // Returns: None |
|
108 // ---------------------------------------------------- |
|
109 // |
|
110 void CRadioStateHandler::RunL() |
|
111 { |
|
112 FTRACE(FPrint(_L("inside runL()"))); |
|
113 |
|
114 if (iStatus.Int() == KRadioStateEventCallback) |
|
115 { |
|
116 iEngine->HandleCallback(iCallbackEventCode, iCallbackErrorCode); |
|
117 } |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------- |
|
121 // CRadioStateHandler::RunError |
|
122 // handle any errors that occur in the RunL |
|
123 // Returns: aError: the error code |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 TInt CRadioStateHandler::RunError( |
|
127 TInt aError ) // error code |
|
128 { |
|
129 FTRACE( FPrint( _L("CRadioStateHandler::RunError()") ) ); |
|
130 return aError; |
|
131 } |
|
132 |
|
133 // end of file |