|
1 // Copyright (c) 1997-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 // Class declaration for CReceiveSmsQueue |
|
15 // This class declaration is intended to be private and must not be exported. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalAll |
|
22 */ |
|
23 |
|
24 #ifndef __SMS_RX_QUEUE_H__ |
|
25 #define __SMS_RX_QUEUE_H__ |
|
26 |
|
27 #include <et_tsy.h> // for TTsyReqHandle |
|
28 |
|
29 |
|
30 // Forward class declarations |
|
31 class CMobileSmsMessaging; |
|
32 class CATSmsReadPDU; |
|
33 |
|
34 class CReceiveSmsQueue : public CBase |
|
35 { |
|
36 friend class CATSmsReadPDU; // CATSmsReadPDU needs to access CompleteClientReqIfPossible |
|
37 |
|
38 public: |
|
39 static CReceiveSmsQueue* NewL(CATIO* aIo, CTelObject* aTelObject, CATInit* aInit,CPhoneGlobals* aGlobals,CMobileSmsMessaging& aMobileSmsMessaging); |
|
40 ~CReceiveSmsQueue(); |
|
41 |
|
42 void Push(const RMobileSmsMessaging::TMobileSmsGsmTpdu& aPdu, |
|
43 const RMobileSmsMessaging::TMobileSmsReceiveAttributesV1& aAttr); |
|
44 |
|
45 void PopAndCompleteClientWhenPossible(const TTsyReqHandle aReqHandle, |
|
46 RMobileSmsMessaging::TMobileSmsGsmTpdu* aPdu, |
|
47 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1* aAttr); |
|
48 |
|
49 void PopAndCompleteClientWhenPossibleCancel(); |
|
50 void CompleteClientReqWithError(TInt aError); |
|
51 |
|
52 TBool inline ClientReqOutstanding() {return iClientReqOutstanding;}; |
|
53 |
|
54 |
|
55 // |
|
56 // ReadPDUFromPhone should be called by CATCommands::Complete at which time the |
|
57 // TSY base classes guarantee that there is not another AT command which is running. |
|
58 // ReadPDUFromPhone starts the reading of the PDU of the message at the front of |
|
59 // the queue if we do not already store it's PDU. |
|
60 void ReadPDUFromPhone(); |
|
61 |
|
62 private: // private methods |
|
63 CReceiveSmsQueue(CMobileSmsMessaging& aMobileSmsMessaging,CPhoneGlobals& aGlobals); |
|
64 |
|
65 void ConstructL(CATIO* aIo, CTelObject* aTelObject, CATInit* aInit,CPhoneGlobals* aGlobals); |
|
66 |
|
67 // Queue utility methods |
|
68 class TItem |
|
69 { |
|
70 public: |
|
71 RMobileSmsMessaging::TMobileSmsGsmTpdu iPdu; |
|
72 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 iAttr; |
|
73 }; |
|
74 |
|
75 TBool QueueEmpty(); |
|
76 TBool QueueFull(); |
|
77 |
|
78 // Client completion utility method |
|
79 void CompleteClientReqIfPossible(); |
|
80 |
|
81 private: // private data |
|
82 enum { KReceiveSmsQueueSize=5 }; |
|
83 |
|
84 CPhoneGlobals& iGlobals; // Reference to the TSY global CPhoneGlobals object |
|
85 CMobileSmsMessaging& iMobileSmsMessaging; // Reference to the client who owners the instance of this class |
|
86 |
|
87 CATSmsReadPDU* iATReadPDU; // This object owned by this class |
|
88 |
|
89 // |
|
90 // Fixed size C array as we want to ensure that all the memory we |
|
91 // need is pre-allocated for us on construction. This is so the TSY |
|
92 // does not fail to receive a SMS because the user has decided to edit |
|
93 // 'War and Peace' in Symbian Word. |
|
94 // |
|
95 TItem iQueue[KReceiveSmsQueueSize]; |
|
96 TInt iQueueFront; // The front of the queue (where items are popped off) |
|
97 TInt iQueueBack; // The back of the queue (where items are pushed on) |
|
98 |
|
99 // |
|
100 // Outstanding client request storage |
|
101 TBool iClientReqOutstanding; |
|
102 TTsyReqHandle iClientReq; |
|
103 RMobileSmsMessaging::TMobileSmsGsmTpdu* iClientReqPdu; // This class does not own this object |
|
104 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1* iClientReqAttr; // This class does not own this object |
|
105 }; |
|
106 |
|
107 #endif |