ncdengine/debuglogger/obex/inc/objectexchangeclient.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __OBJECTEXCHANGECLIENT_H__
       
    20 #define __OBJECTEXCHANGECLIENT_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <obex.h>
       
    24 
       
    25 class CObjectExchangeServiceSearcher;
       
    26 
       
    27 /** 
       
    28  * @class CObjectExchangeClient
       
    29  * @description Class for connecting and sending files to a remote OBEX capable device
       
    30  */
       
    31 class CObjectExchangeClient : public CActive
       
    32     {
       
    33 public:
       
    34 /**
       
    35  * @function NewL
       
    36  * 
       
    37  * @description Construct a CObjectExchangeClient
       
    38  * @return a pointer to the created instance of CObjectExchangeClient
       
    39  */
       
    40     static CObjectExchangeClient* NewL();
       
    41 
       
    42 /**
       
    43  * @function NewLC
       
    44  * 
       
    45  * @description Construct a CObjectExchangeClient and put it into the cleanup stack
       
    46  * @return a pointer to the created instance of CObjectExchangeClient
       
    47  */
       
    48     static CObjectExchangeClient* NewLC();
       
    49 
       
    50 /**
       
    51  * @function ~CObjectExchangeClient
       
    52  * 
       
    53  * @description Destroy the object and release all memory objects. Close any open sockets
       
    54  */
       
    55     ~CObjectExchangeClient();
       
    56 
       
    57 /**
       
    58  * @function ConnectL
       
    59  * 
       
    60  * @description Connect to an OBEX service on a remote device
       
    61  * pops up 
       
    62  */
       
    63     void ConnectL(TRequestStatus& aObsRequestStatus);
       
    64 
       
    65 /**
       
    66  * @function DisconnectL
       
    67  * 
       
    68  * @description Disconnect from the remote device.  Sends an OBEX disconnect, and
       
    69  * closes the transport on response from the server.
       
    70  **/
       
    71     void DisconnectL(TRequestStatus& aObsRequestStatus);
       
    72 
       
    73 /**
       
    74  * @function SendObjectL
       
    75  * 
       
    76  * @description Send a file to an OBEX service on a remote machine
       
    77  * @param aFileName {const TDesc&, in} The full path name of the file to send
       
    78  */
       
    79     void SendObjectL(const TDesC& aFileName, TRequestStatus& aObsRequestStatus);
       
    80 
       
    81 /**
       
    82  * @function StopL
       
    83  * 
       
    84  * @description Send the OBEX aborts command to the remote machine 
       
    85  */
       
    86     void StopL();
       
    87 
       
    88 /**
       
    89  * @function IsConnected
       
    90  * 
       
    91  * @return ETrue if the client is connected
       
    92  */
       
    93     TBool IsConnected();
       
    94 
       
    95 /**
       
    96  * @function IsBusy
       
    97  * 
       
    98  * @return ETrue if the client is performing some operation.
       
    99  */
       
   100     TBool IsBusy();
       
   101 
       
   102 protected:    // from CActive
       
   103 /**
       
   104  * @function DoCancel
       
   105  * 
       
   106  * @description Cancel any outstanding requests
       
   107  */
       
   108     void DoCancel();
       
   109 
       
   110 /**
       
   111  * @function RunL
       
   112  * 
       
   113  * @description Respond to an asynhcronous event
       
   114  */
       
   115     void RunL();
       
   116 
       
   117 private:
       
   118 /**
       
   119  * @function CObjectExchangeClient
       
   120  *
       
   121  * @description Construct this object
       
   122  */
       
   123     CObjectExchangeClient();
       
   124 
       
   125 /**
       
   126  * @function ConstructL
       
   127  *
       
   128  * @description Perform second phase construction of this object
       
   129  */
       
   130     void ConstructL();
       
   131     
       
   132 /**
       
   133  * @function ConnectToServerL
       
   134  * 
       
   135  * @description Connect to the server
       
   136  */
       
   137     void ConnectToServerL();
       
   138 
       
   139 private:
       
   140 
       
   141 /**
       
   142  * @enumtype TState
       
   143  *
       
   144  * @description The state of the active object which determines behaviour within
       
   145  * the RunL method.
       
   146  * @value EWaitingToGetDevice waiting for the user to select a device
       
   147  * @value EGettingDevice searching for a device
       
   148  * @value EGettingService searching for a service
       
   149  * @value EGettingConnection connecting to a service on a remote device
       
   150  * @value EWaitingToSend sending a message to the remote device
       
   151  * @value EDisconnecting disconnecting from the server
       
   152  */
       
   153   
       
   154     
       
   155     enum TState 
       
   156     {
       
   157         EWaitingToGetDevice,
       
   158             EGettingDevice,
       
   159             EGettingService,
       
   160             EGettingConnection,
       
   161             EWaitingToSend,
       
   162             EDisconnecting
       
   163             
       
   164     };
       
   165 
       
   166 
       
   167 /* iState the state of the active object, determines behaviour within the RunL method. */
       
   168     TState iState;
       
   169 
       
   170 /* iServiceSearcher searches for service this client can connect to */
       
   171     CObjectExchangeServiceSearcher* iServiceSearcher;
       
   172 
       
   173 /* iClient manages the OBEX client connection */
       
   174     CObexClient* iClient;
       
   175 
       
   176 /* iCurrObject the OBEX object to transfer */
       
   177     CObexBaseObject* iCurrObject;
       
   178 
       
   179 /* @var iObserverStatus pointer to the observer's TRequestStatus */
       
   180     TRequestStatus* iObserverStatus; 
       
   181 
       
   182 	TParse iParse;
       
   183 
       
   184     };
       
   185 
       
   186 
       
   187 
       
   188 #endif // __OBJECTEXCHANGECLIENT_H__
       
   189