|
1 |
|
2 /* |
|
3 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: Location Trigger Creation and monitoring |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __LBTTRIGGERADAPTER_H__ |
|
20 #define __LBTTRIGGERADAPTER_H__ |
|
21 |
|
22 |
|
23 #include <lbt.h> |
|
24 #include <lbtsessiontrigger.h> |
|
25 #include <lbtgeocircle.h> |
|
26 #include <lbttriggerfiringeventnotifier.h> |
|
27 #include <lbttriggerinfo.h> |
|
28 #include <lbttriggerfilterbyattribute.h> |
|
29 |
|
30 #include "lbtcontexttriggerobserver.h" |
|
31 #include "lbttriggernode.h" |
|
32 |
|
33 /* |
|
34 * A handle to the trigger creation and handling mechanism. |
|
35 * This class is responsible for creating triggers and monotoring them. |
|
36 */ |
|
37 |
|
38 NONSHARABLE_CLASS( CLocationTriggerAdapter ) : |
|
39 public CActive, |
|
40 public MLbtTriggerFiringEventObserver |
|
41 { |
|
42 |
|
43 public: |
|
44 |
|
45 /* |
|
46 * Default constructor for CLocationTriggerAdapter class. |
|
47 * |
|
48 * @param[in] aObserver Handle of the source plugin. The pointer is noted |
|
49 * for calling the virtual functions implemented by the source plugin. |
|
50 */ |
|
51 CLocationTriggerAdapter( MLBTContextTriggerObserver& aObserver ); |
|
52 |
|
53 /* |
|
54 * Default destructor. |
|
55 */ |
|
56 ~CLocationTriggerAdapter(); |
|
57 |
|
58 /* |
|
59 * Creates the trigger for the given input node. |
|
60 * |
|
61 * @param[in] aTriggerNode Object of TTriggerNode type. |
|
62 * Contains specifications of trigger to be created. |
|
63 */ |
|
64 void CreateContextTriggerL(TTriggerNode& aTriggerNode); |
|
65 |
|
66 /* |
|
67 * Intialises the lbt server and opens sessions to it. |
|
68 * The observer for trigger changes is also started here. |
|
69 */ |
|
70 void ConstructL(); |
|
71 |
|
72 /* |
|
73 * Two phase constructor for CLocationTriggerAdapter |
|
74 */ |
|
75 static CLocationTriggerAdapter* NewL( MLBTContextTriggerObserver& aObserver ); |
|
76 |
|
77 /* |
|
78 * Two phase constructor for CLocationTriggerAdapter |
|
79 */ |
|
80 static CLocationTriggerAdapter* NewLC( MLBTContextTriggerObserver& aObserver ); |
|
81 |
|
82 public: |
|
83 |
|
84 /* |
|
85 * Derived from CActive |
|
86 */ |
|
87 void RunL(); |
|
88 |
|
89 /* |
|
90 * Derived from CActive |
|
91 */ |
|
92 void DoCancel(); |
|
93 |
|
94 /* |
|
95 * Derived from CActive |
|
96 */ |
|
97 TInt RunError( TInt aError ); |
|
98 |
|
99 /* |
|
100 * Derived from MLbtTriggerFiringEventObserver |
|
101 */ |
|
102 void TriggerFiredL( const TLbtTriggerFireInfo& aFireInfo ); |
|
103 |
|
104 /* |
|
105 * Delete all triggers owned by LBT Context Source Plugin here |
|
106 * This function is called when an update settings call occurs. |
|
107 */ |
|
108 void DeleteAllTriggersL(); |
|
109 |
|
110 |
|
111 private: |
|
112 |
|
113 /* |
|
114 * Pointer to Trigger Fire notifier |
|
115 */ |
|
116 CLbtTriggerFiringEventNotifier* iNotifier; |
|
117 |
|
118 /* |
|
119 * Holds the trigger id,context name,trigger name |
|
120 */ |
|
121 |
|
122 TriggerList iTriggerList; |
|
123 |
|
124 /* |
|
125 * Handle to LBT Server |
|
126 */ |
|
127 RLbtServer iLbtServ; |
|
128 |
|
129 /* |
|
130 * Handle to LBT session for trigger creation |
|
131 */ |
|
132 RLbt iLbt; |
|
133 |
|
134 /* |
|
135 * Handle to LBT session for trigger monitoring |
|
136 */ |
|
137 RLbt iLbtNotifier; |
|
138 |
|
139 /* |
|
140 * Obsever for trigger fire changes |
|
141 */ |
|
142 MLBTContextTriggerObserver& iObserver; |
|
143 |
|
144 |
|
145 }; |
|
146 |
|
147 #endif // __LBTTRIGGERADAPTER_H__ |