0
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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: Message handler for RA8 decoder custom interface.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <Ra8CustomInterface.h>
|
|
22 |
#include "Ra8CustomInterfaceMsgHdlr.h"
|
|
23 |
#include "Ra8CustomInterfaceMsgs.h"
|
|
24 |
|
|
25 |
// EXTERNAL DATA STRUCTURES
|
|
26 |
|
|
27 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
28 |
|
|
29 |
// CONSTANTS
|
|
30 |
|
|
31 |
// MACROS
|
|
32 |
|
|
33 |
// LOCAL CONSTANTS AND MACROS
|
|
34 |
|
|
35 |
// MODULE DATA STRUCTURES
|
|
36 |
|
|
37 |
// LOCAL FUNCTION PROTOTYPES
|
|
38 |
|
|
39 |
// FORWARD DECLARATIONS
|
|
40 |
|
|
41 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
42 |
|
|
43 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
44 |
|
|
45 |
// -----------------------------------------------------------------------------
|
|
46 |
// CRa8CustomInterfaceMsgHdlr::CRa8CustomInterfaceMsgHdlr
|
|
47 |
// C++ default constructor can NOT contain any code, that
|
|
48 |
// might leave.
|
|
49 |
// -----------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
CRa8CustomInterfaceMsgHdlr::CRa8CustomInterfaceMsgHdlr(
|
|
52 |
CRa8CustomInterface* aRa8CustomInterface) :
|
|
53 |
CMMFObject(KUidRa8DecHwDeviceCI)
|
|
54 |
{
|
|
55 |
iRa8CustomInterface = aRa8CustomInterface;
|
|
56 |
}
|
|
57 |
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
// CRa8CustomInterfaceMsgHdlr::ConstructL
|
|
60 |
// Symbian 2nd phase constructor can leave.
|
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
void CRa8CustomInterfaceMsgHdlr::ConstructL()
|
|
64 |
{
|
|
65 |
}
|
|
66 |
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
// CRa8CustomInterfaceMsgHdlr::NewL
|
|
69 |
// Two-phased constructor.
|
|
70 |
// -----------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
EXPORT_C CRa8CustomInterfaceMsgHdlr*
|
|
73 |
CRa8CustomInterfaceMsgHdlr::NewL(TAny* aRa8CustomInterface)
|
|
74 |
{
|
|
75 |
CRa8CustomInterface* custominterface =
|
|
76 |
(CRa8CustomInterface*)aRa8CustomInterface;
|
|
77 |
CRa8CustomInterfaceMsgHdlr* self =
|
|
78 |
new (ELeave) CRa8CustomInterfaceMsgHdlr(custominterface);
|
|
79 |
CleanupStack::PushL( self );
|
|
80 |
self->ConstructL();
|
|
81 |
CleanupStack::Pop(self);
|
|
82 |
|
|
83 |
return self;
|
|
84 |
}
|
|
85 |
|
|
86 |
// -----------------------------------------------------------------------------
|
|
87 |
// Destructor
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
EXPORT_C CRa8CustomInterfaceMsgHdlr::~CRa8CustomInterfaceMsgHdlr()
|
|
91 |
{
|
|
92 |
}
|
|
93 |
|
|
94 |
// -----------------------------------------------------------------------------
|
|
95 |
// CRa8CustomInterfaceMsgHdlr::HandleRequest
|
|
96 |
// Handles the messages from the proxy.
|
|
97 |
// Calls a subfunction which determines which custom interface to call.
|
|
98 |
// A subfunction is used to contain multiple leaving functions for a single
|
|
99 |
// trap.
|
|
100 |
// (other items were commented in a header).
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
EXPORT_C void CRa8CustomInterfaceMsgHdlr::HandleRequest(TMMFMessage& aMessage)
|
|
104 |
{
|
|
105 |
ASSERT(aMessage.Destination().InterfaceId() == KUidRa8DecHwDeviceCI);
|
|
106 |
TRAPD(error,DoHandleRequestL(aMessage));
|
|
107 |
if (error)
|
|
108 |
{
|
|
109 |
aMessage.Complete(error);
|
|
110 |
}
|
|
111 |
}
|
|
112 |
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
// CRa8CustomInterfaceMsgHdlr::DoHandleRequestL
|
|
115 |
// Determines which custom interface to call.
|
|
116 |
// (other items were commented in a header).
|
|
117 |
// -----------------------------------------------------------------------------
|
|
118 |
//
|
|
119 |
void CRa8CustomInterfaceMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
|
|
120 |
{
|
|
121 |
switch (aMessage.Function())
|
|
122 |
{
|
|
123 |
case ERa8CiFrameNumber:
|
|
124 |
{
|
|
125 |
DoFrameNumberL(aMessage);
|
|
126 |
break;
|
|
127 |
}
|
|
128 |
case ERa8CiSetInitString:
|
|
129 |
{
|
|
130 |
DoSetInitStringL(aMessage);
|
|
131 |
break;
|
|
132 |
}
|
|
133 |
default:
|
|
134 |
{
|
|
135 |
aMessage.Complete(KErrNotSupported);
|
|
136 |
}
|
|
137 |
}
|
|
138 |
}
|
|
139 |
|
|
140 |
// -----------------------------------------------------------------------------
|
|
141 |
// CRa8CustomInterfaceMsgHdlr::DoFrameNumberL
|
|
142 |
// Handles the message from the proxy and calls the custom interface method.
|
|
143 |
// The data passed from the proxy is read from the message and passed to
|
|
144 |
// the custom interface.
|
|
145 |
// (other items were commented in a header).
|
|
146 |
// -----------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
void CRa8CustomInterfaceMsgHdlr::DoFrameNumberL(TMMFMessage& aMessage)
|
|
149 |
{
|
|
150 |
TInt frame = iRa8CustomInterface->FrameNumber();
|
|
151 |
TPckgBuf<TInt> pckg(frame);
|
|
152 |
aMessage.WriteDataToClientL(pckg);
|
|
153 |
aMessage.Complete(KErrNone);
|
|
154 |
}
|
|
155 |
|
|
156 |
// -----------------------------------------------------------------------------
|
|
157 |
// CRa8CustomInterfaceMsgHdlr::DoSetInitStringL
|
|
158 |
// Handles the message from the proxy and calls the custom interface method.
|
|
159 |
// The data passed from the proxy is read from the message and passed to
|
|
160 |
// the custom interface.
|
|
161 |
// (other items were commented in a header).
|
|
162 |
// -----------------------------------------------------------------------------
|
|
163 |
//
|
|
164 |
void CRa8CustomInterfaceMsgHdlr::DoSetInitStringL(TMMFMessage& aMessage)
|
|
165 |
{
|
|
166 |
TInt size = aMessage.SizeOfData1FromClient();
|
|
167 |
HBufC8* dataBuf = HBufC8::NewL(size);
|
|
168 |
CleanupStack::PushL( dataBuf );
|
|
169 |
TPtr8 dataPtr = dataBuf->Des();
|
|
170 |
aMessage.ReadData1FromClientL(dataPtr);
|
|
171 |
TInt status = iRa8CustomInterface->SetInitString(dataPtr);
|
|
172 |
CleanupStack::Pop(dataBuf);
|
|
173 |
delete dataBuf;
|
|
174 |
aMessage.Complete(status);
|
|
175 |
}
|
|
176 |
|
|
177 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
178 |
|
|
179 |
// End of File
|