coreapplicationuis/ATCmdPlugin/inc/atcmdplugin.h
changeset 21 c4cbaa4fb734
equal deleted inserted replaced
0:2e3d3ce01487 21:c4cbaa4fb734
       
     1 
       
     2 /*
       
     3  * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4  * All rights reserved.
       
     5  * This component and the accompanying materials are made available
       
     6  * under the terms of "Eclipse Public License v1.0"
       
     7  * which accompanies this distribution, and is available
       
     8  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  * Description : ATCmdplugin class declaration.
       
    14  *
       
    15  */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef __ATCMDPLUGINECOM_H
       
    20 #define __ATCMDPLUGINECOM_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <atextpluginbase.h>
       
    24 #include <w32std.h>
       
    25 #include <hwrmlight.h>
       
    26 #include "matcmdtimer.h"
       
    27 #include "atcmd.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CCoeEnv;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  CATCmdPluginEcom
       
    36 *  -
       
    37 */
       
    38 class CATCmdPluginEcom : public CATExtPluginBase, public MATCmdTimer, public MHWRMLightObserver
       
    39   	{
       
    40   	public: // Constructors, destructor
       
    41         /**
       
    42         * Two-phased constructor.
       
    43         */
       
    44         static CATCmdPluginEcom* NewL();
       
    45         
       
    46         /**
       
    47         * C++ Destructor.
       
    48         */
       
    49         ~CATCmdPluginEcom();
       
    50         
       
    51         /**
       
    52          * From MHWRMLightObserver
       
    53          */
       
    54         void LightStatusChanged (TInt aTarget, CHWRMLight::TLightStatus aStatus);
       
    55         
       
    56         void HandleCommandCancel();
       
    57         
       
    58         void ReportConnectionName( const TDesC8& aName );
       
    59         
       
    60         
       
    61         TInt NextReplyPartLength();
       
    62 
       
    63         /**
       
    64          * Gets the next part of reply initially set by HandleCommandComplete().
       
    65          * Length of aNextReply must be equal or less than KDefaultCmdBufLength.
       
    66          *
       
    67          * @since S60 5.0
       
    68          * @param aNextReply Next reply
       
    69          * @return Symbian error code on error, KErrNone otherwise
       
    70          */
       
    71         TInt GetNextPartOfReply( RBuf8& aNextReply ) ;
       
    72 
       
    73         /**
       
    74          * Receives unsolicited results. Cancelling of the pending request is done
       
    75          * by ReceiveUnsolicitedResultCancel(). The implementation in the extension
       
    76          * plugin should be asynchronous.
       
    77          *
       
    78          * @since S60 5.0
       
    79          * @return None
       
    80          */
       
    81         void ReceiveUnsolicitedResult();
       
    82 
       
    83         /**
       
    84          * Cancels a pending ReceiveUnsolicitedResult request.
       
    85          *
       
    86          * @since S60 5.0
       
    87          * @return None
       
    88          */
       
    89         void ReceiveUnsolicitedResultCancel();
       
    90 
       
    91         /**
       
    92          * Reports NVRAM status change to the plugins.
       
    93          *
       
    94          * @since S60 5.0
       
    95          * @param aNvram New NVRAM status. Each call of this function is a result
       
    96          *               of DUN extracting the form notified by
       
    97          *               CATExtCommonBase::SendNvramStatusChange(). Each of the
       
    98          *               settings from SendNvramStatusChange() is separated to
       
    99          *               one call of ReportNvramStatusChange().
       
   100          * @return None
       
   101          */
       
   102         void ReportNvramStatusChange( const TDesC8& aNvram );
       
   103 
       
   104         /**
       
   105          * Reports about external handle command error condition.
       
   106          * This is for cases when for example DUN decided the reply contained an
       
   107          * error condition but the plugin is still handling the command internally.
       
   108          * Example: in command line "AT+TEST;ATDT1234" was given. "AT+TEST" returns
       
   109          * "OK" and "ATDT" returns "CONNECT". Because "OK" and "CONNECT" are
       
   110          * different reply types the condition is "ERROR" and DUN ends processing.
       
   111          * This solution keeps the pointer to the last AT command handling plugin
       
   112          * inside ATEXT and calls this function there to report the error.
       
   113          * It is to be noted that HandleCommandCancel() is not sufficient to stop
       
   114          * the processing as the command handling has already finished.
       
   115          *
       
   116          * @since S60 5.0
       
   117          * @return None
       
   118          */
       
   119         void ReportExternalHandleCommandError();
       
   120 
       
   121 
       
   122         
       
   123         enum TPluginStatus
       
   124             {
       
   125             ECmdCkpd,
       
   126             ECmdCbklt,
       
   127             EKeepAlive
       
   128             };
       
   129             
       
   130         enum TLightStatus
       
   131             {
       
   132             ELightUninitialized = -1,
       
   133             ELightOff = 0,
       
   134             ELightOnWithDuration,
       
   135             ELightOn
       
   136             };
       
   137 
       
   138     private: // From base classes
       
   139 
       
   140         // @see CCFActionPlugIn
       
   141         void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
       
   142 
       
   143         // @see CCFActionPlugIn
       
   144         TBool IsCommandSupported( const TDesC8& aCmd );
       
   145 
       
   146     private: // New implementation
       
   147 
       
   148         /**
       
   149         * AT commands handling
       
   150         * @param aCmd
       
   151         * @param aReply
       
   152         */
       
   153         void HandleCommandL( const TDesC8& aCmd );                          
       
   154 
       
   155 
       
   156     private: // CATCmdTimer
       
   157 		/**
       
   158         * CATCmdTimer
       
   159         */
       
   160 	    class CATCmdTimer
       
   161 	        : public CTimer
       
   162 		    {
       
   163 	        public: // Constructor, destructor
       
   164 		        /**
       
   165                 * Constructor
       
   166                 */
       
   167 		        CATCmdTimer( MATCmdTimer& aObserver, TInt aRelatedCommand );
       
   168 
       
   169 		        /**
       
   170                 * 2nd phase constructor
       
   171                 */
       
   172 		        void ConstructL();
       
   173 
       
   174 	        public: // from CActive
       
   175 		        /**
       
   176                 * Timer callback
       
   177                 */
       
   178 		        virtual void RunL();
       
   179 		        
       
   180 		    private: // data
       
   181 		        /** */
       
   182 		        MATCmdTimer& iObserver;
       
   183 		        TInt iRelatedCommand;
       
   184 		    };
       
   185     
       
   186     private: // from MATCmdTimer
       
   187         void TimerExpiredL( TInt aRelatedCommand );
       
   188         
       
   189     private:
       
   190         void LoadResourcesL();
       
   191 
       
   192         void HandleCkpdCommandL( const TDesC8& aCmd );
       
   193         
       
   194         void HandleCbkltCommandL( const TDesC8& aCmd );
       
   195         void HandleCtsaCommandL( const TDesC8& aCmd );
       
   196 
       
   197         void ParseParametersL( const TDesC8& aCmd, 
       
   198                                TInt& aStrokeTime, 
       
   199                                TInt& aStrokeDelay );
       
   200 
       
   201         void SendKeyL();
       
   202 
       
   203         void SendNextKeyL();
       
   204 
       
   205         void SimulateRawEventL( TKeyEvent& aKey, TEventCode aEvent  );
       
   206         
       
   207         void EnableBackLight();
       
   208         
       
   209         void DisableBackLight();
       
   210         
       
   211     private:
       
   212 		/**
       
   213         * @param aCmd
       
   214         */
       
   215         //void ATCmdPNDRecv( CATCommand& aCmd );
       
   216 
       
   217     private: // Constructors
       
   218         /**
       
   219         * C++ Constructor
       
   220         */
       
   221         CATCmdPluginEcom();
       
   222 
       
   223         /**
       
   224         * Symbian 2nd phase constructor
       
   225         */
       
   226         void ConstructL();
       
   227 
       
   228     private: // Data
       
   229         /** Owns: */
       
   230         CArrayFix<TATCkpdCmd>* iCkpdCmdArray;
       
   231 
       
   232         /** Owns: */
       
   233         CATCmdTimer* iKpdTimer;
       
   234         
       
   235         CATCmdTimer* iBkltTimer;
       
   236         
       
   237         CATCmdTimer* iKeepAliveTimer;
       
   238         
       
   239         /** Owns: */
       
   240         CArrayPtr<CATCmdTranslation>* iTranslations;
       
   241 
       
   242         TEventCode iLastEvent;
       
   243         
       
   244         /** Owns: */
       
   245         CHWRMLight* iLight;
       
   246         
       
   247         RWsSession iWsSession;
       
   248         
       
   249         TPluginStatus iCmdReceived;
       
   250         
       
   251         TLightStatus iLightStatus;
       
   252         
       
   253         TInt iDuration;
       
   254         
       
   255         RBuf8* iReplyBuf;
       
   256     };
       
   257 
       
   258 #endif // __ATCMDPLUGINECOM_H
       
   259 
       
   260 // End of File