|
1 // Copyright (c) 2007-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // @file TLbschannel.h |
|
15 // This is the header file which contains the channel utilities for communication between |
|
16 // the test harness and the test AGps module. |
|
17 // |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalTechnology |
|
25 @test |
|
26 */ |
|
27 |
|
28 #ifndef TLbsCHANNEL_H |
|
29 #define TLbsCHANNEL_H |
|
30 |
|
31 // User includes |
|
32 #include "tlbschannelutils.h" |
|
33 |
|
34 // Epoc includes |
|
35 #include <e32property.h> |
|
36 |
|
37 |
|
38 class MT_LbsChannelObserver; |
|
39 class CT_ChannelMonitor; |
|
40 |
|
41 |
|
42 /** Logical channel used for communication between Test Harness and |
|
43 the test A-GPS module. |
|
44 |
|
45 Messages are: |
|
46 - sent by calling SendMessage. |
|
47 - received via the Mixin callback MT_LbsChannelObserver::ProcessChannelMessage. |
|
48 */ |
|
49 NONSHARABLE_CLASS(RT_LbsChannel) |
|
50 { |
|
51 public: |
|
52 enum TT_LbsChannelId |
|
53 { |
|
54 EChannelUnknown = -1, |
|
55 EChannelTH2TAGPS = 0, |
|
56 EChannelTAGPS2TH = 1 |
|
57 }; |
|
58 |
|
59 IMPORT_C static void InitializeL(TT_LbsChannelId aChannelId); |
|
60 IMPORT_C static void ShutDownL(TT_LbsChannelId aChannelId); |
|
61 |
|
62 IMPORT_C RT_LbsChannel(); |
|
63 IMPORT_C void OpenL(TT_LbsChannelId aChannelId, MT_LbsChannelObserver& aObserver); |
|
64 IMPORT_C void Close(); |
|
65 |
|
66 IMPORT_C void SendMessage(const TT_LbsMsgBase& aMessage, TRequestStatus& aStatus); |
|
67 IMPORT_C void CancelSendMessageNotification(); |
|
68 |
|
69 private: |
|
70 RProperty iSendProperty; |
|
71 RProperty iSendMsgReadProperty; |
|
72 CT_ChannelMonitor* iMonitor; |
|
73 }; |
|
74 |
|
75 /** Observer for incoming messages from a channel |
|
76 */ |
|
77 class MT_LbsChannelObserver |
|
78 { |
|
79 public: |
|
80 /** Called when a message arrives from a channel. |
|
81 @param aChannelId The channel being monitored. |
|
82 @param aMessage The message received. */ |
|
83 virtual void ProcessChannelMessage(RT_LbsChannel::TT_LbsChannelId aChannelId, const TT_LbsMsgBase& aMessage) = 0; |
|
84 }; |
|
85 |
|
86 /** |
|
87 Monitors for incoming messages from a channel. |
|
88 */ |
|
89 NONSHARABLE_CLASS(CT_ChannelMonitor) : public CActive |
|
90 { |
|
91 public: |
|
92 static CT_ChannelMonitor* NewL(MT_LbsChannelObserver& aObserver, RT_LbsChannel::TT_LbsChannelId aChannelId, TUid aPropId, TUint aPropKey, TUint aAckPropKey); |
|
93 ~CT_ChannelMonitor(); |
|
94 |
|
95 void RunL(); |
|
96 void DoCancel(); |
|
97 TInt RunError(TInt aError); |
|
98 |
|
99 private: |
|
100 void NotifyChannelMessage(); |
|
101 CT_ChannelMonitor(MT_LbsChannelObserver& aObserver, RT_LbsChannel::TT_LbsChannelId aChannelId); |
|
102 void ConstructL(TUid aPropId, TUint aPropKey, TUint aAckPropKey); |
|
103 |
|
104 private: |
|
105 MT_LbsChannelObserver& iObserver; |
|
106 RT_LbsChannel::TT_LbsChannelId iChannelId; |
|
107 |
|
108 RProperty iReceiveProperty; |
|
109 RProperty iReceiveMsgReadProperty; |
|
110 }; |
|
111 |
|
112 #endif // TLbsCHANNEL_H |