btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPController.h
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
child 61 269724087bed
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
     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:  Basic printing controller
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef BT_SERVICE_BPP_CONTROLLER_H
       
    21 #define BT_SERVICE_BPP_CONTROLLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "BTServiceStarter.h"
       
    25 #include "BTServiceParameterList.h"
       
    26 #include "BTServiceClient.h"
       
    27 #include "BTSBPPObjectServer.h"
       
    28 #include "BTSBPPServerWait.h"
       
    29 #include "BTSController.h"
       
    30 
       
    31 
       
    32 
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  A class controlling printing service using Basic Printing Profile.
       
    38 */
       
    39 NONSHARABLE_CLASS (CBTSBPPController) : public CBTSController,                           
       
    40                           public MBTServiceClientObserver,
       
    41                           public MBTSBPPObjectServerObserver,
       
    42                           public MBTSBPPServerWaitObserver
       
    43     {
       
    44     public:  // Constructors and destructor
       
    45         
       
    46         /**
       
    47         * Two-phased constructor.
       
    48         */
       
    49         static CBTSBPPController* NewL( MBTServiceObserver* aObserver,                                                                              
       
    50                                         const TUint aRemotePort,
       
    51                                         const TBTDevAddr& aRemoteDevice,
       
    52                                         const CBTServiceParameterList* aList,
       
    53                                         CBTEngDiscovery* aBTEngDiscoveryPtr );
       
    54         
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         virtual ~CBTSBPPController();
       
    59 
       
    60 
       
    61     private: // Functions from base classes
       
    62 
       
    63         /**
       
    64         * From MBTServiceClientObserver A Connect operation has been completed. 
       
    65         * @param aStatus The status of the operation.
       
    66         * @return None.
       
    67         */
       
    68         void ConnectCompleted( TInt aStatus );
       
    69 
       
    70         /**
       
    71         * From MBTServiceClientObserver A Put operation has been completed. 
       
    72         * @param aStatus The status of the operation.
       
    73         * @param aPutResponse The response object.
       
    74         * @return None.
       
    75         */
       
    76         void PutCompleted( TInt aStatus,const  CObexHeaderSet* aPutResponse );
       
    77 
       
    78         /**
       
    79         * From MBTServiceClientObserver A Get operation has been completed. 
       
    80         * @param aStatus The status of the operation.
       
    81         * @param aGetResponse The response object.
       
    82         * @return None.
       
    83         */
       
    84         void GetCompleted( TInt aStatus, CObexBufObject* aGetResponse );
       
    85 
       
    86         /**
       
    87         * From MBTServiceClientObserver The client connection has been closed.
       
    88         * @return None.
       
    89         */
       
    90         void ClientConnectionClosed();
       
    91         
       
    92         /**
       
    93         * From MBTServiceClientObserver A filehandle can be reseted.
       
    94         * @return None.
       
    95         */
       
    96         void ResetFileHandleL();
       
    97         /**
       
    98         * From MBTPSServerObserver An error in server has occurred.
       
    99         * @param aError The error.
       
   100         * @return None.
       
   101         */
       
   102         void ServerError( TInt aError );
       
   103 
       
   104         /**
       
   105         * From MBTPSServerObserver The server connection has been established.
       
   106         * @param None.
       
   107         * @return None.
       
   108         */
       
   109         void ServerConnectionEstablished();
       
   110 
       
   111         /**
       
   112         * From MBTPSServerObserver The server connection has been closed.
       
   113         * @param None.
       
   114         * @return None.
       
   115         */
       
   116         void ServerConnectionClosed();
       
   117 
       
   118         /**
       
   119         * From MBTPSServerWaitObserver The server wait has completed.
       
   120         * @param None.
       
   121         * @return None.
       
   122         */
       
   123         void WaitComplete();
       
   124         
       
   125         /**
       
   126         * From MBTServiceClientObserver A Connect operation is timed out.
       
   127         * @return None.
       
   128         */
       
   129         void ConnectTimedOut();
       
   130 
       
   131     private:
       
   132 
       
   133         /**
       
   134         * C++ default constructor.
       
   135         */
       
   136         CBTSBPPController( MBTServiceObserver* aObserver,
       
   137                            const CBTServiceParameterList* aList );
       
   138 
       
   139         /**
       
   140         * By default Symbian 2nd phase constructor is private.
       
   141         */
       
   142         void ConstructL( const TBTDevAddr& aRemoteDevice,
       
   143                          const TUint aRemotePort,
       
   144                          CBTEngDiscovery* aBTEngDiscoveryPtr );
       
   145 
       
   146         /**
       
   147         * Selects the next document to send and issues a send request 
       
   148         * to Obex client.
       
   149         * @return None.
       
   150         */
       
   151         void SelectAndSendL();
       
   152     
       
   153     private:    // Data definitions
       
   154 
       
   155         enum TBTSBPPObjectServerState
       
   156             {
       
   157             EBTSBPPSrvIdle,
       
   158             EBTSBPPSrvServing,
       
   159             EBTSBPPSrvDone
       
   160             };
       
   161 
       
   162     private:    // Data
       
   163         
       
   164         // Owned
       
   165         //
       
   166         CBTSBPPObjectServer*        iServer;
       
   167         CBTSBPPServerWait*          iServerWait;
       
   168 
       
   169         TInt                        iSendIndex;
       
   170         TUint                       iClientChannel;
       
   171         TBTSBPPObjectServerState    iServerState;
       
   172         TBool                       iClientDone;
       
   173 
       
   174         // Not owned
       
   175         //
       
   176         MBTServiceObserver*         iObserverPtr;
       
   177         const CBTServiceParameterList* iListPtr;
       
   178         
       
   179     };
       
   180 
       
   181 #endif      // BT_SERVICE_BPP_CONTROLLER_H
       
   182             
       
   183 // End of File