simpleengine/engine/inc/simpleengineimhandler.h
changeset 0 c8caa15ef882
child 12 e6a66db4e9d0
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2009 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:    SIMPLE Engine IM Handler
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_SIMPLEENGINEIMHANDLER_H
       
    19 #define C_SIMPLEENGINEIMHANDLER_H
       
    20 
       
    21 
       
    22 #include <e32std.h>
       
    23 
       
    24 #include "simpleclient.h"
       
    25 #include "simpleinstantmessage.h"
       
    26 
       
    27 class MSimpleInstantMsgObserver;
       
    28 
       
    29 
       
    30 /**
       
    31  *  Class for sending and receiving instant messages.
       
    32  *
       
    33  *  @code
       
    34  *   MSimpleInstantMessage* im = 
       
    35  *      TSimpleFactory::NewInstantMessageL( conn, connObs );
       
    36  *   TInt result = im->SendInstantMessage( text8, recipientsPtr8 );
       
    37  *  @endcode
       
    38  *
       
    39  *  @lib simpleengine.lib
       
    40  *  @since S60 v5.1
       
    41  */
       
    42 class CSimpleEngineImHandler : public CSimpleClient,
       
    43                                public MSimpleInstantMessage
       
    44     {
       
    45 
       
    46 public:
       
    47 
       
    48     /**
       
    49      * Two-phased constructor.
       
    50      * @param aConn connection
       
    51      * @param aObserver callback observer
       
    52      */
       
    53     static CSimpleEngineImHandler* NewL( MSimpleConnection& aConn,
       
    54         MSimpleInstantMsgObserver& aObserver );
       
    55 
       
    56     /**
       
    57      * Destructor.
       
    58      */
       
    59     virtual ~CSimpleEngineImHandler();
       
    60 
       
    61 // from base class MSimpleInstantMessage
       
    62 
       
    63     /**
       
    64      * From MSimpleInstantMessage
       
    65      * Send instant message.
       
    66      *
       
    67      * @since S60 v5.1
       
    68      * @param aMsgContent message content
       
    69      * @param aRecipient  recipient ID
       
    70      * @return operation ID
       
    71      */
       
    72     TInt SendInstantMessage( TPtrC8 aMsgContent, TPtrC8 aRecipient );
       
    73 
       
    74     /**
       
    75      * From MSimpleInstantMessage
       
    76      * Destroy this entity.
       
    77      *
       
    78      * @since S60 v5.1
       
    79      */
       
    80     void Close();
       
    81 
       
    82 // from base class CSimpleClient
       
    83 
       
    84     /**
       
    85      * From CSimpleClient
       
    86      * Complete the open client request.
       
    87      * 
       
    88      * @since S60 v5.1
       
    89      * @param aOpId operation id
       
    90      * @param aStatus result status
       
    91      * @param aReq request
       
    92      */
       
    93     void Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq );
       
    94 
       
    95 private:
       
    96 
       
    97     CSimpleEngineImHandler( MSimpleConnection& aConn,
       
    98         MSimpleInstantMsgObserver& aObserver );
       
    99 
       
   100     void ConstructL();
       
   101 
       
   102     /**
       
   103      * Do Send Instant Message request.
       
   104      * 
       
   105      * @since S60 v5.1
       
   106      * @param aMsgContent message content
       
   107      * @param aRecipient  recipient ID
       
   108      */
       
   109     void DoSendInstantMessageRequestL( TPtrC8 aMsgContent,
       
   110         TPtrC8 aRecipient );
       
   111 
       
   112     /**
       
   113      * Receive instant message.
       
   114      * 
       
   115      * @since S60 v5.1
       
   116      */
       
   117     void ReceiveInstantMessageL();
       
   118 
       
   119 private: // data
       
   120 
       
   121     /**
       
   122      * Instant Message observer for callbacks
       
   123      */
       
   124     MSimpleInstantMsgObserver& iObserver;
       
   125 
       
   126     };
       
   127 
       
   128 #endif // C_SIMPLEENGINEIMHANDLER_H