syncmlfw/common/obex/obexserverbinding/inc/nsmlobexserverbinding.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     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:  SyncML Obex server binding
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <f32file.h>
       
    23 #include <utf.h>
       
    24 
       
    25 
       
    26 #include <nsmldebug.h>
       
    27 #include <nsmlobexclientsession.h>
       
    28 #include "nsmlobexcommserver.h"
       
    29 #include "nsmltransport.h"
       
    30 
       
    31 
       
    32 #ifndef __NSMLOBEXSERVERBINDING_H__
       
    33 #define __NSMLOBEXSERVERBINDING_H__
       
    34 
       
    35 _LIT8( KDataSyncMIME, "application/vnd.syncml+wbxml" );
       
    36 _LIT8( KDevManMIME, "application/vnd.syncml.dm+wbxml" );
       
    37 
       
    38 
       
    39 // ---------------------------------------------------
       
    40 // class CNSmlObexServerBinding
       
    41 // ---------------------------------------------------
       
    42 class CNSmlObexServerBinding : public CActive
       
    43 	{
       
    44 friend class CDisListener;
       
    45 
       
    46 public:
       
    47     static CNSmlObexServerBinding* NewL();        
       
    48 	virtual void ConstructL();
       
    49 	CNSmlObexServerBinding();
       
    50 	virtual ~CNSmlObexServerBinding();
       
    51 
       
    52 	virtual  void Connect( TNSmlObexTransport aTransport,TBool aServerAlerted, TDesC8& aMimeType, TRequestStatus &aStatus );
       
    53 	virtual  void Disconnect();
       
    54 	virtual  void Send( const TDesC8& aStartPtr, TBool /*aFinalPacket*/, TRequestStatus &aStatus );
       
    55 	virtual  void Receive( TDes8& aStartPtr, TRequestStatus &aStatus );
       
    56 
       
    57 
       
    58 protected:
       
    59 	void DoCancel();
       
    60 	void RunL();
       
    61 
       
    62 
       
    63 private:
       
    64 	TInt ConnectToServer();
       
    65 
       
    66 private:
       
    67 	enum TState
       
    68 		{
       
    69 		EIdle,
       
    70 		EConnecting,
       
    71 		ESending,
       
    72 		EReceiving
       
    73 		};
       
    74 	enum TNSmlObexContent 
       
    75 		{
       
    76 		ENSmlDataSync,
       
    77 		ENSmlDeviceManagement,
       
    78 		};
       
    79 
       
    80 	TRequestStatus* iAgentStatus;
       
    81 
       
    82 	RNSmlDSObexClientSession iCsDS;
       
    83 	RNSmlDMObexClientSession iCsDM;
       
    84 	TState iState;
       
    85 	TBool iCancelledByServer;
       
    86 	TNSmlObexContent iContent;
       
    87 	TBool iSessionAlive;
       
    88 	};
       
    89 
       
    90 	IMPORT_C CNSmlObexServerBinding* CreateCNsmlObexServerBindingL();
       
    91 	typedef CNSmlObexServerBinding* (*TNSmlCreateObexServerBindingFunc) ();   
       
    92 
       
    93 
       
    94 #endif // __NSMLOBEXSERVERBINDING_H_