smf/smfservermodule/smfclient/client/smfclientsymbiansession.h
changeset 18 013a02bf2bb0
parent 17 106a4bfcb866
child 19 c412f0526c34
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "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  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  */
       
    15 
       
    16 #ifndef SMFCLIENTSYMBIANSESSION_H_
       
    17 #define SMFCLIENTSYMBIANSESSION_H_
       
    18 
       
    19 #include <e32cmn.h>
       
    20 #include <QByteArray>
       
    21 #include <QString>
       
    22 #include <QVariant>
       
    23 #include <QList>
       
    24 #include "smfglobal.h"
       
    25 
       
    26 /**
       
    27  * Corresponds to client session in Symbian
       
    28  */
       
    29 class RSmfClientSymbianSession : public RSessionBase
       
    30 {
       
    31 public:
       
    32 	/**
       
    33 	 * Constructs
       
    34 	 */
       
    35 	RSmfClientSymbianSession();
       
    36 	/**
       
    37 	 * Creates the server process if not already running and creates session
       
    38 	 * @return Error code while creating server process/ creating session
       
    39 	 */
       
    40     TInt connectToServer();
       
    41     TVersion Version() const{return TVersion(0,0,1);};
       
    42     /**
       
    43      * Calls SendReceive with requestType opcode and packaged data
       
    44      * depending on requestType
       
    45      */
       
    46     TInt sendRequest(SmfRequestTypeID requestType);
       
    47     void Close(){};
       
    48 	bool isConnected();
       
    49 	bool connected;
       
    50 	/**
       
    51 	 * Sends async request to the Smf server
       
    52 	 * @param aSerializedData Serialized data to be sent to the server.
       
    53 	 * Consists of provider Info(SmfProvider*)+ Other common class data
       
    54 	 * (when applicable)-serialized
       
    55 	 * @param aInterfaceName Name of the interface
       
    56 	 * @param aStatus TRequestStatus
       
    57 	 * @param maxSize Size of the data to be allocated. This info is sent to the server
       
    58 	 * @param aXtraInfo When xtra common data class instances to be passed other than SmfProvider
       
    59 	 * so that it can allocate this much of memory.
       
    60 	 */
       
    61 	void sendAsyncRequest(QByteArray& aSerializedData,
       
    62 			QString aInterfaceName,
       
    63 			SmfRequestTypeID aRequestType,
       
    64 			TRequestStatus& aStatus,
       
    65 			TInt aMaxAllocation,
       
    66 			QByteArray aXtraInfo=QByteArray());
       
    67 	/**
       
    68 	 * Sends sync request to the Smf server
       
    69 	 */
       
    70 	TPtr8 sendSyncRequest(QString aInterfaceName,
       
    71 			SmfRequestTypeID aRequestType,
       
    72 			TInt maxSize=0);
       
    73 	/**
       
    74 	 * Sends DSM related sync request to the Smf server
       
    75 	 */
       
    76 	TPtr8 sendDSMSyncRequest(SmfRequestTypeID aRequestType,
       
    77 			QByteArray& aSerializedData,
       
    78 			SmfError aErr,
       
    79 			TInt maxSize=0);
       
    80 	void writeLog(QString log) const;
       
    81     /**
       
    82      * Returns data,used to return back the data received from server
       
    83      */
       
    84     TPtr8 getData()
       
    85 			{
       
    86 			 return iDataPtr;
       
    87 			}
       
    88     TInt getLastRequest()
       
    89     	{
       
    90     	return iLastRequest;
       
    91     	}
       
    92 	/**
       
    93 	 * Following are to form message body.
       
    94 	 */
       
    95 	QByteArray iBaseProvider;
       
    96     TBuf8<525> iProviderSymbian;
       
    97     TBuf<125> iInterfaceSymbian;
       
    98     TBuf8<125> iInterfaceSymbian8;
       
    99     TBuf<100> iDSMErr;
       
   100 	QString iInterfaceName;
       
   101 	QByteArray iInterfaceNamebyte;
       
   102 
       
   103 	TPtr8 iDataPtr;
       
   104 	TPtr iDataPtr16;
       
   105 	HBufC8* iBuffer;
       
   106 	HBufC* iBuffer16;
       
   107 	HBufC* iIntfNameBuffer;
       
   108 	HBufC8* iIntfNameBuffer8;
       
   109 	HBufC8* iProviderBuf;
       
   110 	TPtr8 iPtrProvider;
       
   111 	TPtr iIntfNamePtr;
       
   112 	TPtr8 iIntfNamePtr8;
       
   113 	HBufC8* iSlot0Buffer;
       
   114 	TPtr8 iPtrToSlot0;
       
   115 	TInt iMaxMessageSize;
       
   116 	TInt iMaxSize;
       
   117 	/**
       
   118 	 * Last request opcode
       
   119 	 */
       
   120 	TInt iLastRequest;
       
   121 	
       
   122 private:
       
   123 	QList<QVariant*> result;
       
   124 	
       
   125 
       
   126 	
       
   127 };
       
   128 #endif /* SMFCLIENTSYMBIANSESSION_H_ */