|
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 // |
|
15 |
|
16 #if !defined(__SATPTR_H__) |
|
17 #define __SATPTR_H__ |
|
18 |
|
19 /** @file |
|
20 CSatPtrHolder header file |
|
21 @internalTechnology |
|
22 */ |
|
23 |
|
24 #if !defined(__ETELSAT_H__) |
|
25 #include "etelsat.h" |
|
26 #endif |
|
27 |
|
28 |
|
29 // The ptr holder slot numbers used by RSat asynchronous requests |
|
30 enum TSatPtrHolderSlots |
|
31 { |
|
32 ESlotPCmd=0, |
|
33 ESlot1GetIcon, |
|
34 ESlot2GetIcon, |
|
35 ESlotMsgRef, |
|
36 ESlot1GetClut, |
|
37 ESlot1NotifyTsyStateUpdated, |
|
38 EMaxNumberSatPtrSlots |
|
39 }; |
|
40 |
|
41 enum TSatCPtrHolderSlots |
|
42 { |
|
43 ESlot1GetProvisioningRefFile, |
|
44 ESlotSingleEvent, |
|
45 EMaxNumberSatCPtrSlots |
|
46 }; |
|
47 |
|
48 /** |
|
49 * CSatPtrHolder inherits from CBase. |
|
50 * |
|
51 * The two main purposes of CSatPtrHolder are as follows: |
|
52 * |
|
53 * - non-descriptor parameters in API methods will be copied |
|
54 * into a descriptor and held in the CSatPtrHolder descriptor array, iPtrArray. |
|
55 * |
|
56 * - CSatPtrHolder public data members ( e.g. iPcmd) store copies of API parameters |
|
57 * that are passed in by value rather than by reference. |
|
58 * This keeps the R-classes size constant as the API evolves and keeps BC. |
|
59 */ |
|
60 |
|
61 class CSatPtrHolder : public CBase |
|
62 { |
|
63 public: |
|
64 static CSatPtrHolder* NewL(TInt aSizeOfPtrArray, TInt aSizeOfPtrCArray); |
|
65 ~CSatPtrHolder(); |
|
66 |
|
67 template<typename T> TPtr8& Set(TInt aSlot,T& aObject) |
|
68 { |
|
69 TPtr8& ptr=Ptr(aSlot); |
|
70 ptr.Set(reinterpret_cast<TText8*>(&aObject),sizeof(T),sizeof(T)); |
|
71 return ptr; |
|
72 }; |
|
73 |
|
74 template <typename T> inline TPtrC8& SetC(TInt aSlot, const T& aObject) |
|
75 { |
|
76 TPtrC8& ptr=PtrC(aSlot); |
|
77 ptr.Set(REINTERPRET_CAST(const TText8*,(&aObject)),sizeof(T)); |
|
78 return ptr; |
|
79 }; |
|
80 |
|
81 |
|
82 protected: |
|
83 virtual void ConstructL(TInt aSizeOfPtrArray,TInt aSizeOfPtrCArray); |
|
84 CSatPtrHolder(); |
|
85 |
|
86 private: |
|
87 inline TPtr8& Ptr(TInt aIndex); |
|
88 inline TPtrC8& PtrC(TInt aIndex); |
|
89 public: |
|
90 RSat::TPCmd iPCmd; //< Holds the PCmd name |
|
91 TUint8 iGetIcon; //< Holds the icon record number |
|
92 TUint16 iMsgRef; //< Holds the SMS message reference |
|
93 RSat::TInstanceNumberAndOffset iGetClut; //< Holds the instance number and offset associated with the CLUT. |
|
94 RSat::TEventList iSingleEvent; //< Holds the single event |
|
95 RSat::TProvisioningFileRef iGetProvisioningRefFile; //< Holds the Provisioning reference file |
|
96 |
|
97 protected: |
|
98 RArray<TPtr8> iPtrArray; |
|
99 RArray<TPtrC8> iPtrCArray; |
|
100 }; |
|
101 // |
|
102 // Inline Functions |
|
103 // |
|
104 |
|
105 inline TPtr8& CSatPtrHolder::Ptr(TInt aIndex) |
|
106 { |
|
107 __ASSERT_ALWAYS(aIndex<iPtrArray.Count(),PanicClient(EEtelPanicIndexOutOfRange)); |
|
108 return iPtrArray[aIndex]; |
|
109 } |
|
110 |
|
111 inline TPtrC8& CSatPtrHolder::PtrC(TInt aIndex) |
|
112 { |
|
113 __ASSERT_ALWAYS(aIndex<iPtrCArray.Count(),PanicClient(EEtelPanicIndexOutOfRange)); |
|
114 return iPtrCArray[aIndex]; |
|
115 } |
|
116 |
|
117 #endif |
|
118 |
|
119 |