phonesrv_plat/cbs_message_api/inc/ccbsmessageclient.h
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2007 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:  This file contains the header file of the 
       
    15                  CCbsMessageClient class.
       
    16 *
       
    17 *                CCbsMessageClient provides the interface e.g for Cover UI for
       
    18 *                accessing the CBS server.
       
    19 *
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 
       
    25 #ifndef     CCBSMESSAGECLIENT_H
       
    26 #define     CCBSMESSAGECLIENT_H
       
    27 
       
    28 // INCLUDES
       
    29 #include "CbsCommonTypes.h"
       
    30 
       
    31 //  CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 *   CBS Message API e.g for Cover UI's needs. This API is a smaller snapshot
       
    35 *   of CBS Client API.
       
    36 *
       
    37 *   @lib CbsClient.lib
       
    38 *   @since 3.2
       
    39 */
       
    40 class CCbsMessageClient : public CBase
       
    41     {
       
    42     public:     // New functions
       
    43 
       
    44         /**
       
    45         *   Instantiates new CCbsMessageClient object. During instantaion
       
    46         *   connection to CBS Server is created.
       
    47         *
       
    48         *   @return     A new instance of CCbsMessageClient
       
    49         */
       
    50         IMPORT_C static CCbsMessageClient* NewL();
       
    51 
       
    52         /**
       
    53         *   Finds a message by given handle.
       
    54         *
       
    55         *   @param  aHandle     Handle to the message.
       
    56         *   @param  aMessage    Return: contains the message information.
       
    57         *   @return             Error code.
       
    58         */
       
    59         IMPORT_C virtual TInt FindMessageByHandle(
       
    60             const TCbsMessageHandle& aHandle,
       
    61             TCbsMessage& aMessage ) = 0;
       
    62 
       
    63         /**
       
    64         *   Finds the topic by the given number.
       
    65         *
       
    66         *   Return values:        
       
    67         *
       
    68         *   @param  aNumber         Number of the topic
       
    69         *   @param  aTopic          Return: contains the topic information
       
    70         *   @return KErrNone        Topic returned as parameter
       
    71         *   @return KErrNotFound    Topic was not found
       
    72         */
       
    73         IMPORT_C virtual TInt FindTopicByNumber( const TCbsTopicNumber aNumber,
       
    74             TCbsTopic& aTopic ) = 0;
       
    75 
       
    76         /**
       
    77         *   Returns the total amount of topics the topic list contains.
       
    78         *
       
    79         *   @return                 Contains the total amount of topics.
       
    80         */
       
    81         IMPORT_C virtual TInt TopicCount() = 0;
       
    82 
       
    83         /**
       
    84         *   Returns information about a topic from the topic list.        
       
    85         *
       
    86         *   @param  aIndex       Index to the topic.
       
    87         *   @param  aTopic       It will contain the topic information.
       
    88         *   @return KErrArgument Topic was not found. Rest of return values
       
    89         *                        indicate a file error.
       
    90         */
       
    91         IMPORT_C virtual TInt GetTopic( const TInt aIndex, TCbsTopic& aTopic ) = 0;
       
    92 
       
    93         /**
       
    94         *   Returns the total amount of unread messages.
       
    95         *
       
    96         *   @return             Number of unread messages
       
    97         */
       
    98         IMPORT_C virtual TInt UnreadMessageCount() = 0;
       
    99 
       
   100         /**
       
   101         *   Returns the total amount of messages the topic contains.
       
   102         *
       
   103         *   Return codes:
       
   104         *               
       
   105         *   
       
   106         *
       
   107         *   @param  aNumber         Number of the topic.
       
   108         *   @param  aCount          Number of messages in given topic.
       
   109         *   @return KErrNotFound    Invalid handle
       
   110         *   @return KErrNone        aCount contains the number of messages 
       
   111         *                           in topic
       
   112         */
       
   113         IMPORT_C virtual TInt GetMessageCount( const TCbsTopicNumber aNumber,
       
   114             TInt& aCount ) = 0;
       
   115 
       
   116         /**
       
   117         *   Returns message information.
       
   118         *
       
   119         *   @param  aNumber         Number of the topic
       
   120         *   @param  aIndex          Index to the message in topic.
       
   121         *   @param  aMessage        Returns: the message information
       
   122         *   @return KErrNotFound    Topic or message not found
       
   123         *   @return KErrNone        aMessage contains the message information
       
   124         */
       
   125         IMPORT_C virtual TInt GetMessage( const TCbsTopicNumber aNumber, const TInt aIndex,
       
   126             TCbsMessage& aMessage ) = 0;
       
   127 
       
   128         /**
       
   129         *   Returns the message contents.
       
   130         *
       
   131         *   @param  aHandle     Handle to the message.
       
   132         *   @param  aBuffer     It will contain the contents (as much as it fits).
       
   133         *   @return             Error code.
       
   134         */
       
   135         IMPORT_C virtual TInt GetMessageContents(
       
   136             const TCbsMessageHandle& aHandle,
       
   137             TDes& aBuffer ) = 0;
       
   138 
       
   139         /**
       
   140         *   Sets the message as read.
       
   141         *
       
   142         *   @param  aHandle     Handle to the message to be set read.
       
   143         *   @return             Error code.
       
   144         */
       
   145         IMPORT_C virtual TInt SetMessageAsRead( const TCbsMessageHandle& aHandle ) = 0;
       
   146 
       
   147     protected:
       
   148 
       
   149         /**
       
   150         *   Default constructor.
       
   151         */
       
   152         CCbsMessageClient();
       
   153     };
       
   154 
       
   155 
       
   156 
       
   157 #endif      //  CCBSMESSAGECLIENT_H
       
   158 
       
   159 // End of File
       
   160 
       
   161