epoc32/include/mw/lbttriggerentry.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Abstract base class for location triggering entries
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef LBTTRIGGERENTRY_H
williamr@2
    20
#define LBTTRIGGERENTRY_H
williamr@2
    21
williamr@2
    22
#include <lbtcommon.h>
williamr@2
    23
#include <lbs.h>
williamr@2
    24
williamr@2
    25
class CLbtTriggerConditionBase;
williamr@2
    26
williamr@2
    27
/**
williamr@2
    28
 *  Abstract base class for location triggering entries.
williamr@2
    29
 *
williamr@2
    30
 *  It provides methods to determine the trigger type and to define
williamr@2
    31
 *  basic trigger attributes. The following attributes are defined
williamr@2
    32
 *  in location triggering entries.
williamr@2
    33
 * 
williamr@2
    34
 *  -  <B>Id</B> Defines the identity of a trigger. The Id is allocated 
williamr@2
    35
 *  by Location Triggering Server and it's unique among all triggers
williamr@2
    36
 *  currently exist in the system. If a trigger is removed from the system,
williamr@2
    37
 *  its Id may be reused by another trigger. 
williamr@2
    38
 *  This attribute can not be modified after the trigger is created.
williamr@2
    39
 *
williamr@2
    40
 *  -  <B>Name</B> The name attribute defines a human-readable name for 
williamr@2
    41
 *  the trigger. The purpose of the name attribute is mainly for the end 
williamr@2
    42
 *  user to be able to identify the trigger in the UI. The maximum length 
williamr@2
    43
 *  of the name is @p KLbtMaxNameLength characters. This attribute can 
williamr@2
    44
 *  be modified after the trigger is created.
williamr@2
    45
 *
williamr@2
    46
 *  -  <B>State</B> This attribute specifies if the trigger is enabled 
williamr@2
    47
 *  or disabled. A disabled trigger is not supervised by the Location 
williamr@2
    48
 *  Triggering Server and thus will never be fired. This attribute can 
williamr@2
    49
 *  be modified after the trigger is created. 
williamr@2
    50
 *  
williamr@2
    51
 *  -  <B>Requestors</B> The requestors attribute consists of a requestor stack
williamr@2
    52
 *  with contacts and/or services using the location service. Requestor 
williamr@2
    53
 *  information is used for privacy queries when trigger is created 
williamr@2
    54
 *  and fired. Requestor information is not allowed to be changed
williamr@2
    55
 *  once the trigger has been created. 
williamr@2
    56
 *
williamr@2
    57
 *  -  <B>Manager UI</B>. Manager UI is the UI application that can view, edit 
williamr@2
    58
 * and delete the trigger. Manager UI application shall be provided by the user 
williamr@2
    59
 * of this API. If it's possible, client application must specify the manager 
williamr@2
    60
 * UI application when the trigger is created. Note, Manager UI may be different 
williamr@2
    61
 * from the trigger's owner. Trigger's owner is the process that created the 
williamr@2
    62
 * trigger. Triggers can be directly accessed by the Manager UI application. 
williamr@2
    63
 * Although this attribute is not mandatory when creating a trigger. it's 
williamr@2
    64
 * highly recommended that it is specified. It cannot be modified after the 
williamr@2
    65
 * trigger is created.
williamr@2
    66
 *
williamr@2
    67
 *  -  <B>Trigger condition</B>. Trigger condition specifies in what situation
williamr@2
    68
 *  a trigger shall be fired. Current system supports only basic trigger 
williamr@2
    69
 *  condition. Basic trigger condition is defined by a trigger area and 
williamr@2
    70
 *  direction of terminal's movement. Only circular area can be used as 
williamr@2
    71
 *  trigger area in current system. This attribute can be modified after 
williamr@2
    72
 *  the trigger is created.
williamr@2
    73
 *
williamr@2
    74
 *  @lib lbt.lib
williamr@2
    75
 *  @since S60 5.1
williamr@2
    76
 */
williamr@2
    77
