|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #include "ControllerInitialisationPluginImpl.h" |
|
22 #include "SymbianControllerInitialisor.h" |
|
23 |
|
24 #include <bluetooth/hci/controllerinitialisationobserver.h> |
|
25 #include <bluetooth/logger.h> |
|
26 |
|
27 #ifdef __FLOG_ACTIVE |
|
28 _LIT8(KLogComponent, LOG_COMPONENT_INITIALISOR_SYMBIAN); |
|
29 #endif |
|
30 |
|
31 /*static*/ CControllerInitialisationPluginImpl* CControllerInitialisationPluginImpl::NewL() |
|
32 { |
|
33 LOG_STATIC_FUNC |
|
34 |
|
35 CControllerInitialisationPluginImpl* self = new (ELeave) CControllerInitialisationPluginImpl(); |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(self); |
|
39 return self; |
|
40 } |
|
41 |
|
42 CControllerInitialisationPluginImpl::~CControllerInitialisationPluginImpl() |
|
43 { |
|
44 LOG_FUNC |
|
45 |
|
46 } |
|
47 |
|
48 void CControllerInitialisationPluginImpl::ConstructL() |
|
49 { |
|
50 LOG_FUNC |
|
51 |
|
52 } |
|
53 |
|
54 /*virtual*/ TAny* CControllerInitialisationPluginImpl::Interface(TUid aUid) |
|
55 { |
|
56 LOG_FUNC |
|
57 |
|
58 TAny* ret = NULL; |
|
59 switch(aUid.iUid) |
|
60 { |
|
61 case KControllerInitialisationInterfaceUid: |
|
62 ret = reinterpret_cast<TAny*>(static_cast<MControllerInitialisationInterface*>(this)); |
|
63 break; |
|
64 |
|
65 case KControllerInitialisationAbortExtenstionInterfaceUid: |
|
66 ret = reinterpret_cast<TAny*>(static_cast<MControllerInitialisationAbortExtensionInterface*>(this)); |
|
67 break; |
|
68 |
|
69 default: |
|
70 break; |
|
71 }; |
|
72 |
|
73 return ret; |
|
74 } |
|
75 |
|
76 |
|
77 // Protected constructor. |
|
78 CControllerInitialisationPluginImpl::CControllerInitialisationPluginImpl() |
|
79 { |
|
80 LOG_FUNC |
|
81 |
|
82 } |
|
83 |
|
84 /*virtual*/ void CControllerInitialisationPluginImpl::MciiPreResetCommand() |
|
85 { |
|
86 LOG_FUNC |
|
87 |
|
88 __ASSERT_DEBUG(iControllerInitialisationObserver, PANIC(KSymbianControllerInitialisorPanic, ENullInitialisationObserver)); |
|
89 |
|
90 // Do any pre-reset initialisation... |
|
91 |
|
92 // Inform stack that we have finished |
|
93 iControllerInitialisationObserver->McioPreResetCommandComplete(KErrNone); |
|
94 } |
|
95 |
|
96 /*virtual*/ void CControllerInitialisationPluginImpl::MciiPostResetCommand() |
|
97 { |
|
98 LOG_FUNC |
|
99 |
|
100 __ASSERT_DEBUG(iControllerInitialisationObserver, PANIC(KSymbianControllerInitialisorPanic, ENullInitialisationObserver)); |
|
101 |
|
102 // Do any post-reset initialisation... |
|
103 |
|
104 // Inform stack that we have finished |
|
105 iControllerInitialisationObserver->McioPostResetCommandComplete(KErrNone); |
|
106 } |
|
107 |
|
108 /*virtual*/ void CControllerInitialisationPluginImpl::MciiSetHCICommandQueue(MHCICommandQueue& /*aHCICommandQueue*/) |
|
109 { |
|
110 LOG_FUNC |
|
111 |
|
112 // This initialisor doesn't send any commands. Therefore it will not need a reference |
|
113 // to the command queue. |
|
114 } |
|
115 |
|
116 /*virtual*/ void CControllerInitialisationPluginImpl::MciiSetControllerInitialisationObserver(MControllerInitialisationObserver& aObserver) |
|
117 { |
|
118 LOG_FUNC |
|
119 |
|
120 __ASSERT_DEBUG(iControllerInitialisationObserver == 0, PANIC(KSymbianControllerInitialisorPanic, EInitialisationObserverOverwritten)); |
|
121 iControllerInitialisationObserver = &aObserver; |
|
122 } |
|
123 |
|
124 /*virtual*/ void CControllerInitialisationPluginImpl::MciiSetCoreHci(MCoreHci& /*aCoreHci*/) |
|
125 { |
|
126 LOG_FUNC |
|
127 |
|
128 // This initialisor doesn't need to communicate with the |
|
129 // Core HCI. |
|
130 } |
|
131 |
|
132 /*virtual*/ void CControllerInitialisationPluginImpl::MciaeiAbortInitialisation() |
|
133 { |
|
134 LOG_FUNC |
|
135 |
|
136 // As this initialisor calls back synchronously from MciiPreResetCommand and MciiPostResetCommand |
|
137 // nothing needs to be aborted. This does however show a problem in the Stack logic as this should |
|
138 // only be called if a callback is outstanding. |
|
139 PANIC(KSymbianControllerInitialisorPanic, EUnexpectedAbortInitialisation); |
|
140 } |
|
141 |
|
142 |