contentstorage/caclient/s60/inc/caclientnotifiersession.h
author hgs
Tue, 23 Mar 2010 23:42:03 +0200
changeset 87 9d806967057c
parent 85 7feec50967db
child 73 4bc7b118b3df
permissions -rw-r--r--
201007
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7feec50967db 201003_02
hgs
parents:
diff changeset
     1
/*
7feec50967db 201003_02
hgs
parents:
diff changeset
     2
 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
7feec50967db 201003_02
hgs
parents:
diff changeset
     3
 * All rights reserved.
7feec50967db 201003_02
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
7feec50967db 201003_02
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
7feec50967db 201003_02
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
7feec50967db 201003_02
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
7feec50967db 201003_02
hgs
parents:
diff changeset
     8
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
     9
 * Initial Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
7feec50967db 201003_02
hgs
parents:
diff changeset
    11
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    12
 * Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    13
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    14
 *  Description : Content Arsenal client session for notifications.
7feec50967db 201003_02
hgs
parents:
diff changeset
    15
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    16
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    17
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
#ifndef CACLIENTNOTIFIERSESSION_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
#define CACLIENTNOTIFIERSESSION_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
// INCLUDES
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
#include <e32base.h>
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
#include <e32hashtab.h>
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
#include "caoperationparams.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
#include "casrvdef.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
#include "caclientsubsession.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
#include "cainnernotifierfilter.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
//FORWARD DECLARATIONS
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
class CCaInnerQuery;
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
class RCaEntriesArray;
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
class RCaIdsArray;
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
class CaClientProxy;
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
class CaClientNotifierProxy;
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
// Number of message slots to reserve for this client server session.
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
const TUint KDefaultMessageSlots(5);
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
// CLASS DECLARATION
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
/**
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
 * Client-side interface to Content Arsenal Server
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
 * This class provides the client-side interface to the content arsenal server
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
 * session, it just passes requests to the server.
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
class RCaClientNotifierSession: public RSessionBase
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
public:
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
     * Construct the object.
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
    RCaClientNotifierSession();
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    58
     * Connects to the server and create a session.
7feec50967db 201003_02
hgs
parents:
diff changeset
    59
     * @return error code
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
    TInt Connect();
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
     * Create subsession.
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
     * @return error code
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
    TInt Create(TInt function, const TIpcArgs& args);
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
     * Closes session
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
     *
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
     * @since S60 v 5.0
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
    void Close();
7feec50967db 201003_02
hgs
parents:
diff changeset
    75
7feec50967db 201003_02
hgs
parents:
diff changeset
    76
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    77
     * Registers a notifier.
7feec50967db 201003_02
hgs
parents:
diff changeset
    78
     * @param innerNotifierFilter pointer to inner (symbian style) filter.
7feec50967db 201003_02
hgs
parents:
diff changeset
    79
     * @param notifierFilter notifier filter address
7feec50967db 201003_02
hgs
parents:
diff changeset
    80
     * (used for identification purposes).
7feec50967db 201003_02
hgs
parents:
diff changeset
    81
     * @param notifierProxy client notifier proxy.
7feec50967db 201003_02
hgs
parents:
diff changeset
    82
     *
7feec50967db 201003_02
hgs
parents:
diff changeset
    83
     * @since S60 v 5.0
7feec50967db 201003_02
hgs
parents:
diff changeset
    84
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    85
    TInt RegisterNotifier(CCaInnerNotifierFilter *innerNotifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
    86
            const TAny* notifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
    87
            const CaClientNotifierProxy* notifierProxy);
7feec50967db 201003_02
hgs
parents:
diff changeset
    88
7feec50967db 201003_02
hgs
parents:
diff changeset
    89
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    90
     * Unregisters a notifier.
7feec50967db 201003_02
hgs
parents:
diff changeset
    91
     * @param notifierFilter notifier filter address
7feec50967db 201003_02
hgs
parents:
diff changeset
    92
     * (used for identification purposes).
7feec50967db 201003_02
hgs
parents:
diff changeset
    93
     * @param innerNotifierType inner notifier type.
7feec50967db 201003_02
hgs
parents:
diff changeset
    94
     *
7feec50967db 201003_02
hgs
parents:
diff changeset
    95
     * @since S60 v 5.0
7feec50967db 201003_02
hgs
parents:
diff changeset
    96
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    97
    void UnregisterNotifier(const TAny* notifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
    98
            CCaInnerNotifierFilter::TNotifierType innerNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
    99
7feec50967db 201003_02
hgs
parents:
diff changeset
   100
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   101
     * Returns a number of subsessions (which equals to a number
7feec50967db 201003_02
hgs
parents:
diff changeset
   102
     * of registered notifiers).
7feec50967db 201003_02
hgs
parents:
diff changeset
   103
     * @return a number of subsessions.
7feec50967db 201003_02
hgs
parents:
diff changeset
   104
     *
7feec50967db 201003_02
hgs
parents:
diff changeset
   105
     * @since S60 v 5.0
7feec50967db 201003_02
hgs
parents:
diff changeset
   106
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   107
    TInt SubsessionsCount() const;
7feec50967db 201003_02
hgs
parents:
diff changeset
   108
7feec50967db 201003_02
hgs
parents:
diff changeset
   109
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   110
     * Searches for a subsession.
7feec50967db 201003_02
hgs
parents:
diff changeset
   111
     * @param notifierFilter notifier filter address
7feec50967db 201003_02
hgs
parents:
diff changeset
   112
     * (used for identification purposes).
7feec50967db 201003_02
hgs
parents:
diff changeset
   113
     * @param innerNotifierType inner notifier type.
7feec50967db 201003_02
hgs
parents:
diff changeset
   114
     * @return true if session contains subsession for given parameters.
7feec50967db 201003_02
hgs
parents:
diff changeset
   115
     *
7feec50967db 201003_02
hgs
parents:
diff changeset
   116
     * @since S60 v 5.0
7feec50967db 201003_02
hgs
parents:
diff changeset
   117
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   118
    TBool ContainsSubsession(const TAny* notifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
   119
            CCaInnerNotifierFilter::TNotifierType innerNotifierType) const;
7feec50967db 201003_02
hgs
parents:
diff changeset
   120
7feec50967db 201003_02
hgs
parents:
diff changeset
   121
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   122
     * Return version information
7feec50967db 201003_02
hgs
parents:
diff changeset
   123
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   124
    TVersion Version() const;
7feec50967db 201003_02
hgs
parents:
diff changeset
   125
7feec50967db 201003_02
hgs
parents:
diff changeset
   126
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
   127
7feec50967db 201003_02
hgs
parents:
diff changeset
   128
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   129
     * Registers a notifier (leaving version).
7feec50967db 201003_02
hgs
parents:
diff changeset
   130
     * @param innerNotifierFilter pointer to inner (symbian style) filter.
7feec50967db 201003_02
hgs
parents:
diff changeset
   131
     * @param notifierFilter notifier filter address
7feec50967db 201003_02
hgs
parents:
diff changeset
   132
     * @param notifierProxy client notifier proxy.
7feec50967db 201003_02
hgs
parents:
diff changeset
   133
     *
7feec50967db 201003_02
hgs
parents:
diff changeset
   134
     * @since S60 v 5.0
7feec50967db 201003_02
hgs
parents:
diff changeset
   135
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   136
    void RegisterNotifierL(CCaInnerNotifierFilter* innerNotifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
   137
            const TAny* notifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
   138
            const CaClientNotifierProxy *notifierProxy);
7feec50967db 201003_02
hgs
parents:
diff changeset
   139
7feec50967db 201003_02
hgs
parents:
diff changeset
   140
    /*
7feec50967db 201003_02
hgs
parents:
diff changeset
   141
     * GetSizeL method
7feec50967db 201003_02
hgs
parents:
diff changeset
   142
     * Return error
7feec50967db 201003_02
hgs
parents:
diff changeset
   143
     * @param query query
7feec50967db 201003_02
hgs
parents:
diff changeset
   144
     * @param serverRequest
7feec50967db 201003_02
hgs
parents:
diff changeset
   145
     * @param resultSize
7feec50967db 201003_02
hgs
parents:
diff changeset
   146
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   147
    TInt GetSizeL(const CCaInnerQuery& query,
7feec50967db 201003_02
hgs
parents:
diff changeset
   148
            const TCaServerRequests serverRequest, TInt& resultSize);
7feec50967db 201003_02
hgs
parents:
diff changeset
   149
7feec50967db 201003_02
hgs
parents:
diff changeset
   150
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
   151
7feec50967db 201003_02
hgs
parents:
diff changeset
   152
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   153
     * Class used as a key for a hash map iSubsessions.
7feec50967db 201003_02
hgs
parents:
diff changeset
   154
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   155
    class TKey
7feec50967db 201003_02
hgs
parents:
diff changeset
   156
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
   157
    public:    
7feec50967db 201003_02
hgs
parents:
diff changeset
   158
        TKey(): iFilterAddress(NULL), iNotifierType(0){}
7feec50967db 201003_02
hgs
parents:
diff changeset
   159
        TKey(const TAny* const filterAddress, const TUint notifierType): 
7feec50967db 201003_02
hgs
parents:
diff changeset
   160
            iFilterAddress(filterAddress), iNotifierType(notifierType){}
7feec50967db 201003_02
hgs
parents:
diff changeset
   161
        /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   162
         * filter address, not own.
7feec50967db 201003_02
hgs
parents:
diff changeset
   163
         */
