localconnectivityservice/lccustomplugin/inc/lccustomplugin.h
branchRCL_3
changeset 7 a2f12998bb04
parent 0 c3e98f10fcf4
equal deleted inserted replaced
5:11d83199e2d9 7:a2f12998bb04
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 *
    13 *
    14 * Description:  Main handler for incoming requests
    14 * Description:  Main handler for incoming requests
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 #ifndef C_LCCUSTOMPLUGIN_H
    18 #ifndef C_LCCUSTOMPLUGIN_H
    20 #define C_LCCUSTOMPLUGIN_H
    19 #define C_LCCUSTOMPLUGIN_H
    21 
    20 
    22 #include <atextpluginbase.h>
    21 #include <atextpluginbase.h>
    23 
    22 
    24 class CLcCustomPlugin;
    23 class CLcCustomPlugin;
    25 
    24 
       
    25 /** Character types: carriage return, line feed or backspace */
    26 enum TCharacterTypes
    26 enum TCharacterTypes
    27     {
    27     {
    28     ECharTypeCR,  // Carriage return
    28     ECharTypeCR,  // Carriage return
    29     ECharTypeLF,  // Line feed
    29     ECharTypeLF,  // Line feed
    30     ECharTypeBS   // Backspace
    30     ECharTypeBS   // Backspace
    31     };
    31     };
    32 
    32 
       
    33 /** Type of modes (quiet, verbose) */
    33 enum TModeTypes
    34 enum TModeTypes
    34     {
    35     {
    35     EModeTypeQuiet,   // Quiet mode
    36     EModeTypeQuiet,   // Quiet mode
    36     EModeTypeVerbose  // Verbose mode
    37     EModeTypeVerbose  // Verbose mode
       
    38     };
       
    39 
       
    40 /**  Handler types for the four types */
       
    41 enum TCmdHandlerType
       
    42     {
       
    43     ECmdHandlerTypeUndefined = KErrNotFound,
       
    44     ECmdHandlerTypeBase      = 0x01,  // For command "AT+COMMAND"
       
    45     ECmdHandlerTypeSet       = 0x02,  // For command "AT+COMMAND="
       
    46     ECmdHandlerTypeRead      = 0x04,  // For command "AT+COMMAND?"
       
    47     ECmdHandlerTypeTest      = 0x08,  // For command "AT+COMMAND=?"
       
    48     };
       
    49 
       
    50 /**  Detected commands */
       
    51 enum TDetectedCmd
       
    52     {
       
    53     EDetectedCmdUndefined,
       
    54     EDetectedCmdCLAC  // For command "AT+CLAC"
    37     };
    55     };
    38 
    56 
    39 /**
    57 /**
    40  *  Class for common AT command handler interface
    58  *  Class for common AT command handler interface
    41  *
    59  *
   114      * Creates an AT command reply based on the reply type and completes the
   132      * Creates an AT command reply based on the reply type and completes the
   115      * request to ATEXT. Uses iReplyBuffer for reply storage.
   133      * request to ATEXT. Uses iReplyBuffer for reply storage.
   116      *
   134      *
   117      * @since S60 5.0
   135      * @since S60 5.0
   118      * @param aReplyType Type of reply
   136      * @param aReplyType Type of reply
   119      * @param aDstBuffer Destination buffer; used for the API requiring the
       
   120      *                   AT command reply
       
   121      * @param aSrcBuffer Source buffer; used only if aReplyType is EReplyTypeOther
   137      * @param aSrcBuffer Source buffer; used only if aReplyType is EReplyTypeOther
   122      * @param aError Completion code. If not KErrNone then other arguments are
   138      * @param aError Completion code. If not KErrNone then other arguments are
   123      *               ignored and the request is completed to ATEXT with
   139      *               ignored and the request is completed to ATEXT with
   124      *               EReplyTypeUndefined.
   140      *               EReplyTypeUndefined.
   125      * @return None
   141      * @return None
   126      */
   142      */
   127     virtual TInt CreateReplyAndComplete( TATExtensionReplyType aReplyType,
   143     virtual TInt CreateReplyAndComplete( TATExtensionReplyType aReplyType,
   128                                          RBuf8& aDstBuffer,
       
   129                                          const TDesC8& aSrcBuffer=KNullDesC8,
   144                                          const TDesC8& aSrcBuffer=KNullDesC8,
   130                                          TInt aError=KErrNone ) = 0;
   145                                          TInt aError=KErrNone ) = 0;
   131 
   146 
   132     /**
   147     /**
   133      * Creates a buffer for "OK" or "ERROR" reply based on the line settings
   148      * Creates a buffer for "OK" or "ERROR" reply based on the line settings
   138      *                 EFalse if "ERROR" reply needed
   153      *                 EFalse if "ERROR" reply needed
   139      * @return Symbian error code on error, KErrNone otherwise
   154      * @return Symbian error code on error, KErrNone otherwise
   140      */
   155      */
   141     virtual TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
   156     virtual TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
   142                                        TBool aOkReply ) = 0;
   157                                        TBool aOkReply ) = 0;
       
   158 
       
   159     /**
       
   160      * Checks if the command is a base, set, read or test type of command
       
   161      *
       
   162      * @since TB9.2
       
   163      * @param aCmdBase Base part of the command to check
       
   164      * @param aCmdFull Full command to check
       
   165      * @return Type of command
       
   166      */
       
   167     virtual TCmdHandlerType CheckCommandType( const TDesC8& aCmdBase,
       
   168                                               const TDesC8& aCmdFull ) = 0;
   143 
   169 
   144     /**
   170     /**
   145      * Returns the array of supported commands
   171      * Returns the array of supported commands
   146      *
   172      *
   147      * @since S60 5.0
   173      * @since S60 5.0
   345      * Creates an AT command reply based on the reply type and completes the
   371      * Creates an AT command reply based on the reply type and completes the
   346      * request to ATEXT. Uses iReplyBuffer for reply storage.
   372      * request to ATEXT. Uses iReplyBuffer for reply storage.
   347      *
   373      *
   348      * @since S60 5.0
   374      * @since S60 5.0
   349      * @param aReplyType Type of reply
   375      * @param aReplyType Type of reply
   350      * @param aDstBuffer Destination buffer; used for the API requiring the
       
   351      *                   AT command reply
       
   352      * @param aSrcBuffer Source buffer; used only if aReplyType is EReplyTypeOther
   376      * @param aSrcBuffer Source buffer; used only if aReplyType is EReplyTypeOther
   353      * @param aError Completion code. If not KErrNone then other arguments are
   377      * @param aError Completion code. If not KErrNone then other arguments are
   354      *               ignored and the request is completed to ATEXT with
   378      *               ignored and the request is completed to ATEXT with
   355      *               EReplyTypeUndefined.
   379      *               EReplyTypeUndefined.
   356      * @return None
   380      * @return None
   357      */
   381      */
   358     TInt CreateReplyAndComplete( TATExtensionReplyType aReplyType,
   382     TInt CreateReplyAndComplete( TATExtensionReplyType aReplyType,
   359                                  RBuf8& aDstBuffer,
       
   360                                  const TDesC8& aSrcBuffer=KNullDesC8,
   383                                  const TDesC8& aSrcBuffer=KNullDesC8,
   361                                  TInt aError=KErrNone );
   384                                  TInt aError=KErrNone );
   362 
   385 
   363     /**
   386     /**
   364      * From MLcCustomPlugin.
   387      * From MLcCustomPlugin.
   373     TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
   396     TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
   374                                TBool aOkReply );
   397                                TBool aOkReply );
   375 
   398 
   376     /**
   399     /**
   377      * From MLcCustomPlugin.
   400      * From MLcCustomPlugin.
       
   401      * Checks if the command is a base, set, read or test type of command
       
   402      *
       
   403      * @since S60 5.0
       
   404      * @param aCmdBase Base part of the command to check
       
   405      * @param aCmdFull Full command to check
       
   406      * @return Type of command
       
   407      */
       
   408     TCmdHandlerType CheckCommandType( const TDesC8& aCmdBase,
       
   409                                       const TDesC8& aCmdFull );
       
   410 
       
   411     /**
       
   412      * From MLcCustomPlugin.
   378      * Returns the array of supported commands
   413      * Returns the array of supported commands
   379      *
   414      *
   380      * @since S60 5.0
   415      * @since S60 5.0
   381      * @param aCmd Array of supported commands
   416      * @param aCmd Array of supported commands
   382      * @return Symbian error code on error, KErrNone otherwise
   417      * @return Symbian error code on error, KErrNone otherwise
   418      * Used when IsCommandSupported() detects a matching handler class.
   453      * Used when IsCommandSupported() detects a matching handler class.
   419      */
   454      */
   420     CLcCustomPluginBase* iHandler;
   455     CLcCustomPluginBase* iHandler;
   421 
   456 
   422     /**
   457     /**
       
   458      * Buffer for handle command's command
       
   459      * Not own.
       
   460      */
       
   461     const TDesC8* iHcCmd;
       
   462 
       
   463     /**
       
   464      * Buffer for handle command reply
       
   465      * Not own.
       
   466      */
       
   467     RBuf8* iHcReply;
       
   468 
       
   469     /**
   423      * Global reply buffer for the AT command replies
   470      * Global reply buffer for the AT command replies
   424      */
   471      */
   425     RBuf8 iReplyBuffer;
   472     RBuf8 iReplyBuffer;
   426 
   473 
   427     };
   474     };