adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodemathandler.h
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMODEMATHANDLER_H
       
    21 #define CMODEMATHANDLER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include "mmodematobserver.h"
       
    25 
       
    26 const TInt KMaxDteIdCount(10);
       
    27 const TInt KPluginCount(2); //atext & common plugin
       
    28 const TInt KMaxNumOfTransactionIds(256);
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CModemAtSrv;
       
    32 class RIscApi;
       
    33 class TIsiReceiveC;
       
    34 class MMtiWrapperService;
       
    35 class CModemAtPipeController;
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  CModemAtHandler
       
    42 *  CModemAtHandler receives AT-commands from CModemATSession andsends AT-command to the AT-modem. 
       
    43 *  CModemAtHandler communicates with AT modem by ISI-messages. Also pipemessages and name-service messages
       
    44 *   are sent/received by CModemAtHandler. Pipe- and nameservice messages are forwarded to the CModemAtPipeController. 
       
    45 */
       
    46 
       
    47 class CModemAtHandler : public CActive
       
    48     {
       
    49 public:
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      * @param aServer
       
    53      * @return Instance of self
       
    54      */
       
    55     static CModemAtHandler* NewL( CModemAtSrv& aServer );
       
    56 
       
    57     /**
       
    58      * Destructor.
       
    59      */
       
    60     ~CModemAtHandler();
       
    61     
       
    62     /**
       
    63      * Sends AT-command to Modem AT-server
       
    64      * @param aDteId 
       
    65      * @param aPluginType AText/Common
       
    66      * @param aMessageType 0=normal, 1=getnvram status
       
    67      * @param aCmd AT-command
       
    68      */
       
    69     TInt SendATCommand(
       
    70         const TUint8 aDteId,
       
    71         const TATPluginInterface aPluginType,
       
    72         const TUint8 aMessageType,
       
    73         const TDesC8& aCmd );
       
    74 
       
    75     /**
       
    76       *  Connects Handler to modem with specific dteid.
       
    77       *  @param TUint8 aDteId
       
    78       *  @return KErrNone or
       
    79 	  *  @return KErrNoMemory
       
    80       */
       
    81 
       
    82     TInt Connect( const TUint8 aDteId );
       
    83 
       
    84     /**
       
    85      *  Disconnects handler from modem
       
    86      *  @param TUint8 aDteId
       
    87      *  @return Disconnect status
       
    88      */
       
    89     TInt Disconnect( const  TUint8 aDteId );
       
    90     TBool IsDisconnected();
       
    91     void HandleCommandModeChange( TInt aDteid, TCommandMode aMode );
       
    92     
       
    93     void SendAtModemDataRedirectResultReq( const TUint8 aDteId, const TUint aResult);
       
    94     TInt SendEscapeSignalDetection( const TUint8 aDteId );
       
    95     void HandleSignalDetectedResp( const TIsiReceiveC& aMessage );
       
    96     void RemovePipe( const TUint8 aDteId );
       
    97     TBool IsPluginConnected();
       
    98 
       
    99 protected:
       
   100     // from CActive
       
   101     void RunL();
       
   102     void DoCancel();
       
   103 
       
   104 private:
       
   105     /**
       
   106      * Default C++ constructor.
       
   107      */
       
   108     CModemAtHandler( CModemAtSrv& aServer );
       
   109 
       
   110     /**
       
   111      *  2nd phase constructor
       
   112      */
       
   113     void ConstructL();
       
   114  
       
   115     void OpenChannelL();
       
   116     void HandleATResponse(const TIsiReceiveC& aMessage);
       
   117 
       
   118 #ifdef __WINSCW__
       
   119     void HandleATResponse( );
       
   120 #endif
       
   121     void HandleModemConnectResp( const TIsiReceiveC& aMessage);
       
   122     void HandleSignalInd(const TIsiReceiveC& aMessage);
       
   123     void HandleUnsolicitedData(const TIsiReceiveC& aMessage);
       
   124 
       
   125     TInt GetMinSizeDividendByFour( TInt aSize);
       
   126    
       
   127     void HandleIntermediateDataInd(const TIsiReceiveC& aMessage);
       
   128     void HandleRedirectInd(const TIsiReceiveC& aMessage);
       
   129     void HandleRedirectResultResp(const TIsiReceiveC& aMessage);
       
   130     void SetDisconnected( TBool aIsDisconnected );
       
   131 
       
   132 
       
   133 private:
       
   134     //data
       
   135     CModemAtSrv& iServer;
       
   136 
       
   137     RIscApi* iIscApi;
       
   138     HBufC8* iReceivedMessageBuffer;
       
   139     TUint16 iMessageBufferSize;
       
   140     TPtr8 iReceivePtr;
       
   141         
       
   142     TUint16 iReceiveMessageLength;
       
   143     TIsiReceiveC*  iReceivedMessage;
       
   144     
       
   145     TUint iPepObjId;    //controller pep
       
   146     
       
   147     CModemAtPipeController* iPipeController;
       
   148 #ifdef __WINSCW__
       
   149     TInt iEmulatedValue;
       
   150     TUint8 iDteId;
       
   151     TUint8 iChannel;
       
   152     TATPluginInterface iPluginType;
       
   153 #endif
       
   154     TUint8 iLastTransactionId[KMaxNumOfTransactionIds];
       
   155     TBool iDisconnected;
       
   156     
       
   157     };
       
   158 
       
   159 #endif  // CMODEMATHANDLER_H
       
   160