|         |      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 the License "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:  Header file for RLauncherClientService | 
|         |     15 * | 
|         |     16 * | 
|         |     17 */ | 
|         |     18  | 
|         |     19  | 
|         |     20 #ifndef __LAUNCHERCLIENTSERVICE_H | 
|         |     21 #define __LAUNCHERCLIENTSERVICE_H | 
|         |     22  | 
|         |     23 // INCLUDE FILES  | 
|         |     24 #include <e32std.h> | 
|         |     25 #include <e32base.h> | 
|         |     26 #include <AknServerApp.h> | 
|         |     27 #include "LauncherServerCommands.hrh" | 
|         |     28  | 
|         |     29 // FORWARD DECLARATIONS | 
|         |     30 class CLauncherReceiveHandler; | 
|         |     31  | 
|         |     32 // CLASS DECLARATION | 
|         |     33 // Observer class, observes server application events. | 
|         |     34 class MLaunchedServerObserver: public MAknServerAppExitObserver | 
|         |     35     { | 
|         |     36 public: | 
|         |     37  | 
|         |     38     /** | 
|         |     39     * Notifies the client, that implements this class, about  | 
|         |     40     * the server sent data. | 
|         |     41     * @param aStatus The status of the result of the completion. | 
|         |     42     */ | 
|         |     43     virtual void HandleReceivedDataL( TRequestStatus aStatus ) = 0; | 
|         |     44  | 
|         |     45     }; | 
|         |     46  | 
|         |     47 // CLASS DECLARATION | 
|         |     48 class RLauncherClientService : public RAknAppServiceBase | 
|         |     49     { | 
|         |     50 public:	 | 
|         |     51     /** | 
|         |     52     * Returns the ID of this service. | 
|         |     53     * @return The UID of the service. | 
|         |     54     */	 | 
|         |     55     TUid ServiceUid() const; | 
|         |     56  | 
|         |     57     /** | 
|         |     58     * Initializes this object. Call this before using this object. | 
|         |     59     * @param aServerAppUid The UID of the server application. | 
|         |     60     * @param aServerObserver Observes the server application. | 
|         |     61     */ | 
|         |     62     void InitializeL( TUid aServerAppUid, MLaunchedServerObserver& aServerObserver ); | 
|         |     63  | 
|         |     64     /** | 
|         |     65     * Starts listening to the server application, so the observer | 
|         |     66     * will be notified about server application events. | 
|         |     67     */     | 
|         |     68     void ListenL(); | 
|         |     69  | 
|         |     70     /** | 
|         |     71     * Stops listening to the server application, so the observer | 
|         |     72     * will not be notified about server application events. | 
|         |     73     */     | 
|         |     74     void StopListening(); | 
|         |     75      | 
|         |     76     /** | 
|         |     77     * Destroy the object and release all memory objects | 
|         |     78     */     | 
|         |     79     void Close(); | 
|         |     80  | 
|         |     81     /** | 
|         |     82     * Send data to process by the server application syncronously. | 
|         |     83     * @param aBufferToSend The data to send. | 
|         |     84     * @return The completion code of the processed data. | 
|         |     85     */ | 
|         |     86     TInt SendSync( TDesC8& aBufferToSend ); | 
|         |     87  | 
|         |     88     /** | 
|         |     89     * Send data to process by the server application asyncronously. | 
|         |     90     * @param aBufferToSend Data to send. | 
|         |     91     * @param aBufferSize The size of the buffer which the client should | 
|         |     92     *                                 allocate, to receive the data from server, | 
|         |     93     *                                 before calling SendSyncBuffer() with the | 
|         |     94     *                                 allocated descriptor. aBufferSize is defined | 
|         |     95     *                                 by the server. | 
|         |     96     */ | 
|         |     97     void SendAsync( TDesC8& aBufferToSend,TDes8& aBufferSize ); | 
|         |     98  | 
|         |     99     /** | 
|         |    100     * Send data to process by the server application asyncronously. | 
|         |    101     * @param aBufferToSend Data to send. | 
|         |    102     * @param aBufferSize The size of the buffer which the client should | 
|         |    103     * 					 allocate, to receive the data from server, | 
|         |    104     *                    before calling SendSyncBuffer() with the | 
|         |    105     *                    allocated descriptor. aBufferSize is defined | 
|         |    106     *                    by the server. | 
|         |    107     */ | 
|         |    108     void SendAsync(); | 
|         |    109  | 
|         |    110 	void SendAsync(TDes8& aBufferSize ); | 
|         |    111     /** | 
|         |    112     * Send data to process by the server application syncronously. | 
|         |    113     * @param aReceiveBuffer Buffer, which will be filled by the  | 
|         |    114     *                       server application. | 
|         |    115     */ | 
|         |    116     TInt SendSyncBuffer( TDes8 &aReceiveBuffer ); | 
|         |    117  | 
|         |    118     TInt SendSyncBools( TBool aClientWantsToContinue, TBool aWasContentHandled ); | 
|         |    119  | 
|         |    120     /** | 
|         |    121     * Send a command to execute by the server application. Server  | 
|         |    122     * commands can be found in ServerCommands.hrh. | 
|         |    123     * Possibile commands: EOpenDownloadedContent, EServerExit. | 
|         |    124     * @param aCommand Command to send. | 
|         |    125     * @return The result of the processed command data. | 
|         |    126     */	 | 
|         |    127     TInt SendCommand( TInt aCommand ); | 
|         |    128 	 | 
|         |    129 private: | 
|         |    130  | 
|         |    131     /** | 
|         |    132     * Cancel receiving data. | 
|         |    133     */ | 
|         |    134     void CancelReceive(); | 
|         |    135  | 
|         |    136 public: | 
|         |    137  | 
|         |    138     /* | 
|         |    139     * Observes server application exit. Owned! | 
|         |    140     */ | 
|         |    141     CApaServerAppExitMonitor* iServerExitMonitor; | 
|         |    142  | 
|         |    143     friend class CLauncherReceiveHandler;     | 
|         |    144  | 
|         |    145 private: | 
|         |    146  | 
|         |    147     /* | 
|         |    148     * Active object that is notified when receiving data ayncronously from | 
|         |    149     * server application. Internal use only. Owned! | 
|         |    150     */ | 
|         |    151     CLauncherReceiveHandler* iActiveHandler; | 
|         |    152 }; | 
|         |    153 	 | 
|         |    154 #endif // __LAUNCHER_H | 
|         |    155  | 
|         |    156 // End of File |