adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodemathandler.h
changeset 9 8486d82aef45
parent 8 6295dc2169f3
equal deleted inserted replaced
8:6295dc2169f3 9:8486d82aef45
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-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 the License "Eclipse Public License v1.0"
     5 * under the terms of the License "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".
    21 #define CMODEMATHANDLER_H
    21 #define CMODEMATHANDLER_H
    22 
    22 
    23 #include <e32base.h>
    23 #include <e32base.h>
    24 #include "mmodematobserver.h"
    24 #include "mmodematobserver.h"
    25 
    25 
    26 
       
    27 // FORWARD DECLARATIONS
    26 // FORWARD DECLARATIONS
    28 class CModemAtSrv;
    27 class CModemAtSrv;
    29 class RIscApi;
    28 class RIscApi;
    30 class TIsiReceiveC;
    29 class TIsiReceiveC;
    31 class CModemAtPipeController;
    30 class CModemAtPipeController;
    46     /**
    45     /**
    47      * Two-phased constructor.
    46      * Two-phased constructor.
    48      * @param aServer
    47      * @param aServer
    49      * @return Instance of self
    48      * @return Instance of self
    50      */
    49      */
    51     static CModemAtHandler* NewL( CModemAtSrv& aServer );
    50     static CModemAtHandler* NewL( CModemAtSrv& aServer, TInt aChannel );
    52 
    51 
    53     /**
    52     /**
    54      * Destructor.
    53      * Destructor.
    55      */
    54      */
    56     ~CModemAtHandler();
    55     ~CModemAtHandler();
    57     
    56     
    58     /**
    57     /**
    59      * Sends AT-command to Modem AT-server
    58      * Sends AT-command to Modem AT-server
    60      * @param aDteId 
       
    61      * @param aPluginType AText/Common
    59      * @param aPluginType AText/Common
    62      * @param aMessageType 0=normal, 1=getnvram status
    60      * @param aMessageType 0=normal, 1=getnvram status
    63      * @param aCmd AT-command
    61      * @param aCmd AT-command
    64      */
    62      */
    65     TInt SendATCommand(
    63     TInt SendATCommand(
    66         const TUint8 aDteId,
       
    67         const TATPluginInterface aPluginType,
    64         const TATPluginInterface aPluginType,
    68         const TUint8 aMessageType,
    65         const TUint8 aMessageType,
    69         const TDesC8& aCmd );
    66         const TDesC8& aCmd );
    70 
    67 
    71     /**
    68     /**
    73       *  @param aDteId DteId. Default is zero. If pipe is created, pipehandle will be used.
    70       *  @param aDteId DteId. Default is zero. If pipe is created, pipehandle will be used.
    74       *  @return KErrNone or
    71       *  @return KErrNone or
    75       *  @return KErrNoMemory
    72       *  @return KErrNoMemory
    76       */
    73       */
    77 
    74 
    78     TInt Connect( const TUint8 aDteId );
    75     TInt Connect( TUint8 aDevId, TUint8 aObjId );
    79 
    76 
    80     /**
    77     /**
    81      *  Disconnects handler from modem
    78      *  Disconnects handler from modem
    82      *  @param TUint8 aDteId
    79      *  @param TUint8 aDteId
    83      *  @return Disconnect status
    80      *  @return Disconnect status
    84      */
    81      */
    85     TInt Disconnect( const TUint8 aDteId );
    82     TInt Disconnect();
    86     
    83     
    87     /**
    84     /**
    88      *  Check if disconnect is called directly
    85      *  Check if disconnect is called directly
    89      *  @return ETrue if disconnect called directly
    86      *  @return ETrue if disconnect called directly
    90      */
    87      */
    96      */
    93      */
    97     void HandleCommandModeChange( TCommandMode aMode );
    94     void HandleCommandModeChange( TCommandMode aMode );
    98     
    95     
    99     /**
    96     /**
   100      *  SendAtModemDataRedirectResultReq
    97      *  SendAtModemDataRedirectResultReq
   101      *  @param TUint8 aDteId
       
   102      *  @param TUint aResult
    98      *  @param TUint aResult
   103      */
    99      */
   104     void SendAtModemDataRedirectResultReq( const TUint8 aDteId, const TUint aResult);
   100     void SendAtModemDataRedirectResultReq( const TUint aResult );
   105 
   101 
   106     /**
   102     /**
   107      *  SendEscapeSignalDetection
   103      *  SendSignalDetection
   108      *  @param TUint8 aDteId
   104      *  @param TUint8 aSignal
   109      *  @return Symbian error code if error
   105      *  @return Symbian error code if error
   110      */
   106      */
   111     TInt SendEscapeSignalDetection( const TUint8 aDteId );
   107     TInt SendSignalDetection( const TUint8 aSignal );
   112 
   108 
   113     /**
   109     /**
   114      *  HandleSignalDetectedResp
   110      *  HandleSignalDetectedResp
   115      *  @param TIsiReceiveC aMessage
   111      *  @param TIsiReceiveC aMessage
   116      */
   112      */
   117     void HandleSignalDetectedResp( const TIsiReceiveC& aMessage );
   113     void HandleSignalDetectedResp( const TIsiReceiveC& aMessage );
   118 
   114 
   119     /**
   115     /**
   120      *  RemovePipe
   116      *  RemovePipe
   121      *  @param TUint8 aDteId
   117      */
   122      */
   118     void RemovePipe();
   123     void RemovePipe( const TUint8 aDteId );
       
   124 
   119 
   125     /**
   120     /**
   126      *  IsPluginConnected
   121      *  IsPluginConnected
   127      *  @return ETrue if plugin is connected
   122      *  @return ETrue if plugin is connected
   128      */
   123      */
   134      */
   129      */
   135     void SetModemAtExistsInCmt( TBool aModemAtExistsInCmt );
   130     void SetModemAtExistsInCmt( TBool aModemAtExistsInCmt );
   136     
   131     
   137     /**
   132     /**
   138      *  SendAtModemConnectReq
   133      *  SendAtModemConnectReq
   139      *  @param TUint8 aDteId
   134      */
   140      */
   135     TInt SendAtModemConnectReq();
   141     TInt SendAtModemConnectReq( const TUint8 aDteId );
   136 
       
   137     /**
       
   138      *  Check if pipe is in data mode
       
   139      *  @return ETrue, if pipe is in datamode
       
   140      */
       
   141     TBool IsPipeInDataMode();
       
   142 
       
   143     /**
       
   144      *  Check if text message mode is on
       
   145      *  @return ETrue, if +CMGS or +CMGS command has been received
       
   146      */
       
   147     TBool IsTextMessageMode();
       
   148 
       
   149     /**
       
   150      *  Set text message mode. Modem indications will be ignored during this mode.
       
   151      *  @param TBool aTextMode
       
   152      */
       
   153     void SetTextMessageMode( TBool aTextMode );
       
   154 
       
   155     /**
       
   156      *  Pipe creation result and pipe handle is informed 
       
   157      *  with this function
       
   158      *  @param TUint8 aPipeHandle
       
   159      *  @param TInt aError
       
   160      */
       
   161     void PipeCreated( TUint8 aPipeHandle, TInt aError );
       
   162 
       
   163      /**
       
   164      *  Stores device info so that it's available when
       
   165      *  plugin for the device is created 
       
   166      *  @param TUint8 aDevId
       
   167      *  @param TUint8 aObjId
       
   168      */
       
   169     void AddDevice( TUint8 aDevId, TUint8 aObjId );
       
   170 
       
   171      /**
       
   172      *  Remove device info
       
   173      *  @param TUint8 aDevId
       
   174      *  @param TUint8 aObjId
       
   175      */
       
   176     void RemoveDevice( TUint8 aDevId, TUint8 aObjId );
       
   177 
       
   178     /**
       
   179      *  Get Dataport object id
       
   180      *  @param TUint8& aObjId
       
   181      */
       
   182     void GetDataportObjectId( TUint& aObjId );
       
   183     
       
   184     /**
       
   185      *  Get secondary dataport object id (e.g. if usb and bluetooth connect without PNS_NAME_ADD_IND)
       
   186      *  @param TUint8& aObjId
       
   187      */
       
   188     void GetSecondaryDataportObjectId( TUint& aObjId );
       
   189 
       
   190     /**
       
   191      *  Get ISC channel id used by handler
       
   192      *  @return TUint8 channel id
       
   193      */
       
   194     TInt GetChannelId();
       
   195 
   142 
   196 
   143 protected:
   197 protected:
   144     // from CActive
   198     // from CActive
   145     void RunL();
   199     void RunL();
   146     void DoCancel();
   200     void DoCancel();
   147 
   201 
   148 private:
   202 private:
   149     /**
   203     /**
   150      * Default C++ constructor.
   204      * Default C++ constructor.
   151      */
   205      */
   152     CModemAtHandler( CModemAtSrv& aServer );
   206     CModemAtHandler( CModemAtSrv& aServer, TInt aChannel );
   153 
   207 
   154     /**
   208     /**
   155      *  2nd phase constructor
   209      *  2nd phase constructor
   156      */
   210      */
   157     void ConstructL();
   211     void ConstructL();
   186         
   240         
   187     TUint16 iReceiveMessageLength;
   241     TUint16 iReceiveMessageLength;
   188     TIsiReceiveC*  iReceivedMessage;
   242     TIsiReceiveC*  iReceivedMessage;
   189     
   243     
   190     TUint iPepObjId;    //controller pep
   244     TUint iPepObjId;    //controller pep
   191     
   245     TUint iDataportObjId;
       
   246 
   192     CModemAtPipeController* iPipeController;
   247     CModemAtPipeController* iPipeController;
   193 #ifdef __WINSCW__
   248 #ifdef __WINSCW__
   194     TInt iEmulatedValue;
   249     TInt iEmulatedValue;
   195     TUint8 iDteId;
       
   196     TUint8 iChannel;
       
   197     TATPluginInterface iPluginType;
   250     TATPluginInterface iPluginType;
   198 #endif
   251 #endif
   199     TUint8 iLastTransactionId;
   252     TUint8 iLastTransactionId;
   200     TBool iDisconnected;
   253     TBool iDisconnected;
   201     TBool iModemAtExistInCmt;
   254     TBool iModemAtExistInCmt;
       
   255     TBool iTextMessageMode;
       
   256     TUint8 iDteId;
       
   257     TInt iChannel;
   202     };
   258     };
   203 
   259 
   204 #endif  // CMODEMATHANDLER_H
   260 #endif  // CMODEMATHANDLER_H
   205 
   261