|
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 "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 // Internal implementation of the SUPL Push API |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 @deprecated |
|
22 */ |
|
23 |
|
24 #ifndef SUPL_PUSH_IMPL_H |
|
25 #define SUPL_PUSH_IMPL_H |
|
26 |
|
27 #include <e32std.h> |
|
28 #include <e32property.h> |
|
29 #include <lbs/lbssuplpush.h> |
|
30 #include "lbstimer.h" |
|
31 |
|
32 |
|
33 /** |
|
34 The nested utility class used for storing the message informaton while message is stored in the queue. |
|
35 */ |
|
36 NONSHARABLE_CLASS(CLbsSuplPushMsgInfo) : public CBase |
|
37 { |
|
38 public: |
|
39 CLbsSuplPushMsgInfo(TInt aReqId, HBufC8* aMsg); |
|
40 virtual ~CLbsSuplPushMsgInfo(); |
|
41 |
|
42 public: |
|
43 /** The id of the message delivery request*/ |
|
44 TInt iReqId; |
|
45 /** The message data with the request id in the beginning*/ |
|
46 HBufC8* iMsg; |
|
47 }; |
|
48 |
|
49 |
|
50 /** |
|
51 The class provides an internal implementation of the functionality exposed |
|
52 by the CLbsSuplPush interface. |
|
53 |
|
54 @see CLbsSuplPush |
|
55 @see MLbsSuplPushObserver |
|
56 |
|
57 @internalComponent |
|
58 @deprecated |
|
59 */ |
|
60 NONSHARABLE_CLASS(CLbsSuplPushImpl) : public CActive, public MLbsCallbackTimerObserver |
|
61 { |
|
62 public: |
|
63 /** |
|
64 The set of the states the class can be |
|
65 |
|
66 @see CLbsSuplPushImpl::CheckStateL |
|
67 */ |
|
68 enum TState { |
|
69 /** The initial state the object gets to after creation*/ |
|
70 ECreated = 1, |
|
71 /** The state after the object got the P&S category UID and attached to the BUSY and ACK props |
|
72 In that state there may be from zero to several messages in the queue. |
|
73 The INIT property has never been set for any of the messages in the queue. |
|
74 The BUSY property has not been set to ETrue by this object as well.*/ |
|
75 EInitialized = 2, |
|
76 /** The state after the object has tried to deliver a message, has set successfully the INIT property, |
|
77 * subscribed for the ACK property and is waiting for the ACK property to be set.*/ |
|
78 EWaitingAck = 4, |
|
79 /** The state after the object checked that the BUSY property is set to ETrue by another plug-in, |
|
80 subscribed for the BUSY property and is waiting for the BUSY property to be set to EFalse. */ |
|
81 EWaitingBusy = 8 |
|
82 }; |
|
83 |
|
84 public: |
|
85 static CLbsSuplPushImpl* NewL(TLbsSuplPushChannel aChannel, MLbsSuplPushObserver& aObserver); |
|
86 virtual ~CLbsSuplPushImpl(); |
|
87 |
|
88 virtual void OnTimerEventL(TInt aTimerId); |
|
89 virtual TInt OnTimerError(TInt aTimerId, TInt aError); |
|
90 |
|
91 public: |
|
92 TInt SuplInit(TLbsSuplPushRequestId& aReqId, const TDesC8& aMsg, TInt aReserved); |
|
93 |
|
94 #ifdef TE_LBSSUPLPUSHIMPL_ON |
|
95 /** |
|
96 Checks that the object in one of the possible states and check that the internal state of the object |
|
97 is in the agreement with the state it is currently in. |
|
98 |
|
99 This function is defined in and used only by the |
|
100 unit test code for this component. When building the SUPL Push API component itself (either UDEB or UREL) |
|
101 the TE_LBSSUPLPUSHIMPL_ON macro is undefined. |
|
102 |
|
103 @param aPossibleStates [In] The bitmask of the possible states. |
|
104 |
|
105 @leave If the object is not in one of the possible states or the internal state of the object |
|
106 is not in the agreement with the state it is currently in, this method will leave with error |
|
107 code KErrGeneral. |
|
108 |
|
109 @see CLbsSuplPushImpl::TState |
|
110 */ |
|
111 void CheckStateL(TInt aPossibleStates); |
|
112 #endif |
|
113 |
|
114 protected: |
|
115 virtual void RunL(); |
|
116 virtual void DoCancel(); |
|
117 |
|
118 private: |
|
119 #ifdef TE_LBSSUPLPUSHIMPL_ON |
|
120 protected: |
|
121 #endif |
|
122 |
|
123 CLbsSuplPushImpl(TLbsSuplPushChannel aChannel, MLbsSuplPushObserver& aObserver); |
|
124 private: |
|
125 void ConstructL(TLbsSuplPushChannel aChannel); |
|
126 |
|
127 void SuplInitL(TLbsSuplPushRequestId& aReqId, const TDesC8& aMsg); |
|
128 |
|
129 TInt ReleaseBusyProp(); |
|
130 TInt GetBusyData(TBool& aBusy, TInt& aNextReqId) const; |
|
131 TInt SetBusyData(TBool aBusy, TInt aNextReqId) const; |
|
132 |
|
133 TInt SendMessage(TBool aNotifyObserver); |
|
134 |
|
135 private: |
|
136 /**The id of the channel used*/ |
|
137 TLbsSuplPushChannel iChannel; |
|
138 |
|
139 /** The state of the CLbsSuplPushImpl object*/ |
|
140 TState iState; |
|
141 |
|
142 /** A reference to a user of the CLbsSuplPushImpl interface |
|
143 waiting for request completion call-backs. */ |
|
144 MLbsSuplPushObserver& iObserver; |
|
145 |
|
146 /** The BUSY property key */ |
|
147 TUint iBusyPropKey; |
|
148 |
|
149 /** The INIT property key */ |
|
150 TUint iInitPropKey; |
|
151 |
|
152 /** The ACK property key */ |
|
153 TUint iAckPropKey; |
|
154 |
|
155 /** A BUSY property handle */ |
|
156 RProperty iBusyProperty; |
|
157 |
|
158 /** An ACK property handle */ |
|
159 RProperty iAckProperty; |
|
160 |
|
161 /** The security id of the process that defines the P&S props used*/ |
|
162 TUid iPropOwnerSecureId; |
|
163 |
|
164 /** The message queue */ |
|
165 RPointerArray<CLbsSuplPushMsgInfo> iMsgQueue; |
|
166 |
|
167 /** The message timeout timer */ |
|
168 CLbsCallbackTimer* iTimer; |
|
169 }; |
|
170 |
|
171 #endif //SUPL_PUSH_IMPL_H |