atext/server/inc/atextmetadata.h
changeset 0 29b1cd4cb562
child 1 b4a7eebaaebf
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:  Metadata for ATEXT
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CATEXTMETADATA_H
       
    20 #define C_CATEXTMETADATA_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <atext.h>
       
    24 #include "atextpluginobserver.h"
       
    25 
       
    26 class CATExtPluginBase;
       
    27 class CATExtListen;
       
    28 
       
    29 /**  Support types supported by RSS file (M|P|S) */
       
    30 enum TATExtSupportType
       
    31     {
       
    32     ESupportTypeUndefined = KErrNotFound,
       
    33     ESupportTypeMaster    = 0,
       
    34     ESupportTypePrimary,
       
    35     ESupportTypeSecondary
       
    36     };
       
    37 
       
    38 /**  Operation types, either for command handling or for URC receiving */
       
    39 enum TATExtOperationType
       
    40     {
       
    41     EOperationUndefined     = KErrNotFound,
       
    42     EOperationHandleCommand = 0,
       
    43     EOperationReceiveUrc
       
    44     };
       
    45 
       
    46 /**
       
    47  *  Completion information for CATExtSession::IpcHandleCommand().
       
    48  *  This data is needed to check how the AT command handling succeeded and what
       
    49  *  was the type of the completed AT command (in HandleCommand()).
       
    50  *
       
    51  *  @since S60 v5.0
       
    52  */
       
    53 NONSHARABLE_CLASS( TATExtCompletionInfo )
       
    54     {
       
    55 
       
    56 public:
       
    57 
       
    58     /**
       
    59      * Flag to indicate whether or not an AT command was processed by some
       
    60      * plugin
       
    61      *
       
    62      */
       
    63     TBool iProcessed;
       
    64 
       
    65     /**
       
    66      * Flag to indicate whether or not a reply is expected from some of the
       
    67      * plugins
       
    68      */
       
    69     TBool iReplyExpected;
       
    70 
       
    71     };
       
    72 
       
    73 /**
       
    74  *  Class to store data needed by each plugin.
       
    75  *  Support data TATExtAtCmdSupport creates links to one plugin entry.
       
    76  *
       
    77  *  @since S60 v5.0
       
    78  */
       
    79 NONSHARABLE_CLASS( TATExtPluginEntry )
       
    80     {
       
    81 
       
    82 public:
       
    83 
       
    84     /**
       
    85      * UID of plugin with support
       
    86      */
       
    87     TUid iPluginUid;
       
    88 
       
    89     /**
       
    90      * Instance of plugin
       
    91      */
       
    92     CATExtPluginBase* iInstance;
       
    93 
       
    94     /**
       
    95      * Flag to indicate whether or not the access to plugin data is locked
       
    96      */
       
    97     TBool iLocked;
       
    98 
       
    99     /**
       
   100      * Flag to indicate whether or not URC message receiving has started
       
   101      */
       
   102     TBool iUrcStarted;
       
   103 
       
   104     /**
       
   105      * Client request message for URC message receiver
       
   106      */
       
   107     RMessage2 iUrcMessage;
       
   108 
       
   109     /**
       
   110      * Flag to indicate whether or not the plugin URC handling is owned by the
       
   111      * client side user.
       
   112      */
       
   113     TBool iUrcOwned;
       
   114 
       
   115     };
       
   116 
       
   117 /**
       
   118  *  Search helper information for AddNewMetadataEntryLinkL().
       
   119  *  The data in this class is changes when the indexes are known.
       
   120  *  When known index(es) are found then these indexes are used instead of
       
   121  *  searching for the position where to insert the new entry. Index for master
       
   122  *  entry is not stored as it is always inserted as the first entry.
       
   123  *
       
   124  *  @since S60 v5.0
       
   125  */
       
   126 NONSHARABLE_CLASS( TATExtSearchHelper )
       
   127     {
       
   128 
       
   129 public:
       
   130 
       
   131     TATExtSearchHelper() : iPrimaryIndex( KErrNotFound ),
       
   132                            iSecondaryIndex( KErrNotFound ) {}
       
   133 
       
   134     /**
       
   135      * Index to the primary entry
       
   136      */
       
   137     TInt iPrimaryIndex;
       
   138 
       
   139     /**
       
   140      * Index to the secondary entry
       
   141      */
       
   142     TInt iSecondaryIndex;
       
   143 
       
   144     };
       
   145 
       
   146 /**
       
   147  *  Class to store data needed for one AT command support.
       
   148  *  This includes the support's type and the plugin entry.
       
   149  *  Thus one plugin's RSS file may contain multiple M|P|S entries.
       
   150  *
       
   151  *  @since S60 v5.0
       
   152  */
       
   153 NONSHARABLE_CLASS( TATExtOneCmdSupport )
       
   154     {
       
   155 
       
   156 public:
       
   157 
       
   158     /**
       
   159      * Support's type (M|P|S)
       
   160      */
       
   161     TATExtSupportType iSupportType;
       
   162 
       
   163     /**
       
   164      * Plugin entry for support
       
   165      */
       
   166     TInt iEntryIndex;
       
   167 
       
   168     };
       
   169 
       
   170 /**
       
   171  *  Class to store data needed for one AT command.
       
   172  *  Links to entry data TATExtPluginEntry are added for each supported AT
       
   173  *  command. Each entry of TATExtAtCmdSupport specifies the entry entered to
       
   174  *  an RSS file's "default_data" field with the "=" and the substring after it
       
   175  *  truncated. The truncation is done by CreateAndFindSupportL().
       
   176  *
       
   177  *  @since S60 v5.0
       
   178  */
       
   179 NONSHARABLE_CLASS( TATExtAtCmdSupport )
       
   180     {
       
   181 
       
   182 public:
       
   183 
       
   184     /**
       
   185      * Supported AT command
       
   186      */
       
   187     HBufC8* iAtCmdBase;
       
   188 
       
   189 #if defined( PRJ_OPTIMIZE_FOR_SPEED )
       
   190 
       
   191     /**
       
   192      * Search helper to iEntries. Needed when creating the database.
       
   193      */
       
   194     TATExtSearchHelper iSearchHelper;
       
   195 
       
   196 #endif
       
   197 
       
   198     /**
       
   199      * Plugin entries for support
       
   200      */
       
   201     CArrayFixFlat<TATExtOneCmdSupport>* iEntries;
       
   202 
       
   203     };
       
   204 
       
   205 /**
       
   206  *  Cleanup information for AddEntryToMetadataL().
       
   207  *  This data is needed to clean up partially constructed data in
       
   208  *  HandleCommand() when a leave occurs in plugin entry or support entry
       
   209  *  addition.
       
   210  *
       
   211  *  @since S60 v5.0
       
   212  */
       
   213 NONSHARABLE_CLASS( TATExtCleanupInfo )
       
   214     {
       
   215 
       
   216 public:
       
   217 
       
   218     /**
       
   219      * Flag to indicate whether or not a support entry was created
       
   220      */
       
   221     TBool iSupportCreated;
       
   222 
       
   223     /**
       
   224      * Index to the position where the support entry was inserted
       
   225      */
       
   226     TInt iSupportIndex;
       
   227 
       
   228     /**
       
   229      * Flag to indicate whether or not a plugin entry was created
       
   230      */
       
   231     TBool iEntryCreated;
       
   232 
       
   233     /**
       
   234      * Index to the position where the entry was inserted
       
   235      */
       
   236     TInt iEntryIndex;
       
   237 
       
   238     /**
       
   239      * Support information to normal or auxiliary plugin data
       
   240      */
       
   241     CArrayFixFlat<TATExtAtCmdSupport>* iSupport;
       
   242 
       
   243     };
       
   244 
       
   245 /**
       
   246  *  Class to store data related to AT command handling.
       
   247  *
       
   248  *  @since S60 v5.0
       
   249  */
       
   250 NONSHARABLE_CLASS( TATExtCommandData )
       
   251     {
       
   252 
       
   253 public:
       
   254 
       
   255     /**
       
   256      * Flag indicating whether or not command handling has started
       
   257      */
       
   258     TBool iCmdStarted;
       
   259 
       
   260     /**
       
   261      * Flag indicating whether or not reply expected from plugin to ATEXT.
       
   262      * This is used to omit HandleCommandCompleted() from a plugin to ATEXT
       
   263      * when ATEXT uses its own reply.
       
   264      */
       
   265     TBool iReplyExpected;
       
   266 
       
   267     /**
       
   268      * Client request message for AT command handling
       
   269      */
       
   270     RMessage2 iCmdMessage;
       
   271 
       
   272     /**
       
   273      * Buffer for command.
       
   274      * Set by HandleCommand().
       
   275      */
       
   276     RBuf8 iCmdBuffer;
       
   277 
       
   278     /**
       
   279      * Buffer for reply.
       
   280      * Set by CompleteCommandMessage() and GetNextPartOfReply().
       
   281      */
       
   282     RBuf8 iCmdReplyBuffer;
       
   283 
       
   284     /**
       
   285      * Plugin entry for the AT command handler
       
   286      * Not own.
       
   287      */
       
   288     TATExtPluginEntry* iHandler;
       
   289 
       
   290     /**
       
   291      * Plugin entry for the AT command handler (old command handled);
       
   292      * set when command handling successfully completed.
       
   293      * Not own.
       
   294      */
       
   295     CATExtPluginBase* iOldHandler;
       
   296 
       
   297     };
       
   298 
       
   299 /**
       
   300  *  Class store data for AT command handling.
       
   301  *  This is basically a helper class for internal usage to pass around data
       
   302  *  related to AT command handling.
       
   303  *
       
   304  *  @since S60 v5.0
       
   305  */
       
   306 NONSHARABLE_CLASS( TATExtEntrySupport )
       
   307     {
       
   308 
       
   309 public:
       
   310 
       
   311     TATExtEntrySupport( TDesC8& aAtCmdFull,
       
   312                         const RMessage2& aMessage,
       
   313                         CArrayFixFlat<TATExtOneCmdSupport>* aSupport ) :
       
   314                         iAtCmdFull( aAtCmdFull ),
       
   315                         iMessage( aMessage ),
       
   316                         iSupport( aSupport ) {}
       
   317 
       
   318     /**
       
   319      * Full AT command for which to check the support
       
   320      * (base part + parameters)
       
   321      */
       
   322     TDesC8& iAtCmdFull;
       
   323 
       
   324     /**
       
   325      * Client request message for reading
       
   326      */
       
   327     const RMessage2& iMessage;
       
   328 
       
   329     /**
       
   330      * AT command's plugin entry support data.
       
   331      * Used by SendToMultipleSecondaryL() and FindFirstSecondarySupportL().
       
   332      */
       
   333     CArrayFixFlat<TATExtOneCmdSupport>* iSupport;
       
   334 
       
   335     /**
       
   336      * Found plugin entry.
       
   337      */
       
   338     TATExtPluginEntry* iEntry;
       
   339 
       
   340     /**
       
   341      * Starts index for searches with HandlePrimaryPluginSupportL() and
       
   342      * HandleSecondaryPluginSupportL()
       
   343      */
       
   344     TInt iStartIndex;
       
   345 
       
   346     };
       
   347 
       
   348 /**
       
   349  *  Class for handling various operations of the server session which are
       
   350  *  related to metadata handling. Also adds methods which don't do metadata
       
   351  *  handling but are better to be in this class for abstraction and data hiding
       
   352  *  reasons.
       
   353  *
       
   354  *  @since S60 v5.0
       
   355  */
       
   356 NONSHARABLE_CLASS( CATExtMetadata ) : public CBase
       
   357     {
       
   358 
       
   359 public:
       
   360 
       
   361     /**
       
   362      * Two-phased constructor.
       
   363      * @param aEComSession ECOM session; used for getting ECOM implementation
       
   364      *                     information.
       
   365      * @param aListener ECOM plugin notification event listener
       
   366      * @param aObserver Plugin observer (needed for instantiation)
       
   367      * @return Instance of self
       
   368      */
       
   369 	static CATExtMetadata* NewL( REComSession& aEComSession,
       
   370                                  CATExtListen* aListener,
       
   371                                  MATExtPluginObserver& aObserver );
       
   372 
       
   373     /**
       
   374      * Two-phased constructor.
       
   375      * @param aEComSession ECOM session; used for getting ECOM implementation
       
   376      *                     information.
       
   377      * @param aListener ECOM plugin notification event listener
       
   378      * @param aObserver Plugin observer (needed for instantiation)
       
   379      * @return Instance of self
       
   380      */
       
   381     static CATExtMetadata* NewLC( REComSession& aEComSession,
       
   382                                   CATExtListen* aListener,
       
   383 	                              MATExtPluginObserver& aObserver );
       
   384 
       
   385 
       
   386     /**
       
   387     * Destructor.
       
   388     */
       
   389     virtual ~CATExtMetadata();
       
   390 
       
   391     /**
       
   392      * Resets data to initial values
       
   393      *
       
   394      * @since S60 5.0
       
   395      * @return None
       
   396      */
       
   397     void ResetData();
       
   398 
       
   399     /**
       
   400      * Creates new implementation metadata based on a given interface UID and
       
   401      * connection. Uses AddImplementationL() to add new implementations for the
       
   402      * interface and sets connection identification name for reporting it to the
       
   403      * plugins on instantiation time.
       
   404      *
       
   405      * @since S60 5.0
       
   406      * @param aIfUid Interface UID to support
       
   407      * @param aName Connection identification name
       
   408      * @return None
       
   409      */
       
   410     void CreateImplementationMetadataL( TUid& aIfUid, const TDesC8& aName );
       
   411 
       
   412     /**
       
   413      * Adds an implementation to the metadata based on a given ECOM
       
   414      * implementation information. This is used by the function
       
   415      * CreateImplementationMetadataL() and also by CATExtSession when its ECOM
       
   416      * notification listener detects an addition for a the same ECOM interface.
       
   417      * This function uses DoAddImplementation to add the actual AT command set
       
   418      * to the metadata.
       
   419      *
       
   420      * @since S60 5.0
       
   421      * @param aImplInfo ECOM implementation information from which to create new
       
   422      *                  metadata
       
   423      * @return None
       
   424      */
       
   425     void AddImplementationL( CImplementationInformation* aImplInfo );
       
   426 
       
   427     /**
       
   428      * Removes an implementation from the support data by a given plugin UID.
       
   429      *
       
   430      * @since S60 5.0
       
   431      * @param aPluginUid Plugin UID to search from plugin data
       
   432      * @param aInstanceExists ETrue if instance exists, EFalse otherwise
       
   433      * @return Symbian error code on error, KErrNone otherwise
       
   434      */
       
   435     TInt RemoveImplementation( TUid& aPluginUid, TBool aInstanceExists=ETrue );
       
   436 
       
   437     /**
       
   438      * Handles an AT command
       
   439      *
       
   440      * @since S60 5.0
       
   441      * @param aMessage Client request message for reading
       
   442      * @param aComplInfo Completion information for the handled command
       
   443      * @return Symbian error code on error, KErrNone otherwise
       
   444      */
       
   445     TInt HandleCommand( const RMessage2& aMessage,
       
   446                         TATExtCompletionInfo& aComplInfo );
       
   447 
       
   448     /**
       
   449      * Cancels an active handle command operation. Uses IsCommandHandling() and
       
   450      * CancelCommandOperation().
       
   451      *
       
   452      * @since S60 5.0
       
   453      * @return Symbian error code on error, KErrNone otherwise
       
   454      */
       
   455     TInt CancelHandleCommand();
       
   456 
       
   457     /**
       
   458      * Gets the next part of a reply for HandleCommand().
       
   459      * Length of returned reply must be the same as the one reported
       
   460      * from NextReplyPartLength() for the current reply.
       
   461      *
       
   462      * @since S60 5.0
       
   463      * @param aMessage Client request message for reading
       
   464      * @return Symbian error code on error, KErrNone otherwise
       
   465      */
       
   466     TInt GetNextPartOfReply( const RMessage2& aMessage );
       
   467 
       
   468     /**
       
   469      * Completes an URC processing message by a given plugin UID.
       
   470      * Completion code for the client message is the return code from a
       
   471      * write with WriteReplyBufferToClient()
       
   472      *
       
   473      * @since S60 5.0
       
   474      * @param aAtCmd URC message to write to the client side
       
   475      * @param aPlugin Plugin UID to search from plugin data
       
   476      * @return Symbian error code on error, KErrNone otherwise
       
   477      */
       
   478     TInt CompleteUrcMessage( const TDesC8& aAtCmd,
       
   479                              CATExtPluginBase* aPlugin );
       
   480 
       
   481     /**
       
   482      * Completes an AT command handling message. Also clears internal
       
   483      * initialized command hanlder data; see ClearInitializedCmdHandlerData().
       
   484      *
       
   485      * @since S60 5.0
       
   486      * @param aPlugin Plugin's instance to match against the command data
       
   487      *                NULL if no check wanted for a match against the command
       
   488      *                data
       
   489      * @param aError Completion error code for the command message
       
   490      * @param aErrorReply ETrue if error reply "ERROR" needed,
       
   491      *                    EFalse if empty reply "" needed.
       
   492      *                    For "" and "ERROR" replies the reply must not
       
   493      *                    contain an existing reply
       
   494      * @param aReplyType Reply type for the handled AT command
       
   495      * @param aMultiPart ETrue (default behavior) if multipart reply wanted,
       
   496      *                   EFalse otherwise.
       
   497      *                   For multipart replies the reply may be over
       
   498      *                   KDefaultCmdBufLength.
       
   499      * @return Symbian error code on error, KErrNone otherwise
       
   500      */
       
   501     TInt CompleteCommandMessage( CATExtPluginBase* aPlugin,
       
   502                                  TInt aError,
       
   503                                  TBool aErrorReply,
       
   504                                  TATExtensionReplyType aReplyType,
       
   505                                  TBool aMultiPart );
       
   506 
       
   507     /**
       
   508      * Clears internal initialized command handler data. This is currently used
       
   509      * only by CompleteCommandMessage() and is called when the data is not
       
   510      * needed anymore. It also prepares the internal data for a new
       
   511      * HandleCommand() call.
       
   512      *
       
   513      * @since S60 5.0
       
   514      * @param aMultiPart ETrue (default behavior) if multipart reply wanted,
       
   515      *                   EFalse otherwise.
       
   516      *                   For multipart replies the reply may be over
       
   517      *                   KDefaultCmdBufLength.
       
   518      * @return Symbian error code on error, KErrNone otherwise
       
   519      */
       
   520     TInt ClearInitializedCmdHandlerData( TBool aMultiPart );
       
   521 
       
   522     /**
       
   523      * Gets the array of supported commands.
       
   524      *
       
   525      * @since S60 5.0
       
   526      * @param aPlugin Plugin UID to search from plugin data
       
   527      * @param aCmds Array of supported commands
       
   528      * @return Symbian error code on error, KErrNone otherwise
       
   529      */
       
   530     TInt GetSupportedCommands( CATExtPluginBase* aPlugin,
       
   531                                RPointerArray<HBufC8>& aCmds );
       
   532 
       
   533     /**
       
   534      * Starts URC message receiving for plugin. Note that
       
   535      * MarkUrcHandlingOwnership() must be called immediately after this in order
       
   536      * for the messages to receive their destination.
       
   537      *
       
   538      * @since S60 5.0
       
   539      * @param aMessage Client request message for reading
       
   540      * @param aPluginUid Plugin UID to search from plugin data
       
   541      * @return None
       
   542      */
       
   543     void StartUrcReceivingL( const RMessage2& aMessage,
       
   544                              TUid& aPluginUid );
       
   545 
       
   546     /**
       
   547      * Cancels an active URC message receiving operation by a given plugin UID.
       
   548      * Uses CancelOneUrcOperation() to cancel if plugin UID found from plugin
       
   549      * data.
       
   550      *
       
   551      * @since S60 5.0
       
   552      * @param aPluginUid Plugin UID to search from plugin data
       
   553      * @return Symbian error code on error, KErrNone otherwise
       
   554      */
       
   555     TInt CancelUrcReceiving( TUid& aPluginUid );
       
   556 
       
   557     /**
       
   558      * Marks URC handling ownership for a plugin entry. Call to this function
       
   559      * must be done immediately after the call to StartUrcReceivingL().
       
   560      *
       
   561      * @since S60 5.0
       
   562      * @param aMessage Client request message for reading
       
   563      * @return Symbian error code on error, KErrNone otherwise
       
   564      */
       
   565     TInt MarkUrcHandlingOwnership( const RMessage2& aMessage );
       
   566 
       
   567     /**
       
   568      * Marks the access to a plugin data as "locked". This blocks all operations
       
   569      * where plugin function calls are to be done.
       
   570      *
       
   571      * @since S60 5.0
       
   572      * @param aPluginUid Plugin UID to search from plugin data
       
   573      * @return Symbian error code on error, KErrNone otherwise
       
   574      */
       
   575     TInt LockPluginAccess( TUid& aPluginUid );
       
   576 
       
   577     /**
       
   578      * Marks the access to a plugin data as "unlocked". This enables all
       
   579      * operations where plugin function call are to be done.
       
   580      *
       
   581      * @since S60 5.0
       
   582      * @param aPluginUid Plugin UID to search from plugin data
       
   583      * @return Symbian error code on error, KErrNone otherwise
       
   584      */
       
   585     TInt UnlockPluginAccess( TUid& aPluginUid );
       
   586 
       
   587     /**
       
   588      * Searches for an instances from the support data's plugin data link and
       
   589      * only marks the instance as uninitialized. Note that this doesn't try to
       
   590      * cancel any of the current plugin operations and should be used only when
       
   591      * a plugin destroys itself.
       
   592      *
       
   593      * @since S60 5.0
       
   594      * @param aInstance Instance to remove
       
   595      * @return Symbian error code on error, KErrNone otherwise
       
   596      */
       
   597     TInt RemoveImplementationInstance( CATExtPluginBase* aInstance );
       
   598 
       
   599     /**
       
   600      * Checks if support data has been constructed from the plugin data.
       
   601      *
       
   602      * @since S60 5.0
       
   603      * @return ETrue if plugin support data found, EFalse otherwise
       
   604      */
       
   605     TBool SupportExists();
       
   606 
       
   607     /**
       
   608      * Number of plugins with AT command handling support based on the
       
   609      * information in RSS files' AT command handling entries. This information
       
   610      * is needed to instantiate one or more listeners by the user of the client.
       
   611      *
       
   612      * @since S60 5.0
       
   613      * @return Symbian error code on error, KErrNone otherwise
       
   614      */
       
   615     TInt NumberOfPlugins();
       
   616 
       
   617     /**
       
   618      * Sets the quiet mode to the required value. After this the mode is
       
   619      * reported to the plugins with ReportQuietModeChange().
       
   620      *
       
   621      * @since S60 5.0
       
   622      * @param aMode ETrue if quiet mode on, EFalse if off
       
   623      * @return None
       
   624      */
       
   625     void SetQuietMode( TBool aMode );
       
   626 
       
   627     /**
       
   628      * Sets the verbose mode to the required value. After this the mode is
       
   629      * reported to the plugins with ReportVerboseModeChange().
       
   630      *
       
   631      * @since S60 5.0
       
   632      * @param aMode ETrue if verbose mode on, EFalse if off
       
   633      * @return None
       
   634      */
       
   635     void SetVerboseMode( TBool aMode );
       
   636 
       
   637     /**
       
   638      * Sets new character value for a carriage return, line feed or backspace
       
   639      * character. After this its type and value are reported to the plugins with
       
   640      * ReportCharacterChange().
       
   641      *
       
   642      * @since S60 5.0
       
   643      * @param aCharType Character's type (carriage/linefeed/backspace)
       
   644      * @param aNewChar New character's value to set
       
   645      * @return Symbian error code on error, KErrNone otherwise
       
   646      */
       
   647     TInt SetCharacterValue( TATExtensionCharType aCharType,
       
   648                             TInt8 aNewChar );
       
   649 
       
   650     /**
       
   651      * Extracts the NVRAM settings from a pipe-character delimited NVRAM buffer
       
   652      * and sends the subsettings to all of the plugins with
       
   653      * ReportNvramStatusChange().
       
   654      *
       
   655      * @since S60 5.0
       
   656      * @param aNvram NVRAM setting to broadcast
       
   657      * @return Symbian error code on error, KErrNone otherwise
       
   658      */
       
   659     TInt BroadcastNvramStatusChange( const TDesC8& aNvram );
       
   660 
       
   661     /**
       
   662      * Reports about external handle command error condition.
       
   663      * This is for cases when for example DUN decided the reply contained an
       
   664      * error condition but the plugin is still handling the command internally.
       
   665      * Example: "AT+TEST;+TEST2" was given in command line; "AT+TEST" returns
       
   666      * non-EReplyTypeError condition and "AT+TEST2" returns EReplyTypeError.
       
   667      * As the plugin(s) returning the non-EReplyTypeError may still have some
       
   668      * ongoing operation then these plugins are notified about the external
       
   669      * EReplyTypeError in command line processing. It is to be noted that
       
   670      * HandleCommandCancel() is not sufficient to stop the processing as the
       
   671      * command handling has already finished.
       
   672      *
       
   673      * @since S60 5.0
       
   674      * @return Symbian error code on error, KErrNone otherwise
       
   675      */
       
   676     TInt ReportExternalHandleCommandError();
       
   677 
       
   678     /**
       
   679      * Reports about abort condition in command handling.
       
   680      * This is for cases when for example DUN decided an abort condition was
       
   681      * received from DTE (ITU-T V.250 5.6.1). This API is for notifying the
       
   682      * plugin that abort was requested. However the plugin currently handling
       
   683      * the command may ignore the request if it doesn't support abort for the
       
   684      * command or it may return the changed condition with
       
   685      * HandleCommandCompleted()
       
   686      *
       
   687      * @since S60 5.0
       
   688      * @param aMessage Client request message for writing
       
   689      * @return Symbian error code on error, KErrNone otherwise
       
   690      */
       
   691     TInt ReportHandleCommandAbort( const RMessage2& aMessage );
       
   692 
       
   693     /**
       
   694      * Gets the next special command RSS file entry. These commands are commands
       
   695      * with a matching start but with any ending sequence. Command "ATD*99***1#"
       
   696      * is one of these and the number of these commands should be kept minimal.
       
   697      *
       
   698      * @since S60 5.0
       
   699      * @param aMessage Client request message for reading
       
   700      * @param aFirstSearch ETrue if first search, EFalse otherwise
       
   701      * @return Symbian error code on error, KErrNone otherwise
       
   702      */
       
   703     TInt GetNextSpecialCommand( const RMessage2& aMessage,
       
   704                                 TBool aFirstSearch );
       
   705 
       
   706 private:
       
   707 
       
   708     CATExtMetadata( REComSession& aEComSession,
       
   709                     CATExtListen* aListener,
       
   710                     MATExtPluginObserver& aObserver );
       
   711 
       
   712     void ConstructL();
       
   713 
       
   714     /**
       
   715      * Initializes this class
       
   716      *
       
   717      * @since S60 5.0
       
   718      * @return None
       
   719      */
       
   720     void Initialize();
       
   721 
       
   722     /**
       
   723      * Removes one plugin data entry by plugin UID
       
   724      *
       
   725      * @since S60 5.0
       
   726      * @param aPluginUid Plugin UID to search from plugin data
       
   727      * @param aInstanceExists ETrue if instance exists, EFalse otherwise
       
   728      * @return Symbian error code on error, KErrNone otherwise
       
   729      */
       
   730     TInt RemoveOnePlugindata( TUid& aPluginUid,
       
   731                               TBool aInstanceExists );
       
   732 
       
   733     /**
       
   734      * Removes one plugin data entry by plugin UID
       
   735      *
       
   736      * @since S60 5.0
       
   737      * @param aSupport Support information to normal or auxiliary plugin data
       
   738      * @param aRemovedIndex Index that was removed
       
   739      * @return Symbian error code on error, KErrNone otherwise
       
   740      */
       
   741     TInt UpdateRemovedPluginLinks( CArrayFixFlat<TATExtAtCmdSupport>* aSupport,
       
   742                                    TInt aRemovedIndex );
       
   743 
       
   744     /**
       
   745      * Completes command data
       
   746      *
       
   747      * @since S60 5.0
       
   748      * @return Symbian error code on error, KErrNone otherwise
       
   749      */
       
   750     TInt CompleteCommandData();
       
   751 
       
   752     /**
       
   753      * Adds AT commands set to metadata. Used by function AddImplementationL().
       
   754      *
       
   755      * @since S60 5.0
       
   756      * @param aImplInfo ECOM implementation information from which to create new
       
   757      *                  metadata
       
   758      * @param aAtCmdSet AT command set to add to the metadata
       
   759      *
       
   760      * @return None
       
   761      */
       
   762     void DoAddImplementationL( CImplementationInformation* aImplInfo,
       
   763                                const TDesC8& aAtCmdSet );
       
   764 
       
   765     /**
       
   766      * Removes an implementation from the support data by a given plugin UID.
       
   767      * Used by function RemoveImplementation().
       
   768      *
       
   769      * @since S60 5.0
       
   770      * @param aPluginUid Plugin UID to search from plugin data
       
   771      * @param aSupport Support information to normal or auxiliary plugin data
       
   772      * @return Symbian error code on error, KErrNone otherwise
       
   773      */
       
   774     TInt DoRemoveImplementation( TUid& aPluginUid,
       
   775                                  CArrayFixFlat<TATExtAtCmdSupport>* aSupport );
       
   776 
       
   777     /**
       
   778      * Checks whether or not AT command handling is active
       
   779      *
       
   780      * @since S60 5.0
       
   781      * @return ETrue if command handling is ongoing, EFalse otherwise
       
   782      */
       
   783     TBool IsCommandHandling();
       
   784 
       
   785     /**
       
   786      * Destroys data related to plugins
       
   787      *
       
   788      * @since S60 5.0
       
   789      * @return Symbian error code on error, KErrNone otherwise
       
   790      */
       
   791     TInt DestroyPlugindata();
       
   792 
       
   793     /**
       
   794      * Cancels an active AT command handling operation by reinitializing
       
   795      * internal data, completing the client request message and calling the
       
   796      * plugin's HandleCommandCancel().
       
   797      *
       
   798      * @since S60 5.0
       
   799      * @param aError Completion error code for the command message
       
   800      * @param aCheckLock ETrue if plugin lock check needed, EFalse otherwise
       
   801      * @return Symbian error code on error, KErrNone otherwise
       
   802      */
       
   803     TInt CancelCommandOperation( TInt aError,
       
   804                                  TInt aCheckLock=EFalse );
       
   805 
       
   806     /**
       
   807      * Cancels an active URC message receiving operation by a given plugin
       
   808      * entry, completing the client request message and calling the plugin's
       
   809      * ReceiveUnsolicitedResultCancel().
       
   810      *
       
   811      * @since S60 5.0
       
   812      * @param aPluginEntry The plugin's entry which is cancelled
       
   813      * @param aError Completion error code for the URC message
       
   814      * @param aCheckLock ETrue if plugin lock check needed, EFalse otherwise
       
   815      * @return Symbian error code on error, KErrNone otherwise
       
   816      */
       
   817     TInt CancelOneUrcOperation( TATExtPluginEntry& aPluginEntry,
       
   818                                 TInt aError,
       
   819                                 TInt aCheckLock=EFalse );
       
   820 
       
   821     /**
       
   822      * Destroys data related to AT command support
       
   823      *
       
   824      * @since S60 5.0
       
   825      * @param aSupport Support information to normal or auxiliary plugin data
       
   826      * @return Symbian error code on error, KErrNone otherwise
       
   827      */
       
   828     TInt DestroySupportdata( CArrayFixFlat<TATExtAtCmdSupport>*& aSupport );
       
   829 
       
   830     /**
       
   831      * Extracts one command from a pipe-character delimited command buffer
       
   832      * (Note: This function is used to get the settings from a plugin RSS file)
       
   833      *
       
   834      * @since S60 5.0
       
   835      * @param aCommands Command buffer from where to extract the next subcommand
       
   836      * @param aStartIndex Start index for the found command
       
   837      * @param aEndIndex End index for the found command
       
   838      * @param aSupportType Support's type (M|P|S)
       
   839      * @return Symbian error code on error, KErrNone otherwise
       
   840      */
       
   841     TInt ExtractNextCommand( const TDesC8& aCommands,
       
   842                              TInt& aStartIndex,
       
   843                              TInt& aEndIndex,
       
   844                              TATExtSupportType& aSupportType );
       
   845 
       
   846     /**
       
   847      * Adds a new plugin entry to support data. If command to be added is not
       
   848      * found from the support data then that command is inserted alphabetically
       
   849      * to the support data. After this a search for the plugin UID is done; if
       
   850      * the UID is not found then it is added to the plugin data and a new
       
   851      * initialized data is created for that entry. Finally the added or new
       
   852      * plugin entry is linked to the new or existing support entry.
       
   853      *
       
   854      * @since S60 5.0
       
   855      * @param aAtCmdBase Base AT command which to add to support data
       
   856      *                   (base part without parameters)
       
   857      * @param aPluginUid Plugin's UID to find from plugin data
       
   858      * @param aSupportType Support's type (M|P|S)
       
   859      * @param aCleanupInfo Cleanup information
       
   860      * @return None
       
   861      */
       
   862     void AddEntryToMetadataL( TDes8& aAtCmdBase,
       
   863                               TUid& aPluginUid,
       
   864                               TATExtSupportType aSupportType,
       
   865                               TATExtCleanupInfo& aCleanupInfo );
       
   866 
       
   867     /**
       
   868      * Adds new plugin entry link from plugin support entry to plugin entry
       
   869      *
       
   870      * @since S60 5.0
       
   871      * @param aEntries Plugin entries for support
       
   872      * @param aEntryIndex Plugin index entry
       
   873      * @param aSupportType Support's type (M|P|S)
       
   874      * @param aSearchHelper The search helper
       
   875      * @return Index to the added entry, KErrNotSupported otherwise
       
   876      */
       
   877     TInt AddNewMetadataEntryLinkL(
       
   878         CArrayFixFlat<TATExtOneCmdSupport>*& aEntries,
       
   879         TInt aEntryIndex,
       
   880         TATExtSupportType aSupportType,
       
   881         TATExtSearchHelper& aSearchHelper );
       
   882 
       
   883     /**
       
   884      * Adds new master plugin entry link from plugin support entry to plugin
       
   885      * entry
       
   886      *
       
   887      * @since S60 5.0
       
   888      * @return Index to the added entry, KErrNotSupported otherwise
       
   889      */
       
   890     TInt AddNewMasterMetadataEntryLinkL(
       
   891         CArrayFixFlat<TATExtOneCmdSupport>* aEntries,
       
   892         TATExtSearchHelper& aSearchHelper,
       
   893         TATExtOneCmdSupport& aOneCmdSupport );
       
   894 
       
   895     /**
       
   896      * Adds new primary plugin entry link from plugin support entry to plugin
       
   897      * entry
       
   898      *
       
   899      * @since S60 5.0
       
   900      * @return Index to the added entry, KErrNotSupported otherwise
       
   901      */
       
   902     TInt AddNewPrimaryMetadataEntryLinkL(
       
   903         CArrayFixFlat<TATExtOneCmdSupport>* aEntries,
       
   904         TATExtSearchHelper& aSearchHelper,
       
   905         TATExtOneCmdSupport& aOneCmdSupport );
       
   906 
       
   907     /**
       
   908      * Adds new secondary plugin entry link from plugin support entry to plugin
       
   909      * entry. Search starts from the front as there could be multiple S plugins
       
   910      * but only one or two M/P plugins.
       
   911      *
       
   912      * @since S60 5.0
       
   913      * @return Index to the added entry, KErrNotSupported otherwise
       
   914      */
       
   915     TInt AddNewSecondaryMetadataEntryLinkL(
       
   916         CArrayFixFlat<TATExtOneCmdSupport>* aEntries,
       
   917         TATExtSearchHelper& aSearchHelper,
       
   918         TATExtOneCmdSupport& aOneCmdSupport );
       
   919 
       
   920     /**
       
   921      * Cleans partial created metadata based on TATExtCleanupInfo
       
   922      *
       
   923      * @since S60 5.0
       
   924      * @param aCleanupInfo Cleanup information
       
   925      * @return None
       
   926      */
       
   927     void CleanPartialMetadata( TATExtCleanupInfo& aCleanupInfo );
       
   928 
       
   929     /**
       
   930      * Prints the AT command plugin entries and information about them.
       
   931      * For debugging/bug hunting only
       
   932      *
       
   933      * @since S60 5.0
       
   934      * @param aSupport Support information to normal or auxiliary plugin data
       
   935      * @return Symbian error code on error, KErrNone otherwise
       
   936      */
       
   937     TInt PrintSupportData( CArrayFixFlat<TATExtAtCmdSupport>* aSupport );
       
   938 
       
   939     /**
       
   940      * Prints the found AT command plugin entries and information about them.
       
   941      * For debugging/bug hunting only
       
   942      *
       
   943      * @since S60 5.0
       
   944      * @param aEntries Plugin entries for support
       
   945      * @return Symbian error code on error, KErrNone otherwise
       
   946      */
       
   947     TInt PrintFoundEntries( CArrayFixFlat<TATExtOneCmdSupport>* aEntries );
       
   948 
       
   949     /**
       
   950      * Does a binary search for an AT command to find the AT command from the
       
   951      * support data. Combinations of aFindAuxCmd | aCheckAsterisk:
       
   952      * EFalse | EFalse: Used to find normal command from iSupport
       
   953      * ETrue  | EFalse: Used to create metadata to iSupportAux
       
   954      * EFalse | ETrue : Not possible
       
   955      * ETrue  | ETrue : Used to find metadata from iSupportAux
       
   956      *
       
   957      * @since S60 5.0
       
   958      * @param aAtCmdBase Base AT command to find (base part without parameters)
       
   959      * @param aFoundIndex If positive (found): the index of the found AT command
       
   960      *                    If negative (not found): the index where to add the
       
   961      *                    new AT command
       
   962      * @param aFindAuxCmd ETrue to find an auxiliary command,
       
   963      *                    EFalse to find a normal command
       
   964      * @param aCheckAsterisk ETrue if asterisk mark checking required
       
   965      *                       (needed for normal finding)
       
   966      *                       EFalse if asterisk mark skipping required
       
   967      *                       (needed when creating the metadata)
       
   968      * @return ETrue if support found, EFalse otherwise
       
   969      */
       
   970     TBool FindCommandFromMetadata( TDesC8& aAtCmdBase,
       
   971                                    TInt& aFoundIndex,
       
   972                                    TBool aFindAuxCmd,
       
   973                                    TBool aCheckAsterisk );
       
   974 
       
   975     /**
       
   976      * Finds the first plugin entry from a given plugin UID
       
   977      *
       
   978      * @since S60 5.0
       
   979      * @param aUid UID to find from plugin data
       
   980      * @param aFoundIndex Index to the found plugin entry
       
   981      * @return Found entry for UID, NULL if UID not found
       
   982      */
       
   983     TATExtPluginEntry* FindUidFromPlugindata( TUid& aUid,
       
   984                                               TInt& aFoundIndex );
       
   985 
       
   986     /**
       
   987      * Find the first plugin entry from a given plugin instance
       
   988      *
       
   989      * @since S60 5.0
       
   990      * @param aInstance An instance to find from plugin data
       
   991      * @return Found entry for instance, NULL if instance not found
       
   992      */
       
   993     TATExtPluginEntry* FindInstanceFromPlugindata(
       
   994         CATExtPluginBase* aInstance );
       
   995 
       
   996     /**
       
   997      * Finds an Urc message processing plugin. Must be used in synchronization
       
   998      * with MarkUrcHandlingOwnership(). More information in aPluginUid
       
   999      * parameter's explanation below.
       
  1000      *
       
  1001      * @since S60 5.0
       
  1002      * @param aPluginUid Urc plugin UID to find; if not TUid::Null() then
       
  1003      *                   aPluginUid must match plugin data's entry and the data
       
  1004      *                   must be started and owned plugin.
       
  1005      *                   Otherwise, if aPluginUid is TUid:Null() then plugin
       
  1006      *                   data's entry must not be started or owned.
       
  1007      * @return Found URC processing plugin, NULL if not found
       
  1008      */
       
  1009     TATExtPluginEntry* FindUrcProcessingPlugin( TUid& aPluginUid );
       
  1010 
       
  1011     /**
       
  1012      * Extracts the base command from a given AT command to find support with
       
  1013      * DoCreateAndFindSupportL()
       
  1014      *
       
  1015      * @since S60 5.0
       
  1016      * @param aAtCmdFull Full AT command for which to check the support
       
  1017      *                   (base part + parameters)
       
  1018      * @param aMessage Client request message for reading
       
  1019      * @param aComplInfo Completion information for the handled command
       
  1020      * @return None
       
  1021      */
       
  1022     void CreateAndFindSupportL(
       
  1023         TDesC8& aAtCmdFull,
       
  1024         const RMessage2& aMessage,
       
  1025         TATExtCompletionInfo& aComplInfo );
       
  1026 
       
  1027     /**
       
  1028      * Creates AT command support and finds the given AT command from the
       
  1029      * created support data
       
  1030      *
       
  1031      * @since S60 5.0
       
  1032      * @param aAtCmdBase Base AT command to find from support data
       
  1033      *                   (base part without parameters)
       
  1034      * @param aAtCmdFull Full AT command for which to check the support
       
  1035      *                   (base part + parameters)
       
  1036      * @param aMessage Client request message for reading
       
  1037      * @param aComplInfo Completion information for the handled command
       
  1038      * @return None
       
  1039      */
       
  1040     void DoCreateAndFindSupportL(
       
  1041         TDesC8& aAtCmdBase,
       
  1042         TDesC8& aAtCmdFull,
       
  1043         const RMessage2& aMessage,
       
  1044         TATExtCompletionInfo& aComplInfo );
       
  1045 
       
  1046     /**
       
  1047      * Prepares internal data for completion with "" or "ERROR" messages.
       
  1048      * More explation in CreateEmptyOrErrorBuffer().
       
  1049      *
       
  1050      * @since S60 5.0
       
  1051      * @param aMessage Client request message for reading
       
  1052      * @return None
       
  1053      */
       
  1054     void CreateSelfReplyData( const RMessage2& aMessage );
       
  1055 
       
  1056     /**
       
  1057      * Handles support when a master plugin is detected in the plugin data
       
  1058      * via support data's link (support for a full AT command). If a master
       
  1059      * plugin is detected then reply is detected from that plugin. No further
       
  1060      * sending to primary or secondary plugins is repformed.
       
  1061      *
       
  1062      * @since S60 5.0
       
  1063      * @param aEntrySupport Support data to the first found master plugin
       
  1064      * @param aReplyExpected ETrue if reply is expected from the master plugin,
       
  1065      *                       EFalse if no reply is expected from the master plugin,
       
  1066      *                       (i.e. no support found)
       
  1067      * @return ETrue if support found, EFalse otherwise
       
  1068      */
       
  1069     TBool HandleMasterPluginSupportL( TATExtEntrySupport& aEntrySupport,
       
  1070                                       TBool& aReplyExpected );
       
  1071 
       
  1072     /**
       
  1073      * Handles support when a primary plugin is detect in the plugin data
       
  1074      * via support data's link. If a primary plugin is detected then reply is
       
  1075      * expected from that plugin. Also if one or more secondary plugins are
       
  1076      * detected then no reply is expected from them.
       
  1077      *
       
  1078      * @since S60 5.0
       
  1079      * @param aEntrySupport Support data to the first found primary plugin
       
  1080      * @param aStartIndex Start index to search the next secondary plugin
       
  1081      * @param aReplyExpected ETrue if reply is expected from the primary plugin,
       
  1082      *                       EFalse if no reply is expected from the primary plugin,
       
  1083      *                       (i.e. no support found)
       
  1084      * @return ETrue if support found, EFalse otherwise
       
  1085      */
       
  1086     TBool HandlePrimaryPluginSupportL( TATExtEntrySupport& aEntrySupport,
       
  1087                                        TInt aStartIndex,
       
  1088                                        TBool& aReplyExpected );
       
  1089 
       
  1090     /**
       
  1091      * Handles support when a secondary plugin is detected in the plugin data
       
  1092      * via support data's link. If only one secondary plugin is detected then
       
  1093      * reply is expected from that plugin. Instead, if more than one secondary
       
  1094      * plugins are detected then no reply is expected from them.
       
  1095      *
       
  1096      * @since S60 5.0
       
  1097      * @param aEntrySupport Support data to the first found secondary plugin
       
  1098      *                      entry
       
  1099      * @param aStartIndex Start index to search the next secondary plugin
       
  1100      * @param aReplyExpected ETrue if reply is expected from one or more plugins,
       
  1101      *                       EFalse if no reply is expected from any of the plugins
       
  1102      * @return ETrue if support found, EFalse otherwise
       
  1103      */
       
  1104     TBool HandleSecondaryPluginSupportL( TATExtEntrySupport& aEntrySupport,
       
  1105                                          TInt aStartIndex,
       
  1106                                          TBool& aReplyExpected );
       
  1107 
       
  1108     /**
       
  1109      * Finds support entries from support data for a given base AT command
       
  1110      *
       
  1111      * @since S60 5.0
       
  1112      * @param aAtCmdBase Base AT command for which to find the entries
       
  1113      *                   (base part without parameters)
       
  1114      * @return Found support entry array, NULL if not found
       
  1115      */
       
  1116     CArrayFixFlat<TATExtOneCmdSupport>* FindEntriesForCommandLC(
       
  1117         TDesC8& aAtCmdBase );
       
  1118 
       
  1119     /**
       
  1120      * Instantiates plugin support
       
  1121      *
       
  1122      * @since S60 5.0
       
  1123      * @param aEntrySupport Entry support data for which to instantiate the
       
  1124      *                      plugin
       
  1125      * @return None
       
  1126      */
       
  1127     void InstantiatePluginSupportL( TATExtEntrySupport& aEntrySupport );
       
  1128 
       
  1129     /**
       
  1130      * Instantiates a plugin
       
  1131      *
       
  1132      * @since S60 5.0
       
  1133      * @param aEntrySupport Plugin entry for which to instantiate
       
  1134      * @return None
       
  1135      */
       
  1136     void InstantiatePluginL( TATExtPluginEntry& aPluginEntry );
       
  1137 
       
  1138     /**
       
  1139      * Instantiates a plugin
       
  1140      *
       
  1141      * @since S60 5.0
       
  1142      * @param aEntrySupport Plugin entry for which to instantiate
       
  1143      * @return Leave value from InstantiatePluginL()
       
  1144      */
       
  1145     TInt InstantiatePlugin( TATExtPluginEntry& aPluginEntry );
       
  1146 
       
  1147     /**
       
  1148      * Handles an AT command support request
       
  1149      *
       
  1150      * @since S60 5.0
       
  1151      * @param aEntrySupport Entry support data to a position where to send the
       
  1152      *                      AT command for support checking
       
  1153      * @param aAtCmdFull Full AT command for which to check the support
       
  1154      *                   (base part + parameters)
       
  1155      * @return ETrue if support found, EFalse otherwise
       
  1156      */
       
  1157     TBool HandleCommandSupportL( TATExtEntrySupport& aEntrySupport,
       
  1158                                  const TDesC8* aAtCmdFull=NULL );
       
  1159 
       
  1160     /**
       
  1161      * Handles an AT command
       
  1162      *
       
  1163      * @since S60 5.0
       
  1164      * @param aEntrySupport Entry support data to a position where to send the
       
  1165      *                      AT command for handling
       
  1166      * @param aReplyNeeded ETrue if reply expected from the plugin,
       
  1167      *                     EFalse otherwise
       
  1168      * @param aAtCmdFull Full AT command to handle (base part + parameters)
       
  1169      * @return None
       
  1170      */
       
  1171     void HandleCommandL( TATExtEntrySupport& aEntrySupport,
       
  1172                          TBool aReplyNeeded,
       
  1173                          const TDesC8* aAtCmdFull=NULL );
       
  1174 
       
  1175     /**
       
  1176      * Sends an AT commands to multiple secondary plugins, starting from a
       
  1177      * given position.
       
  1178      *
       
  1179      * @since S60 5.0
       
  1180      * @param aEntrySupport Entry support data to position from where to start
       
  1181      *                      sending to the found secondary plugins
       
  1182      * @param aAtCmdFull Full AT command to send (base part + parameters)
       
  1183      * @return None
       
  1184      */
       
  1185     void SendToMultipleSecondaryL( TATExtEntrySupport& aEntrySupport,
       
  1186                                    const TDesC8* aAtCmdFull );
       
  1187 
       
  1188     /**
       
  1189      * Finds the first secondary plugin support from a given starting position
       
  1190      *
       
  1191      * @since S60 5.0
       
  1192      * @param aEntrySupport Entry support data to the next entry after the found
       
  1193      *                      secondary plugin entry; marks the start for search
       
  1194      * @return ETrue if support found, EFalse otherwise
       
  1195      */
       
  1196     TBool FindFirstSecondarySupportL( TATExtEntrySupport& aEntrySupport );
       
  1197 
       
  1198     /**
       
  1199      * Extracts one NVRAM entry from a pipe-character delimited NVRAM buffer
       
  1200      *
       
  1201      * @since S60 5.0
       
  1202      * @param aNvram NVRAM setting buffer from where to extract the next
       
  1203      *               subsetting
       
  1204      * @param aStartIndex Start index for the found NVRAM setting
       
  1205      * @param aEndIndex End index for the found NVRAM setting
       
  1206      * @return ETrue if setting found, EFalse otherwise
       
  1207      */
       
  1208     TBool ExtractNextNvramSetting( const TDesC8& aNvram,
       
  1209                                    TInt& aStartIndex,
       
  1210                                    TInt& aEndIndex );
       
  1211 
       
  1212     /**
       
  1213      * Gets the next command from support or auxiliary support data.
       
  1214      *
       
  1215      * @since S60 5.0
       
  1216      * @param aFirstSearch If ETrue the search is done from the start,
       
  1217      *                     If EFalse the search continues from the old position.
       
  1218      * @param aSupportFind Index for finding support entries
       
  1219      * @param aFindInAux Flag to indicate whether or not iSupportFind is inside
       
  1220      *                   iSupportAux
       
  1221      * @return Found command if not NULL, NULL otherwise
       
  1222      */
       
  1223     HBufC8* GetNextSupportedCommand( TBool& aFirstSearch,
       
  1224                                      TInt& aSupportFind,
       
  1225                                      TBool& aFindInAux );
       
  1226 
       
  1227     /**
       
  1228      * Reads an AT command from a client request message and creates buffer
       
  1229      * locally. For HandleCommand().
       
  1230      *
       
  1231      * @since S60 5.0
       
  1232      * @param aMessage Client request message for reading
       
  1233      * @return Symbian error code on error, KErrNone otherwise
       
  1234      */
       
  1235     TInt ReadCommandFromMessage( const RMessage2& aMessage );
       
  1236 
       
  1237     /**
       
  1238      * Creates a buffer with "ERROR" or "" string in it; needed for
       
  1239      * creating a reply to an unknown command (i.e. when no plugin supports
       
  1240      * the "base" part of a command) or to the case when plugin support exists
       
  1241      * but reply is not expected from them.
       
  1242      *
       
  1243      * @since S60 5.0
       
  1244      * @param aBuffer Buffer where to create the error or empty buffer
       
  1245      * @param aErrorReply ETrue if error reply needed, EFalse if empty buffer
       
  1246      * @return Symbian error code on error, KErrNone otherwise
       
  1247      */
       
  1248     TInt CreateEmptyOrErrorBuffer( RBuf8& aBuffer,
       
  1249                                    TBool aErrorReply );
       
  1250 
       
  1251     /**
       
  1252      * Writes specified input reply buffer to a client request message at
       
  1253      * given message slot number.
       
  1254      *
       
  1255      * @since S60 5.0
       
  1256      * @param aBuffer Input buffer to write to aDataSlot
       
  1257      * @param aDataSlot Message slot where to write the buffer
       
  1258      * @param aMessage Client request message for writing
       
  1259      * @param aReportNextLength ETrue if length reporting needed,
       
  1260      *                          EFalse otherwise
       
  1261      *                          This tells length of the next available
       
  1262      *                          buffer length for GetNextPartOfReply()
       
  1263      * @param aLengthSlot Message slot where to write the length if
       
  1264      *                    aReportNextLength is ETrue. Not used if
       
  1265      *                    aReportNextLength is EFalse.
       
  1266      * @return Symbian error code on error, KErrNone otherwise
       
  1267      */
       
  1268     TInt WriteReplyBufferToClient( const TDesC8& aBuffer,
       
  1269                                    TInt aDataSlot,
       
  1270                                    const RMessage2& aMessage,
       
  1271                                    TBool aReportNextLength=EFalse,
       
  1272                                    TInt aLengthSlot=KErrNotFound );
       
  1273 
       
  1274 private:  // data
       
  1275 
       
  1276     /**
       
  1277      * ECOM session; used for getting ECOM implementation information.
       
  1278      */
       
  1279     REComSession& iEComSession;
       
  1280 
       
  1281     /**
       
  1282      * ECOM plugin notification event listener.
       
  1283      * Not own.
       
  1284      */
       
  1285     CATExtListen* iListener;
       
  1286 
       
  1287     /**
       
  1288      * Plugin observer (via the parent).
       
  1289      * Needed for plugin instantiation.
       
  1290      */
       
  1291     MATExtPluginObserver& iObserver;
       
  1292 
       
  1293     /**
       
  1294      * Required interface UID of a connection (set in Connect()).
       
  1295      * This UID is used to find the plugin implementation.
       
  1296      */
       
  1297     TUid iIfUid;
       
  1298 
       
  1299     /**
       
  1300      * This connection's identifier name
       
  1301      */
       
  1302     RBuf8 iConnectionName;
       
  1303 
       
  1304     /**
       
  1305      * Support information to plugin data. When supported AT command
       
  1306      * is found then link from iSupport to iPluginData is created and
       
  1307      * AT command is stored to iSupport in alphabetical order.
       
  1308      * Own.
       
  1309      */
       
  1310     CArrayFixFlat<TATExtAtCmdSupport>* iSupport;
       
  1311 
       
  1312     /**
       
  1313      * Support information to auxiliary plugin data (i.e. asterisk mark
       
  1314      * terminated plugin data). When supported AT command is found then
       
  1315      * link from iSupport to iPluginData is created and AT command is
       
  1316      * stored to iSupport in alphabetical order.
       
  1317      * Own.
       
  1318      */
       
  1319     CArrayFixFlat<TATExtAtCmdSupport>* iSupportAux;
       
  1320 
       
  1321     /**
       
  1322      * Information about plugins and plugin-based operation data.
       
  1323      * Own.
       
  1324      */
       
  1325     CArrayFixFlat<TATExtPluginEntry>* iPluginData;
       
  1326 
       
  1327     /**
       
  1328      * Data related to AT command handling.
       
  1329      */
       
  1330     TATExtCommandData iCmdData;
       
  1331 
       
  1332     /**
       
  1333      * Carriage return character.
       
  1334      * Needed for "ERROR" reply when no support found.
       
  1335      * (i.e. when no plugin supports the "base" part).
       
  1336      */
       
  1337     TChar iCarriageReturn;
       
  1338 
       
  1339     /**
       
  1340      * Line feed character.
       
  1341      * Needed for "ERROR" reply when no support found.
       
  1342      * (i.e. when no plugin supports the "base" part).
       
  1343      */
       
  1344     TChar iLineFeed;
       
  1345 
       
  1346     /**
       
  1347      * Backspace character.
       
  1348      * Needed only for reporting to change to plugins.
       
  1349      */
       
  1350     TChar iBackspace;
       
  1351 
       
  1352     /**
       
  1353      * Flag indicating whether quiet mode is on or off (ATQ)
       
  1354      */
       
  1355     TBool iQuietMode;
       
  1356 
       
  1357     /**
       
  1358      * Flag indicating whether verbose mode is on or off (ATV)
       
  1359      */
       
  1360     TBool iVerboseMode;
       
  1361 
       
  1362     /**
       
  1363      * Index for finding support entries.
       
  1364      * Used by GetNextSpecialCommand().
       
  1365      */
       
  1366     TInt iSupportAuxFind;
       
  1367 
       
  1368     /**
       
  1369      * Flag indicating whether shutdown is ongoing or not
       
  1370      */
       
  1371     TBool iShutdown;
       
  1372 
       
  1373     };
       
  1374 
       
  1375 #endif  // C_CATEXTMETADATA_H