phoneclientserver/phoneclient/Inc/UssdWrapper/Ussd_Ext/CPhCltUssdImp.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002 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:  Interface for sending messages.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHCLTUSSDIMP_H
       
    20 #define CPHCLTUSSDIMP_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "mphcltussdrequesthandler.h" 
       
    25 #include "mphcltussdnotecontrollercallback.h" 
       
    26 #include "rphcltussd.h"
       
    27 
       
    28 #include "rphcltserver.h" 
       
    29 #include "cphcltussdint.h" 
       
    30 
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CPhCltUssdRequestHandler;
       
    34 class CPhCltUssdNoteController;
       
    35 
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 *  Interface for sending messages.
       
    41 *
       
    42 *  @lib phoneclient.lib
       
    43 *  @since 1.0
       
    44 */
       
    45 class CPhCltUssdImp:
       
    46     public CPhCltUssdInt,
       
    47     public MPhCltUssdRequestHandler, 
       
    48     public MPhCltUssdNoteControllerCallBack
       
    49     
       
    50     {
       
    51     public:  // Constructors and destructor
       
    52         
       
    53         /**
       
    54         * Two-phased constructor.
       
    55         *
       
    56         * @param aShowNotes If ETrue, notes are shown.
       
    57         * @return Pointer to created CPhCltUssdImp instance.
       
    58         */
       
    59         static CPhCltUssdImp* NewL( TBool aShowNotes = ETrue );
       
    60 
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         virtual ~CPhCltUssdImp();
       
    65         
       
    66      
       
    67      
       
    68      public: // New functions
       
    69 
       
    70         /**
       
    71         * Send Ussd string to network with default DCS.
       
    72         *
       
    73         * @param aMsgData Unicode string to be sent.
       
    74         * @return Error code.
       
    75         */
       
    76         virtual TInt SendUssd( const TDesC& aMsgData  );
       
    77 
       
    78         /**
       
    79         * Send Ussd buffer to network with default DCS.
       
    80         *
       
    81         * @param aMsgData 7-bit buffer to be sent.
       
    82         * @return Error code.
       
    83         */
       
    84         virtual TInt SendUssd( const TDesC8& aMsgData );
       
    85 
       
    86         /**
       
    87         * Send Ussd buffer to network with given DCS.
       
    88         *
       
    89         * @param aMsgData 7-bit buffer to be sent.
       
    90         * @param iSendDcs Specifies DCS and the send type.
       
    91         * @return Error code.
       
    92         */
       
    93         virtual TInt SendUssd( 
       
    94             const TDesC8& aMsgData, 
       
    95             const TUint8 iSendDcs );
       
    96 
       
    97         /**
       
    98         * Cancels outstanding Send request.
       
    99         */
       
   100         virtual void SendUssdCancel(); 
       
   101         
       
   102         /**
       
   103         * Starts editor. Creates own window server session.
       
   104         *
       
   105         * @return Error code.
       
   106         */
       
   107         TInt StartUssdEditor() const;
       
   108         
       
   109         /**
       
   110         * UI informs that it is been created
       
   111         * 
       
   112         * @return Error code.
       
   113         */
       
   114         virtual TInt AppStarting(); 
       
   115         
       
   116         /**
       
   117         * UI informs that it is terminating.
       
   118         *
       
   119         * @param aExitReason The reason why the application was terminated.
       
   120         * @return Error code.
       
   121         */
       
   122         virtual TInt AppTerminating( 
       
   123             TPhCltUssdAppExitReason aExitReason );
       
   124             
       
   125         /* UI informs that it is brougth to foreground.
       
   126         *
       
   127         * @return Should the editor be emptied?
       
   128         */
       
   129         virtual TBool AppToForeground();
       
   130         
       
   131         /**
       
   132         * UI informs that it is gone background.
       
   133         *
       
   134         * @return Error code.
       
   135         */
       
   136         virtual TInt AppToBackground();
       
   137         
       
   138         
       
   139         /**
       
   140         * Starts SAT session.
       
   141         *
       
   142         * @param aStatus Completed status.
       
   143         * @param aReceiveMessage Received message.
       
   144         * @param aShowNotesAndDcs Contains the information of note showing,
       
   145         *                         ( Phone Client -> Phone Server ) and
       
   146         *                         The used dcs in received message
       
   147         *                         ( Phone Server -> Phone Client ).
       
   148         */
       
   149         void StartSAT( 
       
   150             TRequestStatus& aStatus, 
       
   151             TDes& aReceiveMessage, 
       
   152             TPckg< TUint >& aShowNotesAndDcs );
       
   153         
       
   154         /**
       
   155         * Cancels SAT session.
       
   156         */ 
       
   157         void StopSAT();
       
   158         
       
   159         /**
       
   160         * Set data coding scheme
       
   161         * 
       
   162         * @param aDCS data coding scheme value
       
   163         */
       
   164         void SetDCS( TUint8 aDCS );
       
   165         
       
   166         
       
   167          
       
   168      protected:  // From base classes
       
   169         
       
   170 
       
   171         // Called when send completes.
       
   172         void HandleSendEventL( const TInt aError );
       
   173 
       
   174         // Hidden when the user cancel the wait dialog.
       
   175         void GlobalWaitNoteHidden();
       
   176         
       
   177         
       
   178 
       
   179     private: // New functions
       
   180 
       
   181         // Constructor. 
       
   182          CPhCltUssdImp();
       
   183 
       
   184         // Symbian 2nd phase constructor.
       
   185         void ConstructL( TBool aShowNotes );
       
   186 
       
   187         // Encodes the message.
       
   188         void EncodeL( const TDesC& aSrc, TDes8& aDes );
       
   189         
       
   190         // Finds CR character        
       
   191         void FindFirstCarriageReturnL( 
       
   192         const TDesC& aBuffer ,
       
   193         TUint& aSkipChars , 
       
   194         TUint& aStartBit );
       
   195         
       
   196     private:    // Data
       
   197 
       
   198         // The handler of the request.
       
   199         CPhCltUssdRequestHandler* iRequestHandler;
       
   200 
       
   201         // Wait scheduler used in this class. 
       
   202         CActiveSchedulerWait* iWait;
       
   203 
       
   204         // TInt to sending error store place.
       
   205         TInt iSendError;
       
   206         
       
   207         // Data coding scheme value
       
   208         TUint8 iDCS;
       
   209         
       
   210         // Data coding scheme value for ussd sending
       
   211         TUint8 iDCS2;
       
   212         
       
   213         //RPhCltUssd class instance
       
   214         RPhCltUssd  iCltUssd;
       
   215         
       
   216         //RPhCltServer class instance creates phonesession
       
   217         RPhCltServer iServer;
       
   218         
       
   219         //CPhCltUssdNoteController class instance
       
   220         CPhCltUssdNoteController* iNoteController;
       
   221         
       
   222     };
       
   223 
       
   224 #endif // CPHCLTUSSDIMP_H
       
   225 
       
   226 // End of File