|
1 // Copyright (c) 2008-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 // MessageInterceptClient.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include "msginterceptclient.h" |
|
23 #include <elements/sd_mintercept.h> |
|
24 #include <elements/sd_minterceptmsgs.h> |
|
25 |
|
26 using namespace Den; |
|
27 |
|
28 EXPORT_C void RMessageInterceptor::Close() |
|
29 { |
|
30 RApiExtSessionBase::Close(); |
|
31 iReqAndRespEventBuf.Close(); |
|
32 } |
|
33 |
|
34 // fallible messages control |
|
35 EXPORT_C TInt RMessageInterceptorFM::Open(RExtendableSessionBase& aExtendableInterface) |
|
36 { |
|
37 TInt error = |
|
38 #ifdef __ELEMENTS_MESSAGE_INTERCEPT_ACTIVE |
|
39 iReqAndRespEventBuf.Create(TMIMessages::KMaxExternalisedReqAndRespMsgSize); |
|
40 if (KErrNone == error) |
|
41 { |
|
42 error = RApiExtSessionBase::Open(aExtendableInterface, AFallibleTestControl::KInterfaceId); |
|
43 } |
|
44 #else |
|
45 KErrNotSupported; |
|
46 |
|
47 // Fixing unused local variable warnings. |
|
48 (void)aExtendableInterface; |
|
49 #endif |
|
50 return error; |
|
51 } |
|
52 |
|
53 EXPORT_C void RMessageInterceptorFM::ConfigureFallibleMessagesL(RArray<Messages::TNodeSignal::TMessageId>& aArray /*TODO: TAction& aAction = TDefaultAction?*/) |
|
54 { |
|
55 #ifdef __ELEMENTS_MESSAGE_INTERCEPT_ACTIVE |
|
56 TInitFallibleMsgModeMsg msg; |
|
57 msg.InitL(aArray); |
|
58 TRequestStatus status; |
|
59 RApiExtSessionBase::SendReceive(msg, iReqAndRespEventBuf, status); |
|
60 User::WaitForRequest(status); |
|
61 User::LeaveIfError(status.Int()); |
|
62 #else |
|
63 // Fixing unused local variable warnings. |
|
64 (void)aArray; |
|
65 |
|
66 User::Leave(KErrNotSupported); |
|
67 #endif |
|
68 } |
|
69 |
|
70 EXPORT_C TInt RMessageInterceptorFM::EnableFallibleMode(TInt aCount) |
|
71 { |
|
72 #ifdef __ELEMENTS_MESSAGE_INTERCEPT_ACTIVE |
|
73 TEnableFallibleMsgModeMsg msg(aCount); |
|
74 TRequestStatus status; |
|
75 RApiExtSessionBase::SendReceive(msg, iReqAndRespEventBuf, status); |
|
76 User::WaitForRequest(status); |
|
77 return status.Int(); |
|
78 #else |
|
79 // Fixing unused local variable warnings. |
|
80 (void)aCount; |
|
81 |
|
82 return KErrNotSupported; |
|
83 #endif |
|
84 } |
|
85 |
|
86 EXPORT_C TBool RMessageInterceptorFM::CheckFinished() |
|
87 { |
|
88 #ifdef __ELEMENTS_MESSAGE_INTERCEPT_ACTIVE |
|
89 |
|
90 TCheckFallibleMsgModeMsg msg; |
|
91 TRequestStatus status; |
|
92 RApiExtSessionBase::SendReceive(msg, iReqAndRespEventBuf, status); |
|
93 User::WaitForRequest(status); |
|
94 if (KErrNone != status.Int()) |
|
95 { |
|
96 return ETrue; |
|
97 } |
|
98 |
|
99 TBool checkResult; |
|
100 TCheckFallibleMsgModeResponseMsg* respmsg = NULL; |
|
101 TRAP_IGNORE(respmsg = static_cast<TCheckFallibleMsgModeResponseMsg*>(TApiExtRespMsg::NewL(iReqAndRespEventBuf))); |
|
102 if (respmsg) |
|
103 { |
|
104 checkResult = respmsg->iCheckResult; |
|
105 } |
|
106 delete respmsg; |
|
107 return checkResult; |
|
108 #else |
|
109 return EFalse; |
|
110 #endif |
|
111 } |
|
112 |
|
113 |
|
114 |
|
115 // pattern control |
|
116 EXPORT_C TInt RMessageInterceptorPM::Open(RExtendableSessionBase& /*aExtendableInterface*/) |
|
117 { |
|
118 #ifdef __ELEMENTS_MESSAGE_INTERCEPT_ACTIVE |
|
119 return KErrNotSupported; |
|
120 #else |
|
121 return KErrNotSupported; |
|
122 #endif |
|
123 } |
|
124 |
|
125 /* |
|
126 EXPORT_C TInt RMessageInterceptorPM::Enable() |
|
127 { |
|
128 #ifdef __ELEMENTS_MESSAGE_INTERCEPT_ACTIVE |
|
129 TEnableMsg msg; |
|
130 TRequestStatus status; |
|
131 RApiExtSessionBase::SendRequest(msg, iReqAndRespEventBuf, status); |
|
132 User::WaitForRequest(status); |
|
133 return status.Int(); |
|
134 #else |
|
135 return KErrNotSupported; |
|
136 #endif |
|
137 } |
|
138 |
|
139 EXPORT_C void RMessageInterceptorPM::Disable() |
|
140 { |
|
141 #ifdef __ELEMENTS_MESSAGE_INTERCEPT_ACTIVE |
|
142 TDisableMsg msg; |
|
143 RApiExtSessionBase::SendMessage(msg); |
|
144 #endif |
|
145 } |
|
146 */ |
|
147 |