locationcentre/lcutils/inc/lcipcparams.h
branchRCL_3
changeset 9 4721bd00d3da
parent 8 3a25f69541ff
child 11 e15b7f06eba6
equal deleted inserted replaced
8:3a25f69541ff 9:4721bd00d3da
     1 /*
       
     2 * Copyright (c) 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:  Parameters for the IPC message handling between the 
       
    15 *                Location Centre API and Location Centre Server.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef LCIPCPARAMS_H
       
    21 #define LCIPCPARAMS_H
       
    22 
       
    23 // SYSTEM INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <s32strm.h>
       
    26 #include <lclocationappfilter.h>
       
    27 #include <lclocationappinfo.h>
       
    28 
       
    29 // USER INCLUDES
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CLcAppInfo;
       
    33 
       
    34 // ENUMERATION DECLARATIONS
       
    35 /**
       
    36  * Enumeration defining the kind of application that this structure holds.
       
    37  */
       
    38 enum TLcAppType
       
    39     {
       
    40     /**
       
    41      * The structure holds an S60 Java based Application.
       
    42      */
       
    43     ELcNativeApplication,
       
    44     
       
    45     /**
       
    46      * The structure holds a Web URL.
       
    47      */
       
    48     ELcWebUrl,
       
    49     
       
    50     /** 
       
    51      * The structure holds a document.
       
    52      */
       
    53     ELcDocument
       
    54     };
       
    55 
       
    56 // CLASS DECLARATIONS
       
    57 /**
       
    58  * Array of identifiers which is passed to Location Centre server for
       
    59  * filtering.
       
    60  *
       
    61  * Derived from RPointerArray. So all functions of the Arrar are available
       
    62  * through this interface. 
       
    63  */
       
    64 class RLcIpcAppIdArray : public RPointerArray< HBufC >
       
    65     {
       
    66 public:    
       
    67     /**
       
    68      * Externalizes the contents of this Array into a buffer.
       
    69      *
       
    70      * @since S60 v5.0
       
    71      * @param aWriteStream  Buffer onto which the contents of this array
       
    72      *                      would be externalized.
       
    73      */
       
    74     IMPORT_C void ExternalizeL( RWriteStream&   aWriteStream );
       
    75    
       
    76     /**
       
    77      * Internalized the contents of the buffer into this array.
       
    78      * 
       
    79      * @since S60 v5.0
       
    80      * @param aReadStream   Buffer from which the contents of this
       
    81      *                      array would be populated.
       
    82      */
       
    83     IMPORT_C void InternalizeL( RReadStream&    aReadStream );
       
    84     
       
    85     /**
       
    86      * Returns the Length of the buffer needed to pack this array of
       
    87      * Location based Application's identifiers.
       
    88      *
       
    89      * @since S60 v5.0
       
    90      * @return TInt, Length of the Buffer which is needed to pack this
       
    91      *               array.
       
    92      */
       
    93     IMPORT_C TInt BufferLength();
       
    94         
       
    95     /**
       
    96      * Resets and destroys the Application identifer array.
       
    97      * There is no need to call close on the array after this.
       
    98      *
       
    99      * @param aIdArray Generic pointer to the array
       
   100      */
       
   101     IMPORT_C static void ResetAndDestroyIdArray( TAny* aIdArray );
       
   102         
       
   103     };
       
   104     
       
   105 /**
       
   106  * Application information array.
       
   107  *
       
   108  * Derived from RPointerArray. So all functions of the Arrar are available
       
   109  * through this interface.
       
   110  */  
       
   111 class RLcIpcAppInfoArray : public RPointerArray< CLcAppInfo >
       
   112     { 
       
   113 public:
       
   114     /**
       
   115      * Externalizes the contents of this Array into a buffer.
       
   116      *
       
   117      * @since S60 v5.0
       
   118      * @param aWriteStream  Buffer onto which the contents of this array
       
   119      *                      would be externalized.
       
   120      */
       
   121     IMPORT_C void ExternalizeL( RWriteStream&   aWriteStream );
       
   122    
       
   123     /**
       
   124      * Internalized the contents of the buffer into this array.
       
   125      * 
       
   126      * @since S60 v5.0
       
   127      * @param aReadStream   Buffer from which the contents of this
       
   128      *                      array would be populated.
       
   129      */
       
   130     IMPORT_C void InternalizeL( RReadStream&    aReadStream );
       
   131     
       
   132     /**
       
   133      * Returns the Length of the buffer needed to pack this array of
       
   134      * Location based Applications.
       
   135      *
       
   136      * @since S60 v5.0
       
   137      * @return TInt, Length of the Buffer which is needed to pack this
       
   138      *               array.
       
   139      */
       
   140     IMPORT_C TInt BufferLength();
       
   141         
       
   142     /**
       
   143      * Resets and destroys the Application information array.
       
   144      * There is no need to call close on the array after this.
       
   145      *
       
   146      * @param aIdArray Generic pointer to the array
       
   147      */
       
   148     IMPORT_C static void ResetAndDestroyAppArray( TAny* aIdArray );        
       
   149     };
       
   150 
       
   151 /**
       
   152  * Basic Information for a Location based Applicatiuon. This class provides sufficient
       
   153  * information for launching a Location based Application
       
   154  */
       
   155 class CLcBasicAppInfo : public CBase
       
   156     {
       
   157 public:
       
   158     /**
       
   159      * Static two phase constructor
       
   160      */
       
   161     inline static CLcBasicAppInfo* NewL();
       
   162     
       
   163     /**
       
   164      * Static two phased constructor. Leaves the object on the Cleanup stack.
       
   165      */
       
   166     inline static CLcBasicAppInfo* NewLC();
       
   167     
       
   168     /**
       
   169      * C++ Destructor
       
   170      */
       
   171     inline virtual ~CLcBasicAppInfo();
       
   172     
       
   173     /**
       
   174      * Retrieves the type of application stored in this structure.
       
   175      *
       
   176      * @since S60 v5.0     
       
   177      * @return, The Type of Application as defined by @p TLcAppType which is stored
       
   178      *          in this structure.
       
   179      */
       
   180     inline TUint32 ApplicationType() const;
       
   181     
       
   182     /**
       
   183      * Sets the Application type.
       
   184      * @since S60 v5.0     
       
   185      * @param aAppType The Type of Application as defined by @p TLcAppType which
       
   186      *                  is stored in this structure.
       
   187      */
       
   188     inline void SetApplicationType( TUint32      aAppType );
       
   189     
       
   190      /**
       
   191      * Mode in which the Location Application would be launched. 
       
   192      * This is the mode with which the application has registered with
       
   193      * Location Centre.
       
   194      *
       
   195      * @since S60 v5.0     
       
   196      * @return Mode in which the Location Application would be launched.       
       
   197      */
       
   198     inline TUint32 LaunchMode() const;
       
   199 
       
   200     /** 
       
   201      * Sets the Mode in which the Location Application would be launched.
       
   202      *
       
   203      * @since S60 v5.0     
       
   204      * @param[in] aLaunchMode Mode in which the Location Application would be
       
   205      *                        launched. 
       
   206      */
       
   207     inline void SetLaunchMode( TUint32  aLaunchMode );
       
   208         
       
   209     /**
       
   210      * Retrieves the Generic Application data stored in this structure.
       
   211      *
       
   212      * @since S60 v5.0     
       
   213      * @return, The Genereic data content for the Application.
       
   214      */    
       
   215     inline TPtrC ApplicationData() const;
       
   216     
       
   217     /**
       
   218      * Sets the Generic Application data.
       
   219      *
       
   220      * @since S60 v5.0     
       
   221      * @param aAppData The Genereic data content for the Application.
       
   222      */       
       
   223     inline void SetApplicationDataL( const TDesC&   aAppData );
       
   224     
       
   225     /**
       
   226      * Retrieves the command line parameters stored in this structure.
       
   227      *
       
   228      * @since S60 v5.0     
       
   229      * @return, The command line parameters for the Application.
       
   230      */      
       
   231     inline TPtrC CommandLineParamters() const;
       
   232     
       
   233     /**
       
   234      * Sets the Command line parameters.
       
   235      *
       
   236      * @since S60 v5.0     
       
   237      * @param aCmdLineParams The Command line parameters for the Application.
       
   238      */     
       
   239     inline void SetCommandLineParametersL( const TDesC&  aCmdLineParams );
       
   240         
       
   241     /**
       
   242      * Externalizes the contents of this Array into a buffer.
       
   243      *
       
   244      * @since S60 v5.0
       
   245      * @param aWriteStream  Buffer onto which the contents of this array
       
   246      *                      would be externalized.
       
   247      */
       
   248     IMPORT_C void ExternalizeL( RWriteStream&   aWriteStream );
       
   249    
       
   250     /**
       
   251      * Internalized the contents of the buffer into this array.
       
   252      * 
       
   253      * @since S60 v5.0
       
   254      * @param aReadStream   Buffer from which the contents of this
       
   255      *                      array would be populated.
       
   256      */
       
   257     IMPORT_C void InternalizeL( RReadStream&    aReadStream );
       
   258     
       
   259     /**
       
   260      * Returns the Length of the buffer needed to pack this structure.
       
   261      *
       
   262      * @since S60 v5.0
       
   263      * @return TInt, Length of the Buffer which is needed to pack this
       
   264      *               structure.
       
   265      */
       
   266     IMPORT_C TInt BufferLength();  
       
   267         
       
   268 protected:
       
   269     /**
       
   270      * Default C++ constructor.
       
   271      */
       
   272     CLcBasicAppInfo();
       
   273      
       
   274 protected:
       
   275     /**
       
   276      * Type of the application that is present in this structure.
       
   277      */
       
   278     TUint32                             iAppType;
       
   279 
       
   280     /**
       
   281      * Mode in which the Location Application would be launched. If the mode
       
   282      * defined is EDefaultMode, then the default mode specified by the 
       
   283      * application when registering with Location Centre is used.
       
   284      */
       
   285     TUint32                             iLaunchMode; 
       
   286     
       
   287     /**
       
   288      * Generic data content for all Location based Application. The nature of this
       
   289      * data-type depends on the kind of Application as specified by the earlier parameter.
       
   290      * If the iAppType is
       
   291      * ELcApplication - This string contains the SID of the application.
       
   292      * ELcWebUrl      - The string contains the URI of the page that needs to be launched.
       
   293      * ELcDocument    - The string contains the full path of the file which needs to be
       
   294      *                  opened.
       
   295      */
       
   296     HBufC*                              iAppData;
       
   297 
       
   298     /**
       
   299      * Command line parameters.
       
   300      */
       
   301     HBufC*                              iCmdLineParams;
       
   302     };
       
   303         
       
   304 /**
       
   305  * Information of a Location based Application currently registered with
       
   306  * Location Centre.
       
   307  */
       
   308 class CLcAppInfo : public CLcBasicAppInfo
       
   309     {
       
   310 public:
       
   311     /**
       
   312      * Enumeration defining the Icon type present in this App Info
       
   313      */
       
   314     enum TLcIconFileType
       
   315         {
       
   316         EIconfromApp,
       
   317         EMifFile
       
   318         };
       
   319         
       
   320 public:
       
   321     /**
       
   322      * Constructs a new instance of Location Application information object.
       
   323      *
       
   324      * @return The new instance of Location Application information object.
       
   325      */
       
   326     inline static CLcAppInfo* NewL();
       
   327  
       
   328      /**
       
   329      * Constructs a new instance of Location Application information object.
       
   330      *
       
   331      * @return The new instance of Location Application information object.
       
   332      */
       
   333     inline static CLcAppInfo* NewLC();
       
   334              
       
   335     /**
       
   336      * C++ Destructor.
       
   337      * Frees all the resources associated with this Location Application
       
   338      * information object.
       
   339      */
       
   340     inline virtual ~CLcAppInfo();
       
   341 
       
   342     /**
       
   343      * Gets the Unique identifier identifying the Location Application.
       
   344      * This identifier is defined by the Location Application on registration
       
   345      * with Location Centre.
       
   346      * This is the identifier that must be used by the client of this API for 
       
   347      * any operation on the particular Location Application.
       
   348      * A reference to the object's internal string is returned.     
       
   349      *
       
   350      * @since S60 v5.0     
       
   351      * @return Unique identifier identifying the Location Application. If the
       
   352      *         value of the identifier has not been set then a NULL string
       
   353      *         is returned.
       
   354      */
       
   355     inline TPtrC Id() const;
       
   356     
       
   357     /**
       
   358      * Set the Unique identifier identifying the Location Application. The
       
   359      * identifer is copied.
       
   360      *
       
   361      * @since S60 v5.0     
       
   362      * @param[in] aId Unique identifier identifying the Location Application.      
       
   363      */
       
   364     inline void SetIdL( const TDesC& aId );
       
   365                 
       
   366     /**
       
   367      * Gets the Logical name for the Location Application.
       
   368      * The name is defined by the Location Centre on registration with
       
   369      * Location Centre. This is the name which would be displayed by
       
   370      * Location Centre for this application.
       
   371      * A reference to the object's internal string is returned.
       
   372      *
       
   373      * @since S60 v5.0     
       
   374      * @return Logical name for the Location Application. If the name 
       
   375      *         has not been set for the Location Application, then a NULL
       
   376      *         string is returned.
       
   377      */
       
   378     inline TPtrC Name() const;
       
   379 
       
   380     /**   
       
   381      * Set the Logical name for the Location Application. The name is 
       
   382      * copied.
       
   383      *
       
   384      * @since S60 v5.0     
       
   385      * @param[in] aName Logical name for the Location Application. 
       
   386      *                  The logical string is copied.
       
   387      */
       
   388     inline void SetNameL( const TDesC& aName );
       
   389     
       
   390     /**
       
   391      * Gets the Icon file name for the Location based Application.
       
   392      *
       
   393      * @since S60 v5.0     
       
   394      * @return The Icon file name for the Location based Application.
       
   395      */
       
   396     inline TPtrC IconFile() const;
       
   397 
       
   398     /**   
       
   399      * Sets the name of the Icon file for this Location based Application.
       
   400      *
       
   401      * @since S60 v5.0     
       
   402      * @param[in] aIconFile Full path for the Icon file.
       
   403      */
       
   404     inline void SetIconFileL( const TDesC& aIconFile );
       
   405         
       
   406     /**
       
   407      * Gets the Icon File type for the Location Application.
       
   408      * The Location Application can optionally have an icon defined
       
   409      * in the Registration file.
       
   410      *
       
   411      * @since S60 v5.0     
       
   412      * @return The Icon file type for the Location Application.
       
   413      */
       
   414     inline  TLcIconFileType IconFileType() const;
       
   415 
       
   416     /**   
       
   417      * Sets the Icon File type for the Location Application.
       
   418      * The Location Application can optionally have an icon defined
       
   419      * in the Registration file.
       
   420      *
       
   421      * @since S60 v5.0     
       
   422      * @param[in] aIconFileType The type of Icon file for this Location
       
   423      *                          Application
       
   424      */
       
   425     inline void SetIconFileType( const TLcIconFileType aIconFileType );
       
   426     
       
   427  
       
   428     /**
       
   429      * Gets the frame number for the Icon if the Icon file is a MIF file.
       
   430      *
       
   431      * @since S60 v5.0     
       
   432      * @return Frame Number      
       
   433      */
       
   434     inline TUint32 FrameNo() const;
       
   435 
       
   436     /** 
       
   437      * Sets the frame number for the Icon if the Icon file is a MIF file.
       
   438      *
       
   439      * @since S60 v5.0     
       
   440      * @param[in] aFrameNo Frame number for the icon.
       
   441      */
       
   442     inline void SetFrameNo( TUint32  aFrameNo );
       
   443     
       
   444     /**
       
   445      * Returns the System characteristics for the Location Application
       
   446      *
       
   447      * @since S60 v5.0
       
   448      * @return - System Characteristics for the Location
       
   449      *           Application. All the system characteristics for the 
       
   450      *           Location Application would be combined to form an integer
       
   451      *           bit-mask and this function returns the bit-mask. The
       
   452      *           individual System characteristics are defined by
       
   453      *           @ref TLcSystemCharacteristics enumeration.
       
   454      */
       
   455     inline TUint32 SystemCharacteristics() const;
       
   456 
       
   457     /**
       
   458      * Sets the system characteristics for the Location Application.
       
   459      *
       
   460      * @since S60 v5.0     
       
   461      * @param[in] aSysCharacteristics System Characteristics for the Location
       
   462      *                                Application.
       
   463      */
       
   464     inline void SetSystemCharacteristics( TUint32   aSysCharacteristics );
       
   465     
       
   466     /**
       
   467      * Returns the Application characteristics for the Location Application
       
   468      *
       
   469      * @since S60 v5.0
       
   470      * @return - Application Characteristics for the Location
       
   471      *           Application. All the application characteristics for the 
       
   472      *           would be combined to form an integer bit-mask and this
       
   473      *           function returns the current bit-mask. The individual
       
   474      *           Application characteristics are defined by
       
   475      *           @ref TLcApplicationCharacteristics enumeration.
       
   476      */
       
   477     inline TUint32 ApplicationCharacteristics() const;
       
   478 
       
   479     /**    
       
   480      * Sets the Application characteristics for the Location Application.
       
   481      *
       
   482      * @since S60 v5.0     
       
   483      * @param[in] aAppCharacteristics Application Characteristics for the Location
       
   484      *                                Application.
       
   485      */
       
   486     inline void SetApplicationCharacteristics( TUint32   aAppCharacteristics );
       
   487 
       
   488 
       
   489     /**
       
   490      * Externalizes the contents of this Array into a buffer.
       
   491      *
       
   492      * @since S60 v5.0
       
   493      * @param aWriteStream  Buffer onto which the contents of this array
       
   494      *                      would be externalized.
       
   495      */
       
   496     void ExternalizeL( RWriteStream&   aWriteStream );
       
   497    
       
   498     /**
       
   499      * Internalized the contents of the buffer into this array.
       
   500      * 
       
   501      * @since S60 v5.0
       
   502      * @param aReadStream   Buffer from which the contents of this
       
   503      *                      array would be populated.
       
   504      */
       
   505     void InternalizeL( RReadStream&    aReadStream );
       
   506     
       
   507     /**
       
   508      * Returns the Length of the buffer needed to pack this structure.
       
   509      *
       
   510      * @since S60 v5.0
       
   511      * @return TInt, Length of the Buffer which is needed to pack this
       
   512      *               structure.
       
   513      */
       
   514     IMPORT_C TInt BufferLength();    
       
   515         
       
   516 protected:
       
   517     /**
       
   518      * Default C++ Constructor.
       
   519      */
       
   520     inline CLcAppInfo();
       
   521     
       
   522 protected:   
       
   523     /**
       
   524      * System wide unique identifier identifying the Location Application. This
       
   525      * identifier is defined by the Location Application on registration with
       
   526      * Location Centre.
       
   527      *
       
   528      * Owns
       
   529      */
       
   530     HBufC*                              iId;
       
   531     
       
   532     /**
       
   533      * Application Name.
       
   534      * Logical name for the Location Application. The name is defined by the
       
   535      * Location Centre on registration with Location Centre. This is the name
       
   536      * which would be displayed by Location Centre for this application.
       
   537      * 
       
   538      * Owns
       
   539      */
       
   540     HBufC*                              iApplicationName;
       
   541     
       
   542     /**
       
   543      * Icon File name.
       
   544      * The name of the Icon file if its specified in the Location Centre
       
   545      * Registration file for the Location Application.
       
   546      *
       
   547      * Owns
       
   548      */
       
   549     HBufC*                              iIconFile;
       
   550       
       
   551     /**
       
   552      * Icon file type.
       
   553      * The Location based Application can optionally specify an Icon file
       
   554      * which would be displayed for it in Location Centre.
       
   555      */
       
   556     TLcIconFileType                     iIconFileType;
       
   557     
       
   558     /**
       
   559      * Frame number incase the Icon file is a MIF file
       
   560      */
       
   561     TUint32                             iFrameNo;
       
   562      
       
   563    /**
       
   564     * Bit-mask containing the System characteristics for the corresponding
       
   565     * Location application
       
   566     */
       
   567     TUint32                             iSystemCharacteristics;
       
   568     
       
   569    /**
       
   570     * Bit-mask containing the Application characteristics for the corresponding
       
   571     * Location application
       
   572     */
       
   573     TUint32                             iAppCharacteristics; 
       
   574 };
       
   575     
       
   576 #include "lcipcparams.inl"
       
   577      
       
   578 #endif // LCIPCPARAMS_H