|
1 /* |
|
2 * Copyright (c) 2006,2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Active Object operation for serving server logic requests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_LBTCREATETRIGGERAOOPEATION_H |
|
21 #define C_LBTCREATETRIGGERAOOPEATION_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <e32base.h> |
|
25 #include "lbtcontainerextendedtriggerinfo.h" |
|
26 #include "lbtaooperationbase.h" |
|
27 |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MLbtAOObserver; |
|
31 class RMessage2; |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CLbtTriggerEntry; |
|
35 class CLbtContainer; |
|
36 class CLbtSettingsManager; |
|
37 class CLbtContainerTriggerEntry; |
|
38 class CLbtGeoCircle; |
|
39 |
|
40 /** |
|
41 * Class declaration of active object operation |
|
42 * to service client requests comming from |
|
43 * server core. The IPC messages are provided to |
|
44 * this class to service the request asynchronously |
|
45 * |
|
46 * @since S60 v4.0 |
|
47 */ |
|
48 class CLbtCreateTriggerAOOperation : public CLbtAOOperationBase |
|
49 { |
|
50 public: |
|
51 |
|
52 /** |
|
53 * Instantiates a new object of |
|
54 * CLbtCreateTriggerAOOperation |
|
55 * |
|
56 * @param[in] aObserver reference to the active |
|
57 * object observer |
|
58 * @param[in] aMessage the IPC request which the active |
|
59 * object has to service. The active object takes responsibility |
|
60 * of completing this IPC request |
|
61 * @param aContainer reference to the container which holds |
|
62 * the reference to the logic processor |
|
63 */ |
|
64 static CLbtCreateTriggerAOOperation* NewL( MLbtAOObserver& aObserver, |
|
65 const RMessage2& aMessage, |
|
66 CLbtContainer& aContainer, |
|
67 TInt aClientType, |
|
68 CLbtSettingsManager& aSettingsManager ); |
|
69 |
|
70 /** |
|
71 * Destructor |
|
72 * |
|
73 */ |
|
74 ~CLbtCreateTriggerAOOperation(); |
|
75 |
|
76 /** |
|
77 * Cancels create trigger operation |
|
78 * |
|
79 */ |
|
80 void CancelCreateTrigger(); |
|
81 |
|
82 private: |
|
83 |
|
84 /** |
|
85 * 2nd phase constuctor for instantiating member variables |
|
86 * |
|
87 */ |
|
88 void ConstructL(); |
|
89 |
|
90 /** |
|
91 * Default C++ Constructor |
|
92 * |
|
93 * @param[in] aObserver reference to the active object observer |
|
94 * @param[in] aMessage the IPC request which the active |
|
95 * object has to service. The active object takes responsibility |
|
96 * of completing this IPC request |
|
97 * @param aContainer reference to the container which holds |
|
98 * the reference to the logic processor |
|
99 */ |
|
100 CLbtCreateTriggerAOOperation( MLbtAOObserver& aObserver, |
|
101 const RMessage2& aMessage, |
|
102 CLbtContainer& aContainer, |
|
103 TInt aClientType, |
|
104 CLbtSettingsManager& aSettingsManager ); |
|
105 |
|
106 public: // From CLbtAOOperationBase |
|
107 |
|
108 /** |
|
109 * Starts the AO operation of serving the request |
|
110 * |
|
111 */ |
|
112 void StartOperationL(); |
|
113 |
|
114 /** |
|
115 * Returns the trigger id of the newly created trigger |
|
116 * |
|
117 * @return the trigger of the newly create trigger |
|
118 */ |
|
119 TLbtTriggerId GetTriggerId(); |
|
120 |
|
121 private: // helper methods |
|
122 /** |
|
123 * Calculates the hysteresis area |
|
124 * |
|
125 * @param[in] the trigger for which the hysteresis |
|
126 * are has to be created |
|
127 * @return the hysteresis area |
|
128 */ |
|
129 TInt CalculateHysteresisAreaForTrigger(CLbtTriggerEntry& aTrigger); |
|
130 |
|
131 /** |
|
132 * Handles create trigger operation |
|
133 * |
|
134 */ |
|
135 void CreateTriggerL(); |
|
136 |
|
137 /** |
|
138 * Checks if the system cap for trigger will be satisfied if one |
|
139 * more trigger is created. |
|
140 * |
|
141 * @return ETrue if one more trigger can be created, EFalse otherwise |
|
142 */ |
|
143 TBool CheckTriggerCap(); |
|
144 |
|
145 /** |
|
146 * Calculates the Rectangular approximation of a trigger |
|
147 * with a circular trigger area. |
|
148 */ |
|
149 void CalculateRectangularArea( |
|
150 CLbtExtendedTriggerInfo::TLbtTriggerRectArea& aArea, |
|
151 CLbtGeoCircle* aCircle); |
|
152 |
|
153 |
|
154 protected: // From CActive |
|
155 void RunL(); |
|
156 void DoCancel(); |
|
157 |
|
158 private: // Data |
|
159 |
|
160 // Refernce to triggering settings manager |
|
161 CLbtSettingsManager& iSettingsManager; |
|
162 |
|
163 |
|
164 // Reference to container trigger entry |
|
165 CLbtContainerTriggerEntry* iContainerTriggerEntry; |
|
166 |
|
167 }; |
|
168 |
|
169 #endif // C_LBTCREATETRIGGERAOOPEATION_H |