7feec50967db 201003_02
hgs
parents:
diff changeset
   164
        const TAny* const iFilterAddress;
7feec50967db 201003_02
hgs
parents:
diff changeset
   165
        /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   166
         * notifier type.
7feec50967db 201003_02
hgs
parents:
diff changeset
   167
         */
7feec50967db 201003_02
hgs
parents:
diff changeset
   168
        const TUint iNotifierType;
7feec50967db 201003_02
hgs
parents:
diff changeset
   169
        };
7feec50967db 201003_02
hgs
parents:
diff changeset
   170
7feec50967db 201003_02
hgs
parents:
diff changeset
   171
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
   172
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   173
     * Hash function used by hash map iSessions.
7feec50967db 201003_02
hgs
parents:
diff changeset
   174
     * @param key a key (a pair: filter address, notifier type).
7feec50967db 201003_02
hgs
parents:
diff changeset
   175
     * @return hash value.
7feec50967db 201003_02
hgs
parents:
diff changeset
   176
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   177
    static TUint32 HashFunc(const TKey& key);
7feec50967db 201003_02
hgs
parents:
diff changeset
   178
7feec50967db 201003_02
hgs
parents:
diff changeset
   179
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   180
     * Identification function used by hash map iSessions.
7feec50967db 201003_02
hgs
parents:
diff changeset
   181
     * @param key1 the first key.
