2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Abstract base class for location triggering entries
19 #ifndef LBTTRIGGERENTRY_H
20 #define LBTTRIGGERENTRY_H
22 #include <lbtcommon.h>
25 class CLbtTriggerConditionBase;
28 * Abstract base class for location triggering entries.
30 * It provides methods to determine the trigger type and to define
31 * basic trigger attributes. The following attributes are defined
32 * in location triggering entries.
34 * - <B>Id</B> Defines the identity of a trigger. The Id is allocated
35 * by Location Triggering Server and it's unique among all triggers
36 * currently exist in the system. If a trigger is removed from the system,
37 * its Id may be reused by another trigger.
38 * This attribute can not be modified after the trigger is created.
40 * - <B>Name</B> The name attribute defines a human-readable name for
41 * the trigger. The purpose of the name attribute is mainly for the end
42 * user to be able to identify the trigger in the UI. The maximum length
43 * of the name is @p KLbtMaxNameLength characters. This attribute can
44 * be modified after the trigger is created.
46 * - <B>State</B> This attribute specifies if the trigger is enabled
47 * or disabled. A disabled trigger is not supervised by the Location
48 * Triggering Server and thus will never be fired. This attribute can
49 * be modified after the trigger is created.
51 * - <B>Requestors</B> The requestors attribute consists of a requestor stack
52 * with contacts and/or services using the location service. Requestor
53 * information is used for privacy queries when trigger is created
54 * and fired. Requestor information is not allowed to be changed
55 * once the trigger has been created.
57 * - <B>Manager UI</B>. Manager UI is the UI application that can view, edit
58 * and delete the trigger. Manager UI application shall be provided by the user
59 * of this API. If it's possible, client application must specify the manager
60 * UI application when the trigger is created. Note, Manager UI may be different
61 * from the trigger's owner. Trigger's owner is the process that created the
62 * trigger. Triggers can be directly accessed by the Manager UI application.
63 * Although this attribute is not mandatory when creating a trigger. it's
64 * highly recommended that it is specified. It cannot be modified after the
67 * - <B>Trigger condition</B>. Trigger condition specifies in what situation
68 * a trigger shall be fired. Current system supports only basic trigger
69 * condition. Basic trigger condition is defined by a trigger area and
70 * direction of terminal's movement. Only circular area can be used as
71 * trigger area in current system. This attribute can be modified after
72 * the trigger is created.
77 class CLbtTriggerEntry : public CBase
81 * Trigger type definition. It defines the type of the trigger
97 * Trigger attributes identifications.
99 * These ids can be combined and used to form an attribute mask when
100 * retrieving partial attributes from Location Triggering Server.
107 EAttributeId = 0x0001,
111 EAttributeName = 0x0002,
115 EAttributeState = 0x0004,
119 EAttributeRequestor = 0x0008,
123 EAttributeManagerUi = 0x0010,
127 EAttributeRearmTime = 0x0020,
131 EAttributeCondition = 0x0080,
133 * Process ID of start-up trigger. It includes
134 * process executable name and process UID type.
136 EAttributeStartUpProcessId = 0x0100,
138 * Command-line argument string for start-up trigger
140 EAttributeStartUpCommandLine = 0x0200,
146 * Specifies the state of a trigger.
148 enum TLbtTriggerState
151 * The trigger is enabled
155 * The trigger is disabled
163 IMPORT_C virtual ~CLbtTriggerEntry();
166 * Gets the type of the trigger.
168 * @return The type of trigger entry.
170 IMPORT_C virtual TType Type() const = 0;
173 * Gets the trigger ID.
175 * The ID is allocated and set by the Location Triggering Server when a
176 * trigger is successfully created. Trigger ID is unique in the system.
177 * This function returns @p KLbtNullTriggerId if the ID is not
180 * @return The ID of the trigger entry, or @p KLbtNullTriggerId if the
181 * trigger ID has not been set.
183 IMPORT_C const TLbtTriggerId& Id() const;
186 * Sets trigger entry id. SetId is not used during trigger creation as it
187 * is auto generated by the LBT server. This information is only used during
188 * deletion / modification of triggers. This information when specified
189 * during trigger creation, will be ignored by LBT server.
191 * @param[in] aId The ID of the trigger entry, or @p KLbtNullTriggerId.
193 IMPORT_C void SetId( TLbtTriggerId aId );
196 * Gets the name of the trigger entry.
198 * If the name is not set, an empty string is returned. Maximum
199 * length of the name is @p KLbtMaxNameLength.
201 * @return The name of the trigger entry.
203 IMPORT_C const TDesC& Name() const;
206 * Sets the name of the trigger entry.
208 * @param[in] aName The name of the trigger entry.
209 * @leave KErrArgument If the name of the trigger is longer than
210 * @p KLbtMaxNameLength.
212 IMPORT_C void SetNameL( const TDesC& aName );
215 * Gets the rearm time interval.
217 * If no interval is specified for the trigger, this function
219 * @p KLbtDefaultTimeToRearm which is 600s or 10 minutes.
221 * @return Rearm time interval.
223 IMPORT_C TInt TimeToRearm() const;
226 * Sets the time interval to reactivate the trigger after the
229 * @param[in] aSeconds The time interval after which the trigger
230 * is set effective by the Location Triggering Server. Client
231 * applications can set 0 to indicate no delay, in which case
232 * the trigger will remain effective through out its life span.
233 * Range is 0 (KLbtMinTimeToRearm) to +2147483647 (KLbtMaxTimeToRearm)
234 * which is +24855 days (approximately 68 years)
235 * @panic KErrArgument If the time set is out of range.
237 IMPORT_C void SetTimeToRearm( TInt aSeconds );
240 * Gets trigger entry state.
242 * If no state has been set for the trigger, this function returns
243 * @p ELbtTriggerEnabled.
245 * @return The trigger entry state.
247 IMPORT_C TLbtTriggerState State() const;
250 * Sets the trigger entry state.
252 * @param[in] aState The trigger entry state.
254 IMPORT_C void SetState( TLbtTriggerState aState );
257 * Gets requestors of the trigger entry.
259 * Requestor information is used by the Location Triggering Server to
260 * verify that the user allows location information to be sent to
261 * the specified requestors when a trigger fires.
263 * Requestors attribute is a mandatory trigger attribute. If the requestors
264 * attribute is not set when the trigger is created in the server, the
265 * trigger creation will fail.
267 * If requestors have not been set before, this function returns
268 * an empty requestor stack.
270 * Refer to Location Acquisition API for detailed information on
273 * @see RLbt::CreateTriggerL()
274 * @see RRequestorStack
276 * @param[out] aRequestors The requestors of the trigger entry.
278 IMPORT_C void GetRequestorsL( RRequestorStack& aRequestors ) const;
281 * Sets requestors of trigger entry.
283 * Requestor information is used by the Location Triggering Server to
284 * verify that the user allows location information to be sent to
285 * the specified requestors when a trigger fires.
287 * Requestors attribute is a mandatory trigger attribute. If the requestors
288 * attribute is not set when the trigger is created in the server, the
289 * trigger creation will fail.
291 * Refer to Location Acquisition API for detailed information on
294 * @see RLbt::CreateTriggerL()
296 * @param[in] aRequestors The requestors of trigger entry.
297 * @leave KErrArgument The stack contains no requestors.
299 IMPORT_C void SetRequestorsL( const RRequestorStack& aRequestors );
302 * Sets requestor of trigger entry.
304 * Requestor information is used by the Location Triggering Server to
305 * verify that the user allows information to be sent to the specified
306 * requestors when a trigger fires.
308 * Requestors attribute is a mandatory trigger attribute. If the requestors
309 * attribute is not set when the trigger is created in the server, the
310 * trigger creation will fail.
312 * @see RLbt::CreateTriggerL()
314 * @param[in] aType identifies the type of requestor, a service or a contact.
315 * @param[in] aFormat determines the type of data held in aData
316 * @param[in] aData is requestor data. Can be a telephone number, a URL etc.
318 IMPORT_C void SetRequestorL(
319 CRequestor::TRequestorType aType,
320 CRequestor::TRequestorFormat aFormat,
321 const TDesC& aData );
324 * Gets UID of the manager UI. The UID means
325 * the UID3 value, which identifies the particular application.
326 * If the UID of the manager UI is not set, this function
329 * @return The UID of manager UI application. KNullUid if the UID
332 IMPORT_C TUid ManagerUi() const;
335 * Sets UID of the manager UI.
337 * @param[in] aUid The SID value if available. Else the UID3 value, which is
338 * the idenfifier of the particaular application. KNullUid can be used to
339 * remove previous setting.
341 IMPORT_C void SetManagerUi( TUid aUid );
344 * Gets the trigger condition.
346 * The ownership of the returned trigger condition object is
347 * not transferred to the client. The pointer can be
348 * used to modify the trigger condition.
350 * @return A non-const pointer to the trigger's
351 * trigger condition. NULL if the trigger condition is not set.
353 IMPORT_C CLbtTriggerConditionBase* GetCondition();
356 * Gets the trigger condition.
358 * The ownership of the returned trigger condition object is
359 * not transferred to the client. The pointer can be
360 * used to modify the trigger condition.
362 * @return A const pointer to the trigger's
363 * trigger condition. NULL if the trigger condition is not set.
365 IMPORT_C const CLbtTriggerConditionBase* GetCondition() const;
368 * Sets trigger condition.
370 * This object takes the ownership of the trigger condition object.
372 * @param[in] aCondition Pointer to the new trigger condition object.
373 * This object takes the ownership of aCondition. NULL can be used
374 * to remove previous setting.
376 IMPORT_C void SetCondition( CLbtTriggerConditionBase* aCondition );
379 * Internalizes the trigger object's details and attributes
382 * The presence of this function means that the standard template
383 * operator>>() ( defined in s32strm.h ) is available to internalize objects
386 * @param[in] aStream Stream from which the object should be internalized.
388 IMPORT_C void InternalizeL( RReadStream& aStream );
391 * Externalizes the trigger object's details and attributes
394 * The presence of this function means that the standard template
395 * operator<<() ( defined in s32strm.h ) is available to externalize objects
398 * @param[in] aStream Stream to which the object should be externalized.
400 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
404 * Internalize method that subclass must implement.
405 * @param[in] aStream Stream from which the object should be internalized.
407 virtual void DoInternalizeL( RReadStream& aStream ) = 0;
410 * Externalize method that subclass must implement.
411 * @param[in] aStream Stream to which the object should be externalized.
413 virtual void DoExternalizeL( RWriteStream& aStream ) const = 0;
422 * By default, prohibit copy constructor
424 CLbtTriggerEntry( const CLbtTriggerEntry& );
427 * Prohibit assigment operator
429 CLbtTriggerEntry& operator= ( const CLbtTriggerEntry& );
445 TLbtTriggerState iState;
455 RRequestorStack iRequestor;
465 CLbtTriggerConditionBase* iTriggerCondition;
468 * Reserved for schedule information
473 * Reserved pointer for future extension
479 #endif // LBTTRIGGERENTRY_H