|
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 // Definition of the PSY request channel component. |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef CPSYREQUESTCHANNEL_H_ |
|
19 #define CPSYREQUESTCHANNEL_H_ |
|
20 |
|
21 #include "lbsnetinternalapi.h" |
|
22 #include "LbsPsyNgMsgs.h" |
|
23 #include "requestmessagebuffer.h" |
|
24 |
|
25 /** |
|
26 Observer class to be used by the Network Gateway to inform it |
|
27 when messages are deivered from a Network PSY. |
|
28 */ |
|
29 class MPsyRequestObserver |
|
30 { |
|
31 public: |
|
32 virtual void ProcessPsyMessage(const TLbsNetInternalMsgBase& aMessage) = 0; |
|
33 }; |
|
34 |
|
35 /** |
|
36 Provides an API for use by Network PSYs to the Network Gateway. |
|
37 |
|
38 The creator of a CPsyRequestChannel should pass in the channel it |
|
39 wishes the object to write to and read from. |
|
40 */ |
|
41 class CPsyRequestChannel : public CActive, public MLbsNetChannelObserver |
|
42 { |
|
43 public: |
|
44 static CPsyRequestChannel* NewL(MPsyRequestObserver& aObserver, TUint aChannel); |
|
45 ~CPsyRequestChannel(); |
|
46 |
|
47 // from CActive |
|
48 void RunL(); |
|
49 void DoCancel(); |
|
50 TInt RunError(TInt aError); |
|
51 |
|
52 // Send a message to a PSY |
|
53 void SendNetworkResponse(const TLbsNetInternalMsgBase& aMessage); |
|
54 |
|
55 // from MLbsNetChannelObserver : process a message from a PSY |
|
56 void ProcessNetChannelMessage(RLbsNetChannel::TLbsNetChannelId aChannelId, const TLbsNetInternalMsgBase& aMessage); |
|
57 |
|
58 private: |
|
59 CPsyRequestChannel(MPsyRequestObserver& aObserver); |
|
60 void ConstructL(TUint aChannel); |
|
61 void SendMessage(const TLbsNetInternalMsgBase& aMessage); |
|
62 void SendNextBufferedMessage(); |
|
63 |
|
64 private: |
|
65 CRequestMessageBuffer* iMsgBuffer; |
|
66 MPsyRequestObserver& iObserver; |
|
67 RLbsNetChannel iPsyResponseChannel; |
|
68 }; |
|
69 |
|
70 #endif /* CPSYREQUESTCHANNEL_H_ */ |