irda/irdastack/irtranp/SCEP.H
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15  
       
    16 #ifndef SCEP_H
       
    17 #define SCEP_H
       
    18 
       
    19 #include <e32cons.h>
       
    20 
       
    21 class AbstractCommand;
       
    22 class CommandProcessor;
       
    23 class CComReadWrite;
       
    24 class MComReadWriteObserver;
       
    25 class BFTP;
       
    26 class IrTranpUtil;
       
    27 class MTranpNotification;
       
    28 class CTranpProtocol;
       
    29 /*
       
    30  * Name:		SCEP
       
    31  *
       
    32  * Description:	SCEP layer in IrTran-P, aswell as the main interface to the application together with bFTP
       
    33  *
       
    34  */
       
    35 
       
    36 NONSHARABLE_CLASS(SCEP) : public CBase,
       
    37 			              public MComReadWriteObserver
       
    38 	{
       
    39 public:
       
    40 	enum TState { EConnected, EDisconnected, EProgress, EWaiting, EError, ECommunicationInt };
       
    41 public:
       
    42 	~SCEP();
       
    43 
       
    44 	static SCEP* NewL(CTranpProtocol* aTranpProtocol, BFTP* a_oBFTP, const MTranpNotification* aNotifier);
       
    45 	void ConstructL(CTranpProtocol* aTranpProtocol, BFTP* a_oBFTP, const MTranpNotification* aNotifier);
       
    46 	void Abort();
       
    47 
       
    48 	TInt Pump();
       
    49 	void SCONreqL();
       
    50 	void SCONconL();
       
    51 	void SCEPSendCommand(TDes8& a_userData, TUint8 a_pduType);
       
    52 
       
    53 	void SetPMID(const TDesC8& aPMID);
       
    54 	void SetSMID(const TDesC8& aSMID);
       
    55 	void SetPDU(TUint8);
       
    56 
       
    57 	void ReceiveComplete(TDesC8& aBuffer); // Virtuial from MEtanolObserver
       
    58 	void SendComplete();
       
    59 	void SendError(TInt aError);
       
    60 	void ReceiveError(TInt aError);
       
    61 	void Error(TInt aError);
       
    62 
       
    63 private:
       
    64 	SCEP();
       
    65 
       
    66 	void ParseCommand(TDes8& a_TempBuffer);
       
    67 	void SCEPConRequest(TDes8& a_Header, TInt offset);
       
    68 	void SCEPConConfirm(TDes8& a_Header, TInt offset);
       
    69 	void SCEPDataCommand(TDes8& a_Header, TInt a_offset);
       
    70 	void NegInf(TDes8& a_Header, TInt a_offset);
       
    71 	void DoCommand(const TDesC8& a_Header, TInt a_offset);
       
    72 	void AddSegment(TDes8& a_Header, TInt a_offset);
       
    73 	void SCEPDisconnect(TDes8& a_Header, TInt offset);
       
    74 
       
    75 	// Pointer to the CommandProcessor
       
    76 	CommandProcessor* m_oCommandP;
       
    77 	// Pointer to the CComReadWrite communications layer
       
    78 	CComReadWrite* iComReadWrite;
       
    79 	// Buff to hold incoming data
       
    80 	TBuf8<8192> iSCEPFrame;
       
    81 	// Pointer to the bFTP layer
       
    82 	BFTP* m_oBFTP;
       
    83 	CTranpProtocol* iTranpProtocol;
       
    84 	MTranpNotification* iNotifier;
       
    85 
       
    86 	// Pointer to the HBufC used for reassembling incoming packets
       
    87 	HBufC8* m_packet;
       
    88 	// Used for counting the segment sequence
       
    89 	TUint32 m_seq;
       
    90 
       
    91 	// Primary Machine ID
       
    92 	TBufC8<8> m_PMID;
       
    93 	// Secondary Machine ID
       
    94 	TBufC8<8> m_SMID;
       
    95 	// Maximum size of the sender's PDU 
       
    96 	TUint8 m_uiMaxPDU;
       
    97 	// Destination process ID
       
    98 	TUint16 m_DPID;
       
    99 	// Source process ID
       
   100 	TUint16 m_SPID;
       
   101 	// Command ID
       
   102 	TUint16 m_CmdId;
       
   103 
       
   104 	// Product information string
       
   105 	TBufC8<255> m_szPIS;
       
   106 	// User name
       
   107 	TBufC8<255> m_szUserName;
       
   108 	// Password
       
   109 	TBufC8<255> m_szPassword;
       
   110 	// Contains the size of the picture being transferred
       
   111 	TInt m_iPicSize;
       
   112 
       
   113 	TState iState;
       
   114 	};
       
   115 
       
   116 #endif //SCEP_H