7feec50967db 201003_02
hgs
parents:
diff changeset
   182
     * @param key1 the second key.
7feec50967db 201003_02
hgs
parents:
diff changeset
   183
     * @return true if keys are equal.
7feec50967db 201003_02
hgs
parents:
diff changeset
   184
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   185
    static TBool IdentityFunc(const TKey& key1, const TKey& key2);
7feec50967db 201003_02
hgs
parents:
diff changeset
   186
7feec50967db 201003_02
hgs
parents:
diff changeset
   187
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
   188
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   189
     * Static member containing a hash function.
7feec50967db 201003_02
hgs
parents:
diff changeset
   190
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   191
    static const THashFunction32<TKey> iHashFunction;
7feec50967db 201003_02
hgs
parents:
diff changeset
   192
7feec50967db 201003_02
hgs
parents:
diff changeset
   193
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   194
     * Static member containing an identity function.
7feec50967db 201003_02
hgs
parents:
diff changeset
   195
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   196
    static const TIdentityRelation<TKey> iIdentityRelation;
7feec50967db 201003_02
hgs
parents:
diff changeset
   197
7feec50967db 201003_02
hgs
parents:
diff changeset
   198
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   199
     * Hash map containing all subsesions of this session.
7feec50967db 201003_02
hgs
parents:
diff changeset
   200
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   201
    RHashMap<TKey, RCaClientSubSession*> iSubsessions;
7feec50967db 201003_02
hgs
parents:
diff changeset
   202
7feec50967db 201003_02
hgs
parents:
diff changeset
   203
    };
7feec50967db 201003_02
hgs
parents:
diff changeset
   204
7feec50967db 201003_02
hgs
parents:
diff changeset
   205
#endif // CACLIENTNOTIFIERSESSION_H
7feec50967db 201003_02
hgs
parents:
diff changeset
   206
// End of File