class CLbtTriggerEntry : public CBase
williamr@2
    78
    {
williamr@2
    79
public:
williamr@2
    80
    /**
williamr@2
    81
     * Trigger type definition. It defines the type of the trigger
williamr@2
    82
     * entry.
williamr@2
    83
     */
williamr@2
    84
    enum TType
williamr@2
    85
        {
williamr@2
    86
        /**
williamr@2
    87
         * Session trigger 
williamr@2
    88
         */  
williamr@2
    89
        ETypeSession = 1, 
williamr@2
    90
        /**
williamr@2
    91
         * Start-up trigger
williamr@2
    92
         */
williamr@2
    93
        ETypeStartup = 2
williamr@2
    94
        };
williamr@2
    95
        
williamr@2
    96
    /**
williamr@2
    97
     * Trigger attributes identifications. 
williamr@2
    98
     *
williamr@2
    99
     * These ids can be combined and used to form an attribute mask when
williamr@2
   100
     * retrieving partial attributes from Location Triggering Server.
williamr@2
   101
     */
williamr@2
   102
    enum TAttribute
williamr@2
   103
        {
williamr@2
   104
        /**
williamr@2
   105
         * Trigger Id
williamr@2
   106
         */
williamr@2
   107
        EAttributeId = 0x0001, 
williamr@2
   108
        /**
williamr@2
   109
         * Trigger name
williamr@2
   110
         */
williamr@2
   111
        EAttributeName = 0x0002, 
williamr@2
   112
        /**
williamr@2
   113
         * Trigger state
williamr@2
   114
         */
williamr@2
   115
        EAttributeState = 0x0004, 
williamr@2
   116
        /**
williamr@2
   117
         * Trigger requestor
williamr@2
   118
         */
williamr@2
   119
        EAttributeRequestor = 0x0008, 
williamr@2
   120
        /**
williamr@2
   121
         * Trigger manager UI
williamr@2
   122
         */
williamr@2
   123
        EAttributeManagerUi = 0x0010, 
williamr@2
   124
        /**
williamr@2
   125
         * Trigger rearm time
williamr@2
   126
         */
williamr@2
   127
        EAttributeRearmTime = 0x0020, 
williamr@2
   128
        /**
williamr@2
   129
         * Trigger condition
williamr@2
   130
         */
williamr@2
   131
        EAttributeCondition = 0x0080,
williamr@2
   132
        /**
williamr@2
   133
         * Process ID of start-up trigger. It includes
williamr@2
   134
         * process executable name and process UID type.
williamr@2
   135
         */
williamr@2
   136
        EAttributeStartUpProcessId = 0x0100,
williamr@2
   137
        /**
williamr@2
   138
         * Command-line argument string for start-up trigger
williamr@2
   139
         */
williamr@2
   140
        EAttributeStartUpCommandLine = 0x0200,
williamr@2
   141
williamr@2
   142
        };
williamr@2
   143
williamr@2
   144
williamr@2
   145
    /**
williamr@2
   146
     * Specifies the state of a trigger.
williamr@2
   147
     */
williamr@2
   148
    enum TLbtTriggerState
williamr@2
   149
        {
williamr@2
   150
        /** 
williamr@2
   151
         * The trigger is enabled
williamr@2
   152
         */ 
williamr@2
   153
        EStateEnabled = 1,    
williamr@2
   154
        /**
williamr@2
   155
         * The trigger is disabled
williamr@2
   156
         */
williamr@2
   157
        EStateDisabled = 2     
williamr@2
   158
        };
williamr@2
   159
williamr@2
   160
    /**
williamr@2
   161
     * Destructor
williamr@2
   162
     */
williamr@2
   163
    IMPORT_C virtual ~CLbtTriggerEntry();
williamr@2
   164
williamr@2
   165
    /**
williamr@2
   166
     * Gets the type of the trigger.
williamr@2
   167
     *
williamr@2
   168
     * @return The type of trigger entry.
williamr@2
   169
     */
williamr@2
   170
    IMPORT_C virtual TType Type() const = 0;
williamr@2
   171
williamr@2
   172
    /**
williamr@2
   173
     * Gets the trigger ID.
williamr@2
   174
     *
williamr@2
   175
     * The ID is allocated and set by the Location Triggering Server when a
williamr@2
   176
     * trigger is successfully created. Trigger ID is unique in the system.
williamr@2
   177
     * This function returns @p KLbtNullTriggerId if the ID is not 
williamr@2
   178
     * set before.
williamr@2
   179
     *
williamr@2
   180
     * @return The ID of the trigger entry, or @p KLbtNullTriggerId if the
williamr@2
   181
     *   trigger ID has not been set.
williamr@2
   182
     */
williamr@2
   183
    IMPORT_C const TLbtTriggerId& Id() const;
williamr@2
   184
    
williamr@2
   185
    /**
williamr@2
   186
     * Sets trigger entry id. SetId is not used during trigger creation as it 
williamr@2
   187
     * is auto generated by the LBT server. This information is only used during 
williamr@2
   188
     * deletion / modification of triggers. This information when specified 
williamr@2
   189
     * during trigger creation, will be ignored by LBT server. 
williamr@2
   190
     *
williamr@2
   191
     * @param[in] aId The ID of the trigger entry, or @p KLbtNullTriggerId. 
williamr@2
   192
     */
williamr@2
   193
    IMPORT_C void SetId( TLbtTriggerId aId );
williamr@2
   194
williamr@2
   195
    /**
williamr@2
   196
     * Gets the name of the trigger entry.
williamr@2
   197
     * 
williamr@2
   198
     * If the name is not set, an empty string is returned. Maximum 
williamr@2
   199
     * length of the name is @p KLbtMaxNameLength.
williamr@2
   200
     *
williamr@2
   201
     * @return The name of the trigger entry.
williamr@2
   202
     */
williamr@2
   203
    IMPORT_C const TDesC& Name() const;
williamr@2
   204
    
williamr@2
   205
    /**
williamr@2
   206
     * Sets the name of the trigger entry. 
williamr@2
   207
     *
williamr@2
   208
     * @param[in] aName The name of the trigger entry.
williamr@2
   209
     * @leave KErrArgument If the name of the trigger is longer than
williamr@2
   210
     *   @p KLbtMaxNameLength.
williamr@2
   211
     */
williamr@2
   212
    IMPORT_C void SetNameL( const TDesC& aName );
williamr@2
   213
    
williamr@2
   214
    /**
williamr@2
   215
     * Gets the rearm time interval.
williamr@2
   216
     *
williamr@2
   217
     * If no interval is specified for the trigger, this function
williamr@2
   218
     * returns
williamr@2
   219
     * @p KLbtDefaultTimeToRearm which is 600s or 10 minutes.
williamr@2
   220
     *
williamr@2
   221
     * @return Rearm time interval.
williamr@2
   222
     */
williamr@2
   223
    IMPORT_C TInt TimeToRearm() const;
williamr@2
   224
    
williamr@2
   225
    /**
williamr@2
   226
     * Sets the time interval to reactivate the trigger after the
williamr@2
   227
     * trigger is fired.
williamr@2
   228
     *
williamr@2
   229
     * @param[in] aSeconds The time interval after which the trigger
williamr@2
   230
     * is set effective by the Location Triggering Server. Client
williamr@2
   231
     * applications can set 0 to indicate no delay, in which case
williamr@2
   232
     * the trigger will remain effective through out its life span.
williamr@2
   233
     * Range is 0 (KLbtMinTimeToRearm) to +2147483647 (KLbtMaxTimeToRearm) 
williamr@2
   234
     * which is +24855 days (approximately 68 years)
williamr@2
   235
     * @panic KErrArgument If the time set is out of range.
williamr@2
   236
     */
williamr@2
   237
    IMPORT_C void SetTimeToRearm( TInt aSeconds );
williamr@2
   238
    
williamr@2
   239
    /**
williamr@2
   240
     * Gets trigger entry state.
williamr@2
   241
     *
williamr@2
   242
     * If no state has been set for the trigger, this function returns
williamr@2
   243
     * @p ELbtTriggerEnabled.
williamr@2
   244
     *
williamr@2
   245
     * @return The trigger entry state.
williamr@2
   246
     */
williamr@2
   247
    IMPORT_C TLbtTriggerState State() const;
williamr@2
   248
    
williamr@2
   249
    /**
williamr@2
   250
     * Sets the trigger entry state.
williamr@2
   251
     *
williamr@2
   252
     * @param[in] aState The trigger entry state.
williamr@2
   253
     */
williamr@2
   254
    IMPORT_C void SetState( TLbtTriggerState aState );
williamr@2
   255
williamr@2
   256
    /**
williamr@2
   257
     * Gets requestors of the trigger entry.
williamr@2
   258
     * 
williamr@2
   259
     * Requestor information is used by the Location Triggering Server to
williamr@2
   260
     * verify that the user allows location information to be sent to 
williamr@2
   261
     * the specified requestors when a trigger fires.
williamr@2
   262
     *
williamr@2
   263
     * Requestors attribute is a mandatory trigger attribute. If the requestors
williamr@2
   264
     * attribute is not set when the trigger is created in the server, the
williamr@2
   265
     * trigger creation will fail.
williamr@2
   266
     *
williamr@2
   267
     * If requestors have not been set before, this function returns
williamr@2
   268
     * an empty requestor stack.
williamr@2
   269
     *
williamr@2
   270
     * Refer to Location Acquisition API for detailed information on 
williamr@2
   271
     * requestors.
williamr@2
   272
     *
williamr@2
   273
     * @see RLbt::CreateTriggerL()
williamr@2
   274
     * @see RRequestorStack
williamr@2
   275
     *
williamr@2
   276
     * @param[out] aRequestors The requestors of the trigger entry.
williamr@2
   277
     */
williamr@2
   278
    IMPORT_C void GetRequestorsL( RRequestorStack& aRequestors ) const;
williamr@2
   279
    
williamr@2
   280
    /**
williamr@2
   281
     * Sets requestors of trigger entry.
williamr@2
   282
     *
williamr@2
   283
     * Requestor information is used by the Location Triggering Server to
williamr@2
   284
     * verify that the user allows location information to be sent to 
williamr@2
   285
     * the specified requestors when a trigger fires.
williamr@2
   286
     *
williamr@2
   287
     * Requestors attribute is a mandatory trigger attribute. If the requestors
williamr@2
   288
     * attribute is not set when the trigger is created in the server, the
williamr@2
   289
     * trigger creation will fail.
williamr@2
   290
     *
williamr@2
   291
     * Refer to Location Acquisition API for detailed information on 
williamr@2
   292
     * requestors.
williamr@2
   293
     *
williamr@2
   294
     * @see RLbt::CreateTriggerL()
williamr@2
   295
     *
williamr@2
   296
     * @param[in] aRequestors The requestors of trigger entry.
williamr@2
   297
     * @leave KErrArgument The stack contains no requestors.
williamr@2
   298
     */
williamr@2
   299
    IMPORT_C void SetRequestorsL( const RRequestorStack& aRequestors );
williamr@2
   300
    
williamr@2
   301
    /**
williamr@2
   302
     * Sets requestor of trigger entry.
williamr@2
   303
     *
williamr@2
   304
     * Requestor information is used by the Location Triggering Server to
williamr@2
   305
     * verify that the user allows information to be sent to the specified
williamr@2
   306
     * requestors when a trigger fires.
williamr@2
   307
     *
williamr@2
   308
     * Requestors attribute is a mandatory trigger attribute. If the requestors
williamr@2
   309
     * attribute is not set when the trigger is created in the server, the
williamr@2
   310
     * trigger creation will fail.
williamr@2
   311
     *
williamr@2
   312
     * @see RLbt::CreateTriggerL()
williamr@2
   313
     *
williamr@2
   314
     * @param[in] aType identifies the type of requestor, a service or a contact.
williamr@2
   315
     * @param[in] aFormat determines the type of data held in aData
williamr@2
   316
     * @param[in] aData is requestor data. Can be a telephone number, a URL etc.
williamr@2
   317
     */
williamr@2
   318
    IMPORT_C void SetRequestorL( 
williamr@2
   319
        CRequestor::TRequestorType aType,
williamr@2
   320
        CRequestor::TRequestorFormat aFormat,
williamr@2
   321
        const TDesC& aData );
williamr@2
   322
williamr@2
   323
    /**
williamr@2
   324
     * Gets UID of the manager UI. The UID means 
williamr@2
   325
     * the UID3 value, which identifies the particular application. 
williamr@2
   326
     * If the UID of the manager UI is not set, this function 
williamr@2
   327
     * returns KNullUid. 
williamr@2
   328
     *
williamr@2
   329
     * @return The UID of manager UI application. KNullUid if the UID
williamr@2
   330
     * has not been set.
williamr@2
   331
     */
williamr@2
   332
    IMPORT_C TUid ManagerUi() const;
williamr@2
   333
williamr@2
   334
    /**
williamr@2
   335
     * Sets UID of the manager UI.
williamr@2
   336
     * 
williamr@2
   337
     * @param[in] aUid The SID value if available. Else the UID3 value, which is 
williamr@2
   338
     * the idenfifier of the particaular application. KNullUid can be used to 
williamr@2
   339
     * remove previous setting.
williamr@2
   340
     */
williamr@2
   341
    IMPORT_C void SetManagerUi( TUid aUid );
williamr@2
   342
williamr@2
   343
    /**
williamr@2
   344
     * Gets the trigger condition.
williamr@2
   345
     *
williamr@2
   346
     * The ownership of the returned trigger condition object is 
williamr@2
   347
     * not transferred to the client. The pointer can be 
williamr@2
   348
     * used to modify the trigger condition.
williamr@2
   349
     *
williamr@2
   350
     * @return A non-const pointer to the trigger's 
williamr@2
   351
     * trigger condition. NULL if the trigger condition is not set. 
williamr@2
   352
     */
williamr@2
   353
    IMPORT_C CLbtTriggerConditionBase* GetCondition();
williamr@2
   354
    
williamr@2
   355
    /**
williamr@2
   356
     * Gets the trigger condition.
williamr@2
   357
     * 
williamr@2
   358
     * The ownership of the returned trigger condition object is 
williamr@2
   359
     * not transferred to the client. The pointer can be 
williamr@2
   360
     * used to modify the trigger condition.
williamr@2
   361
     *
williamr@2
   362
     * @return A const pointer to the trigger's 
williamr@2
   363
     * trigger condition. NULL if the trigger condition is not set. 
williamr@2
   364
     */
williamr@2
   365
    IMPORT_C const CLbtTriggerConditionBase* GetCondition() const;
williamr@2
   366
    
williamr@2
   367
    /**
williamr@2
   368
     * Sets trigger condition.
williamr@2
   369
     *
williamr@2
   370
     * This object takes the ownership of the trigger condition object.
williamr@2
   371
     * 
williamr@2
   372
     * @param[in] aCondition Pointer to the new trigger condition object.
williamr@2
   373
     * This object takes the ownership of aCondition. NULL can be used
williamr@2
   374
     * to remove previous setting. 
williamr@2
   375
     */
williamr@2
   376
    IMPORT_C void SetCondition( CLbtTriggerConditionBase* aCondition );
williamr@2
   377
williamr@2
   378
    /**
williamr@2
   379
     * Internalizes the trigger object's details and attributes 
williamr@2
   380
     * from stream.
williamr@2
   381
     *
williamr@2
   382
     * The presence of this function means that the standard template 
williamr@2
   383
     * operator>>() ( defined in s32strm.h ) is available to internalize objects 
williamr@2
   384
     * of this class.
williamr@2
   385
     *
williamr@2
   386
     * @param[in] aStream Stream from which the object should be internalized.
williamr@2
   387
     */
williamr@2
   388
    IMPORT_C void InternalizeL( RReadStream& aStream );
williamr@2
   389
    
williamr@2
   390
    /**
williamr@2
   391
     * Externalizes the trigger object's details and attributes
williamr@2
   392
     * to stream.
williamr@2
   393
     *
williamr@2
   394
     * The presence of this function means that the standard template 
williamr@2
   395
     * operator<<() ( defined in s32strm.h ) is available to externalize objects 
williamr@2
   396
     * of this class.
williamr@2
   397
     *
williamr@2
   398
     * @param[in] aStream Stream to which the object should be externalized.
williamr@2
   399
     */
williamr@2
   400
    IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
williamr@2
   401
   
williamr@2
   402
protected:
williamr@2
   403
    /**
williamr@2
   404
     * Internalize method that subclass must implement.
williamr@2
   405
     * @param[in] aStream Stream from which the object should be internalized.
williamr@2
   406
     */
williamr@2
   407
    virtual void DoInternalizeL( RReadStream& aStream ) = 0;
williamr@2
   408
    
williamr@2
   409
    /**
williamr@2
   410
     * Externalize method that subclass must implement.
williamr@2
   411
     * @param[in] aStream Stream to which the object should be externalized.
williamr@2
   412
     */
williamr@2
   413
    virtual void DoExternalizeL( RWriteStream& aStream ) const = 0;
williamr@2
   414
    
williamr@2
   415
    /**
williamr@2
   416
     * Constructor.
williamr@2
   417
     */
williamr@2
   418
    CLbtTriggerEntry();
williamr@2
   419
williamr@2
   420
private:
williamr@2
   421
    /**
williamr@2
   422
     * By default, prohibit copy constructor
williamr@2
   423
     */
williamr@2
   424
    CLbtTriggerEntry( const CLbtTriggerEntry& );
williamr@2
   425
    
williamr@2
   426
    /**
williamr@2
   427
     * Prohibit assigment operator
williamr@2
   428
     */
williamr@2
   429
    CLbtTriggerEntry& operator= ( const CLbtTriggerEntry& );
williamr@2
   430
williamr@2
   431
private: //data
williamr@2
   432
    /**
williamr@2
   433
     * Id
williamr@2
   434
     */
williamr@2
   435
    TLbtTriggerId iId;
williamr@2
   436
    
williamr@2
   437
    /**
williamr@2
   438
     * Name
williamr@2
   439
     */
williamr@2
   440
    HBufC* iName;
williamr@2
   441
    
williamr@2
   442
    /**
williamr@2
   443
     * State
williamr@2
   444
     */
williamr@2
   445
    TLbtTriggerState iState; 
williamr@2
   446
    
williamr@2
   447
    /**
williamr@2
   448
     * Rearm time
williamr@2
   449
     */
williamr@2
   450
    TInt iRearmTime;
williamr@2
   451
    
williamr@2
   452
    /**
williamr@2
   453
     * Requestors
williamr@2
   454
     */
williamr@2
   455
    RRequestorStack iRequestor;
williamr@2
   456
    
williamr@2
   457
    /**
williamr@2
   458
     * manager UI
williamr@2
   459
     */
williamr@2
   460
    TUid iManagerUi;
williamr@2
   461
    
williamr@2
   462
    /**
williamr@2
   463
     * Trigger condition
williamr@2
   464
     */
williamr@2
   465
    CLbtTriggerConditionBase* iTriggerCondition;
williamr@2
   466
    
williamr@2
   467
    /**
williamr@2
   468
     * Reserved for schedule information
williamr@2
   469
     */
williamr@2
   470
    TAny* iSchedule; 
williamr@2
   471
    
williamr@2
   472
    /**
williamr@2
   473
     * Reserved pointer for future extension
williamr@2
   474
     */
williamr@2
   475
    TAny* iReserved;
williamr@2
   476
    };
williamr@2
   477
williamr@2
   478
williamr@2
   479
#endif // LBTTRIGGERENTRY_H